On Mon, Feb 06, 2023 at 11:48:36PM +0100, Francesco Dolcini wrote: > From: Francesco Dolcini > > Fixup #size-cells value when updating the MTD partitions, this is > required to prevent issues in case the MTD parent set #size-cells to > zero. > This could happen for example in the legacy case in which the partitions > are created as direct child of the mtd node and that specific node has > no children. Recent clean-up on Linux device tree files created a boot > regression on colibri-imx7 [0]. > > This fixup has the limitation to assume 32-bit (#size-cells=1) > addressing, therefore it will not work with device bigger than 4GiB. > > This change also enforce #address-cells to be the same as #size-cells, > this was already silently enforced by fdt_node_set_part_info(), now this > is checked explicitly and partition fixup will just fail in such case. > > When the partition list is static the preferred way to pass the mtd > partition list to the kernel is to either define those in the source DTS > file or use mtdparts= in the command line. > Tweaking the DT from U-Boot should be avoided, unless some dynamic > changes are required, since it proved to be problematic when not > following the evolution of the "standard". > > Link: https://lore.kernel.org/all/Y4dgBTGNWpM6SQXI@francesco-nb.int.toradex.com/ > Link: https://lore.kernel.org/all/20221202071900.1143950-1-francesco@dolcini.it/ > Cc: Marek Vasut > Cc: Miquel Raynal > Signed-off-by: Francesco Dolcini > --- > v2: improved commit message > --- > common/fdt_support.c | 45 ++++++++++++++++++++++++++++++++++---------- > 1 file changed, 35 insertions(+), 10 deletions(-) I'm dropping the linux-mtd list here and adding a bunch more platform maintainers. In general, calling fdt_fixup_mtdparts is the wrong choice. I see we do have a few cases in U-Boot where we're clearly doing something dynamic to the partition table, but it looks like at first glance most callers are using this hook when they should either be having the partition map in the device tree properly (and using one of the appropriate bindings) or passing the map in via the kernel command line. I would like to ask everyone I've added to the list here to please audit your platform and update it as needed. Thanks! -- Tom