summaryrefslogtreecommitdiff
path: root/drivers/mtd/cfi_flash.c
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@RuggedCom.com>2009-01-14 08:44:26 -0500
committerStefan Roese <sr@denx.de>2009-01-26 10:59:48 +0100
commite8eac437189430d8e04a5d254ed92c58bc534a79 (patch)
tree67196c67e92a5b966fe6ad8a50c741a76dd101e7 /drivers/mtd/cfi_flash.c
parent0f8e851e897b535959a0781171910cd97f33c30c (diff)
downloadu-boot-imx-e8eac437189430d8e04a5d254ed92c58bc534a79.zip
u-boot-imx-e8eac437189430d8e04a5d254ed92c58bc534a79.tar.gz
u-boot-imx-e8eac437189430d8e04a5d254ed92c58bc534a79.tar.bz2
CFI: Add geometry reversal for STMicro M29W320ET
Added flash_fixup_stm to fix geometry reversal on STMicro M29W320ET flash chip. Modeled after flash_fixup_amd, this patch handles the geometry reversal or erase sectors that exist for ST Micro (now Numonyx) M29W320ET flash. Since I cannot test all STM's chips, the detection is implemented as narrow as possible for now. Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd/cfi_flash.c')
-rw-r--r--drivers/mtd/cfi_flash.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index bc5e151..84ff7e8 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1808,6 +1808,20 @@ static void flash_fixup_atmel(flash_info_t *info, struct cfi_qry *qry)
cfi_reverse_geometry(qry);
}
+static void flash_fixup_stm(flash_info_t *info, struct cfi_qry *qry)
+{
+ /* check if flash geometry needs reversal */
+ if (qry->num_erase_regions > 1) {
+ /* reverse geometry if top boot part */
+ if (info->cfi_version < 0x3131) {
+ /* CFI < 1.1, guess by device id (only M29W320ET now) */
+ if (info->device_id == 0x2256) {
+ cfi_reverse_geometry(qry);
+ }
+ }
+ }
+}
+
/*
* The following code cannot be run from FLASH!
*
@@ -1881,6 +1895,9 @@ ulong flash_get_size (ulong base, int banknum)
case 0x001f:
flash_fixup_atmel(info, &qry);
break;
+ case 0x0020:
+ flash_fixup_stm(info, &qry);
+ break;
}
debug ("manufacturer is %d\n", info->vendor);