Hi Marek,
marex@denx.de wrote on Fri, 2 Dec 2022 17:17:59 +0100:
On 12/2/22 16:49, Miquel Raynal wrote:
Hi Marek,
Hi,
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:
To prevent future breakages: Fix fdt_fixup_mtdparts() in u-boot. This way newer U-Boot + any kernel should work.
To help tracking down situations like that: Keep the warning in ofpart.c but continue to fail.
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.
- This is the original, old, wrong binding:
&gpmi { #size-cells = <1>; ... partition@N { ... }; };
Yes.
- 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).
- This is the newest binding, what we want:
&gpmi { #size-cells = <0>; ... nand-chip { partitions { partition@N { ... }; }; }; };
Yes
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?
I don't know, maybe it is not.
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...
Sure.
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/Documenta...
OK, I see your point. So basically this?
&gpmi { #size-cells = <1>; ... nand-chip@0 { reg = <0>; }; };
btw. the GPMI NAND controller supports only one chipselect, so the reg in nand-chip node makes little sense.
I randomly opened a reference manual (IMX6DQL.pdf), they say:
"Up to four NAND devices, supported by four chip-selects and one ganged ready/ busy."
Anyway, the NAND controller generic bindings which require this reg property, what the controller or the driver actually supports, or even how it is used on current designs is not relevant here.
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/Documenta...
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
I think this is another miscommunication here. The commit
753395ea1e45 ("ARM: dts: imx7: Fix NAND controller size-cells")
modifies the size-cells of the NAND controller. The nand-chip is not involved in this at all . In the examples above, it's the "&gpmi" node size-cells that is modified.
Yes I know. I was referring to this commit, sorry: 36fee2f7621e ("common: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()")
The log says:
Listing MTD partitions directly in the flash mode has been deprecated for a while for kernel Device Trees. Look for a node "partitions" in the found flash nodes and use it instead of the flash node itself for the partition list when it exists, so Device Trees following the current best practices can be fixed up.
Which (I hope) means U-boot will equivalently try to play with the partitions container, either in the controller node or in the chip node.
, 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.
My understanding is that U-Boot checks the nand-controller node size-cells, not the nand-chip{} or partitions{} subnode size-cells .
I don't think U-Boot cares.
Francesco, can you please share the DT, including the U-Boot generated partitions, which is passed to Linux on Colibri MX7 ? I think that should make all confusion go away.
Please also do it with the NAND chip described. If, when the NAND chip is described U-Boot tries to create partitions in the controller node, then the situation is even worse than I thought. But I believe describing the node like a suggest in the DT should prevent the boot failure while still allowing a rather good description of the hardware.
BTW I still think the relevant action right now is to revert the DT patch.
Thanks, Miquèl