u-boot-brain/drivers
Wolfgang Denk 9abda6ba73 CFI Driver: Fix "flash not ready" problem
This patch fixes a problem on systems where the NOR flash is attached
to a 64 bit bus.  The toggle bit detection in flash_toggle() is based
on the assumption that the same flash address is read twice without
any other interjacent flash accesses.  However, on 32 bit systems the
function flash_read64() [as currently implemented] does not perform
an atomic 64 bit read - instead, this is broken down into two 32 bit
read accesses on addresses "addr" and "addr + 4".  So instead of
reading a 64 bit value twice from "addr", we see a sequence of 4 32
bit reads from "addr", "addr + 4", "addr", and "addr + 4".  The
consequence is that flash_toggle() fails to work.

This patch implements a simple, but somewhat ugly solution, as it
avoids the use of flash_read64() in this critical place (by breaking
it down manually into 32 bit read operations) instead of rewriting
flash_read64() such to perform atomic 64 bit reads as one could
expect.  However, such a rewrite would require the use of floating
point load operations, which becomes pretty complex:

	save MSR;
	set Floating Point Enable bit in MSR;
	use "lfd" instruction to perform atomic 64 bit read;
	use "stfd" to store value to temporary variable on stack;
	load u64 value from temporary variable;
	restore saved MSR;
	return u64 value;

The benefit-cost ratio of such an implementation was considered too
bad to actually attempt this, especially as we can expect that such
an implementation would not only have a bigger memory footprint but
also cause a performance degradation.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2008-10-31 11:32:53 +01:00
..
bios_emulator Fix the function conflict in x86emu when DEBUG is on 2008-10-17 01:14:37 +02:00
block Cleanup: fix "MHz" spelling 2008-10-21 11:25:39 +02:00
dma drivers/dma: Move conditional compilation to Makefile 2008-08-13 01:40:39 +02:00
hwmon rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
i2c Cleanup: fix "MHz" spelling 2008-10-21 11:25:39 +02:00
input rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
misc fsl_law clear enable before changing. 2008-10-18 21:54:05 +02:00
mmc rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
mtd CFI Driver: Fix "flash not ready" problem 2008-10-31 11:32:53 +01:00
net Cleanup: fix "MHz" spelling 2008-10-21 11:25:39 +02:00
pci powerpc: fix pci window initialization to work with > 4GB DRAM 2008-10-27 16:27:58 -05:00
pcmcia rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
qe rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
rtc rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
serial rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
spi rename CFG_ macros to CONFIG_SYS 2008-10-18 21:54:03 +02:00
usb Cleanup: fix "MHz" spelling 2008-10-21 11:25:39 +02:00
video atmel_lcdfb: Straighten out funky vl_sync logic 2008-10-25 20:33:32 +02:00