linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Richard Weinberger <richard@nod.at>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org, kernel@pengutronix.de,
	Boris Brezillon <bbrezillon@kernel.org>
Subject: Re: [PATCH v2] mtd: rawnand: initialize ntargets with maxchips
Date: Tue, 21 May 2019 10:44:58 +0200	[thread overview]
Message-ID: <20190521104458.71b25f36@collabora.com> (raw)
In-Reply-To: <20190521084335.15026-1-s.hauer@pengutronix.de>

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/

  reply	other threads:[~2019-05-21  8:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  8:43 [PATCH v2] mtd: rawnand: initialize ntargets with maxchips Sascha Hauer
2019-05-21  8:44 ` Boris Brezillon [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190521104458.71b25f36@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).