diff options
author | Jason Jin <Jason.jin@freescale.com> | 2008-09-19 17:32:49 +0800 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-10-14 13:27:16 +0200 |
commit | fecb5ade3b37f62981f2b05b621005850173aaa9 (patch) | |
tree | fee29df48acb4e7264a6ffcaa6587f0a2287ce54 /drivers | |
parent | 65d4a75fa0f57943aa4e7c552d8e0952d95676ec (diff) | |
download | u-boot-imx-fecb5ade3b37f62981f2b05b621005850173aaa9.zip u-boot-imx-fecb5ade3b37f62981f2b05b621005850173aaa9.tar.gz u-boot-imx-fecb5ade3b37f62981f2b05b621005850173aaa9.tar.bz2 |
Fix the NAND size overflow issue.
When the total size of all NAND devices exceeds 4 GiB, the size will
overflow. This patch tries to fix this.
Note that we still have a problem when a single NAND device is bigger
than 4 GiB: then the overflow would actually happen earlier, i. e.
when storing the size in nand_info[].size, as nand_info[].size is an
"u_int32_t".
Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/nand.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index ebd2acd..71a0e4b 100644 --- a/drivers/mtd/nand/nand.c +++ b/drivers/mtd/nand/nand.c @@ -63,11 +63,11 @@ void nand_init(void) unsigned int size = 0; for (i = 0; i < CFG_MAX_NAND_DEVICE; i++) { nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]); - size += nand_info[i].size; + size += nand_info[i].size / 1024; if (nand_curr_device == -1) nand_curr_device = i; } - printf("%u MiB\n", size / (1024 * 1024)); + printf("%u MiB\n", size / 1024); #ifdef CFG_NAND_SELECT_DEVICE /* |