When CONFIG_FDT_FIXUP_PARTITIONS is enabled, update NAND partition subnodes in the FDT from the mtdparts environment before booting Linux.
Add the Allwinner NAND controller compatibles supported by the U-Boot sunxi NAND driver. Gate the fixup by CONFIG_NAND_SUNXI so it is only used when the sunxi NAND driver is enabled. Signed-off-by: James Hilliard <[email protected]> --- board/sunxi/board.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 3d1afec7c66..ef7139be310 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -19,6 +19,8 @@ #include <init.h> #include <log.h> #include <mmc.h> +#include <mtd.h> +#include <mtd_node.h> #include <axp_pmic.h> #include <generic-phy.h> #include <phy-sun4i-usb.h> @@ -932,6 +934,16 @@ int ft_board_setup(void *blob, struct bd_info *bd) { int __maybe_unused r; + static const struct node_info sunxi_nand_nodes[] = { + { "allwinner,sun4i-a10-nand", MTD_DEV_TYPE_NAND, }, + { "allwinner,sun50i-h616-nand-controller", MTD_DEV_TYPE_NAND, }, + }; + + if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && + IS_ENABLED(CONFIG_NAND_SUNXI)) + fdt_fixup_mtdparts(blob, sunxi_nand_nodes, + ARRAY_SIZE(sunxi_nand_nodes)); + /* * Call setup_environment and fdt_fixup_ethernet again * in case the boot fdt has ethernet aliases the u-boot -- 2.53.0

