From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Marek Vasut <marex@denx.de>
Cc: Francesco Dolcini <francesco@dolcini.it>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org,
Francesco Dolcini <francesco.dolcini@toradex.com>,
Shawn Guo <shawnguo@kernel.org>,
linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org,
u-boot@lists.denx.de
Subject: Re: [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0
Date: Fri, 2 Dec 2022 17:01:07 +0100 [thread overview]
Message-ID: <20221202170107.4733efbc@xps-13> (raw)
In-Reply-To: <20221202164904.08d750df@xps-13>
miquel.raynal@bootlin.com wrote on Fri, 2 Dec 2022 16:49:04 +0100:
> Hi Marek,
>
> marex@denx.de wrote on Fri, 2 Dec 2022 16:23:29 +0100:
>
> > On 12/2/22 16:00, Miquel Raynal wrote:
> > > Hi Marek,
> >
> > Hi,
> >
> > > marex@denx.de wrote on Fri, 2 Dec 2022 15:31:40 +0100:
> > >
> > >> On 12/2/22 15:05, Miquel Raynal wrote:
> > >>> Hi Francesco,
> > >>
> > >> Hi,
> > >>
> > >> [...]
> > >>
> > >>> I still strongly disagree with the initial proposal but what I think we
> > >>> can do is:
> > >>>
> > >>> 1. To prevent future breakages:
> > >>> Fix fdt_fixup_mtdparts() in u-boot. This way newer U-Boot + any
> > >>> kernel should work.
> > >>>
> > >>> 2. To help tracking down situations like that:
> > >>> Keep the warning in ofpart.c but continue to fail.
> > >>>
> > >>> 3. To fix the current situation:
> > >>> Immediately revert commit (and prevent it from being backported):
> > >>> 753395ea1e45 ("ARM: dts: imx7: Fix NAND controller size-cells")
> > >>> This way your own boot flow is fixed in the short term.
> > >>
> > >> Here I disagree, the fix is correct and I think we shouldn't
> > >> proliferate incorrect DTs which don't match the binding document.
> > >
> > > I agree we should not proliferate incorrect DTs, so let's use a modern
> > > description then
> >
> > Yes please !
> >
> > > , with a controller and a child node which defines the
> > > chip.
> >
> > But what if there is no chip connected to the controller node ?
> >
> > If I understand the proposal here right (please correct me if I'm wrong), then:
>
> Good idea to summarize.
>
> >
> > 1) This is the original, old, wrong binding:
> > &gpmi {
> > #size-cells = <1>;
> > ...
> > partition@N { ... };
> > };
>
> Yes.
>
> >
> >
> > 2) This is the newer, but still wrong binding:
> > &gpmi {
> > #size-cells = <0>;
> > ...
> > partitions {
> > partition@N { ... };
> > };
> > };
>
> Well, this is wrong description, but it would work (for compat reasons,
> even though I don't think this is considered valid DT by the schemas).
>
> >
> > 3) This is the newest binding, what we want:
> > &gpmi {
> > #size-cells = <0>;
> > ...
> > nand-chip {
> > partitions {
> > partition@N { ... };
> > };
> > };
> > };
>
> Yes
Perhaps I should also mention that #size-cells expected to be 0 has
nothing to do with the "partitions" container (otherwise #address-cells
would be 0 as well). This value is however asking for an address-only
reg property describing which NAND chip should be addressed and how,
basically the NAND controller CS because you can wire your NAND to
any CS.
> > But if there is no physical nand chip connected to the controller, would we end up with empty nand-chip node in DT, like this?
> > &gpmi {
> > #size-cells = <X>;
> > ...
> > nand-chip { /* empty */ };
> > };
>
> Is this really a concern? If there is no NAND chip, the controller
> should be disabled, no? I guess technically you could even use the
> status property in the nand-chip node...
>
> However, it should not be empty, at the very least a reg property
> should indicate on which CS it is wired, as expected there:
> https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/tree/Documentation/devicetree/bindings/mtd/nand-chip.yaml?h=mtd/next
>
> But, as nand-chip.yaml references mtd.yaml, you can as well use
> whatever is described here:
> https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/tree/Documentation/devicetree/bindings/mtd/mtd.yaml?h=mtd/next
>
> > What would be the gpmi controller size cells (X) in that case, still 0, right ? So how does that help solve this problem, wouldn't U-Boot still populate the partitions directly under the gpmi node or into partitions sub-node ?
>
> The commit that was pointed in the original fix clearly stated that the
> NAND chip node was targeted, not the NAND controller node. I hope this
> is correctly supported in U-Boot though. So if there is a NAND chip
> subnode, I suppose U-Boot would try to create the partitions that are
> inside, or even in the sub "partitions" container.
>
> > >> Rather, if a bootloader generates incorrect (new) DT entries, I
> > >> believe the driver should implement a fixup and warn user about this.
> > >> PC does that as well with broken ACPI tables as far as I can tell.
> > >>
> > >> I'm not convinced making a DT non-compliant with bindings again,
> > >
> > > I am sorry to say so, but while warnings reported by the tools
> > > should be fixed, it's not because the tool does not scream at you that
> > > the description is valid. We are actively working on enhancing the
> > > schema so that "all" improper descriptions get warnings (see the series
> > > pointed earlier), but in no way this change makes the node compliant
> > > with modern bindings.
> > >
> > > I'm not saying the fix is wrong, but let's be pragmatic, it currently
> > > leads to boot failures.
> >
> > I fully agree that we do have a problem, and that it trickled into stable makes it even worse. Maybe I don't fully understand the thing with nand-chip proposal, see my question above, esp. the last part.
> >
> > >> only to work around a problem induced by bootloader, is the right approach
> > >> here.
> > >
> > > When a patch breaks a board and there is no straight fix, you revert
> > > it, then you think harder. That's what I am saying. This is a temporary
> > > solution.
> >
> > Isn't this patch the straight fix, at least until the bootloader can be updated to generate the nand-chip node correctly ?
> >
> > >> This would be setting a dangerous example, where anyone could request a DT fix to be reverted because their random bootloader does the wrong thing and with valid DT clean up, something broke.
> > >
> > > Please, you know this is not valid DT clean up. We've been decoupling
> > > controller and chip description since 2016. What I am proposing is a
> > > valid DT cleanup, not to the latest standard, but way closer than the
> > > current solution.
> >
> > I think I really need one more explanation of the nand-chip part above.
>
> I hope things are clearer now.
>
> Thanks,
> Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-12-02 16:05 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 7:19 [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0 Francesco Dolcini
2022-12-02 9:14 ` Miquel Raynal
2022-12-02 10:12 ` Francesco Dolcini
2022-12-02 10:24 ` Francesco Dolcini
2022-12-02 10:53 ` Miquel Raynal
2022-12-02 11:23 ` Francesco Dolcini
2022-12-02 14:05 ` Miquel Raynal
2022-12-02 14:31 ` Marek Vasut
2022-12-02 15:00 ` Miquel Raynal
2022-12-02 15:23 ` Marek Vasut
2022-12-02 15:49 ` Miquel Raynal
2022-12-02 16:01 ` Miquel Raynal [this message]
2022-12-02 16:17 ` Marek Vasut
2022-12-02 16:42 ` Miquel Raynal
2022-12-02 16:52 ` Marek Vasut
2022-12-02 16:57 ` Miquel Raynal
2022-12-02 17:08 ` Marek Vasut
2022-12-05 11:26 ` Francesco Dolcini
2022-12-05 13:49 ` Miquel Raynal
2022-12-05 16:25 ` Marek Vasut
2022-12-15 7:16 ` Miquel Raynal
2022-12-15 7:45 ` Marek Vasut
2022-12-15 8:04 ` Miquel Raynal
2022-12-16 0:36 ` Marek Vasut
2022-12-16 7:52 ` Francesco Dolcini
2022-12-16 7:45 ` Francesco Dolcini
2022-12-16 10:46 ` Marek Vasut
2022-12-16 11:01 ` Miquel Raynal
2022-12-16 12:37 ` Francesco Dolcini
2022-12-16 13:37 ` Miquel Raynal
2022-12-16 14:32 ` Marek Vasut
2022-12-16 15:35 ` Miquel Raynal
2022-12-16 16:30 ` Francesco Dolcini
2023-01-02 9:40 ` Miquel Raynal
2023-01-05 11:33 ` Miquel Raynal
2023-01-05 12:47 ` Francesco Dolcini
2023-01-05 14:51 ` Marek Vasut
2023-01-05 15:03 ` Miquel Raynal
2022-12-02 17:20 ` Francesco Dolcini
2022-12-05 11:30 ` Francesco Dolcini
2022-12-05 15:28 ` Miquel Raynal
2022-12-02 16:45 ` Francesco Dolcini
2022-12-02 17:05 ` Miquel Raynal
2022-12-02 15:56 ` Thorsten Leemhuis
2022-12-04 12:50 ` Marek Vasut
2022-12-04 12:59 ` Thorsten Leemhuis
2022-12-04 15:50 ` Marek Vasut
2022-12-02 12:43 ` Greg KH
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=20221202170107.4733efbc@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=francesco.dolcini@toradex.com \
--cc=francesco@dolcini.it \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
--cc=richard@nod.at \
--cc=shawnguo@kernel.org \
--cc=stable@vger.kernel.org \
--cc=u-boot@lists.denx.de \
--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;
as well as URLs for NNTP newsgroup(s).