public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices
@ 2011-04-11 11:01 Heiko Schocher
  2011-04-11 12:04 ` Stefan Roese
  2011-04-11 12:16 ` [U-Boot] [PATCH v2] " Heiko Schocher
  0 siblings, 2 replies; 4+ messages in thread
From: Heiko Schocher @ 2011-04-11 11:01 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Heiko Schocher <hs@denx.de>
---
 drivers/mtd/cfi_flash.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5788328..7617e0e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1202,8 +1202,9 @@ void flash_print_info (flash_info_t * info)
 		info->manufacturer_id);
 	printf (info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
 		info->device_id);
-	if (info->device_id == 0x7E) {
-		printf("%04X", info->device_id2);
+	if ((info->device_id & 0xff) == 0x7E) {
+		printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
+		info->device_id2);
 	}
 	printf ("\n  Erase timeout: %ld ms, write timeout: %ld ms\n",
 		info->erase_blk_tout,
@@ -1599,6 +1600,14 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info)
 	case FLASH_CFI_16BIT:
 		info->device_id = flash_read_word (info,
 						FLASH_OFFSET_DEVICE_ID);
+		if ((info->device_id & 0xff) == 0x7E) {
+			/* AMD 3-byte (expanded) device ids */
+			info->device_id2 = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID2);
+			info->device_id2 <<= 8;
+			info->device_id2 |= flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID3);
+		}
 		break;
 	default:
 		break;
-- 
1.7.4

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

* [U-Boot] [PATCH] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices
  2011-04-11 11:01 [U-Boot] [PATCH] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices Heiko Schocher
@ 2011-04-11 12:04 ` Stefan Roese
  2011-04-11 12:16 ` [U-Boot] [PATCH v2] " Heiko Schocher
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2011-04-11 12:04 UTC (permalink / raw)
  To: u-boot

Hi Heiko,

could you please add an "flinfo" example, with and without this patch? So that 
we can better see, which problem is fixed. And which device this is needed 
for/tested on?

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

* [U-Boot] [PATCH v2] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices
  2011-04-11 11:01 [U-Boot] [PATCH] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices Heiko Schocher
  2011-04-11 12:04 ` Stefan Roese
@ 2011-04-11 12:16 ` Heiko Schocher
  2011-04-21 13:55   ` Stefan Roese
  1 sibling, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2011-04-11 12:16 UTC (permalink / raw)
  To: u-boot

tested on the a4m072 board with a S29GL512P flash.

flinfo without this patch
Bank # 1: CFI conformant flash (16 x 16)  Size: 32 MB in 256 Sectors
  AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
  Erase timeout: 16384 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 32 bytes
[...]

flinfo with this patch
Bank # 1: CFI conformant flash (16 x 16)  Size: 32 MB in 256 Sectors
  AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E2301
  Erase timeout: 16384 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 32 bytes
[...]

Signed-off-by: Heiko Schocher <hs@denx.de>
---
changes for v2:
- added flinfo output in commit message

 drivers/mtd/cfi_flash.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5788328..7617e0e 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1202,8 +1202,9 @@ void flash_print_info (flash_info_t * info)
 		info->manufacturer_id);
 	printf (info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
 		info->device_id);
-	if (info->device_id == 0x7E) {
-		printf("%04X", info->device_id2);
+	if ((info->device_id & 0xff) == 0x7E) {
+		printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
+		info->device_id2);
 	}
 	printf ("\n  Erase timeout: %ld ms, write timeout: %ld ms\n",
 		info->erase_blk_tout,
@@ -1599,6 +1600,14 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info)
 	case FLASH_CFI_16BIT:
 		info->device_id = flash_read_word (info,
 						FLASH_OFFSET_DEVICE_ID);
+		if ((info->device_id & 0xff) == 0x7E) {
+			/* AMD 3-byte (expanded) device ids */
+			info->device_id2 = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID2);
+			info->device_id2 <<= 8;
+			info->device_id2 |= flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID3);
+		}
 		break;
 	default:
 		break;
-- 
1.7.4

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

* [U-Boot] [PATCH v2] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices
  2011-04-11 12:16 ` [U-Boot] [PATCH v2] " Heiko Schocher
@ 2011-04-21 13:55   ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2011-04-21 13:55 UTC (permalink / raw)
  To: u-boot

On Monday 11 April 2011 14:16:19 Heiko Schocher wrote:
> tested on the a4m072 board with a S29GL512P flash.
> 
> flinfo without this patch
> Bank # 1: CFI conformant flash (16 x 16)  Size: 32 MB in 256 Sectors
>   AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
>   Erase timeout: 16384 ms, write timeout: 2 ms
>   Buffer write timeout: 5 ms, buffer size: 32 bytes
> [...]
> 
> flinfo with this patch
> Bank # 1: CFI conformant flash (16 x 16)  Size: 32 MB in 256 Sectors
>   AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E2301
>   Erase timeout: 16384 ms, write timeout: 2 ms
>   Buffer write timeout: 5 ms, buffer size: 32 bytes
> [...]

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-04-21 13:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-11 11:01 [U-Boot] [PATCH] mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devices Heiko Schocher
2011-04-11 12:04 ` Stefan Roese
2011-04-11 12:16 ` [U-Boot] [PATCH v2] " Heiko Schocher
2011-04-21 13:55   ` Stefan Roese

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