Barebox on mini2440 256MB

microcris
Hi there :)

Is there anyone able to run the barebox (trunk or other recent version) on
the mini2440 with 256MB nand?

I'm able to run it from RAM but I'm unable to boot it from NAND

Here it is what I did:
********************************
Compiling the barebox:

made some changes in the arch/arm/boards/friendlyarm-mini2440/env/config
file

make friendlyarm_mini2440_defconfig

make menuconfig

make
*******************************
Lodad the barebox.bin to the mini2440:

put the S2 connector in NOR position
RESET
pushed the "x" option on vivi

Enter your selection: x
Found block size = 0x00020000
Erasing...    ... done
Writing...    ... done
Written 49152 bytes
Saved vivi private data


RESET again
pushed the "q" option on vivi

Supervivi> load ram 0x32000000 206420 u
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:32000000h,TOTAL:206430]
RECEIVED FILE SIZE:  206430 (201KB/S, 1S)
Downloaded file at 0x32000000, size = 206420 bytes

Supervivi> go 0x32000000
go to 0x32000000
  argument 0 = 0x00000000
  argument 1 = 0x00000000
  argument 2 = 0x00000000
  argument 3 = 0x00000000

barebox 2013.07.0-00228-gf457f68-dirty #13 Mon Jul 8 12:19:15 WEST 2013

Board: Mini 2440

nand: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V
8-bit), page size: 2048, OOB size: 64
nand: Bad block table not found for chip 0
nand: Bad block table not found for chip 0
nand: Scanning device for bad blocks
nand: Bad eraseblock 205 at 0x019a0000
nand: Bad eraseblock 570 at 0x04740000
nand: Bad eraseblock 2013 at 0x0fba0000
dm9000 dm90000: Found DM9000E at i/o: 0x20000300
mdio_bus: miibus0: probed
s3c_mci s3c_mci0: registered as s3c_mci0
malloc space: 0x31bf8000 -> 0x31ff7fff (size 4 MiB)
refclk:    12000 kHz
mpll:     405000 kHz
upll:      48000 kHz
fclk:     405000 kHz
hclk:     101250 kHz
pclk:      50625 kHz
SDRAM1:   CL4@101MHz
SDRAM2:   CL4@101MHz
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...
set parameter: Invalid argument
Hit any key to stop autoboot:  2
mini2440:/ 
mini2440:/ saveenv
saving environment
mini2440:/ update -t barebox -d nand
set parameter: Invalid argument
warning: No MAC address set. Using random address F2:14:71:AE:1E:F0
100Mbps full duplex link detected
DHCP client bound to address 10.42.0.73
host 10.42.0.1 is alive

erasing partition /dev/nand0.barebox.bb

flashing barebox.bin to /dev/nand0.barebox.bb
  [                                                                 ]
  [#################################################################
mini2440:/ 
mini2440:/ nand_boot_test 0x31000000 0x40000
mini2440:/ go 0x31000000
## Starting application at 0x31000000 ...

barebox 2013.07.0-00228-gf457f68-dirty #13 Mon Jul 8 12:19:15 WEST 2013

Board: Mini 2440

nand: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V
8-bit), page size: 2048, OOB size: 64
dm9000 dm90000: Found DM9000E at i/o: 0x20000300
mdio_bus: miibus0: probed
s3c_mci s3c_mci0: registered as s3c_mci0
malloc space: 0x31bf8000 -> 0x31ff7fff (size 4 MiB)
refclk:    12000 kHz
mpll:     405000 kHz
upll:      48000 kHz
fclk:     405000 kHz
hclk:     101250 kHz
pclk:      50625 kHz
SDRAM1:   CL4@101MHz
SDRAM2:   CL4@101MHz
running /env/bin/init...
set parameter: Invalid argument
Hit any key to stop autoboot:  2
mini2440:/ 

that step 
mini2440:/ nand_boot_test 0x31000000 0x40000
mini2440:/ go 0x31000000
is to check if the downloaded image is alright... and as we can see, it is
alright.

Now, I put the S2 in NAND position, RESET and nothing happens :(

What am I doing wrong?

Thank you for any help that you can provide.

pgm
Hello,

I have the same problem with my board (EM2440-III witch is very similar to
mini2440)
Barebox is really great soft but in my case it cannot read/write to nand
and even mmc doesn't work :(
(I've tested many bb versions since 2011 and nand driver every time returns
'err -74')

My goal was to load kernel 3.8.13 and here is my solution:

U-Boot  
  - it can    read/write to nand and load barebox 
  - it cannot load kernel 3.x 
barebox 
  - it cannot boot from nand because its nand driver doesn't work
  - it cannot read/write to nand and mmc
  - it can load kernel 3.x 

My board nand partitions looks like this.

nandflash0:256k@0(bios),128k(params),128k(toc),512k(eboot),1024k(logo),2m(kernel
),-(root)

bios = u-boot 

1. write barebox.bin to eboot

tftp 0x31000000 barebox.bin; 
nand erase eboot
nand write.e 0x31000000 eboot $(filesize)

2. write zImage to kernel

tftp 0x31000000 zImage
nand erase kernel
nand write.e 0x31000000 kernel $(filesize)


3. u-boot boot command:
nand read.e 0x31000000 eboot 40000; nand read.e 0x32000000 kernel 200000;
go 0x31000000 

it simply loads barebox.bin to 0x31000000 and kernel to 0x32000000 for
barebox and then starts barebox 

4. here is barebox env/bin/init 

#copy file loaded via u-boot from memory addr 0x32000000 to /zImage 

memcpy -b 0x32000000 -d /zImage 0 2097152

bootm zImage 

5. Please note that my rootfs in on mmc but the it also can be on nand
(kernel MTD driver works fine)



U-Boot 1.3.2-mini2440 (Jul 24 2013 - 20:16:17)
I2C:   ready
DRAM:  64 MB
Flash:  0 kB
NAND:  64 MiB
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0


barebox 2013.07.0 #33 Wed Jul 24 20:39:52 CEST 2013
Board: Mini 2440
nand: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit),
page size: 512, OOB size: 16
dm9000 dm90000: Found DM9000E at i/o: 0x20000300
mdio_bus: miibus0: probed
s3c_mci s3c_mci0: registered as s3c_mci0
malloc space: 0x31a00000 -> 0x31dfffff (size 4 MiB)
refclk:    12000 kHz
mpll:     405000 kHz
upll:      48000 kHz
fclk:     405000 kHz
hclk:     101250 kHz
pclk:      50625 kHz
SDRAM1:   CL2@101MHz
SDRAM2:   CL2@101MHz
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...

