Hi all,
The last week I finished to build my AT91SAM9260 based custom board. I have some problems and questions, I hope someone will have idea because I am blocked since 2-3 days.
My board is largely inspired from the AT91SAM9260-EK board.
The 3 majors differences are :
1) My 64MB SDRAM are two MT48LC32M8 chips,
connected with 16 bits databus to the processor. On my board I need a lot of GPIO thus I need D16 to D31 to be GPIO
2) My Nand flash is a 512MB (4Gb) from ST (NAND04GW3B2DN6E). The ready/busy pin of the Nand is connected to
PB16 and not PC13.
3) My ethernet Phy is a DP83848I from National, and the interrupt line is connected on PA22 (this phy has no ETXER, I don't know why).
On my board I want to reserve the Nand memory to store kernel image and rootfs, thus the bootstrap, uboot and uboot's environnement are stored in the dataflash, a AT45DB161 connected on NPCS1.
Here is what I done in the bootstrap sources :- Modify the sdram init procedure to use a 16 bits bus and do not set D16-D32 as peripheral mode
- Change debug baudrate to 57600 bauds (I don't know why but my pcmcia/seriall adapter on my laptop don't work at 115200)
My modification works well I am able to load u-boot in SDRAM and execute him successfully, thus I have not problem with the bootstrap
Here is what I done in the uboot sources :- Modify board/at91sam9260ek/nand.c to use PB16 and not PC13 as ready/busy input pin
- Modify include/configs/at91sam9260ek.h to say uboot environnement is in dataflash
- Modify AT91C_SPI_CS1_CLK in cpu/arm926ejs/at91sam926x/spi.c to have 5Mhz instead of 33Mhz, because my AT45DB161 was not found (This dataflash works at max 13Mhz), and change baudrate to 57600 bauds (I don't know why but my pcmcia/seriall adapter on my laptop don't work at 115200)
- Create a DP83848.c and DP83848.h to support my Phy. In fact I copied the dm9161a.c and dm9161a.h and I just modified names and the OUI value in the DP83848.h
My modications works well, nand flash is detected, dataflash is detected, and Phy is detected.
I can save uboot env successfully in dataflash. I can also successfully download kernel and image by tftp, but I found that the download speed is not very rapid. I download a 13MB rootfs image in 12-13sec, thus approx 1MB/s. Is it a normal download speed ? Someone can tell me the dowload speed of his board ?
Here is what I done in the linux kernel sources :- First I installed official 2.6.25 kernel sources, and applied 2.6.25-at91.patch.gz patchs from linux4sam.org
- I done a make mrproper, and a make ARCH=arm at91sam9260ek_defconfig
- I compiled the kernel with a make ARCH=arm CROSS_COMPILE=arm-linux- , to see if everything was OK. The compilation was successfull.
- After I modified the kernel configuration (make ARCH=arm xconfig) to activate MTD and nand flash support with Hardware ECC, MTD partionning support, ext2 support, ext3 support, and jffs2 support.
- I changed the boot cmd line to : mem=64M console=ttyS0,57600 root=/dev/mtd1 rw
- I modified the arch/arm/mach-at91/board-sam9260ek.c file to change the nand ready/busy pin(PB16 in my case) and the PHY interrupt pin (PA22 in my case).
For now I don't put any root filesystem in the flash, the first thing I want to do is to verify that kernel boot correctly and see my nand flash.
Here is what I do :
U-Boot> nand erase
--> Reboot
U-Boot> nand bad
Device 0 bad blocks:
0d820000
0d860000
U-Boot> tftp 21000000 uImage
--> it's my compiled kernel, I done a mkimage on it.
U-Boot> bootm 21000000
--> kernel startup :
kernel in minicom wrote:
Uncompressing Linux................................................................................ done, booting the kernel.
Linux version 2.6.25 (nlc@nlcLaptop) (gcc version 3.4.3) #9 Fri Nov 28 14:21:36 CET 2008
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: Atmel AT91SAM9260-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: mem=64M console=ttyS0,57600 root=/dev/mtd1 rw
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62360KB available (2236K code, 159K data, 108K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL
brd: module loaded
ssc ssc.0: Atmel SSC device at 0xc4860000 (irq 14)
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffc4000 irq 21 (00:50:c2:43:b0:01)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
Driver 'sd' needs updating - please use bus_type methods
NAND device: Manufacturer ID: 0x20, Chip ID: 0xdc (ST Micro NAND 512MiB 3,3V 8-bit)
AT91 NAND: 8-bit, <NULL> ECC
Scanning device for bad blocks
Bad eraseblock 1729 at 0x0d820000
Bad eraseblock 1731 at 0x0d860000
Creating 2 MTD partitions on "NAND 512MiB 3,3V 8-bit":
0x00000000-0x00040000 : "Partition 1"
0x00040000-0x20000000 : "Partition 2"
usbmon: debugfs is not available
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 20, io mem 0x00500000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
at91sam9_wdt: invalid timeout (must be between 1 and 16)
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Cannot open root device "mtd1" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
0100 8192 ram0 (driver?)
0101 8192 ram1 (driver?)
0102 8192 ram2 (driver?)
0103 8192 ram3 (driver?)
0104 8192 ram4 (driver?)
0105 8192 ram5 (driver?)
0106 8192 ram6 (driver?)
0107 8192 ram7 (driver?)
0108 8192 ram8 (driver?)
0109 8192 ram9 (driver?)
010a 8192 ram10 (driver?)
010b 8192 ram11 (driver?)
010c 8192 ram12 (driver?)
010d 8192 ram13 (driver?)
010e 8192 ram14 (driver?)
010f 8192 ram15 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
My nand flash is detected correctly. But I have a problem, the nand scan for bad block listing is very long, it takes more than 60sec !! uboot only takes 3-4sec to do that. Why scanning is very long and how reduce this time ?
Now I want to put a jffs2 file system in the nand flash but I have a big problem, every time I write something in the flash from uboot, the blocks are seen as bads a the next uboot restart or even in the kernel message when nand is scanned !!
Example :
uboot in minicom wrote:
U-Boot> nand bad
Device 0 bad blocks:
0d820000
0d860000
U-Boot> tftp 21000000 uImage
[...]
U-Boot> nand write 21000000 0 12d800
NAND write: device 0 offset 0x0, size 0x12d800
1234944 bytes written: OK
-->reboot
U-Boot> nand bad
uboot in minicom wrote:
Device 0 bad blocks:
00000000
00020000
00040000
00060000
00080000
000a0000
000c0000
000e0000
00100000
00120000
0d820000
0d860000
And if for exemple I do a nand erase clean, at the next uboot restart
all blocks are marked as bad if I launch the "nand bad" command, or if I boot the linux kernel.
Any idea where the problem can come from ?
Sorry for my long message and my poor english
To resume my question :
- What is your dowload speed with tftp in uboot ?
- Why the bad block scanning is very long in linux (>60sec) compared to uboot (only 3-4sec)
- Why blocks are considered bad at next startup when I write into it with uboot (and ther is no write error !)
Regards