Re: [PATCH 4/9] mtd: pxa3xx_nand: add a default chunk size

Boris Brezillon
2015-02-08T20:18:23Z

On Sun, 8 Feb 2015 21:15:08 +0100
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Tue, 27 Jan 2015 15:10:11 +0100
> Antoine Tenart <antoine.tenart@free-electrons.com> wrote:
>
> > Add a default chunk size of 512 in the pxa3xx nand driver.
> >
> > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> > ---
> > drivers/mtd/nand/pxa3xx_nand.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> > index 782ae24d6b7d..b2783b1f663c 100644
> > --- a/drivers/mtd/nand/pxa3xx_nand.c
> > +++ b/drivers/mtd/nand/pxa3xx_nand.c
> > @@ -1430,6 +1430,9 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
> > if (pdata->keep_config && !pxa3xx_nand_detect_config(info))
> > goto KEEP_CONFIG;
> >
> > + /* Set a default chunk size */
>
> Could you explain why you need to set this default chunk size ?
> I guess it's because your NAND is not configured by the bootloader, and
> thus you did not specify the keep-config attribute in the DT.
> And I guess you need this field to be initialized before pxa_ecc_init is
> called (for some NAND operations done in the meantime: READID ?).
>
> Moreover, IMHO this should be place in an 'else' statement, otherwise
> you'll overwrite the value set in pxa3xx_nand_detect_config.

My bad, I didn't notice the 'goto KEEP_CONFIG' statement.

>
>
> > + info->chunk_size = 512;
> > +
> > ret = pxa3xx_nand_sensing(info);
> > if (ret) {
> > dev_info(&info->pdev->dev, "There is no chip on cs %d!\n",
>
>
>

--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering