All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
@ 2019-05-21  8:43 Sascha Hauer
  2019-05-21  8:44 ` Boris Brezillon
  2019-05-21  9:04 ` Miquel Raynal
  0 siblings, 2 replies; 6+ messages in thread
From: Sascha Hauer @ 2019-05-21  8:43 UTC (permalink / raw)
  To: linux-mtd
  Cc: Richard Weinberger, Sascha Hauer, Miquel Raynal, kernel, Boris Brezillon

memorg->ntargets is initialized with '1'. It should be initialized with
the maxchips argument from nand_scan() instead. Otherwise multi chip
support errors out on the secondary chip selects when trying to call
nand_reset() on them:

WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
nand_reset_op+0x194/0x1c4

With this memorg->ntargets is initialized with the maximum number of
chip selects supported by the driver. After having detected the number
of actually connected chips memory->ntargets is updated with that
number.

Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Changes since v1:

- initialize memorg->ntargets directly in nand_scan_ident() rather than
  passing it as argument to nand_detect()
- Fix Fixes: committish, leading '3' was missing

 drivers/mtd/nand/raw/nand_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 7db0f04cf52b..a8a7e81be710 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4638,7 +4638,6 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
 	memorg = nanddev_get_memorg(&chip->base);
 	memorg->planes_per_lun = 1;
 	memorg->luns_per_target = 1;
