]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
MPC5200: workaround data corruption for unaligned local bus accesses
authorWolfgang Denk <wd@denx.de>
Mon, 21 Jun 2010 20:29:59 +0000 (22:29 +0200)
committerWolfgang Denk <wd@denx.de>
Wed, 23 Jun 2010 00:09:20 +0000 (02:09 +0200)
commit460c2ce362e56890c2a029e2c3b1ff2796c7fc54
tree625be474d895469685f41febbe93f278542076f3
parent47ea6edfb3004fb2d2a979e19c3f6e4e32f45e51
MPC5200: workaround data corruption for unaligned local bus accesses

The MPC5200 has a nasty problem that will cause silent data corruption
when performing unaligned 16 or 32 byte accesses when reading from the
local bus - typically this affects reading from flash. The problem can
be easily shown:

=> md fc0c0000 10
fc0c0000323e4337 01626f6f 74636d64 3d72756e    2>C7.bootcmd=run
fc0c0010206e6574 5f6e6673 00626f6f 7464656c     net_nfs.bootdel
fc0c002061793d35 00626175 64726174 653d3131    ay=5.baudrate=11
fc0c003035323030 00707265 626f6f74 3d656368    5200.preboot=ech
=> md fc0c0001 10
fc0c000165636801 00000074 0000003d 00000020    ech....t...=...
fc0c00110000005f 00000000 00000074 00000061    ..._.......t...a
fc0c002100000000 00000064 00000065 00000035    .......d...e...5
fc0c003100000000 00000062 0000003d 0000006f    .......b...=...o
=> md.w fc0c0001 10
fc0c0001: 0000 3701 0000 6f74 0000 643d 0000 6e20    ..7...ot..d=..n
fc0c0011: 0000 745f 0000 7300 0000 6f74 0000 6c61    ..t_..s...ot..la

This commit implements a workaround at least for the most blatant
problem: using memcpy() from NOR flash. We rename the assembler
routine into __memcpy() and provide a wrapper, which will use a
byte-wise copy loop for unaligned source or target addresses when
reading from NOR flash, and branch to the optimized __memcpy()
in all other cases, thus minimizing the performance impact.

Tested on lite5200b and TQM5200S.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
arch/powerpc/cpu/mpc5xxx/Makefile
arch/powerpc/cpu/mpc5xxx/memcpy_mpc5200.c [new file with mode: 0644]
arch/powerpc/lib/Makefile