[PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0

Francesco Dolcini francesco at dolcini.it
Fri Dec 2 08:45:37 PST 2022


On Fri, Dec 02, 2022 at 05:17:59PM +0100, Marek Vasut wrote:
> On 12/2/22 16:49, Miquel Raynal wrote:
> > , 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 .
Not 100% correct.

 - U-Boot before v2022.04 updates the nand-controller{} node, no matter what.
 - U-Boot starting from v2022.04 looks for `partitions{}` into the
   nand-controller{} node, and creates the partition into it if found.
   If not found it behaves the same way as the previous versions.
   See commit 36fee2f7621e ("common: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()")

I'd like to stress once more the fact that we cannot expect old U-Boot
to be updated in the field, and they will keep generating the partitions
as child of the nand-controller node whatever we do with the dts file.

I think that this should be treated the same way as any other fixup we
might have for broken firmware, especially considering that this used to
"work" (yes, I can agree that it horrible, but I cannot change the past)
without even a warning since the imx7 support was first introduced in
the linux kernel years ago.

> 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.

The device tree part is easy, just
arch/arm/boot/dts/imx7d-colibri-eval-v3.dts.

and the nand-controller node is coming from

#include "imx7d.dtsi"

plus

&gpmi {
	fsl,use-minimum-ecc;
	nand-ecc-mode = "hw";
	nand-on-flash-bbt;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpmi_nand>;
};

The partitions nodes are generated 100% by U-Boot, nothing is present in
the dts source files.

With this DTS file as input, whatever U-Boot version is used I have the
following generated:

root at colibri-imx7-02844233:/# ls /proc/device-tree/soc/nand-controller at 33002000/
#address-cells          dma-names               nand-on-flash-bbt       pinctrl-0
#size-cells             dmas                    partition at 0             pinctrl-names
assigned-clock-parents  fsl,use-minimum-ecc     partition at 200000        reg
assigned-clocks         interrupt-names         partition at 380000        reg-names
clock-names             interrupts              partition at 400000        status
clocks                  name                    partition at 80000
compatible              nand-ecc-mode           phandle

root at colibri-imx7-02844233:/# ls /proc/device-tree/soc/nand-controller at 33002000/partition@*
/proc/device-tree/soc/nand-controller at 33002000/partition at 0:
label  name   reg

/proc/device-tree/soc/nand-controller at 33002000/partition at 200000:
label      name       read_only  reg

/proc/device-tree/soc/nand-controller at 33002000/partition at 380000:
label  name   reg

/proc/device-tree/soc/nand-controller at 33002000/partition at 400000:
label  name   reg

/proc/device-tree/soc/nand-controller at 33002000/partition at 80000:
label      name       read_only  reg





More information about the linux-mtd mailing list