linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Ensure operation completion before shutdown
@ 2023-10-12  5:51 Md Sadre Alam
  2023-10-12  9:11 ` Michael Walle
  0 siblings, 1 reply; 5+ messages in thread
From: Md Sadre Alam @ 2023-10-12  5:51 UTC (permalink / raw)
  To: tudor.ambarus, pratyush, michael, miquel.raynal, richard,
	vigneshr, linux-mtd, linux-kernel
  Cc: quic_srichara, quic_varada, Md Sadre Alam

Ensure that there are no pending spi operation inprogress
when system halts.

Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
---
 drivers/mtd/spi-nor/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..adc4d2c68695 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3690,6 +3690,9 @@ static void spi_nor_shutdown(struct spi_mem *spimem)
 {
 	struct spi_nor *nor = spi_mem_get_drvdata(spimem);
 
+	/* Ensure no pending spi operation in progress */
+	spi_nor_wait_till_ready(nor);
+
 	spi_nor_restore(nor);
 }
 
-- 
2.34.1


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

* Re: [PATCH] mtd: spi-nor: Ensure operation completion before shutdown
  2023-10-12  5:51 [PATCH] mtd: spi-nor: Ensure operation completion before shutdown Md Sadre Alam
@ 2023-10-12  9:11 ` Michael Walle
  2023-10-12 10:06   ` Pratyush Yadav
  2023-10-18 11:06   ` Md Sadre Alam
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Walle @ 2023-10-12  9:11 UTC (permalink / raw)
  To: Md Sadre Alam
  Cc: tudor.ambarus, pratyush, miquel.raynal, richard, vigneshr,
	linux-mtd, linux-kernel, quic_srichara, quic_varada

Hi,

Am 2023-10-12 07:51, schrieb Md Sadre Alam:
> Ensure that there are no pending spi operation inprogress
> when system halts.

What operation might be in progress here? Did you encounter some 
problems?
Please explain it in more detail in the commit message.

Fixes tag?

-michael

> Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
> ---
>  drivers/mtd/spi-nor/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 1c443fe568cf..adc4d2c68695 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3690,6 +3690,9 @@ static void spi_nor_shutdown(struct spi_mem 
> *spimem)
>  {
>  	struct spi_nor *nor = spi_mem_get_drvdata(spimem);
> 
> +	/* Ensure no pending spi operation in progress */
> +	spi_nor_wait_till_ready(nor);
> +
>  	spi_nor_restore(nor);
>  }

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

* Re: [PATCH] mtd: spi-nor: Ensure operation completion before shutdown
  2023-10-12  9:11 ` Michael Walle
@ 2023-10-12 10:06   ` Pratyush Yadav
  2023-10-18 11:07     ` Md Sadre Alam
  2023-10-18 11:06   ` Md Sadre Alam
  1 sibling, 1 reply; 5+ messages in thread
From: Pratyush Yadav @ 2023-10-12 10:06 UTC (permalink / raw)
  To: Michael Walle
  Cc: Md Sadre Alam, tudor.ambarus, pratyush, miquel.raynal, richard,
	vigneshr, linux-mtd, linux-kernel, quic_srichara, quic_varada

On Thu, Oct 12 2023, Michael Walle wrote:

> Hi,
>
> Am 2023-10-12 07:51, schrieb Md Sadre Alam:
>> Ensure that there are no pending spi operation inprogress
>> when system halts.
>
> What operation might be in progress here? Did you encounter some problems?
> Please explain it in more detail in the commit message.

+1

Ideally we should never reach this function with a pending operation. I
think we should do a proper wait in the place we did the operation that
needs waiting rather than here. That would make sure operations other
than shutdown, like reads, also work properly.

-- 
Regards,
Pratyush Yadav

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

* Re: [PATCH] mtd: spi-nor: Ensure operation completion before shutdown
  2023-10-12  9:11 ` Michael Walle
  2023-10-12 10:06   ` Pratyush Yadav
@ 2023-10-18 11:06   ` Md Sadre Alam
  1 sibling, 0 replies; 5+ messages in thread
From: Md Sadre Alam @ 2023-10-18 11:06 UTC (permalink / raw)
  To: Michael Walle
  Cc: tudor.ambarus, pratyush, miquel.raynal, richard, vigneshr,
	linux-mtd, linux-kernel, quic_srichara, quic_varada



On 10/12/2023 2:41 PM, Michael Walle wrote:
> Hi,
> 
> Am 2023-10-12 07:51, schrieb Md Sadre Alam:
>> Ensure that there are no pending spi operation inprogress
>> when system halts.
> 
> What operation might be in progress here? Did you encounter some problems?
> Please explain it in more detail in the commit message.
> 
> Fixes tag?

   We have faced issue while doing nor flash read/write test with specific nor part.
   Will check once again with the same part and post new patch.
> 
> -michael
> 
>> Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
>> ---
>>  drivers/mtd/spi-nor/core.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>> index 1c443fe568cf..adc4d2c68695 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -3690,6 +3690,9 @@ static void spi_nor_shutdown(struct spi_mem *spimem)
>>  {
>>      struct spi_nor *nor = spi_mem_get_drvdata(spimem);
>>
>> +    /* Ensure no pending spi operation in progress */
>> +    spi_nor_wait_till_ready(nor);
>> +
>>      spi_nor_restore(nor);
>>  }

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

* Re: [PATCH] mtd: spi-nor: Ensure operation completion before shutdown
  2023-10-12 10:06   ` Pratyush Yadav
@ 2023-10-18 11:07     ` Md Sadre Alam
  0 siblings, 0 replies; 5+ messages in thread
From: Md Sadre Alam @ 2023-10-18 11:07 UTC (permalink / raw)
  To: Pratyush Yadav, Michael Walle
  Cc: tudor.ambarus, miquel.raynal, richard, vigneshr, linux-mtd,
	linux-kernel, quic_srichara, quic_varada



On 10/12/2023 3:36 PM, Pratyush Yadav wrote:
> On Thu, Oct 12 2023, Michael Walle wrote:
> 
>> Hi,
>>
>> Am 2023-10-12 07:51, schrieb Md Sadre Alam:
>>> Ensure that there are no pending spi operation inprogress
>>> when system halts.
>>
>> What operation might be in progress here? Did you encounter some problems?
>> Please explain it in more detail in the commit message.
> 
> +1
> 
> Ideally we should never reach this function with a pending operation. I
> think we should do a proper wait in the place we did the operation that
> needs waiting rather than here. That would make sure operations other
> than shutdown, like reads, also work properly.
> 

   We have faced issue while doing nor flash read/write test with specific nor part.
   Will check once again with the same part and post new patch.

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

end of thread, other threads:[~2023-10-18 11:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12  5:51 [PATCH] mtd: spi-nor: Ensure operation completion before shutdown Md Sadre Alam
2023-10-12  9:11 ` Michael Walle
2023-10-12 10:06   ` Pratyush Yadav
2023-10-18 11:07     ` Md Sadre Alam
2023-10-18 11:06   ` Md Sadre Alam

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