linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
@ 2019-04-08  8:31 Miquel Raynal
  2019-04-08 16:50 ` Daniel Mack
  2019-04-14  8:50 ` Boris Brezillon
  0 siblings, 2 replies; 7+ messages in thread
From: Miquel Raynal @ 2019-04-08  8:31 UTC (permalink / raw)
  To: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Tudor Ambarus, Vignesh Raghavendra, linux-mtd
  Cc: stable, Daniel Mack, Miquel Raynal

Since the migration of the driver to stop using the legacy
->select_chip() hook, there is nothing deselecting the target anymore,
thus the selection is not forced at the next access. Ensure the ND_RUN
bit and the interrupts are always in a clean state.

Cc: Daniel Mack <daniel@zonque.org>
Cc: stable@vger.kernel.org
Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Changes in v2:
* Also include the reset of the interrupts each time
  marvell_nfc_select_target() is called.

 drivers/mtd/nand/raw/marvell_nand.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index f38e5c1b87e4..d984538980e2 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
 	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
 	u32 ndcr_generic;
 
-	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
-		return;
-
-	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
-	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
-
 	/*
 	 * Reset the NDCR register to a clean state for this particular chip,
 	 * also clear ND_RUN bit.
@@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
 	/* Also reset the interrupt status register */
 	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
 
+	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
+		return;
+
+	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
+	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
+
 	nfc->selected_chip = chip;
 	marvell_nand->selected_die = die_nr;
 }
-- 
2.19.1


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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-08  8:31 [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation Miquel Raynal
@ 2019-04-08 16:50 ` Daniel Mack
  2019-04-14  8:50 ` Boris Brezillon
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Mack @ 2019-04-08 16:50 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, David Woodhouse, Brian Norris,
	Marek Vasut, Tudor Ambarus, Vignesh Raghavendra, linux-mtd
  Cc: stable

Hi Miquel,

On 8/4/2019 10:31 AM, Miquel Raynal wrote:
> Since the migration of the driver to stop using the legacy
> ->select_chip() hook, there is nothing deselecting the target anymore,
> thus the selection is not forced at the next access. Ensure the ND_RUN
> bit and the interrupts are always in a clean state.

Thanks a lot for this. I can confirm that this solves my problem. Awesome :)

> Cc: Daniel Mack <daniel@zonque.org>
> Cc: stable@vger.kernel.org
> Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Tested-by: Daniel Mack <daniel@zonque.org>


Best regards,
Daniel



