linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd: spi-nor: core: Ignore -ENOTSUPP in spi_nor_init()
@ 2022-09-23  9:34 Mika Westerberg
  2022-09-23  9:37 ` Michael Walle
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Mika Westerberg @ 2022-09-23  9:34 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav
  Cc: Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Takahiro Kuwano, Hongyu Ning,
	Mika Westerberg, linux-mtd

The Intel SPI-NOR controller does not support the 4-byte address opcode
so ->set_4byte_addr_mode() ends up returning -ENOTSUPP and the SPI flash
chip probe fail like this:

  [ 12.291082] spi-nor: probe of spi0.0 failed with error -524

Whereas previously before commit 08412e72afba ("mtd: spi-nor: core:
Return error code from set_4byte_addr_mode()") it worked just fine.

Fix this by ignoring -ENOTSUPP in spi_nor_init().

Fixes: 08412e72afba ("mtd: spi-nor: core: Return error code from set_4byte_addr_mode()")
Cc: stable@vger.kernel.org
Reported-by: Hongyu Ning <hongyu.ning@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
The previous version of the patch (the revert) can be found here:

  https://lore.kernel.org/linux-mtd/20220922134824.46758-1-mika.westerberg@linux.intel.com/

In this version we ignore -ENOTSUPP but the other error codes will be
passed to the caller.

 drivers/mtd/spi-nor/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index f2c64006f8d7..bee8fc4c9f07 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2724,7 +2724,9 @@ static int spi_nor_init(struct spi_nor *nor)
 		 */
 		WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET,
 			  "enabling reset hack; may not recover from unexpected reboots\n");
-		return nor->params->set_4byte_addr_mode(nor, true);
+		err = nor->params->set_4byte_addr_mode(nor, true);
+		if (err && err != -ENOTSUPP)
+			return err;
 	}
 
 	return 0;
-- 
2.35.1


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

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

end of thread, other threads:[~2022-10-18  8:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23  9:34 [PATCH v2] mtd: spi-nor: core: Ignore -ENOTSUPP in spi_nor_init() Mika Westerberg
2022-09-23  9:37 ` Michael Walle
2022-10-03  5:04 ` Tudor.Ambarus
2022-10-03  5:21   ` Mika Westerberg
2022-10-03  5:52     ` Tudor.Ambarus
2022-10-03  6:11       ` Mika Westerberg
2022-10-06  4:41 ` Tudor.Ambarus
2022-10-06  4:56   ` Tudor.Ambarus
2022-10-18  8:17 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).