All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Generic CFI flash driver is not so generic?
@ 2008-11-26  5:51 Choe, Hyun-ho
  2008-11-26  9:58 ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Choe, Hyun-ho @ 2008-11-26  5:51 UTC (permalink / raw)
  To: u-boot

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)

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>

But, following code does work.

<SNIP>
u16 d = flash_read16(addr);
udelay(1);
u16 t = flash_read16(addr);
retval = d != t;
<SNIP>

I tried to increase read wait cycle to maximum which my chip allows, but
has no effect. Only waiting small period between each read can solve the
problem.


Second workaround, I defined slightly modified version of
flash_read_word() functions like following:

<SNIP>
static inline ushort flash_read_one_word (flash_info_t * info,
flash_sect_t sect, uint offset)
{
	ushort *addr, retval;

	addr = flash_map (info, sect, offset);
	retval = flash_read16 (addr);
	flash_unmap (info, sect, offset, addr);
	return retval;
}
<SNIP>

And flash_toggle() function is changed like this:

<SNIP>
retval = flash_read_one_word(info, sect, offset) !=
flash_read_one_word(info, sect, offset);
<SNIP>

This trick works perfectly on my board, without any delay.
I don't know exactly that this is caused by specific bus access
mechanism, or simply chip silicon bug.

flash_read_uchar(), flash_read_word() can be modified to get another
parameter for sector. (flash_read_long() already gets sector)
And, flash_read_long_long() function may needs to be defined.

What do you think about this? Is there any side effect between each
platform?

Regards,
Choe, Hyun-ho

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

end of thread, other threads:[~2008-11-26 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-26  5:51 [U-Boot] Generic CFI flash driver is not so generic? Choe, Hyun-ho
2008-11-26  9:58 ` Wolfgang Denk
2008-11-26 12:23   ` Choe, Hyun-ho
2008-11-26 15:10     ` Michael Lawnick
2008-11-26 15:33       ` Choe, Hyun-ho

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.