[PATCH 1/2] dt-bindings: mtd: nand: Macronix: document new binding

Miquel Raynal miquel.raynal at bootlin.com
Fri Mar 24 03:49:11 PDT 2023


Hi Álvaro,

noltari at gmail.com wrote on Fri, 24 Mar 2023 11:31:17 +0100:

> Hi Miquèl,
> 
> El vie, 24 mar 2023 a las 10:40, Miquel Raynal
> (<miquel.raynal at bootlin.com>) escribió:
> >
> > Hi Álvaro,
> >
> > noltari at gmail.com wrote on Thu, 23 Mar 2023 13:45:09 +0100:
> >  
> > > Add new "mxic,disable-block-protection" binding documentation.
> > > This binding allows disabling block protection support for those devices not
> > > supporting it.
> > >
> > > Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
> > > ---
> > >  Documentation/devicetree/bindings/mtd/nand-macronix.txt | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/mtd/nand-macronix.txt b/Documentation/devicetree/bindings/mtd/nand-macronix.txt
> > > index ffab28a2c4d1..03f65ca32cd3 100644
> > > --- a/Documentation/devicetree/bindings/mtd/nand-macronix.txt
> > > +++ b/Documentation/devicetree/bindings/mtd/nand-macronix.txt
> > > @@ -16,6 +16,9 @@ in children nodes.
> > >  Required NAND chip properties in children mode:
> > >  - randomizer enable: should be "mxic,enable-randomizer-otp"
> > >
> > > +Optional NAND chip properties in children mode:
> > > +- block protection disable: should be "mxic,disable-block-protection"
> > > +  
> >
> > Besides the fact that nowadays we prefer to see binding conversions to
> > yaml before adding anything, I don't think this will fly.
> >
> > I'm not sure exactly what "disable block protection" means, we
> > already have similar properties like "lock" and "secure-regions", not
> > sure they will fit but I think it's worth checking.  
> 
> As explained in 2/2, commit 03a539c7a118 introduced a regression on
> Sercomm H500-s (BCM63268) OpenWrt devices with Macronix MX30LF1G18AC
> which hangs the device.
> 
> This is the log with block protection disabled:
> [    0.495831] bcm6368_nand 10000200.nand: there is not valid maps for
> state default
> [    0.504995] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
> [    0.511526] nand: Macronix MX30LF1G18AC
> [    0.515586] nand: 128 MiB, SLC, erase size: 128 KiB, page size:
> 2048, OOB size: 64
> [    0.523516] bcm6368_nand 10000200.nand: detected 128MiB total,
> 128KiB blocks, 2KiB pages, 16B OOB, 8-bit, BCH-4
> [    0.535912] Bad block table found at page 65472, version 0x01
> [    0.544268] Bad block table found at page 65408, version 0x01
> [    0.954329] 9 fixed-partitions partitions found on MTD device brcmnand.0
> ...
> 
> This is the log with block protection enabled:
> [    0.495095] bcm6368_nand 10000200.nand: there is not valid maps for
> state default
> [    0.504249] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
> [    0.510772] nand: Macronix MX30LF1G18AC
> [    0.514874] nand: 128 MiB, SLC, erase size: 128 KiB, page size:
> 2048, OOB size: 64
> [    0.522780] bcm6368_nand 10000200.nand: detected 128MiB total,
> 128KiB blocks, 2KiB pages, 16B OOB, 8-bit, BCH-4
> [    0.539687] Bad block table not found for chip 0
> [    0.550153] Bad block table not found for chip 0
> [    0.555069] Scanning device for bad blocks
> [    0.601213] CPU 1 Unable to handle kernel paging request at virtual
> address 10277f00, epc == 8039ce70, ra == 8016ad50
> *** Device hangs ***
> 
> Enabling macronix_nand_block_protection_support() makes the device
> unable to detect the bad block table and hangs it when trying to scan
> for bad blocks.

Please trace nand_macronix.c and look:
- are the get_features and set_features really supported by the
  controller driver?
- what is the state of the locking configuration in the chip when you
  boot?
- is there anything that locks the device by calling mxic_nand_lock() ?
- finding no bbt is one thing, hanging is another, where is it hanging
  exactly? (offset in nand/ and line in the code)

> 
> >
> > Otherwise, why would you disable the block protection? What does it
> > mean exactly? I'm not in favor of a Macronix-specific property here.
> >
> > Thanks,
> > Miquèl  
> 
> --
> Álvaro


Thanks,
Miquèl



More information about the linux-mtd mailing list