public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts
@ 2011-05-09 22:33 Mike Frysinger
  2011-06-28 19:30 ` Mike Frysinger
  2011-06-29  8:08 ` Stefan Roese
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Frysinger @ 2011-05-09 22:33 UTC (permalink / raw)
  To: u-boot

For newer STM parts where CFI >= 1.1, there is a byte in the extended
structure that declares the flash layout type (just like the AMD parts),
so key off of that to find out when we need to reverse the geometry.

This can be seen with M29W640 parts where U-Boot does:
Bank # 1: CFI conformant FLASH (16 x 16)  Size: 8 MB in 135 Sectors
  AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22ED
  Erase timeout: 8192 ms, write timeout: 1 ms
  Buffer write timeout: 1 ms, buffer size: 16 bytes

  Sector Start Addresses:
  20000000   RO   20002000   RO   20004000   RO   20006000   RO   20008000   RO
  2000A000   RO   2000C000   RO   2000E000   RO   20010000   RO   20020000   RO
  ...

But Linux does:
physmap platform flash device: 00800000 at 20000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank.
                 Manufacturer ID 0x000020 Chip ID 0x0022ed
physmap-flash.0: Swapping erase regions for top-boot CFI table.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/mtd/cfi_flash.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 69f12d3..13774c4 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1858,6 +1858,10 @@ static void flash_fixup_stm(flash_info_t *info, struct cfi_qry *qry)
 			    info->device_id == 0x22D7) { /* M29W800DT */
 				cfi_reverse_geometry(qry);
 			}
+		} else if (flash_read_uchar(info, info->ext_addr + 0xf) == 3) {
+			/* CFI >= 1.1, deduct from top/bottom flag */
+			/* note: ext_addr is valid since cfi_version > 0 */
+			cfi_reverse_geometry(qry);
 		}
 	}
 }
-- 
1.7.5.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts
  2011-05-09 22:33 [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts Mike Frysinger
@ 2011-06-28 19:30 ` Mike Frysinger
  2011-06-29  6:24   ` Stefan Roese
  2011-06-29  8:08 ` Stefan Roese
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2011-06-28 19:30 UTC (permalink / raw)
  To: u-boot

On Monday, May 09, 2011 18:33:36 Mike Frysinger wrote:
> For newer STM parts where CFI >= 1.1, there is a byte in the extended
> structure that declares the flash layout type (just like the AMD parts),
> so key off of that to find out when we need to reverse the geometry.

ping ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110628/804745be/attachment.pgp 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts
  2011-06-28 19:30 ` Mike Frysinger
@ 2011-06-29  6:24   ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2011-06-29  6:24 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Tuesday 28 June 2011 21:30:28 Mike Frysinger wrote:
> On Monday, May 09, 2011 18:33:36 Mike Frysinger wrote:
> > For newer STM parts where CFI >= 1.1, there is a byte in the extended
> > structure that declares the flash layout type (just like the AMD parts),
> > so key off of that to find out when we need to reverse the geometry.
>
> ping  ...

I'll take care of it later today.

Cheers,
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts
  2011-05-09 22:33 [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts Mike Frysinger
  2011-06-28 19:30 ` Mike Frysinger
@ 2011-06-29  8:08 ` Stefan Roese
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2011-06-29  8:08 UTC (permalink / raw)
  To: u-boot

On Tuesday 10 May 2011 00:33:36 Mike Frysinger wrote:
> For newer STM parts where CFI >= 1.1, there is a byte in the extended
> structure that declares the flash layout type (just like the AMD parts),
> so key off of that to find out when we need to reverse the geometry.
> 
> This can be seen with M29W640 parts where U-Boot does:
> Bank # 1: CFI conformant FLASH (16 x 16)  Size: 8 MB in 135 Sectors
>   AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22ED
>   Erase timeout: 8192 ms, write timeout: 1 ms
>   Buffer write timeout: 1 ms, buffer size: 16 bytes
> 
>   Sector Start Addresses:
>   20000000   RO   20002000   RO   20004000   RO   20006000   RO   20008000 
>  RO 2000A000   RO   2000C000   RO   2000E000   RO   20010000   RO  
> 20020000   RO ...
> 
> But Linux does:
> physmap platform flash device: 00800000 at 20000000
> physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank.
>                  Manufacturer ID 0x000020 Chip ID 0x0022ed
> physmap-flash.0: Swapping erase regions for top-boot CFI table.

Applied to u-boot-cfi-flash/master. Thanks.
 
Cheers,
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-29  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-09 22:33 [U-Boot] [PATCH] cfi_flash: reverse geometry for newer STM parts Mike Frysinger
2011-06-28 19:30 ` Mike Frysinger
2011-06-29  6:24   ` Stefan Roese
2011-06-29  8:08 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox