summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorArmando Visconti <armando.visconti@st.com>2012-05-07 13:00:28 +0530
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-07-07 14:07:39 +0200
commitcf9026deb8d83b00c37b19ec7b63491e9338d49f (patch)
treee09a3c830cc72e098e16a977d455767103b48171 /drivers
parent6d6d23c143f50389018fd1f5091a7101247d79d5 (diff)
downloadu-boot-imx-cf9026deb8d83b00c37b19ec7b63491e9338d49f.zip
u-boot-imx-cf9026deb8d83b00c37b19ec7b63491e9338d49f.tar.gz
u-boot-imx-cf9026deb8d83b00c37b19ec7b63491e9338d49f.tar.bz2
st_smi: Fix bug in flash_print_info()
If the flash size was smaller than 1MB then flash_print_info() was erroneously reporting 0 MB. Signed-off-by: Armando Visconti <armando.visconti@st.com> Signed-off-by: Amit Virdi <amit.virdi@st.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/st_smi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 976b097..5378b57 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -471,8 +471,13 @@ void flash_print_info(flash_info_t *info)
puts("missing or unknown FLASH type\n");
return;
}
- printf(" Size: %ld MB in %d Sectors\n",
- info->size >> 20, info->sector_count);
+
+ if (info->size >= 0x100000)
+ printf(" Size: %ld MB in %d Sectors\n",
+ info->size >> 20, info->sector_count);
+ else
+ printf(" Size: %ld KB in %d Sectors\n",
+ info->size >> 10, info->sector_count);
puts(" Sector Start Addresses:");
for (i = 0; i < info->sector_count; ++i) {