public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: micron-st: fix FSR read fallback for controllers returning -ENOTSUPP
@ 2026-03-18 13:18 Bean Huo
  2026-03-18 13:26 ` Tudor Ambarus
  0 siblings, 1 reply; 6+ messages in thread
From: Bean Huo @ 2026-03-18 13:18 UTC (permalink / raw)
  To: tudor.ambarus, pratyush, mwalle
  Cc: linux-mtd, linux-kernel, zaizhang, Bean Huo

From: Bean Huo <beanhuo@micron.com>

micron_st_nor_ready() falls back to SR-only polling when the SPI
controller does not support low-level FSR reads, but only checks for
-EOPNOTSUPP (95).  Some SPI master drivers return the kernel-internal
-ENOTSUPP (524) for the same condition.  The two codes carry identical
semantics but have different numeric values, so the fallback is never
reached when the master returns -ENOTSUPP; the function propagates the
error instead, causing all subsequent erase/program operations on the
Micron flash to fail.

Fix this by treating -ENOTSUPP equivalently to -EOPNOTSUPP in the FSR
error path.  Note that spi-mem.c already treats both error codes as
equivalent in its own fallback logic, so this aligns micron_st_nor_ready()
with that existing convention.

Fixes: 90c517f435a9 ("mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it")
Reported-by: Zailiang Zhang <zaizhang@cisco.com>
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/mtd/spi-nor/micron-st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 88033384a71e..4be6a76fc3e5 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -598,7 +598,7 @@ static int micron_st_nor_ready(struct spi_nor *nor)
 		 * operations to the software. If this is the case we use
 		 * only the status register value.
 		 */
-		return ret == -EOPNOTSUPP ? sr_ready : ret;
+		return (ret == -EOPNOTSUPP || ret == -ENOTSUPP) ? sr_ready : ret;
 	}
 
 	if (nor->bouncebuf[0] & (FSR_E_ERR | FSR_P_ERR)) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-19 11:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 13:18 [PATCH] mtd: spi-nor: micron-st: fix FSR read fallback for controllers returning -ENOTSUPP Bean Huo
2026-03-18 13:26 ` Tudor Ambarus
2026-03-18 13:44   ` Bean Huo
     [not found]     ` <DS0PR11MB8668FC8E62236D0893A8CEFFC84EA@DS0PR11MB8668.namprd11.prod.outlook.com>
2026-03-18 17:17       ` Bean Huo
2026-03-19  9:10         ` Tudor Ambarus
2026-03-19 11:19           ` Pratyush Yadav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox