spi_flash: Add error message when lock operations are not supported
PATCH 1/2 spi_flash: Add error message when lock operations are not supported
From: Fabio Estevam <[email protected]>
In the case of lock operations not being supported, we should better let the user know instead of failing silently.
--- include/spi_flash.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/spi_flash.h +3 -1
@@ -237,8 +237,10 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,static inline int spi_flash_protect (struct spi_flash *flash,u32 ofs,u32 len,bool prot) { -if (!flash->flash_lock) +if (!flash->flash_lock) { +printf ("Protect operation not supported for this flash\n" );return -EOPNOTSUPP ; + }if (prot)return flash->flash_lock (flash, ofs, len);
Signature · 1 line
1.9.1
PATCH 2/2 sf_probe: Add lock ops for SST SPI NOR flash
From: Fabio Estevam <[email protected]>
SST SPI NOR flash has the same locking programming bits as ST Micro.
Add support for it.
--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/sf_probe.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi/sf_internal.h +1 -0
@@ -64,6 +64,7 @@ enum spi_nor_option_flags {#define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 +#define SPI_FLASH_CFI_MFR_SST 0xbf#define SPI_FLASH_CFI_MFR_WINBOND 0xef/* Erase commands */
drivers/mtd/spi/sf_probe.c +2 -1
@@ -184,8 +184,9 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,/* lock hooks are flash specific - assign them based on idcode0 */ switch (idcode[0 ]) { -#ifdef CONFIG_SPI_FLASH_STMICRO +#if definedCONFIG_SPI_FLASH_STMICRO || definedCONFIG_SPI_FLASH_SST case SPI_FLASH_CFI_MFR_STMICRO : +case SPI_FLASH_CFI_MFR_SST : flash->flash_lock = stm_lock; flash->flash_unlock = stm_unlock; flash->flash_is_locked = stm_is_locked;
Signature · 1 line
1.9.1
PATCH 2/2 sf_probe: Add lock ops for SST SPI NOR flash
Hi Jagan,
Quoted 7 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
SST SPI NOR flash has the same locking programming bits as ST Micro.
Add support for it.
Signed-off-by Fabio Estevam <[email protected]>
Any comments on this series, please?
PATCH 2/2 sf_probe: Add lock ops for SST SPI NOR flash
In reply to Fabio EstevamQuoted 30 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
SST SPI NOR flash has the same locking programming bits as ST Micro.
Add support for it.
Signed-off-by Fabio Estevam <[email protected]>--- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/sf_probe.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)drivers/mtd/spi/sf_internal.h +1
-0@@ -64,6 +64,7 @@ enum spi_nor_option_flags {#define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_STMICRO 0x20#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 +#define SPI_FLASH_CFI_MFR_SST 0xbf#define SPI_FLASH_CFI_MFR_WINBOND 0xef/* Erase commands */ drivers/mtd/spi/sf_probe.c +0
-0@@ -184,8 +184,9 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
drivers/mtd/spi/sf_probe.c static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
Quoted 10 lines
drivers/mtd/spi/sf_probe.c +2
-2/* lock hooks are flash specific - assign them based on idcode0 */ switch (idcode[0 ]) { -#ifdef CONFIG_SPI_FLASH_STMICRO +#if definedCONFIG_SPI_FLASH_STMICRO || definedCONFIG_SPI_FLASH_SST case SPI_FLASH_CFI_MFR_STMICRO : +case SPI_FLASH_CFI_MFR_SST : flash->flash_lock = stm_lock; flash->flash_unlock = stm_unlock; flash->flash_is_locked = stm_is_locked; --
Please add SST #ifdef on lock definitions as well.
thanks!
Signature · 1 line
Jagan | openedev.
PATCH 1/2 spi_flash: Add error message when lock operations are not supported
In reply to Fabio EstevamQuoted 15 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
In the case of lock operations not being supported, we should better let the user know instead of failing silently.
Signed-off-by Fabio Estevam <[email protected]>--- include/spi_flash.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/spi_flash.h +0
-0
include/spi_flash.h static inline int spi_flash_erase(struct spi_flash *flash, u32 offset, · line 243
Quoted 8 lines
include/spi_flash.h +3
-1@@ -237,8 +237,10 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,static inline int spi_flash_protect (struct spi_flash *flash,u32 ofs,u32 len,bool prot) { -if (!flash->flash_lock) +if (!flash->flash_lock) { +printf ("Protect operation not supported for this flash\n" );return -EOPNOTSUPP ; + }
Here it's not required, it's better to print the protected area in cmd_sf itself similar way as mtd_utils flash_lock
thanks!
Signature · 1 line
Jagan | openedev.