Skip to contentSkip to conversation

mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it

PATCH Applied Mika Westerberg 3 participants 5 messages May 6, 2022 – Jul 19, 2022

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

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

---
 drivers/mtd/spi-nor/micron-st.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/micron-st.c +10 -2
index 8a20475ce77a..885683e0aeb8 100644
@@ -396,8 +396,16 @@ static int micron_st_nor_ready(struct spi_nor *nor)
 		return sr_ready;
 
 	ret = micron_st_nor_read_fsr(nor, nor->bouncebuf);
-	if (ret)
-		return ret;
+	if (ret) {
+		/*
+		 * Some controllers, such as Intel SPI, do not support low
+		 * level operations such as reading the flag status
+		 * register. They only expose small amount of high level
+		 * operations to the software. If this is the case we use
+		 * only the status register value.
+		 */
+		return ret == -EOPNOTSUPP ? sr_ready : ret;
+	}
 
 	if (nor->bouncebuf[0] & (FSR_E_ERR | FSR_P_ERR)) {
 		if (nor->bouncebuf[0] & FSR_E_ERR)
Signature · 6 lines
2.35.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v1 1/1
#1 lore raw

Am 2022-05-06 12:51, schrieb Mika Westerberg:

Quoted 9 lines

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).

-michael

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#2 lore raw

Hi SPI-NOR maintainers,

Quoted 9 lines · Michael Walle

Am 2022-05-06 12:51, schrieb Mika Westerberg:

Quoted 8 lines

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).

Quoted 3 lines
Quoted 1 line

Gentle ping on this :)

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#3 lore raw
Quoted 3 lines · Mika Westerberg

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi SPI-NOR maintainers,

Hi, Mika!

Quoted 11 lines · Michael Walle
Quoted 9 lines

Am 2022-05-06 12:51, schrieb Mika Westerberg:

Quoted 8 lines

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).

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Gentle ping on this :)

Sorry, I was out of office most of this release cycle.

Looks good to me, I can queue it. But I see in other thread that you requested to ignore it? Why's that?

https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#4 lore raw
In reply to Mika Westerberg
Quoted 9 lines · Mika Westerberg

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).

[...]

Applied to spi-nor/next, thanks!

[1/1] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it

      https://git.kernel.org/mtd/c/90c517f435a9

Best regards,

Signature · 5 lines
Tudor Ambarus <[email protected]>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/