X-loader SDRAM errors on Rev C2

Hi,

I'am trying to set up a boot process for an EBVBeagle rev. C2, but I'm
stuck at what looks like a RAM settings issue in X-loader.

X-loader is Sakoman's version,
git://gitorious.org/x-load-omap3/mainline.git, built using Codesourcery
2009q3 as:

$ git remote -v
origin git://gitorious.org/x-load-omap3/mainline.git
$ git checkout master
Already on 'master'
$ make mrproper
$ make omap3530beagle_config
$ make
$ ../omap-u-boot-utils/gpsign -f x-load.bin

I write in NAND:
- X-loader at address 0
- U-boot-v1 at address 0x80000.

After reboot I get on the debug serial:

Texas Instruments X-Loader 1.4.2 (Dec 21 2009 - 17:52:02)
Loading u-boot.bin from nand
ECC Failed, page 0x00080000
12 0 0 ea 14 f0 bf 65 14 f0 9f e5 14 f0 9f 65 14 f0 9f e5 14 f0 bf 65 14
f0 9f e5 14 f0 3f 65 40 1 e8 80 a0 1 e8 0 0 2 e8 80 60 2 e8 0 c0 2 e8 80
20 3 e8 0 80 3 e8 80 78 56 34 12 0 0 e8 80 0 0 e8 0 58 b2 ea 80 68 c5 ed
0 0 0 f e1 1f 0 60 63 d3 0 80 e3 0 f0 29 61 68 0 4f e2 4 0 80 62 40 20
a0 e3 2 20 a0 60 1 11 a0 e3 2 36 a0 63 3 10 81 e0 3e 3b a0 63 3 10 81 e0
d8 7 30 68 f8 7 a1 e8 2 0 70 61 fb ff ff 1a a4 5 0 6b 19 0 0 eb a4 0 6f
e2 68 10 1f e5 1 0 70 61 7 0 0 a 50 20 3f 65 70 30 1f e5 2 20 63 60 2 20
80 e0 d8 7 b0 68 f8 7 a1 e8 2 0 70 61 fb ff ff da 94 0 3f 65 1 7 40 e2
80 0 60 62 c d0 40 e2 7 d0 ed 63 a0 0 1d e5 80 10 3f 65 0 20 a0 e3 0 20
20 65 1 0 50 e1 4 0 a0 62 fb ff fd 1a 4 f0 1f 65

And nothing else.
Note that if I reboot (without re-writing NAND), the result is the same
but the error is reported at different addresses: 0x00080300,
0x00080100... always a multiple of 256 anyway. In the cases when the
address is the same, the content bytes are not identical, but similar.

I've set up a trivial sdram test before NAND loading (patch below) and
it shows a lot of errors:

Texas Instruments X-Loader 1.4.2 (Dec 22 2009 - 12:23:29)
err addr=80008098 i=004c read=004a
err addr=80008128 i=0094 read=febf
err addr=8000812c i=0096 read=fc9f
err addr=80008130 i=0098 read=ffef
err addr=80008134 i=009a read=bf5f
err addr=80008138 i=009c read=7d9f
err addr=8000813c i=009e read=ef8f
err addr=80008140 i=00a0 read=deff
err addr=80008144 i=00a2 read=fedf
err addr=80008148 i=00a4 read=6fff
err addr=8000814c i=00a6 read=df96
err addr=80008150 i=00a8 read=dcff
err addr=80008154 i=00aa read=efff
err addr=80008158 i=00ac read=eeeb
...

Does X-loader need modifications to work with Beagle C2, which has
different SDRAM hardware than rev.B?
It seems like all the relevant commits in Sakoman's X-loader git tree
are dated before rev.C was out.

The hardware of the SDRAM seems to be OK anyway: the images at
http://elinux.org/BeagleBoard#Binaries work perfectly (from MMC).

PS:
In the spirit of adventure, I replaced the whole content of
config_3430sdram_ddr() (board/.../omap3530beagle.c) with the content of
config_3430sdram_ddr() from overo.c.
The SDRAM test now completes without errors! (but NAND ECC errors are
still there)
Does this give any hint?

Thanks in advance,
Luca

SDRAM tests patch follows

lib/board.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/lib/board.c b/lib/board.c
index a3b8369..2c25521 100644
--- a/lib/board.c
+++ b/lib/board.c
@@ -70,6 +70,25 @@ init_fnc_t *init_sequence[] = {
NULL,
};

+#define COUNT 1024
+static void ram_test(unsigned short *addr)
+{
+ int i;
+ unsigned short val;
+ for (i=0; i<COUNT; i+=2)
+ {
+ *(addr+i) = i;
+ }
+ for (i=0; i<COUNT; i+=2)
+ {
+ val = *(addr+i);
+ if (val != i)
+ {
+ printf("err addr=%08x i=%04x read=%04x\n", addr+i, i, val);
+ }
+ }
+}