Re: [PATCH 1/2] Fix FSL NAND driver to read all ONFI parameter pages
From: Boris Brezillon
Date: Wed May 02 2018 - 06:39:32 EST
On Tue, 1 May 2018 05:01:23 +0000
"Wan, Jane (Nokia - US/Sunnyvale)" <jane.wan@xxxxxxxxx> wrote:
> Hi MiquÃl and Boris,
>
> Thank you for your response and feedback. I've modified the fix based on your comments.
> Please see the updated patch file at the end of this message (also in attachment).
> My answers to your comments/questions are inline in the previous message.
>
> Here is the answer to Boris question in another email thread:
>
> > What if some NANDs have 4 or more copies of the param page?
> [Jane] The ONFI spec defines that the parameter page and its two redundant copies are mandatory.
> The additional redundant pages are optional. Currently, the FSL NAND driver only reads the first
> parameter page. This patch is to fix the driver to meet the mandatory requirement in the spec.
> We got a batch of particularly bad NAND chips recently and we needed these changes to make them
> work reliably over temperature. The patch was verified using these bad chips.
And that proves my point. The core is reading 3 param pages [1], but
since this driver was trying to guess how many bytes to read from
->cmdfunc() and did not guess correctly you ended up with a partially
working implementation (works only if the first PARAM page is valid).
Now, you fix it to read 3 PARAM pages, but what if we decide to read
more to cope with MLC NANDs where even more copy are needed to have one
valid version? You'll have to patch ->cmdfunc() again, just because
you're trying to guess something that the core is supposed to tell you.
[1]https://elixir.bootlin.com/linux/v4.17-rc3/source/drivers/mtd/nand/raw/nand_base.c#L5115