Skip to contentSkip to conversation

sf: stmicro: dont send 4 bytes when reading status register

PATCH New Mike Frysinger 1 participant 1 message Apr 2, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sf: stmicro: dont send 4 bytes when reading status register

I can't find anywhere in the datasheet that says the status register needs 3 dummy bytes sent to it before being able to read back the first real result. Tests on a Blackfin board show that after writing the opcode, the status register starts coming back immediately. So only write out the read status register opcode before polling the result.

CC Jason McMullan <[email protected]>
CC TsiChung Liew <[email protected]>
---
 drivers/mtd/spi/stmicro.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/spi/stmicro.c +3 -3
index b43e9f4..9b910c1 100644
@@ -133,12 +133,12 @@ static int stmicro_wait_ready(struct spi_flash *flash, unsigned long timeout)
 	struct spi_slave *spi = flash->spi;
 	unsigned long timebase;
 	int ret;
+	u8 cmd = CMD_M25PXX_RDSR;
 	u8 status;
-	u8 cmd[4] = { CMD_M25PXX_RDSR, 0xff, 0xff, 0xff };
 
-	ret = spi_xfer(spi, 32, &cmd[0], NULL, SPI_XFER_BEGIN);
+	ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
 	if (ret) {
-		debug("SF: Failed to send command %02x: %d\n", cmd[0], ret);
+		debug("SF: Failed to send command %02x: %d\n", cmd, ret);
 		return ret;
 	}
 
Signature · 1 line
1.6.2