All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	"David Woodhouse" <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] mtd: rawnand: marvell: fix command xtype in BCH write hook
Date: Fri, 4 May 2018 00:06:48 +0000	[thread overview]
Message-ID: <f1b88811dd88481da1c1b84341bbc9a5@svr-chch-ex1.atlnz.lc> (raw)
In-Reply-To: 20180503100027.16229-1-miquel.raynal@bootlin.com

Hi Miquel,

On 03/05/18 22:00, Miquel Raynal wrote:
> One layout supported by the Marvell NAND controller supports NAND pages
> of 2048 bytes, all handled in one single chunk when using BCH with a
> strength of 4-bit per 512 bytes. In this case, instead of the generic
> XTYPE_WRITE_DISPATCH/XTYPE_LAST_NAKED_RW couple, the controller expects
> to receive XTYPE_MONOLITHIC_RW.
> 
> This fixes problems at boot like:
> 
> [    1.315475] Scanning device for bad blocks
> [    3.203108] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    3.209564] nand_bbt: error while writing BBT block -110
> [    4.243106] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    5.283106] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    5.289562] nand_bbt: error -110 while marking block 2047 bad
> [    6.323106] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    6.329559] nand_bbt: error while writing BBT block -110
> [    7.363106] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    8.403105] marvell-nfc f10d0000.flash: Timeout waiting for RB signal
> [    8.409559] nand_bbt: error -110 while marking block 2046 bad
> ...
> 
> Fixes: 02f26ecf8c772 ("mtd: nand: add reworked Marvell NAND controller driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

For the following combinations

SoC             NAND                    Size     EB      Page OOB
---             ----                    ----     --      ---- ---
Armada-385      Micron MT29F8G08ABACAWP 1024 MiB 256 KiB 4096 224
Armada-385      Micron MT29F2G08ABAEAWP 256 MiB  128 KiB 2048 64
Armada-385      Macronix MX30LF2G18AC   256 MiB  128 KiB 2048 64
Armada-98DX4251 AMD/Spansion S34ML08G2  1024 MiB 128 KiB 2048 128
Armada-98DX4251 Macronix MX60LF8G18AC   1024 MiB 128 KiB 2048 64
Armada-98DX4251 Micron MT29F8G08ABABAWP 1024 MiB 512 KiB 4096 224

Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

I do have one platform that passes the initial detection but starts to 
report ubifs errors when mounted.

Armada-98DX4251 Micron MT29F8G08ABACAWP 1024 MiB 256 KiB 4096 224

This is probably unrelated to this particular fix. It may be as simple 
as something not catering for the Armada-98DX4251 SoC or a genuine 
difference between Armada-98DX4251 and Armada-385. 4.16.4 with 
pxa3xx_nand works with this combination.

> ---
> 
> Chris,
> 
> Can you please give this patch a try? This is very likely to solve your
> boot issue.
> 
> Thanks,
> Miquèl
> 
>   drivers/mtd/nand/raw/marvell_nand.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> index e4b964fd40d8..db5ec4e8bde9 100644
> --- a/drivers/mtd/nand/raw/marvell_nand.c
> +++ b/drivers/mtd/nand/raw/marvell_nand.c
> @@ -1408,6 +1408,7 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk,
>   	struct marvell_nand_chip *marvell_nand = to_marvell_nand(chip);
>   	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
>   	const struct marvell_hw_ecc_layout *lt = to_marvell_nand(chip)->layout;
> +	u32 xtype;
>   	int ret;
>   	struct marvell_nfc_op nfc_op = {
>   		.ndcb[0] = NDCB0_CMD_TYPE(TYPE_WRITE) | NDCB0_LEN_OVRD,
> @@ -1423,7 +1424,12 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk,
>   	 * last naked write.
>   	 */
>   	if (chunk == 0) {
> -		nfc_op.ndcb[0] |= NDCB0_CMD_XTYPE(XTYPE_WRITE_DISPATCH) |
> +		if (lt->nchunks == 1)
> +			xtype = XTYPE_MONOLITHIC_RW;
> +		else
> +			xtype = XTYPE_WRITE_DISPATCH;
> +
> +		nfc_op.ndcb[0] |= NDCB0_CMD_XTYPE(xtype) |
>   				  NDCB0_ADDR_CYC(marvell_nand->addr_cyc) |
>   				  NDCB0_CMD1(NAND_CMD_SEQIN);
>   		nfc_op.ndcb[1] |= NDCB1_ADDRS_PAGE(page);
> 


  reply	other threads:[~2018-05-04  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 10:00 [PATCH] mtd: rawnand: marvell: fix command xtype in BCH write hook Miquel Raynal
2018-05-04  0:06 ` Chris Packham [this message]
2018-05-04  7:10   ` Miquel Raynal
2018-05-07  3:48     ` ubifs error with marvell_nand on Armada-98DX4251 (was Re: [PATCH] mtd: rawnand: marvell: fix command xtype in BCH write hook) Chris Packham
2018-05-07  7:50       ` Boris Brezillon
2018-05-08  1:38         ` Chris Packham
2018-05-08  7:59           ` Boris Brezillon
2018-05-08 23:40             ` Chris Packham
2018-05-07  7:41 ` [PATCH] mtd: rawnand: marvell: fix command xtype in BCH write hook Boris Brezillon

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=f1b88811dd88481da1c1b84341bbc9a5@svr-chch-ex1.atlnz.lc \
    --to=chris.packham@alliedtelesis.co.nz \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --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 \
    /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.