Skip to contentSkip to conversation

: Fix printing & reading of 16-bit CFI device identifiers

PATCH New Philippe De Muyter 2 participants 2 messages Aug 10, 2010 – Aug 12, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix printing & reading of 16-bit CFI device identifiers

Fix reading and printing of CFI flashes 16-bit devices identifiers

Nowadays CFI flashes have a 16-bit device identifier. U-boot still print them and read them as if they were only 8-bit wide. Fix that. Before:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x1B
After:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x881B

---
 drivers/mtd/cfi_flash.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/mtd/cfi_flash.c +7 -4
index 013d4ad..8fb6c2e 100644
@@ -1142,8 +1142,10 @@ void flash_print_info (flash_info_t * info)
 			printf ("Unknown (%d)", info->vendor);
 			break;
 	}
-	printf (" command set, Manufacturer ID: 0x%02X, Device ID: 0x%02X",
-		info->manufacturer_id, info->device_id);
+	printf (" command set, Manufacturer ID: 0x%02X, Device ID: 0x",
+		info->manufacturer_id);
+	printf (info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X",
+		info->device_id);
 	if (info->device_id == 0x7E) {
 		printf("%04X", info->device_id2);
 	}
@@ -1494,8 +1496,9 @@ static void cmdset_intel_read_jedec_ids(flash_info_t *info)
 	udelay(1000); /* some flash are slow to respond */
 	info->manufacturer_id = flash_read_uchar (info,
 					FLASH_OFFSET_MANUFACTURER_ID);
-	info->device_id = flash_read_uchar (info,
-					FLASH_OFFSET_DEVICE_ID);
+	info->device_id = (info->chipwidth == FLASH_CFI_16BIT) ?
+			flash_read_word (info, FLASH_OFFSET_DEVICE_ID) :
+			flash_read_uchar (info, FLASH_OFFSET_DEVICE_ID);
 	flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
 }
 
Signature · 6 lines
1.6.3.3


-- 
Philippe De Muyter  phdm at macqel dot be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077
#1 lore raw

PATCH 1/1 : Fix printing & reading of 16-bit CFI device identifiers

Quoted 10 lines · On Tuesday 10 August 2010 16:54:52 Philippe De Muyter wrote:

Fix reading and printing of CFI flashes 16-bit devices identifiers

Nowadays CFI flashes have a 16-bit device identifier. U-boot still print them and read them as if they were only 8-bit wide. Fix that. Before:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x1B
After:
Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x881B

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