All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Richard Weinberger <richard@nod.at>,
	stable@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH] mtd: rawnand: marvell: Ensure the ND_RUN bit is reset
Date: Mon, 8 Apr 2019 10:07:47 +0200	[thread overview]
Message-ID: <20190408100747.7dc8412e@collabora.com> (raw)
In-Reply-To: <20190407193401.7983-1-miquel.raynal@bootlin.com>

On Sun,  7 Apr 2019 21:34:01 +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 is 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>
> ---
> 
> Hi Daniel, could you please test this version of the fix?
> 
> Thanks,
> Miquèl
> 
> 
>  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..a7d7f17d8682 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.
> @@ -736,6 +730,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  		       NDCR_GENERIC_FIELDS_MASK & ~NDCR_ND_RUN;
>  	writel_relaxed(ndcr_generic | marvell_nand->ndcr, nfc->regs + NDCR);
>  
> +	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);
> +
>  	/* Also reset the interrupt status register */
>  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);

I think this should also be moved before the

	if (chip == nfc->selected_chip &&
	    die_nr == marvell_nand->selected_die)

check.

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

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	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@lists.infradead.org>,
	stable@vger.kernel.org, Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH] mtd: rawnand: marvell: Ensure the ND_RUN bit is reset
Date: Mon, 8 Apr 2019 10:07:47 +0200	[thread overview]
Message-ID: <20190408100747.7dc8412e@collabora.com> (raw)
In-Reply-To: <20190407193401.7983-1-miquel.raynal@bootlin.com>

On Sun,  7 Apr 2019 21:34:01 +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 is 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>
> ---
> 
> Hi Daniel, could you please test this version of the fix?
> 
> Thanks,
> Miquèl
> 
> 
>  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..a7d7f17d8682 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.
> @@ -736,6 +730,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
>  		       NDCR_GENERIC_FIELDS_MASK & ~NDCR_ND_RUN;
>  	writel_relaxed(ndcr_generic | marvell_nand->ndcr, nfc->regs + NDCR);
>  
> +	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);
> +
>  	/* Also reset the interrupt status register */
>  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);

I think this should also be moved before the

	if (chip == nfc->selected_chip &&
	    die_nr == marvell_nand->selected_die)

check.

  reply	other threads:[~2019-04-08  8:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07 19:34 [PATCH] mtd: rawnand: marvell: Ensure the ND_RUN bit is reset Miquel Raynal
2019-04-07 19:34 ` Miquel Raynal
2019-04-08  8:07 ` Boris Brezillon [this message]
2019-04-08  8:07   ` Boris Brezillon
2019-04-08  8:11   ` Miquel Raynal
2019-04-08  8:11     ` Miquel Raynal

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=20190408100747.7dc8412e@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=computersforpeace@gmail.com \
    --cc=daniel@zonque.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.com \
    /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 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.