1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- From 76a4707de5e18dc32d9cb4e990686140c5664a15 Mon Sep 17 00:00:00 2001
- From: Brian Norris <computersforpeace@gmail.com>
- Date: Fri, 29 Jan 2016 11:25:35 -0800
- Subject: [PATCH] mtd: spi-nor: add SPI_NOR_HAS_LOCK flag
- We can't determine this purely by manufacturer type (see commit
- 67b9bcd36906 ("mtd: spi-nor: fix Spansion regressions (aliased with
- Winbond)")), and it's not autodetectable by anything like SFDP. So make
- a new flag for it.
- Signed-off-by: Brian Norris <computersforpeace@gmail.com>
- Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- ---
- drivers/mtd/spi-nor/spi-nor.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
- --- a/drivers/mtd/spi-nor/spi-nor.c
- +++ b/drivers/mtd/spi-nor/spi-nor.c
- @@ -68,6 +68,7 @@ struct flash_info {
- #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */
- #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */
- #define USE_FSR 0x80 /* use flag status register */
- +#define SPI_NOR_HAS_LOCK 0x100 /* Flash supports lock/unlock via SR */
- };
-
- #define JEDEC_MFR(info) ((info)->id[0])
- @@ -1156,7 +1157,8 @@ int spi_nor_scan(struct spi_nor *nor, co
-
- if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
- JEDEC_MFR(info) == SNOR_MFR_INTEL ||
- - JEDEC_MFR(info) == SNOR_MFR_SST) {
- + JEDEC_MFR(info) == SNOR_MFR_SST ||
- + info->flags & SPI_NOR_HAS_LOCK) {
- write_enable(nor);
- write_sr(nor, 0);
- }
- @@ -1172,7 +1174,8 @@ int spi_nor_scan(struct spi_nor *nor, co
- mtd->_read = spi_nor_read;
-
- /* NOR protection support for STmicro/Micron chips and similar */
- - if (JEDEC_MFR(info) == SNOR_MFR_MICRON) {
- + if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
- + info->flags & SPI_NOR_HAS_LOCK) {
- nor->flash_lock = stm_lock;
- nor->flash_unlock = stm_unlock;
- nor->flash_is_locked = stm_is_locked;
|