All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] CFI: Add geometry reversal for STMicro M29W320ET
Date: Wed, 14 Jan 2009 08:44:26 -0500	[thread overview]
Message-ID: <496DEC3A.1000308@RuggedCom.com> (raw)
In-Reply-To: <200901141255.52717.sr@denx.de>

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>

---

 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

  reply	other threads:[~2009-01-14 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 17:31 [U-Boot] [PATCH] CFI: Add geometry reversal for STMicro M29W320ET Richard Retanubun
2009-01-13 22:15 ` Mike Frysinger
2009-01-14 11:55   ` Stefan Roese
2009-01-14 13:44     ` Richard Retanubun [this message]
2009-01-26 10:00       ` [U-Boot] [PATCH V2] " Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=496DEC3A.1000308@RuggedCom.com \
    --to=richardretanubun@ruggedcom.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.