diff options
author | Pali Rohár <pali@kernel.org> | 2022-08-01 23:58:42 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2022-08-09 08:57:23 +0200 |
commit | 7cd67018dd7f754c66cf08a76397bbee254b32aa (patch) | |
tree | 2830c2a05a5f9d808620aaf740bb07b65c4943e7 /board/CZ.NIC/turris_omnia | |
parent | c959374e841de4c9d2317ff3f110f03574e7db79 (diff) | |
download | u-boot-7cd67018dd7f754c66cf08a76397bbee254b32aa.tar.gz u-boot-7cd67018dd7f754c66cf08a76397bbee254b32aa.tar.bz2 u-boot-7cd67018dd7f754c66cf08a76397bbee254b32aa.zip |
arm: mvebu: turris_omnia: Remove hardcoded spi-nor device tree path
Linux kernel DTS files renamed spi-nor@0 node to flash@0 which effectively
broke U-Boot to boot new Linux kernel versions correctly.
So remove hardcoded spi-nor device tree path from Turris Omnia board code
and replace it by searching for mtd node by compatible string.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board/CZ.NIC/turris_omnia')
-rw-r--r-- | board/CZ.NIC/turris_omnia/turris_omnia.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 98bad11537..5ddd873d02 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -32,8 +32,6 @@ DECLARE_GLOBAL_DATA_PTR; -#define OMNIA_SPI_NOR_PATH "/soc/spi@10600/spi-nor@0" - #define OMNIA_I2C_BUS_NAME "i2c@11000->i2cmux@70->i2c@0" #define OMNIA_I2C_MCU_CHIP_ADDR 0x2a @@ -1030,14 +1028,22 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd) static void fixup_spi_nor_partitions(void *blob) { - struct mtd_info *mtd; + struct mtd_info *mtd = NULL; + char mtd_path[64]; int node; - mtd = get_mtd_device_nm(OMNIA_SPI_NOR_PATH); + node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "jedec,spi-nor"); + if (node < 0) + goto fail; + + if (fdt_get_path(gd->fdt_blob, node, mtd_path, sizeof(mtd_path)) < 0) + goto fail; + + mtd = get_mtd_device_nm(mtd_path); if (IS_ERR_OR_NULL(mtd)) goto fail; - node = fdt_path_offset(blob, OMNIA_SPI_NOR_PATH); + node = fdt_node_offset_by_compatible(blob, -1, "jedec,spi-nor"); if (node < 0) goto fail; |