Skip to content

Commit 90c517f

Browse files
westeriambarus
authored andcommitted
mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
The Intel SPI controller does not support low level operations, like reading the flag status register (FSR). It only exposes a set of high level operations for software to use. For this reason check the return value of micron_st_nor_read_fsr() and if the operation was not supported, use the status register value only. This allows the chip to work even when attached to Intel SPI controller (there are such systems out there). Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Tudor Ambarus <[email protected]> Reviewed-by: Michael Walle <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9271459 commit 90c517f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/mtd/spi-nor/micron-st.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,16 @@ static int micron_st_nor_ready(struct spi_nor *nor)
399399
return sr_ready;
400400

401401
ret = micron_st_nor_read_fsr(nor, nor->bouncebuf);
402-
if (ret)
403-
return ret;
402+
if (ret) {
403+
/*
404+
* Some controllers, such as Intel SPI, do not support low
405+
* level operations such as reading the flag status
406+
* register. They only expose small amount of high level
407+
* operations to the software. If this is the case we use
408+
* only the status register value.
409+
*/
410+
return ret == -EOPNOTSUPP ? sr_ready : ret;
411+
}
404412

405413
if (nor->bouncebuf[0] & (FSR_E_ERR | FSR_P_ERR)) {
406414
if (nor->bouncebuf[0] & FSR_E_ERR)

0 commit comments

Comments
 (0)