From: Wolfgang Denk Date: Thu, 21 Oct 2010 22:19:22 +0200 Subject: [U-Boot] [PATCH 4/5] cfi_flash: handle 'chip size exceeds address window' situation In-Reply-To: <1287674413-3900-5-git-send-email-yanok@emcraft.com> References: <1287674413-3900-1-git-send-email-yanok@emcraft.com> <1287674413-3900-5-git-send-email-yanok@emcraft.com> Message-ID: <20101021201922.C0BB41359B7@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Stefan, In message <1287674413-3900-5-git-send-email-yanok@emcraft.com> you wrote: > 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 > --- > drivers/mtd/cfi_flash.c | 28 +++++++++++++++++++++++----- > 1 files changed, 23 insertions(+), 5 deletions(-) If this patch looks OK with you, then please ACK it; I suggest I will pull it with the resto of this patch series directly then. Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It's not an optical illusion, it just looks like one. -- Phil White