[uboot] mtd NAND recognition regression

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Fri Oct 21 08:15:20 CEST 2022


Hi Marcin

On Thu, Oct 20, 2022 at 6:32 PM Michael Nazzareno Trimarchi
<michael at amarulasolutions.com> wrote:
>
> Hi Marcin
>
> On Thu, Oct 20, 2022 at 6:13 PM Michael Nazzareno Trimarchi
> <michael at amarulasolutions.com> wrote:
> >
> > Hi
> >
> > On Thu, Oct 20, 2022 at 5:58 PM Marcin Gołaś <marcingol30 at gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > after uboot update from 2022.07 to 2022.10 SAMSUNG NAND is not recognized
> > > correctly.
> > > I use device with SAMSUNG K9K8G08U0F flash which does not support ONFI and
> > > JEDEC.
> > > Both uboot versions read 8-byte id_data in the same way: 0xD3ECC65A9551D3EC.
> > > However 2022.07 recognized flash correctly as:
> > > nand_base: 1024 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size:
> > > 64
> > > 1024 MiB
> > > The new 2022.10 recognized flash incorrectly:
> > > nand_base: 1024 MiB, SLC, erase size: 4096 KiB, page size: 4096, OOB size:
> > > 128
> > > 1024 MiB
> > >
> > > This behavior is caused by not setting chip->bits_per_cell value which is
> > > in my case equal to zero.
> > > To fix the issue we need to set it before we enter to function
> > > nand_manufacturer_detect.
> > > Following patch do this:
> > >
> > > diff --git a/drivers/mtd/nand/raw/nand_base.c
> > > b/drivers/mtd/nand/raw/nand_base.c
> > > index 4b09a11288..143d3cb755 100644
> > > --- a/drivers/mtd/nand/raw/nand_base.c
> > > +++ b/drivers/mtd/nand/raw/nand_base.c
> > > @@ -4375,6 +4375,8 @@ struct nand_flash_dev *nand_get_flash_type(struct
> > > nand_chip *chip, int *maf_id,
> > >
> > >         chip->chipsize = (uint64_t)type->chipsize << 20;
> > >
> > > +       chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]);
> > > +
> > >         if (!type->pagesize) {
> > >                 nand_manufacturer_detect(chip);
> > >         } else {
> > >
> >
> > Can you please send a patch for it? I will check this regression
>
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4171,10 +4171,13 @@ static void nand_manufacturer_detect(struct
> nand_chip *chip)
>          * nand_decode_ext_id() otherwise.
>          */
>         if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
> -           chip->manufacturer.desc->ops->detect)
> +           chip->manufacturer.desc->ops->detect) {
> +               /* The 3rd id byte holds MLC / multichip data */
> +               chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]);
>                 chip->manufacturer.desc->ops->detect(chip);
> -       else
> +       } else {
>                 nand_decode_ext_id(chip);
> +       }
>  }
>
> Can you test this one?
>

I have now sent a proper patch after checking linux mainline. The
patch is already applied on the tree and
will sent to Tom

Michael

> Michael
> >
> > Michael
> >
> > >
> > > BR,
> > > Marcin
> >
> >
> >
> > --
> > Michael Nazzareno Trimarchi
> > Co-Founder & Chief Executive Officer
> > M. +39 347 913 2170
> > michael at amarulasolutions.com
> > __________________________________
> >
> > Amarula Solutions BV
> > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> > T. +31 (0)85 111 9172
> > info at amarulasolutions.com
> > www.amarulasolutions.com
>
>
>
> --
> Michael Nazzareno Trimarchi
> Co-Founder & Chief Executive Officer
> M. +39 347 913 2170
> michael at amarulasolutions.com
> __________________________________
>
> Amarula Solutions BV
> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> T. +31 (0)85 111 9172
> info at amarulasolutions.com
> www.amarulasolutions.com



-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com


More information about the U-Boot mailing list