[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6njdeo8kHw6RtYH@probook>
Date: Mon, 10 Feb 2025 11:31:01 +0000
From: J. Neuschäfer <j.ne@...teo.net>
To: Crystal Wood <oss@...error.net>
Cc: j.ne@...teo.net, devicetree@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
Krzysztof Kozlowski <krzk@...nel.org>, imx@...ts.linux.dev,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Damien Le Moal <dlemoal@...nel.org>,
Niklas Cassel <cassel@...nel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>, Lee Jones <lee@...nel.org>,
Vinod Koul <vkoul@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
J. Neuschäfer <j.neuschaefer@....net>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>, Mark Brown <broonie@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>, linux-kernel@...r.kernel.org,
linux-ide@...r.kernel.org, linux-crypto@...r.kernel.org,
dmaengine@...r.kernel.org, linux-pci@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-spi@...r.kernel.org,
linux-mtd@...ts.infradead.org, Li Yang <leoyang.li@....com>,
John Ogness <john.ogness@...utronix.de>
Subject: Re: [PATCH v2 09/12] dt-bindings: memory-controllers: Convert
fsl,elbc to YAML
On Sun, Feb 09, 2025 at 02:31:34PM -0600, Crystal Wood wrote:
> On Fri, Feb 07, 2025 at 10:30:26PM +0100, J. Neuschäfer via B4 Relay wrote:
> > From: "J. Neuschäfer" <j.ne@...teo.net>
> >
> > Convert the Freescale localbus controller bindings from text form to
> > YAML. The updated list of compatible strings reflects current usage
> > in arch/powerpc/boot/dts/, except that many existing device trees
> > erroneously specify "simple-bus" in addition to fsl,*elbc.
> >
> > Changes compared to the txt version:
> > - removed the board-control (fsl,mpc8272ads-bcsr) node because it only
> > appears in this example and nowhere else
> > - added a new example with NAND flash
> > - updated list of compatible strings
> >
> > Signed-off-by: J. Neuschäfer <j.ne@...teo.net>
> > ---
> >
> > V2:
> > - fix order of properties in examples, according to dts coding style
> > - move to Documentation/devicetree/bindings/memory-controllers
> > - clarify the commit message a tiny bit
> > - remove unnecessary multiline markers (|)
> > - define address format in patternProperties
> > - trim subject line (remove "binding")
> > - remove use of "simple-bus", because it's technically incorrect
>
> While I admit I haven't been following recent developments in this area,
> as someone who was involved when "simple-bus" was created (and was on the
> ePAPR committee that standardized it) I'm surprised to hear simple-bus
> being called "erroneous" or "technically incorrect" here.
It is quite possible that my understanding of it is incomplete or wrong.
>
> For non-NAND devices this bus generally meets the definition of "an
> internal I/O bus that cannot be probed for devices" where "devices on the
> bus can be accessed directly without additional configuration
> required". NAND flash is an exception, but those devices have
> compatibles that are specific to the bus controller.
>
> The fact that the address encoding is non-linear is irrelevant; the
> addresses can still be translated using the standard "ranges" mechanism.
> This seems to be a disconnect between the schema verification and the way
> the compatible has previously been defined and used.
This is what led me to my assumptions: The simple-bus validation logic
in dtc complains about unit addresses such as nand@1,0 which are quite
appropriate for the eLBC.
>
> And as a practical matter, unless I'm missing something (which I might be
> since I haven't been in devicetree-land for nearly a decade), Linux is
> relying on simple-bus to probe these devices. There is a driver that
> binds to the bus itself but that is just for error interrupts and NAND.
As of now, yes, that's correct. Without simple-bus, a current Linux
kernel doesn't find the device nodes inside such a localbus.
>
> You'd probably need something like commit 3e25f800afb82bd9e5f8 ("memory:
> fsl_ifc: populate child devices without relying on simple-bus") and the
> subsequent fix in dd8adc713b1656 ("memory: fsl_ifc: populate child
> nodes of buses and mfd devices")...
I have prepared such a patch, based on the same assumptions:
[PATCH] powerpc/fsl_lbc: Explicitly populate bus
https://lore.kernel.org/lkml/20250209-localbus-v1-1-efcd780153a0@posteo.net/
>
> I'm curious what the reasoning was for removing simple-bus from IFC. It
> seems that the schema verification also played a role in that:
> https://www.spinics.net/lists/devicetree/msg220418.html
Yes, that's the same as my reasoning.
>
> ...but there's also the comment in 985ede63a045eabf3f9d ("dt-bindings:
> memory: fsl: convert ifc binding to yaml schema") that "this will help to
> enforce the correct probe order between parent device and child devices",
> but was that really not already guaranteed by the parent/child
> relationship (and again, it should only really matter for NAND except for
> the possibility of missing error reports during early boot)?
I'm inclined to agree with you, but it's somewhat beyond my skill level.
I'll let Li Yang or Rob Herring comment on that.
>
> > + compatible:
> > + oneOf:
> > + - items:
> > + - enum:
> > + - fsl,mpc8313-elbc
> > + - fsl,mpc8315-elbc
> > + - fsl,mpc8377-elbc
> > + - fsl,mpc8378-elbc
> > + - fsl,mpc8379-elbc
> > + - fsl,mpc8536-elbc
> > + - fsl,mpc8569-elbc
> > + - fsl,mpc8572-elbc
> > + - fsl,p1020-elbc
> > + - fsl,p1021-elbc
> > + - fsl,p1023-elbc
> > + - fsl,p2020-elbc
> > + - fsl,p2041-elbc
> > + - fsl,p3041-elbc
> > + - fsl,p4080-elbc
> > + - fsl,p5020-elbc
> > + - fsl,p5040-elbc
> > + - const: fsl,elbc
>
> Is it really necessary to list every single chip?
>
> And then it would need to be updated when new ones came out? I know this
> particular line of chips is not going to see any new members at this
> point, but as far as the general approach goes...
As far as I'm aware, this reflects common practice today.
>
> Does the schema validation complain if it sees an extra compatible it
> doesn't recognize? If so that's obnoxious.
Yes.
>
> > +examples:
> > + - |
> > + localbus@...10100 {
> > + compatible = "fsl,mpc8272-localbus",
> > + "fsl,pq2-localbus";
> > + reg = <0xf0010100 0x40>;
> > + ranges = <0x0 0x0 0xfe000000 0x02000000
> > + 0x1 0x0 0xf4500000 0x00008000
> > + 0x2 0x0 0xfd810000 0x00010000>;
> > + #address-cells = <2>;
> > + #size-cells = <1>;
> > +
> > + flash@0,0 {
> > + compatible = "jedec-flash";
> > + reg = <0x0 0x0 0x2000000>;
> > + bank-width = <4>;
> > + device-width = <1>;
> > + };
> > +
> > + simple-periph@2,0 {
> > + compatible = "fsl,elbc-gpcm-uio";
> > + reg = <0x2 0x0 0x10000>;
> > + elbc-gpcm-br = <0xfd810800>;
> > + elbc-gpcm-or = <0xffff09f7>;
> > + };
>
> I know this isn't new, but... since we're using this as an example,
> where is the documentation for this fsl,elbc-gpcm-uio and
> elbc-gpcm-br/or? What exactly is a simple-periph?
fsl,elbc-gpcm-uio is handled in the following patch
(dt-bindings: memory-controllers: Add fsl,elbc-gpcm-uio).
simple-periph is something I haven't thought about, because this whole
example comes from the old txt-format binding. The whole purpose of
fsl,elbc-gpcm-uio is to allow userspace drivers to interact with
localbus devices, so that doesn't make the intention any clearer, either.
>
> There are no in-tree device trees that use this either. The bcsr
> node was actually a much more normal example, despite that particular
> platform having been removed. There are other bcsr nodes that still
> exist that could be used instead.
Ah, fsl,mpc8568mds-bcsr for example, good point. I'll add it back.
>
> -Crystal
Thank you for reaching out!
Best regards,
J. Neuschäfer
Powered by blists - more mailing lists