> ---
> 
> Changes in v2:
> * Also include the reset of the interrupts each time
>   marvell_nfc_select_target() is called.
> 
>  drivers/mtd/nand/raw/marvell_nand.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> index f38e5c1b87e4..d984538980e2 100644
> --- a/drivers/mtd/nand/raw/marvell_nand.c
> +++ b/drivers/mtd/nand/raw/marvell_nand.c
> @@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
>  	u32 ndcr_generic;
>  
> -	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> -		return;
> -
> -	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> -	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> -
>  	/*
>  	 * Reset the NDCR register to a clean state for this particular chip,
>  	 * also clear ND_RUN bit.
> @@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  	/* Also reset the interrupt status register */
>  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
>  
> +	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> +		return;
> +
> +	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> +	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> +
>  	nfc->selected_chip = chip;
>  	marvell_nand->selected_die = die_nr;
>  }
> 


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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-08  8:31 [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation Miquel Raynal
  2019-04-08 16:50 ` Daniel Mack
@ 2019-04-14  8:50 ` Boris Brezillon
  2019-04-28 12:20   ` Daniel Mack
  1 sibling, 1 reply; 7+ messages in thread
From: Boris Brezillon @ 2019-04-14  8:50 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger, stable,
	Marek Vasut, linux-mtd, Brian Norris, David Woodhouse,
	Daniel Mack

On Mon,  8 Apr 2019 10:31:45 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Since the migration of the driver to stop using the legacy
> ->select_chip() hook, there is nothing deselecting the target anymore,  
> thus the selection is not forced at the next access. Ensure the ND_RUN
> bit and the interrupts are always in a clean state.
> 
> Cc: Daniel Mack <daniel@zonque.org>
> Cc: stable@vger.kernel.org
> Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
> 
> Changes in v2:
> * Also include the reset of the interrupts each time
>   marvell_nfc_select_target() is called.
> 
>  drivers/mtd/nand/raw/marvell_nand.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> index f38e5c1b87e4..d984538980e2 100644
> --- a/drivers/mtd/nand/raw/marvell_nand.c
> +++ b/drivers/mtd/nand/raw/marvell_nand.c
> @@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
>  	u32 ndcr_generic;
>  
> -	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> -		return;
> -
> -	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> -	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> -
>  	/*
>  	 * Reset the NDCR register to a clean state for this particular chip,
>  	 * also clear ND_RUN bit.
> @@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  	/* Also reset the interrupt status register */
>  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
>  
> +	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> +		return;
> +
> +	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> +	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> +
>  	nfc->selected_chip = chip;
>  	marvell_nand->selected_die = die_nr;
>  }


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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-14  8:50 ` Boris Brezillon
@ 2019-04-28 12:20   ` Daniel Mack
  2019-04-28 13:07     ` Richard Weinberger
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Mack @ 2019-04-28 12:20 UTC (permalink / raw)
  To: Boris Brezillon, Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger, stable,
	Marek Vasut, linux-mtd, Brian Norris, David Woodhouse

On 14/4/2019 10:50 AM, Boris Brezillon wrote:
> On Mon,  8 Apr 2019 10:31:45 +0200
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
>> Since the migration of the driver to stop using the legacy
>> ->select_chip() hook, there is nothing deselecting the target anymore,  
>> thus the selection is not forced at the next access. Ensure the ND_RUN
>> bit and the interrupts are always in a clean state.
>>
>> Cc: Daniel Mack <daniel@zonque.org>
>> Cc: stable@vger.kernel.org
>> Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
>> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

Has this one been queued in any tree yet?



Thanks,
Daniel




> 
>> ---
>>
>> Changes in v2:
>> * Also include the reset of the interrupts each time
>>   marvell_nfc_select_target() is called.
>>
>>  drivers/mtd/nand/raw/marvell_nand.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
>> index f38e5c1b87e4..d984538980e2 100644
>> --- a/drivers/mtd/nand/raw/marvell_nand.c
>> +++ b/drivers/mtd/nand/raw/marvell_nand.c
>> @@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>>  	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
>>  	u32 ndcr_generic;
>>  
>> -	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
>> -		return;
>> -
>> -	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
>> -	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
>> -
>>  	/*
>>  	 * Reset the NDCR register to a clean state for this particular chip,
>>  	 * also clear ND_RUN bit.
>> @@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>>  	/* Also reset the interrupt status register */
>>  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
>>  
>> +	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
>> +		return;
>> +
>> +	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
>> +	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
>> +
>>  	nfc->selected_chip = chip;
>>  	marvell_nand->selected_die = die_nr;
>>  }
> 


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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-28 12:20   ` Daniel Mack
@ 2019-04-28 13:07     ` Richard Weinberger
  2019-04-29  9:00       ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Weinberger @ 2019-04-28 13:07 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Vignesh Raghavendra, Tudor Ambarus, stable, Marek Vasut,
	Boris Brezillon, linux-mtd, Miquel Raynal, Brian Norris,
	David Woodhouse

Daniel,

