u-boot/drivers/mtd/spi
Fabio Estevam c3c016cf75 sf: Add SPI NOR protection mechanism
Many SPI flashes have protection bits (BP2, BP1 and BP0) in the
status register that can protect selected regions of the SPI NOR.

Take these bits into account when performing erase operations,
making sure that the protected areas are skipped.

Tested on a mx6qsabresd:

=> sf probe
SF: Detected M25P32 with page size 256 Bytes, erase size 64 KiB, total 4 MiB
=> sf protect lock  0x3f0000 0x10000
=> sf erase 0x3f0000 0x10000
offset 0x3f0000 is protected and cannot be erased
SF: 65536 bytes @ 0x3f0000 Erased: ERROR
=> sf protect unlock  0x3f0000 0x10000
=> sf erase 0x3f0000 0x10000
SF: 65536 bytes @ 0x3f0000 Erased: OK

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
[re-worked to fit the lock common to dm and non-dm]
Signed-off-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jteki@openedev.com>
2015-11-05 16:47:06 -05:00
..
eeprom_m95xxx.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
fsl_espi_spl.c driver: Add support of image load for MMC & SPI in SPL 2014-04-22 17:58:50 -07:00
Kconfig sf: Make 4K sector support configurable 2015-08-17 15:59:48 +05:30
Makefile sf: dataflash: Rename to CONFIG_SPI_FLASH_DATAFLASH 2015-07-01 21:15:04 +05:30
sandbox.c sandbox: spi: Add newline to printf() in sandbox_sf_probe 2015-05-14 18:49:35 -06:00
sf-uclass.c dm: sf: Update default name of spi flash in structure udevice 2015-05-06 14:00:35 -06:00
sf.c sf: Add CONFIG_SF_DUAL_FLASH 2014-01-12 21:40:22 +05:30
sf_dataflash.c dm: Rename dev_get_parentdata() to dev_get_parent_priv() 2015-10-23 09:42:28 -06:00
sf_internal.h sf: Add SPI NOR protection mechanism 2015-11-05 16:47:06 -05:00
sf_mtd.c mtd, spi: Add MTD layer driver 2015-06-30 00:40:11 +05:30
sf_ops.c sf: Add SPI NOR protection mechanism 2015-11-05 16:47:06 -05:00
sf_params.c sf: params: Add IS25LP128 part support 2015-10-25 20:17:03 +05:30
sf_probe.c sf: Add SPI NOR protection mechanism 2015-11-05 16:47:06 -05:00
spi_spl_load.c sf: Tidy up public and private header files 2014-10-22 10:36:50 -06:00