linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
@ 2022-05-06 10:51 Mika Westerberg
  2022-05-09  7:12 ` Michael Walle
  2022-07-19  9:27 ` Tudor Ambarus
  0 siblings, 2 replies; 5+ messages in thread
From: Mika Westerberg @ 2022-05-06 10:51 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: Pratyush Yadav, Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Mika Westerberg, linux-mtd

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 <mika.westerberg@linux.intel.com>
---
 drivers/mtd/spi-nor/micron-st.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 8a20475ce77a..885683e0aeb8 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -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)
-- 
2.35.1


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

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

* Re: [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
  2022-05-06 10:51 [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it Mika Westerberg
@ 2022-05-09  7:12 ` Michael Walle
  2022-06-06 14:03   ` Mika Westerberg
  2022-07-19  9:27 ` Tudor Ambarus
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Walle @ 2022-05-09  7:12 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd

Am 2022-05-06 12:51, schrieb 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).
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Michael Walle <michael@walle.cc>

-michael

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

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

* Re: [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
  2022-05-09  7:12 ` Michael Walle
@ 2022-06-06 14:03   ` Mika Westerberg
  2022-07-19  8:55     ` Tudor.Ambarus
  0 siblings, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2022-06-06 14:03 UTC (permalink / raw)
  To: Michael Walle
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd

Hi SPI-NOR maintainers,

On Mon, May 09, 2022 at 09:12:17AM +0200, Michael Walle wrote:
> Am 2022-05-06 12:51, schrieb 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).
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> Reviewed-by: Michael Walle <michael@walle.cc>

Gentle ping on this :)

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

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

* Re: [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
  2022-06-06 14:03   ` Mika Westerberg
@ 2022-07-19  8:55     ` Tudor.Ambarus
  0 siblings, 0 replies; 5+ messages in thread
From: Tudor.Ambarus @ 2022-07-19  8:55 UTC (permalink / raw)
  To: mika.westerberg, michael
  Cc: p.yadav, miquel.raynal, richard, vigneshr, linux-mtd

On 6/6/22 17:03, Mika Westerberg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi SPI-NOR maintainers,

Hi, Mika!

> 
> On Mon, May 09, 2022 at 09:12:17AM +0200, Michael Walle wrote:
>> Am 2022-05-06 12:51, schrieb 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).
>>>
>>> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>>
>> Reviewed-by: Michael Walle <michael@walle.cc>
> 
> 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/20220616121446.293408-1-oocheret@cisco.com/
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it
  2022-05-06 10:51 [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it Mika Westerberg
  2022-05-09  7:12 ` Michael Walle
@ 2022-07-19  9:27 ` Tudor Ambarus
  1 sibling, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-07-19  9:27 UTC (permalink / raw)
  To: mika.westerberg
  Cc: Tudor Ambarus, michael, richard, miquel.raynal, linux-mtd,
	vigneshr, p.yadav

On Fri, 6 May 2022 13:51:58 +0300, Mika Westerberg wrote:
> 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,
-- 
Tudor Ambarus <tudor.ambarus@microchip.com>

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

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

end of thread, other threads:[~2022-07-19  9:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 10:51 [PATCH] mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it Mika Westerberg
2022-05-09  7:12 ` Michael Walle
2022-06-06 14:03   ` Mika Westerberg
2022-07-19  8:55     ` Tudor.Ambarus
2022-07-19  9:27 ` Tudor Ambarus

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