Skip to contentSkip to conversation

Is the Numonyx's M29W128 fully supported in U-Boot?

U-Boot txema lopez 3 participants 6 messages Dec 11, 2009 – Oct 28, 2010

lore
Share & tools
lore
#0 lore raw

Hi all,

We have a MPC5200B custom board and we are evaluating the Numonyx M29W128 Flash as a second source for the Spansion's S29GL128. I've checked the top of the tree version of the U-Boot (u-boot.git) CFI driver and the Numonyx Flash is not detected. This is the U-Boot debug output:

FLASH: flash detect cfi
fwc addr fe000000 cmd f0 f0 8bit x 8 bit
fwc addr fe000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5100 5151
fwc addr fe000000 cmd f0 00f0 16bit x 16 bit
fwc addr fe0000aa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr fe000020 is= 6d69 0051
fwc addr fe000000 cmd f0 f0f0f0f0 32bit x 8 bit
fwc addr fe000154 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 51515151
fwc addr fe000000 cmd f0 00f000f0 32bit x 16 bit
fwc addr fe000154 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00510051
fwc addr fe000000 cmd f0 000000f0 32bit x 32 bit
fwc addr fe000154 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00000051 fwrite addr fe000000 cmd f0 f0f0f0f0f0f0f0f0 64 bit x 8 bit fwrite addr fe0002a8 cmd 98 9898989898989898 64 bit x 8 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 5151515151515151 fwrite addr fe000000 cmd f0 00f000f000f000f0 64 bit x 16 bit fwrite addr fe0002a8 cmd 98 0098009800980098 64 bit x 16 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0051005100510051 fwrite addr fe000000 cmd f0 000000f0000000f0 64 bit x 32 bit fwrite addr fe0002a8 cmd 98 0000009800000098 64 bit x 32 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000005100000051 fwrite addr fe000000 cmd f0 00000000000000f0 64 bit x 64 bit fwrite addr fe0002a8 cmd 98 0000000000000098 64 bit x 64 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000000000000051 not found
## Unknown FLASH on Bank 0 - Size = 0x00000000 = 0 MB

This is the debug output for the Spansion Flash that works fine.

FLASH: flash detect cfi
fwc addr fe000000 cmd f0 f0 8bit x 8 bit
fwc addr fe000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5151 5151
is= cmd 52(R) addr fe000022 is= 5252 5252
is= cmd 59(Y) addr fe000024 is= 5959 5959
ushort addr is at fe000050 info->portwidth = 2 addr[0] = 0x2
addr[1] = 0x2
addr[2] = 0x0
addr[3] = 0x0
retval = 0x2
device interface is 2
found port 2 chip 1 port 16 bits chip 8 bits ushort addr is at fe000026 info->portwidth = 2 addr[0] = 0x2
addr[1] = 0x2
addr[2] = 0x0
addr[3] = 0x0
retval = 0x2
fe000020 : 51 51 52 52 59 59 02 02 00 00 40 40 00 00 00 00 QQRRYY....@@....
fe000030 : 00 00 00 00 00 00 27 27 36 36 00 00 00 00 06 06 ......''66......
fe000040 : 06 06 09 09 13 13 03 03 05 05 03 03 02 02 18 18 ................
fe000050 : 02 02 00 00 06 06 00 00 01 01 7f 7f 00 00 00 00 ................
fe000060 : 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
fe000070 : 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ................
fe000080 : 50 50 52 52 49 49 31 31 33 33 14 14 02 02 01 01 PPRRII1133......
fe000090 : 00 00 08 08 00 00 00 00 02 02 b5 b5 c5 c5 04 04 ................
manufacturer is 2
size_ratio 1 port 16 bits chip 8 bits
found 1 erase regions
long addr is at fe00005a info->portwidth = 2 addr[0] = 0x7f
addr[1] = 0x7f
addr[2] = 0x0
addr[3] = 0x0
addr[4] = 0x0
addr[5] = 0x0
addr[6] = 0x2
addr[7] = 0x2
erase_region_count = 128 erase_region_size = 131072 ushort addr is at fe000054 info->portwidth = 2 addr[0] = 0x6
addr[1] = 0x6
addr[2] = 0x0
addr[3] = 0x0
retval = 0x6

So the problem seems to be that the Numonyx Flash do not put the CFI query information in the odd bytes as you can see here:

	fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
	fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
	is= cmd 51(Q) addr fe000020 is= 5100 5151

