diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2017-09-12 19:09:08 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2017-09-26 10:57:53 +0200 |
commit | 1ec0a37e1cf2add5680b8d7305922c8210c3e2ed (patch) | |
tree | 634a3ca0fe61b9dd7cd03f0a58d4c3b41f219a87 /drivers/mtd | |
parent | 1f6049e2501b5c35c61435dbc05ba96743202674 (diff) | |
download | u-boot-1ec0a37e1cf2add5680b8d7305922c8210c3e2ed.tar.gz |
mtd: cfi: Zap cfi_flash_base in DM case
Embed the flash base into struct flash_info instead of having ad-hoc
static array in the code. This does not only remove static variable,
but also allows CFI-like controllers, ie. HyperFlash ones, to use most
of the CFI flash code by populating the flash_info with matching base
address.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/cfi_flash.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index f3bb72788a..df04a425e2 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -111,11 +111,9 @@ static void cfi_flash_init_dm(void) } } -static phys_addr_t cfi_flash_base[CFI_MAX_FLASH_BANKS]; - phys_addr_t cfi_flash_bank_addr(int i) { - return cfi_flash_base[i]; + return flash_info[i].base; } #else __weak phys_addr_t cfi_flash_bank_addr(int i) @@ -2458,10 +2456,12 @@ static int cfi_flash_probe(struct udevice *dev) while (idx < len) { addr = fdt_translate_address((void *)blob, node, cell + idx); - cfi_flash_base[cfi_flash_num_flash_banks++] = addr; + flash_info[cfi_flash_num_flash_banks].dev = dev; + flash_info[cfi_flash_num_flash_banks].base = addr; + cfi_flash_num_flash_banks++; idx += addrc + sizec; } - gd->bd->bi_flashstart = cfi_flash_base[0]; + gd->bd->bi_flashstart = flash_info[0].base; return 0; } |