Loading OS arm Linux zImage 'zImage'
commandline: noinitrd mini2440=0 console=ttySAC0,115200 mem=128M
root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4 init=/init
arch_number: 1999
Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.8.13-svn37436 (user@linux) (gcc version
4.6.4 (OpenWrt/Linaro GCC 4.6-2012.12 r37481) ) #19 Thu Jul 25 08:22:52
CEST 2013
[    0.000000] S3C24XX Clocks, Copyright 2004 Simtec Electronics
[    0.000000] Kernel command line: noinitrd mini2440=0
console=ttySAC0,115200 mem=128M root=/dev/mmcblk0p2 rw rootwait
rootfstype=ext4 init=/init
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] __ex_table already sorted, skipping sort
[    0.000000] Memory: 128MB = 128MB total
[    0.000000] Memory: 125700k/125700k available, 5372k reserved, 0K
highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc03a4e4c   (3700 kB)
[    0.000000]       .init : 0xc03a5000 - 0xc03c0c98   ( 112 kB)
[    0.000000]       .data : 0xc03c2000 - 0xc03eddcc   ( 176 kB)
[    0.000000]        .bss : 0xc03eddcc - 0xc041bc24   ( 184 kB)
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
[    0.000000] NR_IRQS:85
[    0.000000] sched_clock: 32 bits at 200 Hz, resolution 5000000ns, wraps
every 4294967291ms
[    0.000000] Console: colour dummy device 80x30
[    0.005000] Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
[    0.050000] pid_max: default: 32768 minimum: 301
[    0.050000] Mount-cache hash table entries: 512
[    0.050000] CPU: Testing write buffer coherency: ok
[    0.050000] Setting up static identity map for 0x3000e460 - 0x3000e4b8
[    0.055000] NET: Registered protocol family 16
[    0.060000] DMA: preallocated 256 KiB pool for atomic coherent
allocations
[    0.060000] MINI2440: Option string mini2440=0
[    0.060000] MINI2440: LCD [0:240x320] 1:800x480 2:1024x768 3:320x240
[    0.075000] bio: create slab <bio-0> at 0
[    0.080000] usbcore: registered new interface driver usbfs
[    0.080000] usbcore: registered new interface driver hub
[    0.080000] usbcore: registered new device driver usb
[    0.080000] s3c-i2c s3c2440-i2c.0: slave address 0x10
[    0.080000] s3c-i2c s3c2440-i2c.0: bus frequency set to 98 KHz
[    0.080000] s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
[    0.105000] NET: Registered protocol family 2
[    0.105000] TCP established hash table entries: 1024 (order: 1, 8192
bytes)
[    0.105000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.105000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.105000] TCP: reno registered
[    0.105000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.105000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.105000] NET: Registered protocol family 1
[    0.140000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.140000] jffs2: version 2.2 (NAND) (ZLIB) (RTIME) (c) 2001-2006 Red
Hat, Inc.
[    0.140000] Block layer SCSI generic (bsg) driver version 0.4 loaded
(major 252)
[    0.145000] io scheduler noop registered
[    0.145000] io scheduler deadline registered
[    0.145000] io scheduler cfq registered (default)
[    0.285000] s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a
S3C2440
[    0.485000] console [ttySAC0] enabled
[    0.490000] s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a
S3C2440
[    0.500000] s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a
S3C2440
[    0.515000] loop: module loaded
[    0.515000] at24 0-0050: 1024 byte 24c08 EEPROM, writable, 16
bytes/write
[    0.520000] s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns,
Twrph1=2 19ns
[    0.525000] s3c24xx-nand s3c2440-nand: NAND soft ECC
[    0.530000] NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung
NAND 64MiB 3,3V 8-bit), 64MiB, page size: 512, OOB size: 16
[    0.535000] Creating 4 MTD partitions on "nand":
[    0.540000] 0x000000000000-0x000000040000 : "u-boot"
[    0.545000] 0x000000040000-0x000000060000 : "u-boot-env"
[    0.550000] 0x000000060000-0x000000560000 : "kernel"
[    0.565000] 0x000000560000-0x000004000000 : "root"
[    0.680000] dm9000 Ethernet Driver, V1.31
[    0.680000] dm9000 dm9000: read wrong id 0x09090909
[    0.685000] eth0: dm9000e at c889a300,c889c304 IRQ 51 
[    0.690000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.700000] s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
[    0.700000] s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned
bus number 1
[    0.705000] s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
[    0.770000] hub 1-0:1.0: USB hub found
[    0.770000] hub 1-0:1.0: 2 ports detected