I've checked the U-Boot mainling list and I've found only something about a M29W128 bug but in a coldfire architecture. So I think the Numonyx Flash has been tested in some boards but I don't knwon if there is full support in U-Boot for it. If not, is there a patch available or in process? Any clue will be welcomed.

TIA,

#1 lore raw

Hi all,

I'm sorry, I sent to the list the debug messages of a older U-Boot version. Here are the debug messages of the current U-Boot version.

FLASH: flash detect cfi
fwc addr fe000000 cmd f0 f0 8bit x 8 bit
fwc addr fe000000 cmd ff ff 8bit x 8 bit
fwc addr fe000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000555 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fe000000 cmd ff ffff 16bit x 8 bit
fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5100 5151
fwc addr fe000aaa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5100 5151
fwc addr fe000000 cmd f0 00f0 16bit x 16 bit
fwc addr fe000000 cmd ff 00ff 16bit x 16 bit
fwc addr fe0000aa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr fe000020 is= 6d69 0051
fwc addr fe000aaa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr fe000020 is= 6d69 0051
fwc addr fe000000 cmd f0 f0f0f0f0 32bit x 8 bit
fwc addr fe000000 cmd ff ffffffff 32bit x 8 bit
fwc addr fe000154 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 51515151
fwc addr fe001554 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 51515151
fwc addr fe000000 cmd f0 00f000f0 32bit x 16 bit
fwc addr fe000000 cmd ff 00ff00ff 32bit x 16 bit
fwc addr fe000154 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00510051
fwc addr fe001554 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00510051
fwc addr fe000000 cmd f0 000000f0 32bit x 32 bit
fwc addr fe000000 cmd ff 000000ff 32bit x 32 bit
fwc addr fe000154 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00000051
fwc addr fe001554 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00000051 fwrite addr fe000000 cmd f0 f0f0f0f0f0f0f0f0 64 bit x 8 bit fwrite addr fe000000 cmd ff ffffffffffffffff 64 bit x 8 bit fwrite addr fe0002a8 cmd 98 9898989898989898 64 bit x 8 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 5151515151515151 fwrite addr fe002aa8 cmd 98 9898989898989898 64 bit x 8 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 5151515151515151 fwrite addr fe000000 cmd f0 00f000f000f000f0 64 bit x 16 bit fwrite addr fe000000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit fwrite addr fe0002a8 cmd 98 0098009800980098 64 bit x 16 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0051005100510051 fwrite addr fe002aa8 cmd 98 0098009800980098 64 bit x 16 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0051005100510051 fwrite addr fe000000 cmd f0 000000f0000000f0 64 bit x 32 bit fwrite addr fe000000 cmd ff 000000ff000000ff 64 bit x 32 bit fwrite addr fe0002a8 cmd 98 0000009800000098 64 bit x 32 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000005100000051 fwrite addr fe002aa8 cmd 98 0000009800000098 64 bit x 32 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000005100000051 fwrite addr fe000000 cmd f0 00000000000000f0 64 bit x 64 bit fwrite addr fe000000 cmd ff 00000000000000ff 64 bit x 64 bit fwrite addr fe0002a8 cmd 98 0000000000000098 64 bit x 64 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000000000000051 fwrite addr fe002aa8 cmd 98 0000000000000098 64 bit x 64 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000000000000051 not found

El vie, 11-12-2009 a las 15:03 +0100, txema lopez escribi?:

Quoted 127 lines

Hi all,

We have a MPC5200B custom board and we are evaluating the Numonyx M29W128 Flash as a second source for the Spansion's S29GL128. I've checked the top of the tree version of the U-Boot (u-boot.git) CFI driver and the Numonyx Flash is not detected. This is the U-Boot debug output:

FLASH: flash detect cfi
fwc addr fe000000 cmd f0 f0 8bit x 8 bit
fwc addr fe000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5100 5151
fwc addr fe000000 cmd f0 00f0 16bit x 16 bit
fwc addr fe0000aa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr fe000020 is= 6d69 0051
fwc addr fe000000 cmd f0 f0f0f0f0 32bit x 8 bit
fwc addr fe000154 cmd 98 98989898 32bit x 8 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 51515151
fwc addr fe000000 cmd f0 00f000f0 32bit x 16 bit
fwc addr fe000154 cmd 98 00980098 32bit x 16 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00510051
fwc addr fe000000 cmd f0 000000f0 32bit x 32 bit
fwc addr fe000154 cmd 98 00000098 32bit x 32 bit
is= cmd 51(Q) addr fe000040 is= 4e6f7620 00000051 fwrite addr fe000000 cmd f0 f0f0f0f0f0f0f0f0 64 bit x 8 bit fwrite addr fe0002a8 cmd 98 9898989898989898 64 bit x 8 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 5151515151515151 fwrite addr fe000000 cmd f0 00f000f000f000f0 64 bit x 16 bit fwrite addr fe0002a8 cmd 98 0098009800980098 64 bit x 16 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0051005100510051 fwrite addr fe000000 cmd f0 000000f0000000f0 64 bit x 32 bit fwrite addr fe0002a8 cmd 98 0000009800000098 64 bit x 32 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000005100000051 fwrite addr fe000000 cmd f0 00000000000000f0 64 bit x 64 bit fwrite addr fe0002a8 cmd 98 0000000000000098 64 bit x 64 bit is= cmd 51(Q) addr fe000080 is= 0000000000000000 0000000000000051 not found
## Unknown FLASH on Bank 0 - Size = 0x00000000 = 0 MB

