diff options
author | Simon Glass <sjg@chromium.org> | 2018-11-06 15:21:41 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-11-20 19:14:22 -0700 |
commit | a58986ca8b53d8c7a441397082f84edc7f47d19f (patch) | |
tree | c9ec3c59244371d8ad9992a2ba332a7b50d33950 /drivers/mtd/spi/sf-uclass.c | |
parent | f9d49f92f8cdf04a47704519a63368259595c3a0 (diff) |
sf: Add a method to obtain the block-protect setting
It is useful to obtain the block-protect setting of the SPI flash, so we
know whether it is fully open or (perhaps partially) write-protected. Add
a method for this. Update the sandbox driver to process this operation and
add a test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi/sf-uclass.c')
-rw-r--r-- | drivers/mtd/spi/sf-uclass.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index 662525f016..719a2fd23a 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -28,6 +28,15 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len) return log_ret(sf_get_ops(dev)->erase(dev, offset, len)); } +int spl_flash_get_sw_write_prot(struct udevice *dev) +{ + struct dm_spi_flash_ops *ops = sf_get_ops(dev); + + if (!ops->get_sw_write_prot) + return -ENOSYS; + return log_ret(ops->get_sw_write_prot(dev)); +} + /* * TODO(sjg@chromium.org): This is an old-style function. We should remove * it when all SPI flash drivers use dm |