linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
@ 2020-07-22 14:01 Alexander Sverdlin
  2020-07-22 14:28 ` Tudor.Ambarus
  2020-07-27 12:33 ` Tudor Ambarus
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Sverdlin @ 2020-07-22 14:01 UTC (permalink / raw)
  To: Tudor Ambarus, Vignesh Raghavendra, linux-mtd
  Cc: linux-kernel, Baurzhan Ismagulov

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

After spi_nor_write_disable() return code checks were introduced in the
spi-nor front end intel-spi backend stopped to work because WRDI was never
supported and always failed.

Just pretend it was sucessful and ignore the command itself. HW sequencer
shall do the right thing automatically, while with SW sequencer we cannot
do it anyway, because the only tool we had was preopcode and it makes no
sense for WRDI.

Cc: stable@vger.kernel.org
Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
index 61d2a0a..134b356 100644
--- a/drivers/mtd/spi-nor/controllers/intel-spi.c
+++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
@@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
 		return 0;
 	}
 
+	/*
+	 * We hope that HW sequencer will do the right thing automatically and
+	 * with the SW seuencer we cannot use preopcode any way, so just ignore
+	 * write disable operation and pretend it was completed successfully.
+	 */
+	if (opcode == SPINOR_OP_WRDI)
+		return 0;
+
 	writel(0, ispi->base + FADDR);
 
 	/* Write the value beforehand */
