aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sandbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/spi/sandbox.c')
-rw-r--r--drivers/mtd/spi/sandbox.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 7fef754c634..7b9891cb981 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -57,6 +57,8 @@ static const char *sandbox_sf_state_name(enum sandbox_sf_state state)
/* Bits for the status register */
#define STAT_WIP (1 << 0)
#define STAT_WEL (1 << 1)
+#define STAT_BP_SHIFT 2
+#define STAT_BP_MASK (7 << STAT_BP_SHIFT)
/* Assume all SPI flashes have 3 byte addresses since they do atm */
#define SF_ADDR_LEN 3
@@ -102,6 +104,14 @@ struct sandbox_spi_flash_plat_data {
int cs;
};
+void sandbox_sf_set_block_protect(struct udevice *dev, int bp_mask)
+{
+ struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
+
+ sbsf->status &= ~STAT_BP_MASK;
+ sbsf->status |= bp_mask << STAT_BP_SHIFT;
+}
+
/**
* This is a very strange probe function. If it has platform data (which may
* have come from the device tree) then this function gets the filename and