mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 18:11:33 +00:00
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>
This commit is contained in:
parent
1f6049e250
commit
1ec0a37e1c
2 changed files with 9 additions and 5 deletions
|
@ -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)
|
phys_addr_t cfi_flash_bank_addr(int i)
|
||||||
{
|
{
|
||||||
return cfi_flash_base[i];
|
return flash_info[i].base;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
__weak phys_addr_t cfi_flash_bank_addr(int i)
|
__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) {
|
while (idx < len) {
|
||||||
addr = fdt_translate_address((void *)blob,
|
addr = fdt_translate_address((void *)blob,
|
||||||
node, cell + idx);
|
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;
|
idx += addrc + sizec;
|
||||||
}
|
}
|
||||||
gd->bd->bi_flashstart = cfi_flash_base[0];
|
gd->bd->bi_flashstart = flash_info[0].base;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,10 @@ typedef struct {
|
||||||
#ifdef CONFIG_MTD
|
#ifdef CONFIG_MTD
|
||||||
struct mtd_info *mtd;
|
struct mtd_info *mtd;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_CFI_FLASH /* DM-specific parts */
|
||||||
|
struct udevice *dev;
|
||||||
|
phys_addr_t base;
|
||||||
|
#endif
|
||||||
} flash_info_t;
|
} flash_info_t;
|
||||||
|
|
||||||
extern flash_info_t flash_info[]; /* info for FLASH chips */
|
extern flash_info_t flash_info[]; /* info for FLASH chips */
|
||||||
|
|
Loading…
Add table
Reference in a new issue