we're trying to change the nfc driver for the vybrid processor. Drivers for NFC in Uboot are already changed. This works already and I'm able to write my own ECC where I want it to be.
In linux kernel I try the same thing. I changed the driver to support our ECC and raw reads. The problem now is that I'm getting an error message when I try to boot.
We're using ubi as filesystem. I writing the filesystem into TargetFS by Uboot. Also I make a ubi partition etc. Then I write the ubifs image into my ubi partition.
Uncompressing Linux... done, booting the kernel.
Linux version 3.0.15-F+S+ (zeiler@VBFedora14) (gcc version 4.7.2 (crosstool-NG 1.18.0 - for F+S boards and modules) ) #189 Wed May 28 14:50:32 CEST 2014
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: F+S Elektronik Systeme GmbH, armStoneA5
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: console=ttymxc1,115200 login_tty=ttymxc1,115200 mtdparts=NAND:256k(NBoot)ro,768k(UserDef),256k(Refresh)ro,512k(UBoot)ro,256k(UBootEnv)ro,4m(Kernel)ro,-(TargetFS) rootfstype=ubifs ubi.mtd=TargetFS root=ubi0:rootfs ro init=linuxrc
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 254120k/254120k available, 8024k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xf4600000 - 0xffe00000 ( 184 MB)
vmalloc : 0x90800000 - 0xf2000000 (1560 MB)
lowmem : 0x80000000 - 0x90000000 ( 256 MB)
modules : 0x7f000000 - 0x80000000 ( 16 MB)
.init : 0x80008000 - 0x8002e000 ( 152 kB)
.text : 0x8002e000 - 0x80528000 (5096 kB)
.data : 0x80528000 - 0x8055c860 ( 211 kB)
.bss : 0x8055c884 - 0x80599a08 ( 245 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
MVF GPIO hardware
sched_clock: 64 bits at 132MHz, resolution 7ns, wraps every 34359ms
Console: colour dummy device 80x30
Calibrating delay loop... 262.96 BogoMIPS (lpj=1314816)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
mcf_edma: Initialized successfully
armStoneA5 Board Rev. 1.10
Using UART1 for UART port A (TXD/RXD/RTS/CTS)
Using UART2 for UART port B (TXD/RXD)
Using UART3 for UART port C (TXD/RXD)
Booting on CPU #0 CA5 r0p1 on port #2, 2 CPU(s)
Level 1 cache: I: 32768 Bytes/2 ways, D: 32768 Bytes/4 ways
Level 2 cache: 0 bytes/0 ways
IMX usb wakeup probe. id=1
IMX usb wakeup probe. id=0
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.4: using pins 119 (SDA) and 118 (SCL)
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource global_timer
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Static Power Management for Freescale Vybrid
PM driver module loaded
squashfs: version 4.0 (2009/01/31) Phillip Lougher
JFFS2 version 2.2. (NAND) (SUMMARY) Â© 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 496
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 100x60
fb0: Layer0 fb device registered successfully.
fb1: fb device registered successfully.
fb2: fb device registered successfully.
fb3: fb device registered successfully.
Serial: MVF driver
IMX UART RTS/CTS enabled
IMX UART FIFO enabled
imx-uart.1: ttymxc1 at MMIO 0x40028000 (irq = 94) is a IMX
console [ttymxc1] enabled
IMX UART FIFO enabled
imx-uart.2: ttymxc2 at MMIO 0x40029000 (irq = 95) is a IMX
IMX UART FIFO enabled
imx-uart.3: ttymxc3 at MMIO 0x4002a000 (irq = 96) is a IMX
brd: module loaded
loop: module loaded
at24 4-0050: 2048 byte 24c16 EEPROM, writable, 1 bytes/write
mvf-adc mvf-adc.0: attached adc driver
mvf-adc mvf-adc.1: attached adc driver
FSL NFC MTD nand Driver 1.0
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 0 at 0x000000000000
Bad eraseblock 14 at 0x0000001c0000
7 cmdlinepart partitions found on MTD device NAND
Creating 7 MTD partitions on "NAND":
0x000000000000-0x000000040000 : "NBoot"
0x000000040000-0x000000100000 : "UserDef"
0x000000100000-0x000000140000 : "Refresh"
0x000000140000-0x0000001c0000 : "UBoot"
0x0000001c0000-0x000000200000 : "UBootEnv"
0x000000200000-0x000000600000 : "Kernel"
0x000000600000-0x000008000000 : "TargetFS"
UBI: attaching mtd6 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. sequence number: 258
UBI: attached mtd6 to ubi0
UBI: MTD device name: "TargetFS"
UBI: MTD device size: 122 MiB
UBI: number of good PEBs: 976
UBI: number of bad PEBs: 0
UBI: number of corrupted PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 976
UBI: number of PEBs reserved for bad PEB handling: 9
UBI: max/mean erase counter: 4/1
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 530
Faraday DSPI DMA addr: Tx-0xffdff000[0x8a1ff000], Rx-0xffdfe000[0x8a1fe000]
DSPI: Coldfire master initialized
CAN device driver interface
flexcan netdevice driver
flexcan mvf-flexcan.0: device registered (reg_base=90920000, irq=90)
flexcan mvf-flexcan.1: device registered (reg_base=90928000, irq=91)
FEC Ethernet Driver
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 108, io base 0x400b4000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Freescale On-Chip EHCI Host Controller
usb usb1: Manufacturer: Linux 3.0.15-F+S+ ehci_hcd
usb usb1: SerialNumber: fsl-ehci.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ARC USBOTG Device Controller driver (1 August 2005)
gs_bind: controller 'fsl-usb2-udc' not recognized
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
fsl-usb2-udc: bind to driver g_serial
mousedev: PS/2 mouse device common for all mice
sx8655 3-0048: sx8655_probe()
sx8655 3-0048: write mask fail
sx8655: probe of 3-0048 failed with error -5
sx8655 3-0049: sx8655_probe()
sx8655 3-0049: write mask fail
sx8655: probe of 3-0049 failed with error -5
snvs_rtc snvs_rtc.0: rtc core: registered snvs_rtc as rtc0
i2c /dev entries driver
Linux video capture interface: v2.00
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v1.1.0)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci sdhci-esdhc-imx.1: no write-protect pin available!
mmc0: SDHCI controller on platform [sdhci-esdhc-imx.1] using ADMA
i2c-core: driver [pca9632] using legacy suspend method
i2c-core: driver [pca9632] using legacy resume method
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
sgtl5000 4-000a: sgtl5000 revision 17
asoc: sgtl5000 <-> mvf-sai.0 mapping ok
ALSA device list:
TCP cubic registered
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
can: broadcast manager protocol (rev 20090105 t)
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 2 part 30 variant 5 rev 1
g_serial gadget: high speed config #2: CDC ACM config
snvs_rtc snvs_rtc.0: setting system clock to 1970-01-01 05:52:58 UTC (21178)
UBIFS error (pid 1): ubifs_recover_master_node: failed to recover master node
List of all partitions:
1f00 256 mtdblock0 (driver?)
1f01 768 mtdblock1 (driver?)
1f02 256 mtdblock2 (driver?)
1f03 512 mtdblock3 (driver?)
1f04 256 mtdblock4 (driver?)
1f05 4096 mtdblock5 (driver?)
1f06 124928 mtdblock6 (driver?)
No filesystem could mount root, tried: ubifs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[<80036b00>] (dump_backtrace+0x0/0x108) from [<804096d8>] (dump_stack+0x18/0x1c)
r6:800254e8 r5:8ffed006 r4:8055cee0 r3:60000013
[<804096c0>] (dump_stack+0x0/0x1c) from [<80409a50>] (panic+0x5c/0x17c)
[<804099f4>] (panic+0x0/0x17c) from [<80008dd8>] (mount_block_root+0x1d4/0x218)
r3:8ffcff3c r2:804b9c5d r1:8ffcff68 r0:804af8ed
[<80008c04>] (mount_block_root+0x0/0x218) from [<80009080>] (prepare_namespace+0x94/0x1c0)
[<80008fec>] (prepare_namespace+0x0/0x1c0) from [<800089ec>] (kernel_init+0xf0/0x11c)
[<800088fc>] (kernel_init+0x0/0x11c) from [<8004ae74>] (do_exit+0x0/0x5f8)
Seems that first ubi reads the whole Filesystempartition and then reads one block completely. So I get these error messages and a stack_dump.
Reading the pages from nand also seems to be ok and when I look at my ecc status flag everything is ok. we also check on empty pages. but we notice them and don't throw errors on that.
Does anyone know how to solve this? I have no idea!!!!
I could build a rootfs.ubi image in buildroot. I write it with "nand write $loadaddr TargetFS $filesize" into nand. Now the kernel starts and boots. Also the kernel is able to mount rootfs. When I reboot the system it is working again.
But when I just mount my filesystem with rw I get read errors in next boot.
Seems that ubi write here something into fs...
I suggest you at least look at the driver I referenced above. You use hardware ECC, and the stock TimeSys driver has some errors; like it never actually tested that the ECC failed and hence when flash wears, it will report it good when it is really bad. With the hardware ECC, you don't have a choice where it is placed. The controller will write it automatically at the end of the OOB data. It sounds like you have the reading working, but when you write, the hardware ECC may place data at the wrong point. It is helpful to use nanddump with the oob information to get what the controller hw ecc wrote (and where). The hardware ECC may attempt to correct data and fail. It reports the status, which the stock Timesys driver doesn't handle because of the endian issue (see link above). So, if the hardware ECC is not working, the first write/read may give some corrupt data, even though the MTD driver reports nothing. Also, I am not sure about sub-page handling with the TimeSys (originally by Freescale) driver, which UBI/UbiFS wants to use. This will also come into play on the first writes.
thanks for reply.
We use custom boards. The thing is that we wanted to use hardware ecc with our own layout. The former UBoot driver of nfc could only write with ecc. Besides this I changed the layout but nothing has changed. I saw some changes in the oob area when I set ecc to 24bit ecc. But I couldn't see anything usefull in the oob. After I made some changes in the driver I could write raw and also I could set ecc to right place. We want ecc to start on byte 2052. We use 2k pages. So 2048 byte data + 4 byte BadBlockMarker etc. + 30Byte ecc and behind that some other stuff. We use 16bit ecc with 30byte length.
So these changes looked good to me.
I made also some changes in the linux kernel to be able to read the right ecc position, etc.
I use the "nand write $loadaddr Kernel $filesize" command to write linux kernel in uboot into Kernel partition. Then I run "ubi part TargetFS" to select TargetFS as Filesystem partition. After that I create a ubi intern partition called "rootfs" with command "ubi create rootfs". Into this "rootfs" I write the rootfs.ubifs Image which was build by buildroot. I use the command "ubi write $loadaddr rootfs $filesize".
Now, when I boot the linux kernel gets loaded and starts booting. Then I get the output which I posted above. I also print some pages and oob areas at bootup and also printed the ecc status byte. and this byte shows no errors. So I assume that the ubi partition should be read correctly?!?!
Do I have to configure something in my buildroot?? Is it possible that ubi writes into oob area? maybe I have some trouble there and it overwrites something?
It definitely looks as if the Linux MTD's ECC doesn't agree with the U-Boot ECC. For instance, I have the same message if I write a UBI partition with Software-ECC and then mount with Hardware-ECC. Here is some conversation with Stefan Agner and I,
Stefan provides a link to 'U-boot' there that has an updated driver and there are other links to a Linux mainline driver. It is fairly easy to back-port to the TimeSys kernel. I think there are definite bugs/issues with the TimeSys version you seem to be using. These community links might also be useful,
I would compile the mtdtests as modules and load them to see if you have any issues. Are you using the tower board or custom hardware? Also, this statement seems wrong,
Then I write the ubifs image into my ubi partition.
Maybe I take it too literally. You need to run 'ubinize' to convert a 'ubifs' image to a 'ubi' image. So, from an initial directory, run 'mkfs.ubifs' and then on that image, run 'ubinize'. This image can be written to flash using 'nandwrite' or other similar raw flashers. I think UBI support is in some versions of u-boot, but if you wrote the wrong data, then the UBI headers will not be found and a similar error message will be printed.
UBI: max/mean erase counter: 4/1
I guess this means it is not your issue, it seems that something found some UBI headers to get an erase count of '4'.
Boot from an MMC card, if on the tower board, or create an initramfs (buildroot/klibc) and then you can probe the ubifs root partition from the ram disk.
Did you try to install your ubi volume from linux (not from u-boot) ?
Then mount ubi to see if it works.
You can also use nand write.trimffs with u-boot to install ubi volume. U-boot must be compiled with CONFIG_CMD_NAND_TRIMFFS option.