-	memorg->ntargets = 1;
 
 	/*
 	 * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
@@ -5003,6 +5002,8 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips,
 	if (ret)
 		return ret;
 
+	memorg->ntargets = maxchips;
+
 	/* Read the flash type */
 	ret = nand_detect(chip, table);
 	if (ret) {
-- 
2.20.1


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

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

* Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
  2019-05-21  8:43 [PATCH v2] mtd: rawnand: initialize ntargets with maxchips Sascha Hauer
@ 2019-05-21  8:44 ` Boris Brezillon
  2019-05-21  9:04 ` Miquel Raynal
  1 sibling, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2019-05-21  8:44 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Richard Weinberger, Miquel Raynal, linux-mtd, kernel, Boris Brezillon

On Tue, 21 May 2019 10:43:35 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> memorg->ntargets is initialized with '1'. It should be initialized with
> the maxchips argument from nand_scan() instead. Otherwise multi chip
> support errors out on the secondary chip selects when trying to call
> nand_reset() on them:
> 
> WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
> nand_reset_op+0x194/0x1c4
> 
> With this memorg->ntargets is initialized with the maximum number of
> chip selects supported by the driver. After having detected the number
> of actually connected chips memory->ntargets is updated with that
> number.
> 
> Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

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

And thanks for the fix.

Boris

> ---
> 
> Changes since v1:
> 
> - initialize memorg->ntargets directly in nand_scan_ident() rather than
>   passing it as argument to nand_detect()
> - Fix Fixes: committish, leading '3' was missing
> 
>  drivers/mtd/nand/raw/nand_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 7db0f04cf52b..a8a7e81be710 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4638,7 +4638,6 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
>  	memorg = nanddev_get_memorg(&chip->base);
>  	memorg->planes_per_lun = 1;
>  	memorg->luns_per_target = 1;
> -	memorg->ntargets = 1;
>  
>  	/*
>  	 * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
> @@ -5003,6 +5002,8 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips,
>  	if (ret)
>  		return ret;
>  
> +	memorg->ntargets = maxchips;
> +
>  	/* Read the flash type */
>  	ret = nand_detect(chip, table);
>  	if (ret) {


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

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

* Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
  2019-05-21  8:43 [PATCH v2] mtd: rawnand: initialize ntargets with maxchips Sascha Hauer
  2019-05-21  8:44 ` Boris Brezillon
@ 2019-05-21  9:04 ` Miquel Raynal
  2019-05-21  9:40   ` Boris Brezillon
  1 sibling, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2019-05-21  9:04 UTC (permalink / raw)
  To: Sascha Hauer, linux-mtd
  Cc: Richard Weinberger, Boris Brezillon, kernel, Miquel Raynal

On Tue, 2019-05-21 at 08:43:35 UTC, Sascha Hauer wrote:
> memorg->ntargets is initialized with '1'. It should be initialized with
> the maxchips argument from nand_scan() instead. Otherwise multi chip
> support errors out on the secondary chip selects when trying to call
> nand_reset() on them:
> 
> WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
> nand_reset_op+0x194/0x1c4
> 
> With this memorg->ntargets is initialized with the maximum number of
> chip selects supported by the driver. After having detected the number
> of actually connected chips memory->ntargets is updated with that
> number.
> 
> Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

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

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

* Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
  2019-05-21  9:04 ` Miquel Raynal
@ 2019-05-21  9:40   ` Boris Brezillon
  2019-05-21  9:48     ` Miquel Raynal
  0 siblings, 1 reply; 6+ messages in thread
From: Boris Brezillon @ 2019-05-21  9:40 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Sascha Hauer, linux-mtd, kernel, Boris Brezillon

On Tue, 21 May 2019 11:04:17 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> On Tue, 2019-05-21 at 08:43:35 UTC, Sascha Hauer wrote:
> > memorg->ntargets is initialized with '1'. It should be initialized with
> > the maxchips argument from nand_scan() instead. Otherwise multi chip
> > support errors out on the secondary chip selects when trying to call
> > nand_reset() on them:
> > 
> > WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
> > nand_reset_op+0x194/0x1c4
> > 
> > With this memorg->ntargets is initialized with the maximum number of
> > chip selects supported by the driver. After having detected the number
> > of actually connected chips memory->ntargets is updated with that
> > number.
> > 
> > Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>  
> 
> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Are you sure it's mtd/next? I'd expect it to be queued in mtd/fixes not
mtd/next.

> 
> Miquel


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

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

* Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
  2019-05-21  9:40   ` Boris Brezillon
@ 2019-05-21  9:48     ` Miquel Raynal
  2019-06-21 10:32       ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2019-05-21  9:48 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Richard Weinberger, Sascha Hauer, linux-mtd, kernel, Boris Brezillon

Hi Boris,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Tue, 21 May
2019 11:40:22 +0200:

> On Tue, 21 May 2019 11:04:17 +0200
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > On Tue, 2019-05-21 at 08:43:35 UTC, Sascha Hauer wrote:  
> > > memorg->ntargets is initialized with '1'. It should be initialized with
> > > the maxchips argument from nand_scan() instead. Otherwise multi chip
> > > support errors out on the secondary chip selects when trying to call
> > > nand_reset() on them:
> > > 
> > > WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
> > > nand_reset_op+0x194/0x1c4
> > > 
> > > With this memorg->ntargets is initialized with the maximum number of
> > > chip selects supported by the driver. After having detected the number
> > > of actually connected chips memory->ntargets is updated with that
> > > number.
> > > 
> > > Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>    
> > 
> > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.  
> 
> Are you sure it's mtd/next? I'd expect it to be queued in mtd/fixes not
> mtd/next.

Yes, I failed to checkout the right branch :)
I meant mtd/fixes, will move the patch.

Thanks,
Miquèl

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

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

* Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
  2019-05-21  9:48     ` Miquel Raynal
@ 2019-06-21 10:32       ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-21 10:32 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Boris Brezillon, Richard Weinberger, Sascha Hauer,
	Boris Brezillon, linux-mtd, Sascha Hauer

On Tue, May 21, 2019 at 6:48 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Boris,
>
> Boris Brezillon <boris.brezillon@collabora.com> wrote on Tue, 21 May
> 2019 11:40:22 +0200:
>
> > On Tue, 21 May 2019 11:04:17 +0200
> > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > > On Tue, 2019-05-21 at 08:43:35 UTC, Sascha Hauer wrote:
> > > > memorg->ntargets is initialized with '1'. It should be initialized with
> > > > the maxchips argument from nand_scan() instead. Otherwise multi chip
> > > > support errors out on the secondary chip selects when trying to call
> > > > nand_reset() on them:
> > > >
> > > > WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
> > > > nand_reset_op+0x194/0x1c4
> > > >
> > > > With this memorg->ntargets is initialized with the maximum number of
> > > > chip selects supported by the driver. After having detected the number
> > > > of actually connected chips memory->ntargets is updated with that
> > > > number.
> > > >
> > > > Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
> > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> > >
> > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
> >
> > Are you sure it's mtd/next? I'd expect it to be queued in mtd/fixes not
> > mtd/next.
>
> Yes, I failed to checkout the right branch :)
> I meant mtd/fixes, will move the patch.
>

I was also suffering from this problem today,
then found this patch.


Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>



-- 
Best Regards
Masahiro Yamada

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

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

end of thread, other threads:[~2019-06-21 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  8:43 [PATCH v2] mtd: rawnand: initialize ntargets with maxchips Sascha Hauer
2019-05-21  8:44 ` Boris Brezillon
2019-05-21  9:04 ` Miquel Raynal
2019-05-21  9:40   ` Boris Brezillon
2019-05-21  9:48     ` Miquel Raynal
2019-06-21 10:32       ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.