-- 
2.10.2


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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 14:01 [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command Alexander Sverdlin
@ 2020-07-22 14:28 ` Tudor.Ambarus
  2020-07-22 14:36   ` Mika Westerberg
  2020-07-27 12:33 ` Tudor Ambarus
  1 sibling, 1 reply; 7+ messages in thread
From: Tudor.Ambarus @ 2020-07-22 14:28 UTC (permalink / raw)
  To: alexander.sverdlin, vigneshr, linux-mtd, mika.westerberg
  Cc: linux-kernel, ibr

+ Mika

Hi, Mika,

Would you please review the patch from below?

Thanks!

On 7/22/20 5:01 PM, Alexander Sverdlin wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> After spi_nor_write_disable() return code checks were introduced in the
> spi-nor front end intel-spi backend stopped to work because WRDI was never
> supported and always failed.
> 
> Just pretend it was sucessful and ignore the command itself. HW sequencer
> shall do the right thing automatically, while with SW sequencer we cannot
> do it anyway, because the only tool we had was preopcode and it makes no
> sense for WRDI.
> 
> Cc: stable@vger.kernel.org
> Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
>  drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
> index 61d2a0a..134b356 100644
> --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
> +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
> @@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
>                 return 0;
>         }
> 
> +       /*
> +        * We hope that HW sequencer will do the right thing automatically and
> +        * with the SW seuencer we cannot use preopcode any way, so just ignore
> +        * write disable operation and pretend it was completed successfully.
> +        */
> +       if (opcode == SPINOR_OP_WRDI)
> +               return 0;
> +
>         writel(0, ispi->base + FADDR);
> 
>         /* Write the value beforehand */
> --
> 2.10.2
> 


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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 14:28 ` Tudor.Ambarus
@ 2020-07-22 14:36   ` Mika Westerberg
  2020-07-22 15:18     ` Tudor.Ambarus
  0 siblings, 1 reply; 7+ messages in thread
From: Mika Westerberg @ 2020-07-22 14:36 UTC (permalink / raw)
  To: Tudor.Ambarus; +Cc: alexander.sverdlin, vigneshr, linux-mtd, linux-kernel, ibr

Hi,

On Wed, Jul 22, 2020 at 02:28:30PM +0000, Tudor.Ambarus@microchip.com wrote:
> + Mika
> 
> Hi, Mika,
> 
> Would you please review the patch from below?

Sure, there is minor comment below.

> 
> Thanks!
> 
> On 7/22/20 5:01 PM, Alexander Sverdlin wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> > 
> > After spi_nor_write_disable() return code checks were introduced in the
> > spi-nor front end intel-spi backend stopped to work because WRDI was never
> > supported and always failed.
> > 
> > Just pretend it was sucessful and ignore the command itself. HW sequencer
> > shall do the right thing automatically, while with SW sequencer we cannot
> > do it anyway, because the only tool we had was preopcode and it makes no
> > sense for WRDI.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> > ---
> >  drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
> > index 61d2a0a..134b356 100644
> > --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
> > +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
> > @@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
> >                 return 0;
> >         }
> > 
> > +       /*
> > +        * We hope that HW sequencer will do the right thing automatically and
> > +        * with the SW seuencer we cannot use preopcode any way, so just ignore
                           ^^^^^^^^
Typo, should be sequencer.

Otherwise looks good to me.

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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 14:36   ` Mika Westerberg
@ 2020-07-22 15:18     ` Tudor.Ambarus
  2020-07-22 16:40       ` Alexander Sverdlin
  2020-07-23  6:22       ` Mika Westerberg
  0 siblings, 2 replies; 7+ messages in thread
From: Tudor.Ambarus @ 2020-07-22 15:18 UTC (permalink / raw)
  To: mika.westerberg
  Cc: alexander.sverdlin, vigneshr, linux-mtd, linux-kernel, ibr

On 7/22/20 5:36 PM, Mika Westerberg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi,
> 
> On Wed, Jul 22, 2020 at 02:28:30PM +0000, Tudor.Ambarus@microchip.com wrote:
>> + Mika
>>
>> Hi, Mika,
>>
>> Would you please review the patch from below?
> 
> Sure, there is minor comment below.
> 
>>
>> Thanks!
>>
>> On 7/22/20 5:01 PM, Alexander Sverdlin wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
>>>
>>> After spi_nor_write_disable() return code checks were introduced in the
>>> spi-nor front end intel-spi backend stopped to work because WRDI was never
>>> supported and always failed.
>>>
>>> Just pretend it was sucessful and ignore the command itself. HW sequencer
>>> shall do the right thing automatically, while with SW sequencer we cannot
>>> do it anyway, because the only tool we had was preopcode and it makes no
>>> sense for WRDI.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
>>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
>>> ---
>>>  drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
>>> index 61d2a0a..134b356 100644
>>> --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
>>> +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
>>> @@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
>>>                 return 0;
>>>         }
>>>
>>> +       /*
>>> +        * We hope that HW sequencer will do the right thing automatically and
>>> +        * with the SW seuencer we cannot use preopcode any way, so just ignore
>                            ^^^^^^^^
> Typo, should be sequencer.
> 
> Otherwise looks good to me.
> 

It looks good to me too. Should I add your R-b tag when applying?
I can fix the typo.

Cheers,
ta


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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 15:18     ` Tudor.Ambarus
@ 2020-07-22 16:40       ` Alexander Sverdlin
  2020-07-23  6:22       ` Mika Westerberg
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Sverdlin @ 2020-07-22 16:40 UTC (permalink / raw)
  To: Tudor.Ambarus, mika.westerberg; +Cc: vigneshr, linux-mtd, linux-kernel, ibr

Hi!

On 22/07/2020 17:18, Tudor.Ambarus@microchip.com wrote:

[...]

>>>> After spi_nor_write_disable() return code checks were introduced in the
>>>> spi-nor front end intel-spi backend stopped to work because WRDI was never
>>>> supported and always failed.
>>>>
>>>> Just pretend it was sucessful and ignore the command itself. HW sequencer
>>>> shall do the right thing automatically, while with SW sequencer we cannot
>>>> do it anyway, because the only tool we had was preopcode and it makes no
>>>> sense for WRDI.
>>>>
>>>> Cc: stable@vger.kernel.org
>>>> Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
>>>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
>>>> ---
>>>>  drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
>>>>  1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
>>>> index 61d2a0a..134b356 100644
>>>> --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
>>>> +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
>>>> @@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
>>>>                 return 0;
>>>>         }
>>>>
>>>> +       /*
>>>> +        * We hope that HW sequencer will do the right thing automatically and
>>>> +        * with the SW seuencer we cannot use preopcode any way, so just ignore
>>                            ^^^^^^^^
>> Typo, should be sequencer.
>>
>> Otherwise looks good to me.
>>
> It looks good to me too. Should I add your R-b tag when applying?
> I can fix the typo.

Thank you, Mika, Tudor!

-- 
Best regards,
Alexander Sverdlin.

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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 15:18     ` Tudor.Ambarus
  2020-07-22 16:40       ` Alexander Sverdlin
@ 2020-07-23  6:22       ` Mika Westerberg
  1 sibling, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2020-07-23  6:22 UTC (permalink / raw)
  To: Tudor.Ambarus; +Cc: alexander.sverdlin, vigneshr, linux-mtd, linux-kernel, ibr

On Wed, Jul 22, 2020 at 03:18:50PM +0000, Tudor.Ambarus@microchip.com wrote:
> On 7/22/20 5:36 PM, Mika Westerberg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi,
> > 
> > On Wed, Jul 22, 2020 at 02:28:30PM +0000, Tudor.Ambarus@microchip.com wrote:
> >> + Mika
> >>
> >> Hi, Mika,
> >>
> >> Would you please review the patch from below?
> > 
> > Sure, there is minor comment below.
> > 
> >>
> >> Thanks!
> >>
> >> On 7/22/20 5:01 PM, Alexander Sverdlin wrote:
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> >>>
> >>> After spi_nor_write_disable() return code checks were introduced in the
> >>> spi-nor front end intel-spi backend stopped to work because WRDI was never
> >>> supported and always failed.
> >>>
> >>> Just pretend it was sucessful and ignore the command itself. HW sequencer
> >>> shall do the right thing automatically, while with SW sequencer we cannot
> >>> do it anyway, because the only tool we had was preopcode and it makes no
> >>> sense for WRDI.
> >>>
> >>> Cc: stable@vger.kernel.org
> >>> Fixes: bce679e5ae3a ("mtd: spi-nor: Check for errors after each Register Operation")
> >>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> >>> ---
> >>>  drivers/mtd/spi-nor/controllers/intel-spi.c | 8 ++++++++
> >>>  1 file changed, 8 insertions(+)
> >>>
> >>> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
> >>> index 61d2a0a..134b356 100644
> >>> --- a/drivers/mtd/spi-nor/controllers/intel-spi.c
> >>> +++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
> >>> @@ -612,6 +612,14 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf,
> >>>                 return 0;
> >>>         }
> >>>
> >>> +       /*
> >>> +        * We hope that HW sequencer will do the right thing automatically and
> >>> +        * with the SW seuencer we cannot use preopcode any way, so just ignore
> >                            ^^^^^^^^
> > Typo, should be sequencer.
> > 
> > Otherwise looks good to me.
> > 
> 
> It looks good to me too. Should I add your R-b tag when applying?
> I can fix the typo.

Sure. Thanks!

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

* Re: [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command
  2020-07-22 14:01 [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command Alexander Sverdlin
  2020-07-22 14:28 ` Tudor.Ambarus
@ 2020-07-27 12:33 ` Tudor Ambarus
  1 sibling, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2020-07-27 12:33 UTC (permalink / raw)
  To: Alexander Sverdlin, Vignesh Raghavendra, linux-mtd
  Cc: Tudor Ambarus, linux-kernel, Baurzhan Ismagulov

On Wed, 22 Jul 2020 16:01:36 +0200, Alexander Sverdlin wrote:
> After spi_nor_write_disable() return code checks were introduced in the
> spi-nor front end intel-spi backend stopped to work because WRDI was never
> supported and always failed.
> 
> Just pretend it was sucessful and ignore the command itself. HW sequencer
> shall do the right thing automatically, while with SW sequencer we cannot
> do it anyway, because the only tool we had was preopcode and it makes no
> sense for WRDI.

Applied to spi-nor/next, thanks!

[1/1] mtd: spi-nor: intel-spi: Simulate WRDI command
      https://git.kernel.org/mtd/c/44a80df4bfce

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@microchip.com>

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

end of thread, other threads:[~2020-07-27 12:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 14:01 [PATCH] mtd: spi-nor: intel-spi: Simulate WRDI command Alexander Sverdlin
2020-07-22 14:28 ` Tudor.Ambarus
2020-07-22 14:36   ` Mika Westerberg
2020-07-22 15:18     ` Tudor.Ambarus
2020-07-22 16:40       ` Alexander Sverdlin
2020-07-23  6:22       ` Mika Westerberg
2020-07-27 12:33 ` 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).