[U-Boot] CFI Driver Problem: flash not ready

Wolfgang Denk wd at denx.de
Sun Oct 19 21:51:42 CEST 2008


Hi,

while tryong to convert the TQM8260 board  to  using  the  CFI  flash
driver  (instead  of  a  perfectly working legacy flash driver) I ran
into a strange problem: after an  erase  operation,  the  CFI  driver
returns without any error indication, but the flash is not ready yet.
It takes some more milliseconds before the flash gets ready - by then
it's indeed erased, but this behaviour makes things like "saveenv" or
any "erase;cp" command sequences fail with a "Flash not Erased" error
message.

Symptoms look like this:

=> md 40300000 10 ; era 40300000 +1 ; md 40300000 ; echo ===== ; sleep 1 ; md 40300000
40300000: 19852003 0000000c f060dc98 ffffffff    .. ......`......
40300010: ffffffff ffffffff ffffffff ffffffff    ................
40300020: ffffffff ffffffff ffffffff ffffffff    ................
40300030: ffffffff ffffffff ffffffff ffffffff    ................

. done
Erased 1 sectors
40300000: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
40300010: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
40300020: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
40300030: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
=====
40300000: ffffffff ffffffff ffffffff ffffffff    ................
40300010: ffffffff ffffffff ffffffff ffffffff    ................
40300020: ffffffff ffffffff ffffffff ffffffff    ................
40300030: ffffffff ffffffff ffffffff ffffffff    ................
=> 

The board uses 4 x 29LV652UE-90 flash chips for a single 32 MiB flash
bank, 64 bit wide; the old legacy driver showed:

	Bank # 1: FUJITSU 29LV640D (64 M, uniform sector)
	  Size: 32 MB in 128 Sectors

The CFI driver says:

	Bank # 1: CFI conformant FLASH (64 x 16)  Size: 32 MB in 128 Sectors
	  AMD Standard command set, Manufacturer ID: 0x04, Device ID: 0x22D7
	  Erase timeout: 16384 ms, write timeout: 1 ms

CFI debugging shows nothing unusual (at least as far as I can tell):

	...
	FLASH: flash detect cfi
	fwc addr 40000000 cmd f0 f0 8bit x 8 bit
	fwc addr 40000000 cmd ff ff 8bit x 8 bit
	fwc addr 40000055 cmd 98 98 8bit x 8 bit
	is= cmd 51(Q) addr 40000010 is= 80 51
	fwc addr 40000555 cmd 98 98 8bit x 8 bit
	is= cmd 51(Q) addr 40000010 is= 80 51
	fwc addr 40000000 cmd f0 f0f0 16bit x 8 bit
	fwc addr 40000000 cmd ff ffff 16bit x 8 bit
	fwc addr 400000aa cmd 98 9898 16bit x 8 bit
	is= cmd 51(Q) addr 40000020 is= 0000 5151
	fwc addr 40000aaa cmd 98 9898 16bit x 8 bit
	is= cmd 51(Q) addr 40000020 is= 0000 5151
	fwc addr 40000000 cmd f0 00f0 16bit x 16 bit
	fwc addr 40000000 cmd ff 00ff 16bit x 16 bit
	fwc addr 400000aa cmd 98 0098 16bit x 16 bit
	is= cmd 51(Q) addr 40000020 is= 0000 0051
	fwc addr 40000aaa cmd 98 0098 16bit x 16 bit
	is= cmd 51(Q) addr 40000020 is= 0000 0051
	fwc addr 40000000 cmd f0 f0f0f0f0 32bit x 8 bit
	fwc addr 40000000 cmd ff ffffffff 32bit x 8 bit
	fwc addr 40000154 cmd 98 98989898 32bit x 8 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 51515151
	fwc addr 40001554 cmd 98 98989898 32bit x 8 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 51515151
	fwc addr 40000000 cmd f0 00f000f0 32bit x 16 bit
	fwc addr 40000000 cmd ff 00ff00ff 32bit x 16 bit
	fwc addr 40000154 cmd 98 00980098 32bit x 16 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 00510051
	fwc addr 40001554 cmd 98 00980098 32bit x 16 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 00510051
	fwc addr 40000000 cmd f0 000000f0 32bit x 32 bit
	fwc addr 40000000 cmd ff 000000ff 32bit x 32 bit
	fwc addr 40000154 cmd 98 00000098 32bit x 32 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 00000051
	fwc addr 40001554 cmd 98 00000098 32bit x 32 bit
	is= cmd 51(Q) addr 40000040 is= 00000000 00000051
	fwrite addr 40000000 cmd f0 f0f0f0f0f0f0f0f0 64 bit x 8 bit
	fwrite addr 40000000 cmd ff ffffffffffffffff 64 bit x 8 bit
	fwrite addr 400002a8 cmd 98 9898989898989898 64 bit x 8 bit
	is= cmd 51(Q) addr 40000080 is= 0051005100510051 5151515151515151
	fwrite addr 40002aa8 cmd 98 9898989898989898 64 bit x 8 bit
	is= cmd 51(Q) addr 40000080 is= 0051005100510051 5151515151515151
	fwrite addr 40000000 cmd f0 00f000f000f000f0 64 bit x 16 bit
	fwrite addr 40000000 cmd ff 00ff00ff00ff00ff 64 bit x 16 bit
	fwrite addr 400002a8 cmd 98 0098009800980098 64 bit x 16 bit
	is= cmd 51(Q) addr 40000080 is= 0051005100510051 0051005100510051
	is= cmd 52(R) addr 40000088 is= 0052005200520052 0052005200520052
	is= cmd 59(Y) addr 40000090 is= 0059005900590059 0059005900590059
	device interface is 1
	found port 8 chip 2 port 64 bits chip 16 bits
	00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 04  QRY.. at .....'6...
	10 : 00 0a 00 05 00 04 00 17 01 00 00 00 01 7f 00 00  ................
	20 : 01 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff  ................
	fwrite addr 40000000 cmd f0 00f000f000f000f0 64 bit x 16 bit
	fwrite addr 40002aa8 cmd aa 00aa00aa00aa00aa 64 bit x 16 bit
	fwrite addr 40001550 cmd 55 0055005500550055 64 bit x 16 bit
	fwrite addr 40002aa8 cmd 90 0090009000900090 64 bit x 16 bit
	fwrite addr 40000000 cmd f0 00f000f000f000f0 64 bit x 16 bit
	fwrite addr 400002a8 cmd 98 0098009800980098 64 bit x 16 bit
	manufacturer is 2
	manufacturer id is 0x4
	device id is 0x22d7
	device id2 is 0x0
	cfi version is 0x3131
	size_ratio 4 port 64 bits chip 16 bits
	found 1 erase regions
	erase region 0: 0x0100007f
	erase_region_count = 128 erase_region_size = 65536
	fwrite addr 40000000 cmd f0 00f000f000f000f0 64 bit x 16 bit
	32 MB

The test from above with debug enabled looks like this:

	=> md 40300000 10 ; era 40300000 +1 ; md 40300000 ; echo ===== ; sleep 1 ; md 40300000
	40300000: 19852003 0000000c f060dc98 ffffffff    .. ......`......
	40300010: ffffffff ffffffff ffffffff ffffffff    ................
	40300020: ffffffff ffffffff ffffffff ffffffff    ................
	40300030: ffffffff ffffffff ffffffff ffffffff    ................

	fwrite addr 40302aa8 cmd aa 00aa00aa00aa00aa 64 bit x 16 bit
	fwrite addr 40301550 cmd 55 0055005500550055 64 bit x 16 bit
	fwrite addr 40302aa8 cmd 80 0080008000800080 64 bit x 16 bit
	fwrite addr 40302aa8 cmd aa 00aa00aa00aa00aa 64 bit x 16 bit
	fwrite addr 40301550 cmd 55 0055005500550055 64 bit x 16 bit
	fwrite addr 40300000 cmd 30 0030003000300030 64 bit x 16 bit
	flash_is_busy: 0
	. done
	Erased 1 sectors
	40300000: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
	40300010: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
	40300020: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
	40300030: 004c004c 00080008 004c004c 00080008    .L.L.....L.L....
	=====
	40300000: ffffffff ffffffff ffffffff ffffffff    ................
	40300010: ffffffff ffffffff ffffffff ffffffff    ................
	40300020: ffffffff ffffffff ffffffff ffffffff    ................
	40300030: ffffffff ffffffff ffffffff ffffffff    ................
	=> 

Why the heck does flash_is_busy() return 0 when the flashobviously is
still busy?

Thanks in advance.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Beware of bugs in the above code; I have only proved it correct, not
tried it."                                             - Donald Knuth


More information about the U-Boot mailing list