This is the debug output for the Spansion Flash that works fine.

FLASH: flash detect cfi
fwc addr fe000000 cmd f0 f0 8bit x 8 bit
fwc addr fe000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fe000010 is= 0 51
fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fe000020 is= 5151 5151
is= cmd 52(R) addr fe000022 is= 5252 5252
is= cmd 59(Y) addr fe000024 is= 5959 5959
ushort addr is at fe000050 info->portwidth = 2 addr[0] = 0x2
addr[1] = 0x2
addr[2] = 0x0
addr[3] = 0x0
retval = 0x2
device interface is 2
found port 2 chip 1 port 16 bits chip 8 bits ushort addr is at fe000026 info->portwidth = 2 addr[0] = 0x2
addr[1] = 0x2
addr[2] = 0x0
addr[3] = 0x0
retval = 0x2
fe000020 : 51 51 52 52 59 59 02 02 00 00 40 40 00 00 00 00 QQRRYY....@@....
fe000030 : 00 00 00 00 00 00 27 27 36 36 00 00 00 00 06 06 ......''66......
fe000040 : 06 06 09 09 13 13 03 03 05 05 03 03 02 02 18 18 ................
fe000050 : 02 02 00 00 06 06 00 00 01 01 7f 7f 00 00 00 00 ................
fe000060 : 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
fe000070 : 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ................
fe000080 : 50 50 52 52 49 49 31 31 33 33 14 14 02 02 01 01 PPRRII1133......
fe000090 : 00 00 08 08 00 00 00 00 02 02 b5 b5 c5 c5 04 04 ................
manufacturer is 2
size_ratio 1 port 16 bits chip 8 bits
found 1 erase regions
long addr is at fe00005a info->portwidth = 2 addr[0] = 0x7f
addr[1] = 0x7f
addr[2] = 0x0
addr[3] = 0x0
addr[4] = 0x0
addr[5] = 0x0
addr[6] = 0x2
addr[7] = 0x2
erase_region_count = 128 erase_region_size = 131072 ushort addr is at fe000054 info->portwidth = 2 addr[0] = 0x6
addr[1] = 0x6
addr[2] = 0x0
addr[3] = 0x0
retval = 0x6

So the problem seems to be that the Numonyx Flash do not put the CFI query information in the odd bytes as you can see here:

	fwc addr fe000000 cmd f0 f0f0 16bit x 8 bit
	fwc addr fe0000aa cmd 98 9898 16bit x 8 bit
	is= cmd 51(Q) addr fe000020 is= 5100 5151

I've checked the U-Boot mainling list and I've found only something about a M29W128 bug but in a coldfire architecture. So I think the Numonyx Flash has been tested in some boards but I don't knwon if there is full support in U-Boot for it. If not, is there a patch available or in process? Any clue will be welcomed.

TIA,

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

Hi all,

This is a patch to fix the NUMONYX's M29W128GL cfi detection bug in my Lite5200B based custom board. I thing I's only a starting point for a more formal patch valid for any kind of architecture (big and little endian) and flash layout (I've only check it in a 16x portwitdh 8x chipwitch).
I'm not a CFI flash expert and any feedback about this issue will be welcomed.

TIA,

cfi_flash_new.c renamed from cfi_flash_old.c +29 -4
@@ -214,6 +214,10 @@ static void flash_make_cmd(flash_info_t 
 		val = *((uchar*)&cmd + sizeof(u32) - cword_offset - 1);
 #endif
 		cp[cp_offset] = (cword_offset >= sizeof(u32)) ? 0x00 : val;
+		if(info->cfi_fixup & CFI_NUMONYX_FIXUP)	{	
+			if(cp_offset & 1)
+				cp[cp_offset] = 0x00;
+		}
 	}
 }
 
