diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-12-17 18:18:44 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-12-17 18:18:44 +0100 |
commit | db572dce5f662bec1f2130913a71301e4e603643 (patch) | |
tree | 1aac87dd90b1f40718c354ca84a27f2923c736bf | |
parent | 7e9bb400cf60a04ad4681f069493a368e9fba0ba (diff) | |
download | barebox-db572dce5f662bec1f2130913a71301e4e603643.tar.gz barebox-db572dce5f662bec1f2130913a71301e4e603643.tar.xz |
cfi driver: Limit device size to actual size
When probing CFI, limit the device size to the actual probed size of
the flash
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/nor/cfi_flash.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c index 4bdd2f656f..830e9fc4a3 100644 --- a/drivers/nor/cfi_flash.c +++ b/drivers/nor/cfi_flash.c @@ -316,6 +316,12 @@ static int cfi_probe (struct device_d *dev) /* Init: no FLASHes known */ info->flash_id = FLASH_UNKNOWN; size += info->size = flash_get_size(info, dev->map_base); + + if (dev->size > size) { + dev_dbg(dev, "limiting size from 0x%08x to 0x%08x\n", dev->size, size); + dev->size = size; + } + if (info->flash_id == FLASH_UNKNOWN) { debug ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n", dev->map_base, info->size, info->size << 20); |