Skip to contentSkip to conversation

CFI: Add geometry reversal for STMicro M29W320ET

PATCH Superseded Richard Retanubun 3 participants 5 messages Jan 13, 2009 – Jan 26, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CFI: Add geometry reversal for STMicro M29W320ET

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

---

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(-)
drivers/mtd/cfi_flash.c +17 -0
index e8afe99..7ece71c 100644
@@ -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);
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 CFI: Add geometry reversal for STMicro M29W320ET

Quoted 6 lines · On Tuesday 13 January 2009 12:31:46 Richard Retanubun wrote:

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

---

Quoted 7 lines

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.

this comment should be above the --- and in the changelog imo
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090113/40b8702b/attachment.pgp

#2 lore raw

PATCH 1/1 CFI: Add geometry reversal for STMicro M29W320ET

Quoted 10 lines · Mike Frysinger
Quoted 9 lines · On Tuesday 13 January 2009 12:31:46 Richard Retanubun wrote:

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

---

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

Quoted 6 lines
Quoted 4 lines

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.

this comment should be above the --- and in the changelog imo

ACK. Richard, please resend with this additional description in the main commit text.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#3 lore raw

PATCH v2 1/1 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.

---

 drivers/mtd/cfi_flash.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/mtd/cfi_flash.c +17 -0
index e8afe99..7ece71c 100644
@@ -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);
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH v2 1/1 CFI: Add geometry reversal for STMicro M29W320ET

Quoted 9 lines · Richard Retanubun

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.

Applied to u-boot/master. Thanks

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================