[U-Boot] [PATCH] CFI: Add geometry reversal for STMicro M29W320ET

Richard Retanubun RichardRetanubun at RuggedCom.com
Tue Jan 13 18:31:46 CET 2009


Added flash_fixup_stm to fix geometry reversal on
STMicro M29W320ET flash chip.

Signed-off-by: Richard Retanubun <RichardRetanubun at RuggedCom.com>
---

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.

Any feedback is appreciated.

 drivers/mtd/cfi_flash.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index e8afe99..7ece71c 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1795,6 +1795,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!
  *
@@ -1868,6 +1882,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);
-- 
1.5.6.5









More information about the U-Boot mailing list