Skip to contentSkip to conversation

sf_probe: Add lock ops for SST SPI NOR flash

PATCH Superseded Fabio Estevam 2 participants 2 messages Nov 17, 2015 Memory technology devices (MTD)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
Changes since v1:
- Also add SST defined in sf_ops (Jagan)

 drivers/mtd/spi/sf_internal.h | 1 +
 drivers/mtd/spi/sf_ops.c      | 4 ++--
 drivers/mtd/spi/sf_probe.c    | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi/sf_internal.h +1 -0
index 8793f18..85c8a89 100644
@@ -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_ops.c +2 -2
index 6cc2d31..f045471 100644
@@ -583,7 +583,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
 }
 #endif
 
-#ifdef CONFIG_SPI_FLASH_STMICRO
+#if defined CONFIG_SPI_FLASH_STMICRO || defined CONFIG_SPI_FLASH_SST
 static void stm_get_locked_range(struct spi_flash *flash, u8 sr, loff_t *ofs,
 				 u32 *len)
 {
@@ -756,4 +756,4 @@ int stm_unlock(struct spi_flash *flash, u32 ofs, size_t len)
 
 	return 0;
 }
-#endif  /* CONFIG_SPI_FLASH_STMICRO */
+#endif
drivers/mtd/spi/sf_probe.c +2 -1
index bc05d30..fea6c24 100644
@@ -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 defined CONFIG_SPI_FLASH_STMICRO || defined CONFIG_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
#1 lore raw

PATCH v2 1/1 sf_probe: Add lock ops for SST SPI NOR flash

Quoted 8 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.

---

Quoted 25 lines

Changes since v1:
- Also add SST defined in sf_ops (Jagan)

 drivers/mtd/spi/sf_internal.h | 1 +
 drivers/mtd/spi/sf_ops.c      | 4 ++--
 drivers/mtd/spi/sf_probe.c    | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi/sf_internal.h +1 -0
index 8793f18..85c8a89 100644
@@ -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_ops.c +0 -0
index 6cc2d31..f045471 100644

drivers/mtd/spi/sf_ops.c int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len, · line 586

Quoted 5 lines
drivers/mtd/spi/sf_ops.c +1 -1
@@ -583,7 +583,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
 }
 #endif
 
-#ifdef CONFIG_SPI_FLASH_STMICRO
+#if defined CONFIG_SPI_FLASH_STMICRO || defined CONFIG_SPI_FLASH_SST

#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST) this look more readable - comments?

thanks!

Signature · 1 line
Jagan | openedev.