@@ -266,7 +270,10 @@ static inline uchar flash_read_uchar (fl
 #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
 	retval = flash_read8(cp);
 #else
-	retval = flash_read8(cp + info->portwidth - 1);
+	if(info->cfi_fixup & CFI_NUMONYX_FIXUP)
+		retval = flash_read8(cp);
+	else
+		retval = flash_read8(cp + info->portwidth - 1);
 #endif
 	flash_unmap (info, 0, offset, cp);
 	return retval;
@@ -1420,7 +1427,12 @@ static void cmdset_amd_read_jedec_ids(fl
 {
 	ushort bankId = 0;
 	uchar  manuId;
+	uchar portwidth;
 
+	portwidth = info->portwidth;
+	if(info->chipwidth == FLASH_CFI_8BIT)
+		info->portwidth = FLASH_CFI_8BIT;
+	
 	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
 	flash_unlock_seq(info, 0);
 	flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID);
@@ -1438,14 +1450,14 @@ static void cmdset_amd_read_jedec_ids(fl
 	switch (info->chipwidth){
 	case FLASH_CFI_8BIT:
 		info->device_id = flash_read_uchar (info,
-						FLASH_OFFSET_DEVICE_ID);
+						FLASH_OFFSET_DEVICE_ID * portwidth);
 		if (info->device_id == 0x7E) {
 			/* AMD 3-byte (expanded) device ids */
 			info->device_id2 = flash_read_uchar (info,
-						FLASH_OFFSET_DEVICE_ID2);
+						FLASH_OFFSET_DEVICE_ID2 * portwidth);
 			info->device_id2 <<= 8;
 			info->device_id2 |= flash_read_uchar (info,
-						FLASH_OFFSET_DEVICE_ID3);
+						FLASH_OFFSET_DEVICE_ID3 * portwidth);
 		}
 		break;
 	case FLASH_CFI_16BIT:
@@ -1456,6 +1468,9 @@ static void cmdset_amd_read_jedec_ids(fl
 		break;
 	}
 	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
+
+	info->portwidth = portwidth;
+	
 }
 
 static int cmdset_amd_init(flash_info_t *info, struct cfi_qry *qry)
@@ -1582,6 +1597,10 @@ void __flash_cmd_reset(flash_info_t *inf
 	 * that AMD flash roms ignore the Intel command.
 	 */
 	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
+
+	if(info->cfi_fixup & CFI_NUMONYX_FIXUP)
+		return;
+
 	flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
 }
 void flash_cmd_reset(flash_info_t *info)
@@ -1646,6 +1665,12 @@ static int flash_detect_cfi (flash_info_
 {
 	debug ("flash detect cfi\n");
 
+	info->cfi_fixup = 0;
+
+#ifdef 	CONFIG_FLASH_NUMONYX_FIXUP
+	info->cfi_fixup = CFI_NUMONYX_FIXUP;
+#endif
+	
 	for (info->portwidth = CONFIG_SYS_FLASH_CFI_WIDTH;
 	     info->portwidth <= FLASH_CFI_64BIT; info->portwidth <<= 1) {
 		for (info->chipwidth = FLASH_CFI_BY8;
flash_new.h renamed from flash_old.h +4 -0
@@ -55,6 +55,7 @@ typedef struct {
 	ulong   addr_unlock1;		/* unlock address 1 for AMD flash roms  */
 	ulong   addr_unlock2;		/* unlock address 2 for AMD flash roms  */
 	const char *name;		/* human-readable name	                */
+	uchar    cfi_fixup;
 #endif
 } flash_info_t;
 
@@ -87,6 +88,9 @@ typedef unsigned long flash_sect_t;
 /* convert between bit value and numeric value */
 #define CFI_FLASH_SHIFT_WIDTH	3
 
+
+#define CFI_NUMONYX_FIXUP	0x01
+
 /* Prototypes */
 
 extern unsigned long flash_init (void);
#3 lore raw
In reply to txema lopez
Quoted 9 lines · txema lopez <tlopez <at> aotek.es> writes:

Hi all,

We have a MPC5200B custom board and we are evaluating the Numonyx M29W128 Flash as a second source for the Spansion's S29GL128. I've checked the top of the tree version of the U-Boot (u-boot.git) CFI driver and the Numonyx Flash is not detected. This is the U-Boot debug output:

Hi,
Did you manage to solve this problem eventually?

#5 lore raw

Txema L?pez <tlopez <at> fagorautomation.es> writes:

Great !
Thanks a lot :)