diff options
author | Tom Rini <trini@konsulko.com> | 2023-05-15 08:33:16 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-05-15 08:33:16 -0400 |
commit | c9b2a789281c76d3710036455d0524a1ac997f66 (patch) | |
tree | c99f153110c95126ccd20871ea99e1b38ecb2e25 | |
parent | 17f6e6cc499e207908b269d04cb7581d8f8f6870 (diff) | |
parent | 43bacbe6ab85030a4dc424700f83108333e99536 (diff) | |
download | u-boot-WIP/15May2023.zip u-boot-WIP/15May2023.tar.gz u-boot-WIP/15May2023.tar.bz2 |
Merge https://source.denx.de/u-boot/custodians/u-boot-cfi-flashWIP/15May2023
- cfi: respect reg address length (Nuno)
-rw-r--r-- | drivers/mtd/cfi_flash.c | 10 | ||||
-rw-r--r-- | include/flash.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index f378f6f..8ade794 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2196,6 +2196,12 @@ ulong flash_get_size(phys_addr_t base, int banknum) /* multiply the size by the number of chips */ info->size *= size_ratio; max_size = cfi_flash_bank_size(banknum); +#ifdef CONFIG_CFI_FLASH + if (max_size) + max_size = min((unsigned long)info->addr_size, max_size); + else + max_size = info->addr_size; +#endif if (max_size && info->size > max_size) { debug("[truncated from %ldMiB]", info->size >> 20); info->size = max_size; @@ -2492,15 +2498,17 @@ unsigned long flash_init(void) static int cfi_flash_probe(struct udevice *dev) { fdt_addr_t addr; + fdt_size_t size; int idx; for (idx = 0; idx < CFI_MAX_FLASH_BANKS; idx++) { - addr = dev_read_addr_index(dev, idx); + addr = dev_read_addr_size_index(dev, idx, &size); if (addr == FDT_ADDR_T_NONE) break; flash_info[cfi_flash_num_flash_banks].dev = dev; flash_info[cfi_flash_num_flash_banks].base = addr; + flash_info[cfi_flash_num_flash_banks].addr_size = size; cfi_flash_num_flash_banks++; } gd->bd->bi_flashstart = flash_info[0].base; diff --git a/include/flash.h b/include/flash.h index 95992fa..3710a27 100644 --- a/include/flash.h +++ b/include/flash.h @@ -46,6 +46,7 @@ typedef struct { #ifdef CONFIG_CFI_FLASH /* DM-specific parts */ struct udevice *dev; phys_addr_t base; + phys_size_t addr_size; #endif } flash_info_t; |