From: Fabio Estevam <[email protected]> Make spl-boot-order accept booting from SPI NAND as well.
With this change, it is possible to specify spi_nand as the boot medium like this: u-boot,spl-boot-order = &spi_nand; Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Simon Glass <[email protected]> --- Changes in v3: - Guard the spi-nand checks with SPI_NAND_LOAD so that boards without SPI NAND support do not grow in size arch/arm/mach-rockchip/spl-boot-order.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c index d2dd5e10935..3942dfe6f5c 100644 --- a/arch/arm/mach-rockchip/spl-boot-order.c +++ b/arch/arm/mach-rockchip/spl-boot-order.c @@ -4,6 +4,7 @@ */ #include <dm.h> +#include <dm/device_compat.h> #include <fdt_support.h> #include <log.h> #include <mmc.h> @@ -75,6 +76,9 @@ static int spl_node_to_boot_device(int node) */ if (!uclass_find_device_by_of_offset(UCLASS_SPI_FLASH, node, &parent)) return BOOT_DEVICE_SPI; + if (CONFIG_IS_ENABLED(SPI_NAND_LOAD) && + !fdt_node_check_compatible(gd->fdt_blob, node, "spi-nand")) + return BOOT_DEVICE_SPI; if (!uclass_find_device_by_of_offset(UCLASS_UFS, node, &parent)) return BOOT_DEVICE_UFS; @@ -223,8 +227,14 @@ int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen) } ret = uclass_find_device_by_of_offset(UCLASS_SPI_FLASH, node, &dev); + if (ret && CONFIG_IS_ENABLED(SPI_NAND_LOAD)) { + ret = uclass_find_device_by_of_offset(UCLASS_MTD, node, &dev); + if (!ret && !device_is_compatible(dev, "spi-nand")) + ret = -ENODEV; + } if (ret) { - debug("%s: could not find udevice for %s\n", __func__, conf); + debug("%s: could not find udevice for %s\n", + __func__, conf); continue; } -- 2.43.0

