Skip to contentSkip to conversation

dm: sf: Make SST flash write op work again

PATCH New Bin Meng 2 participants 2 messages Apr 24, 2015 – Apr 28, 2015 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Bin Meng

author
#1 lore raw

PATCH v2 2/2 dm: sf: Make SST flash write op work again

With SPI flash moving to driver model, commit fbb0991 "dm: Convert spi_flash_probe() and 'sf probe' to use driver model" ignored the SST flash-specific write op (byte program & word program), which actually broke the SST flash from wroking.

This commit makes SST flash work again under driver model, by adding SST flash-specific handling in the spi_flash_std_write().

---

Changes in v2:
- Instead of creating an SST flash-specifc driver to handle the write op, handle that in the standard spi_flash_std_write().
- Drop the crownbay.dts update patch

 drivers/mtd/spi/sf_probe.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mtd/spi/sf_probe.c +9 -0
index ac93114..038fe2d 100644
@@ -472,6 +472,15 @@ int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
 {
 	struct spi_flash *flash = dev_get_uclass_priv(dev);
 
+#if defined(CONFIG_SPI_FLASH_SST)
+	if (flash->flags & SST_WR) {
+		if (flash->spi->op_mode_tx & SPI_OPM_TX_BP)
+			return sst_write_bp(flash, offset, len, buf);
+		else
+			return sst_write_wp(flash, offset, len, buf);
+	}
+#endif
+
 	return spi_flash_cmd_write_ops(flash, offset, len, buf);
 }
 
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH v2 2/2 dm: sf: Make SST flash write op work again

Quoted 41 lines · Bin Meng

With SPI flash moving to driver model, commit fbb0991 "dm: Convert spi_flash_probe() and 'sf probe' to use driver model" ignored the SST flash-specific write op (byte program & word program), which actually broke the SST flash from wroking.

This commit makes SST flash work again under driver model, by adding SST flash-specific handling in the spi_flash_std_write().

---

Changes in v2:
- Instead of creating an SST flash-specifc driver to handle the write op, handle that in the standard spi_flash_std_write().
- Drop the crownbay.dts update patch

 drivers/mtd/spi/sf_probe.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mtd/spi/sf_probe.c +9 -1
index ac93114..038fe2d 100644
@@ -472,6 +472,15 @@ int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
 {
        struct spi_flash *flash = dev_get_uclass_priv(dev);
 
+#if defined(CONFIG_SPI_FLASH_SST)
+       if (flash->flags & SST_WR) {
+               if (flash->spi->op_mode_tx & SPI_OPM_TX_BP)
+                       return sst_write_bp(flash, offset, len, buf);
+               else
+                       return sst_write_wp(flash, offset, len, buf);
+       }
+#endif
+
        return spi_flash_cmd_write_ops(flash, offset, len, buf);
 }
 
--
Quoted 2 lines

1.8.2.1

Applied to u-boot-spi/master

thanks!

Signature · 1 line
Jagan.