From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, masonccyang@mxic.com.tw,
linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: mtd: nand: Macronix: document new binding
Date: Fri, 24 Mar 2023 14:45:59 +0100 [thread overview]
Message-ID: <20230324144559.3473c537@xps-13> (raw)
In-Reply-To: <CAKR-sGc3R_k_+-hzv5DOOeRO-5rHL1k_dq7mpZLcv=FgZ1Moug@mail.gmail.com>
Hi Álvaro,
noltari@gmail.com wrote on Fri, 24 Mar 2023 12:21:11 +0100:
> El vie, 24 mar 2023 a las 11:49, Miquel Raynal
> (<miquel.raynal@bootlin.com>) escribió:
> >
> > Hi Álvaro,
> >
> > noltari@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@bootlin.com>) escribió:
> > > >
> > > > Hi Álvaro,
> > > >
> > > > noltari@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@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?
>
> This is what I could find by debugging:
> [ 0.494993] bcm6368_nand 10000200.nand: there is not valid maps for
> state default
> [ 0.505375] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1
> [ 0.512077] nand: Macronix MX30LF1G18AC
> [ 0.515994] nand: 128 MiB, SLC, erase size: 128 KiB, page size:
> 2048, OOB size: 64
> [ 0.523928] bcm6368_nand 10000200.nand: detected 128MiB total,
> 128KiB blocks, 2KiB pages, 16B OOB, 8-bit, BCH-4
> [ 0.534415] bcm6368_nand 10000200.nand: ll_op cmd 0xa00ee
> [ 0.539988] bcm6368_nand 10000200.nand: ll_op cmd 0x600a0
> [ 0.545659] bcm6368_nand 10000200.nand: ll_op cmd 0x10000
> [ 0.551214] bcm6368_nand 10000200.nand: NAND_CMD_GET_FEATURES = 0x00
> [ 0.557843] bcm6368_nand 10000200.nand: ll_op cmd 0x10000
> [ 0.563475] bcm6368_nand 10000200.nand: NAND_CMD_GET_FEATURES = 0x00
> [ 0.569998] bcm6368_nand 10000200.nand: ll_op cmd 0x10000
> [ 0.575653] bcm6368_nand 10000200.nand: NAND_CMD_GET_FEATURES = 0x00
> [ 0.582246] bcm6368_nand 10000200.nand: ll_op cmd 0x80010000
> [ 0.588067] bcm6368_nand 10000200.nand: NAND_CMD_GET_FEATURES = 0x00
> [ 0.594657] nand: nand_get_features: addr=a0 subfeature_param=[00
> 00 00 00] -> 0
> [ 0.602341] macronix_nand_block_protection_support:
> ONFI_FEATURE_ADDR_MXIC_PROTECTION=0
> [ 0.610548] macronix_nand_block_protection_support: !=
> MXIC_BLOCK_PROTECTION_ALL_LOCK
> [ 0.624760] Bad block table not found for chip 0
> [ 0.635542] Bad block table not found for chip 0
> [ 0.640270] Scanning device for bad blocks
>
> I don't know how to tell if get_features / set_features is really supported...
Looks like your driver does not support exec_op but the core provides a
get/set_feature implementation.
>
> > - what is the state of the locking configuration in the chip when you
> > boot?
>
> Unlocked, I guess...
> How can I check that?
It's in your dump, the chip returns 0, meaning it's all unlocked,
apparently.
> > - is there anything that locks the device by calling mxic_nand_lock() ?
So nobody locks the device I guess? Did you add traces there?
> > - finding no bbt is one thing, hanging is another, where is it hanging
> > exactly? (offset in nand/ and line in the code)
>
> I've got no idea...
You can use ftrace or just add printks a bit everywhere and try to get
closer and closer.
I looked at the patch, I don't see anything strange. Besides, I have a
close enough datasheet and I don't see what could confuse the device.
Are you really sure this patch is the problem? Is the WP pin wired on
your design?
Thanks,
Miquèl
next prev parent reply other threads:[~2023-03-24 13:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 12:45 [PATCH 0/2] mtd: nand: raw: macronix: allow disabling block protection Álvaro Fernández Rojas
2023-03-23 12:45 ` [PATCH 1/2] dt-bindings: mtd: nand: Macronix: document new binding Álvaro Fernández Rojas
2023-03-24 9:40 ` Miquel Raynal
2023-03-24 10:31 ` Álvaro Fernández Rojas
2023-03-24 10:49 ` Miquel Raynal
2023-03-24 11:21 ` Álvaro Fernández Rojas
2023-03-24 13:45 ` Miquel Raynal [this message]
2023-03-24 14:15 ` Álvaro Fernández Rojas
2023-03-24 14:36 ` Miquel Raynal
2023-03-24 17:04 ` Álvaro Fernández Rojas
2023-03-27 8:21 ` Miquel Raynal
2023-04-22 9:28 ` Álvaro Fernández Rojas
2023-03-23 12:45 ` [PATCH 2/2] mtd: nand: raw: macronix: allow disabling block protection Álvaro Fernández Rojas
2023-03-23 12:47 ` Tudor Ambarus
2023-03-23 12:55 ` Álvaro Fernández Rojas
[not found] <CAAQoYRm3766SG7+VuwVzu_xH8aWihoKWMEp8xQGNgJ6oOtC9+g@mail.gmail.com>
2023-04-26 7:24 ` [PATCH 1/2] dt-bindings: mtd: nand: Macronix: document new binding liao jaime
2023-05-16 18:55 ` Álvaro Fernández Rojas
2023-05-16 18:58 ` Florian Fainelli
2023-05-16 19:02 ` Álvaro Fernández Rojas
2023-05-17 5:30 ` William Zhang
2023-05-17 15:20 ` Álvaro Fernández Rojas
2023-05-22 8:15 ` Miquel Raynal
2023-05-22 9:21 ` liao jaime
2023-05-23 0:59 ` William Zhang
2023-05-24 5:30 ` liao jaime
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=20230324144559.3473c537@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=masonccyang@mxic.com.tw \
--cc=noltari@gmail.com \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=vigneshr@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox