diff options
author | Simon Glass <sjg@chromium.org> | 2016-01-21 19:43:54 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-01-21 20:42:35 -0700 |
commit | d178a1c5b2b3d47a6380b7990a8a3f44b1cafe24 (patch) | |
tree | 9456fc37aca1f48be78aee37bd140b0efe9563ab | |
parent | 4082fce92498a64e5e543ad53a1ed5a5c02a64d1 (diff) | |
download | u-boot-d178a1c5b2b3d47a6380b7990a8a3f44b1cafe24.tar.gz u-boot-d178a1c5b2b3d47a6380b7990a8a3f44b1cafe24.tar.xz u-boot-d178a1c5b2b3d47a6380b7990a8a3f44b1cafe24.zip |
spi: Correct device tree usage in spi_flash_decode_fdt()
This function currently searches the entire device tree for a node that
it thinks is relevant. But the node is known and is passed in. Correct the
code and enable it only with driver model, since only driver-model boards
will use it.
This avoids bringing in a large number of strings from fdtdec.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/mtd/spi/spi_flash.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index a567414669..8a60c72926 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -939,14 +939,10 @@ static int set_quad_mode(struct spi_flash *flash, u8 idcode0) #if CONFIG_IS_ENABLED(OF_CONTROL) int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) { +#ifdef CONFIG_DM_SPI_FLASH fdt_addr_t addr; fdt_size_t size; - int node; - - /* If there is no node, do nothing */ - node = fdtdec_next_compatible(blob, 0, COMPAT_GENERIC_SPI_FLASH); - if (node < 0) - return 0; + int node = flash->dev->of_offset; addr = fdtdec_get_addr_size(blob, node, "memory-map", &size); if (addr == FDT_ADDR_T_NONE) { @@ -959,6 +955,7 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) return -1; } flash->memory_map = map_sysmem(addr, size); +#endif return 0; } |