mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] read cfi device id according the bus width
@ 2012-11-22  6:01 张忠山
  2012-11-22  6:14 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: 张忠山 @ 2012-11-22  6:01 UTC (permalink / raw)
  To: barebox

Signed-off-by: 张忠山 <zzs213@126.com>
---
 drivers/nor/cfi_flash_amd.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
index 45c59b9..3ab4be0 100644
--- a/drivers/nor/cfi_flash_amd.c
+++ b/drivers/nor/cfi_flash_amd.c
@@ -62,8 +62,11 @@ static void amd_read_jedec_ids (struct flash_info *info)
 	udelay(1000); /* some flash are slow to respond */
 
 	info->manufacturer_id = jedec_read_mfr(info);
-	info->device_id = flash_read_uchar (info,
-					FLASH_OFFSET_DEVICE_ID);
+	if(info->chipwidth == FLASH_CFI_BY16)
+		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
+	else
+		info->device_id = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID);
 	if (info->device_id == 0x7E) {
 		/* AMD 3-byte (expanded) device ids */
 		info->device_id2 = flash_read_uchar (info,
-- 
1.7.4.4



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH] read cfi device id according the bus width
@ 2012-11-22  6:49 张忠山
  2012-11-22  7:25 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: 张忠山 @ 2012-11-22  6:49 UTC (permalink / raw)
  To: barebox

Signed-off-by: 张忠山 <zzs213@126.com>
---
 drivers/nor/cfi_flash_amd.c   |    7 +++++--
 drivers/nor/cfi_flash_intel.c |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
index 45c59b9..3ab4be0 100644
--- a/drivers/nor/cfi_flash_amd.c
+++ b/drivers/nor/cfi_flash_amd.c
@@ -62,8 +62,11 @@ static void amd_read_jedec_ids (struct flash_info *info)
 	udelay(1000); /* some flash are slow to respond */
 
 	info->manufacturer_id = jedec_read_mfr(info);
-	info->device_id = flash_read_uchar (info,
-					FLASH_OFFSET_DEVICE_ID);
+	if(info->chipwidth == FLASH_CFI_BY16)
+		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
+	else
+		info->device_id = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID);
 	if (info->device_id == 0x7E) {
 		/* AMD 3-byte (expanded) device ids */
 		info->device_id2 = flash_read_uchar (info,
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index 32e581a..75dc5a8 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -19,8 +19,11 @@ static void intel_read_jedec_ids (struct flash_info *info)
 	udelay(1000); /* some flash are slow to respond */
 
 	info->manufacturer_id = jedec_read_mfr(info);
-	info->device_id = flash_read_uchar (info,
-					FLASH_OFFSET_DEVICE_ID);
+	if(info->chipwidth == FLASH_CFI_BY16)
+		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
+	else
+		info->device_id = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID);
 	flash_write_cmd(info, 0, 0, info->cmd_reset);
 }
 
-- 
1.7.4.4



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH] read cfi device id according the bus width
@ 2012-11-22  1:48 张忠山
  2012-11-22  5:46 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: 张忠山 @ 2012-11-22  1:48 UTC (permalink / raw)
  To: barebox

Signed-off-by: 张忠山 <zzs213@126.com>
---
 drivers/nor/cfi_flash_amd.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
index 45c59b9..8384f46 100644
--- a/drivers/nor/cfi_flash_amd.c
+++ b/drivers/nor/cfi_flash_amd.c
@@ -62,15 +62,19 @@ static void amd_read_jedec_ids (struct flash_info *info)
 	udelay(1000); /* some flash are slow to respond */
 
 	info->manufacturer_id = jedec_read_mfr(info);
-	info->device_id = flash_read_uchar (info,
-					FLASH_OFFSET_DEVICE_ID);
-	if (info->device_id == 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);
+	if(info->chipwidth == FLASH_CFI_BY16) {
+		info->device_id = flash_read16(flash_make_addr(info, 0, FLASH_OFFSET_DEVICE_ID));
+	} else {
+		info->device_id = flash_read_uchar (info,
+						FLASH_OFFSET_DEVICE_ID);
+		if (info->device_id == 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);
+		}
 	}
 	flash_write_cmd(info, 0, 0, info->cmd_reset);
 }
-- 
1.7.4.4



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-11-22  8:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  6:01 [PATCH] read cfi device id according the bus width 张忠山
2012-11-22  6:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22  6:26   ` 张忠山
2012-11-22  6:38     ` Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2012-11-22  6:49 张忠山
2012-11-22  7:25 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22  8:06   ` 张忠山
2012-11-22  1:48 张忠山
2012-11-22  5:46 ` Jean-Christophe PLAGNIOL-VILLARD

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