[U-Boot] Generic CFI flash driver is not so generic?

Wolfgang Denk wd at denx.de
Wed Nov 26 10:58:48 CET 2008


Dear "Choe, Hyun-ho",

In message <1227678669.15327.62.camel at hades.legend.co.kr> you wrote:
> I did several tests for my b'd that has CFI Nor erase/write problem.
> 
> My main problem is that flash_toggle() function doesn't work properly,
> it always returns 0 even while bus writing operation is proceeding.
> I mean, toggle bit doesn't toggle for each read operation. (refer to
> drivers/mtd/cfi_flash.c)

Similar problems have been reported before - please see for example
http://lists.denx.de/pipermail/u-boot/2008-October/042036.html

> I found two workarounds.
> 
> First, small waiting between each read. So, following code doesn't work.
> 
> <SNIP>
> retval = flash_read16(addr) != flash_read16(addr);
> <SNIP>

Eventually you are not performing atomic 16 bit read operations.

> But, following code does work.
> 
> <SNIP>
> u16 d = flash_read16(addr);
> udelay(1);
> u16 t = flash_read16(addr);
> retval = d != t;

Hm... a plain delay would probably not change this behaviour unless
you have another problem.

> I don't know exactly that this is caused by specific bus access
> mechanism, or simply chip silicon bug.

I think the problem is that for some reason flash_read16() might  not
result  in  16bit  bus  accesses. Do you have a chance to verify this
suspicion, for example with a logic analyzer?

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
Never ascribe to malice that which can  adequately  be  explained  by
stupidity.


More information about the U-Boot mailing list