Am Sonntag, 28. April 2019, 14:20:49 CEST schrieb Daniel Mack:
> On 14/4/2019 10:50 AM, Boris Brezillon wrote:
> > On Mon,  8 Apr 2019 10:31:45 +0200
> > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > 
> >> Since the migration of the driver to stop using the legacy
> >> ->select_chip() hook, there is nothing deselecting the target anymore,  
> >> thus the selection is not forced at the next access. Ensure the ND_RUN
> >> bit and the interrupts are always in a clean state.
> >>
> >> Cc: Daniel Mack <daniel@zonque.org>
> >> Cc: stable@vger.kernel.org
> >> Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
> >> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> >> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > 
> > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> 
> Has this one been queued in any tree yet?

Isn't it visible in linux-next?
I was about to send a final PR to Linus later today.

Thanks,
//richard




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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-28 13:07     ` Richard Weinberger
@ 2019-04-29  9:00       ` Miquel Raynal
  2019-04-29 20:39         ` Richard Weinberger
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2019-04-29  9:00 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Vignesh Raghavendra, Tudor Ambarus, stable, Marek Vasut,
	Boris Brezillon, linux-mtd, Brian Norris, David Woodhouse,
	Daniel Mack

Hi Richard,

Richard Weinberger <richard@nod.at> wrote on Sun, 28 Apr 2019 15:07:40
+0200:

> Daniel,
> 
> Am Sonntag, 28. April 2019, 14:20:49 CEST schrieb Daniel Mack:
> > On 14/4/2019 10:50 AM, Boris Brezillon wrote:  
> > > On Mon,  8 Apr 2019 10:31:45 +0200
> > > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > >   
> > >> Since the migration of the driver to stop using the legacy  
> > >> ->select_chip() hook, there is nothing deselecting the target anymore,    
> > >> thus the selection is not forced at the next access. Ensure the ND_RUN
> > >> bit and the interrupts are always in a clean state.
> > >>
> > >> Cc: Daniel Mack <daniel@zonque.org>
> > >> Cc: stable@vger.kernel.org
> > >> Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
> > >> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> > >> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>  
> > > 
> > > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>  
> > 
> > Has this one been queued in any tree yet?  
> 
> Isn't it visible in linux-next?
> I was about to send a final PR to Linus later today.
> 

Indeed the patch is missing in 20190426 -next. 


Thanks,
Miquèl

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

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

* Re: [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation
  2019-04-29  9:00       ` Miquel Raynal
@ 2019-04-29 20:39         ` Richard Weinberger
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Weinberger @ 2019-04-29 20:39 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, stable, Marek Vasut,
	Boris Brezillon, linux-mtd, Brian Norris, David Woodhouse,
	Daniel Mack

----- Ursprüngliche Mail -----
> Von: "Miquel Raynal" <miquel.raynal@bootlin.com>
> An: "richard" <richard@nod.at>
> CC: "Daniel Mack" <daniel@zonque.org>, "Boris Brezillon" <boris.brezillon@collabora.com>, "David Woodhouse"
> <dwmw2@infradead.org>, "Brian Norris" <computersforpeace@gmail.com>, "Marek Vasut" <marek.vasut@gmail.com>, "Tudor
> Ambarus" <Tudor.Ambarus@microchip.com>, "Vignesh Raghavendra" <vigneshr@ti.com>, "linux-mtd"
> <linux-
>> Isn't it visible in linux-next?
>> I was about to send a final PR to Linus later today.
>> 
> 
> Indeed the patch is missing in 20190426 -next.

Bad timing on my side I fear, now it is in -next. :-)

Thanks,
//richard

P.s: Yay, mail works again! My laptop had "issues".

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

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

end of thread, other threads:[~2019-04-29 20:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08  8:31 [PATCH v2] mtd: rawnand: marvell: Clean the controller state before each operation Miquel Raynal
2019-04-08 16:50 ` Daniel Mack
2019-04-14  8:50 ` Boris Brezillon
2019-04-28 12:20   ` Daniel Mack
2019-04-28 13:07     ` Richard Weinberger
2019-04-29  9:00       ` Miquel Raynal
2019-04-29 20:39         ` Richard Weinberger

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