]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
cfi_flash: handle 'chip size exceeds address window' situation
authorIlya Yanok <yanok@emcraft.com>
Thu, 21 Oct 2010 15:20:12 +0000 (17:20 +0200)
committerWolfgang Denk <wd@denx.de>
Sat, 23 Oct 2010 19:04:49 +0000 (21:04 +0200)
commitec50a8e389863ac35bfd9d9a2e8b30187318e59e
tree8b397e1b04db049fb1d0cc53e73b7ade9f298678
parente03e4b7312f0da424550e6b06f1964332aac1c09
cfi_flash: handle 'chip size exceeds address window' situation

On some boards we have flash mapped high in the address space with
considerably small window (say 0xFE000000 and 32MB). When we install
bigger chip (say 64MB) on such a board strange things happen
(flash_write() doesn't work at all, for ex). That's because cfi_flash
driver doesn't care about window size at all.
Of course, cleanest solution would probably be to just extend address
window to be able to map the whole flash but for legacy/compatibility
reasons some people prefer just truncate the flash size and never use
the upper part.
This patch adds an option for cfi_flash driver to handle this situation
properly. To achieve this we add the new function cfi_flash_bank_size()
which can be provided by the board code and weak-aliased to default
implementation that returns value from the CONFIG_SYS_FLASH_BANKS_SIZES
array if it's defined or 0 otherwise (the last case is added for
compatibility).
If non-zero flash bank size is provided and detected chip size is bigger
than provided address window size the warning will be displayed and
flash chip will be truncated.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Changed cfi_flash_bank_size() return type to unsigned long
to match caller function.
Signed-off-by: Wolfgang Denk <wd@denx.de>
drivers/mtd/cfi_flash.c