public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Arseniy Krasnov <AVKrasnov@sberdevices.ru>,
	Liang Yang <liang.yang@amlogic.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Jianxin Pan <jianxin.pan@amlogic.com>,
	Yixun Lan <yixun.lan@amlogic.com>,
	oxffffaa@gmail.com, kernel@sberdevices.ru,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/6] mtd: rawnand: meson: rename node for chip select
Date: Wed, 10 May 2023 22:53:59 +0200	[thread overview]
Message-ID: <20230510225359.061c2df6@xps-13> (raw)
In-Reply-To: <CAFBinCAbTuNGEG13f71F8vhN3yGce+kkYJ7PHMpZbh8DzSapJg@mail.gmail.com>

Hi Martin & Arseniy,

martin.blumenstingl@googlemail.com wrote on Wed, 10 May 2023 22:40:37
+0200:

> Hello Arseniy,
> 
> On Wed, May 10, 2023 at 1:13 PM Arseniy Krasnov
> <AVKrasnov@sberdevices.ru> wrote:
> >
> > This renames node with values for chip select from "reg" to "cs". It is
> > needed because when OTP access is enabled on the attached storage, MTD
> > subsystem registers this storage in the NVMEM subsystem. NVMEM in turn
> > tries to use "reg" node in its own manner, supposes that it has another
> > layout. All of this leads to device initialization failure.  
> In general: if we change the device-tree interface (in this case:
> replacing a "reg" with a "cs" property) the dt-bindings have to be
> updated as well.

True, and I would add, bindings should not be broken.

> Documentation/devicetree/bindings/mtd/nand-controller.yaml and
> Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml show
> that the chip select of a NAND chip is specified with a "reg"
> property.

All NAND controller binding expect the chip-select to be in the
'reg' property, very much like a spi device would use reg to store the
cs as well: the reg property tells you how you address the device.

I also fully agree with Martin's comments below. Changing reg is likely
a wrong approach :)

> Also the code has to be backwards compatible with old .dtbs.
> 
> > Example:
> >
> > [...] nvmem mtd0-user-otp: nvmem: invalid reg on /soc/bus@ffe00000/...
> > [...] mtd mtd0: Failed to register OTP NVMEM device
> > [...] meson-nand ffe07800.nfc: failed to register MTD device: -22
> > [...] meson-nand ffe07800.nfc: failed to init NAND chips
> > [...] meson-nand: probe of ffe07800.nfc failed with error -22  
> This is odd - can you please share your definition of the &nfc node?
> 
> &nfc {
>       nand_chip0: nand@0 {
>         reg = <0>;
>       };
> };
> 
> This should result in nand_set_flash_node() being called with
> &nand_chip0 (if it's called with &nfc then something is buggy in our
> driver).
> If there's no child nodes within &nand_chip0 then why would the
> MTD-to-NVMEM code think that it has to parse something?
> If you do have child nodes and those are partitions, then make sure
> that the structure is correct (see the extra "partitions" node inside
> which all partitions are nested):
> &nand_chip0 {
>     partitions {
>         compatible = "fixed-partitions";
>         #address-cells = <1>;
>         #size-cells = <1>;
> 
>         partition@0 {
>             label = "u-boot";
>             reg = <0x0000000 0x4000>;
>             read-only;
>         };
>     };
> };
> 
> 
> Best regards,,
> Martin


Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2023-05-10 20:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10 11:08 [PATCH v3 0/6] refactoring and fix for Meson NAND Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 1/6] mtd: rawnand: meson: fix command sequence for read/write Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 2/6] mtd: rawnand: meson: move OOB to non-protected ECC area Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 3/6] mtd: rawnand: meson: always read whole OOB bytes Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 4/6] mtd: rawnand: meson: check buffer length Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 5/6] mtd: rawnand: meson: remove unneeded bitwise OR with zeroes Arseniy Krasnov
2023-05-10 11:08 ` [PATCH v3 6/6] mtd: rawnand: meson: rename node for chip select Arseniy Krasnov
2023-05-10 20:40   ` Martin Blumenstingl
2023-05-10 20:53     ` Miquel Raynal [this message]
2023-05-11  8:59       ` Arseniy Krasnov
2023-05-11  9:12         ` Miquel Raynal
2023-05-11  9:17           ` Arseniy Krasnov
2023-05-11 10:16             ` Arseniy Krasnov
2023-05-11 12:11               ` Miquel Raynal
2023-05-11 14:22                 ` Arseniy Krasnov
2023-05-12 14:49                   ` Miquel Raynal
2023-05-13 13:22                     ` Arseniy Krasnov

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=20230510225359.061c2df6@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=AVKrasnov@sberdevices.ru \
    --cc=jbrunet@baylibre.com \
    --cc=jianxin.pan@amlogic.com \
    --cc=kernel@sberdevices.ru \
    --cc=khilman@baylibre.com \
    --cc=liang.yang@amlogic.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=oxffffaa@gmail.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yixun.lan@amlogic.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