OpenNuvoton/NUC980-linux-4.4.y

can not mount UBIFS file system with devicetree

lampl92 opened this issue · 1 comments

File system can not mount when use UBIFS file system on NK-980IOT-V1.0
i also attach buildroot, uboot, kernel, device tree, ubinize config, could you please help me to figure out?

config.zip

Check ubi partition in uboot

=> mtdparts

device nand0 , # parts = 4
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: kernel 0x00700000 0x00200000 0
2: device-tree 0x00100000 0x00900000 0
3: rootfs 0x07000000 0x01000000 0

active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000

defaults:
mtdids : nand0=nand0
mtdparts: mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)
=> ubi part user
incorrect device type in user
Partition user not found!
=> ubi part rootfs
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=3", size 112 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 896, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1067416621
ubi0: available PEBs: 0, total reserved PEBs: 896, PEBs reserved for bad PEB handling: 20
=>

Linux kernel bootlog

=> boot
jedec aa21SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
device 0 offset 0x200000, size 0x800000
SF: 8388608 bytes @ 0x200000 Read: OK
device 0 offset 0x900000, size 0x100000
SF: 1048576 bytes @ 0x900000 Read: OK

Booting kernel from Legacy Image at 00007fc0 ...

Image Name: Linux-4.4.289
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2789352 Bytes = 2.7 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK

Flattened Device Tree blob at 01400000

Booting using the fdt blob at 0x1400000
XIP Kernel Image ... OK
Loading Device Tree to 03e61000, end 03e6b481 ... OK

Starting kernel ...

jedec aa21SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
SF: DeviceBooting Linux on physical CPU 0x0
Linux version 4.4.289 (lam@server-HP-Z420) (gcc version 4.8.5 (Buildroot 2016.11.1-g63232b2-dirty) ) #18 PREEMPT Tue Sep 26 18:12:44 +07 2023
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
Machine model: Nuvoton NUC980 IOT V1.0
Memory policy: Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd ubi.mtd=3 root=ubi0:system rw rootfstype=ubifs console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=nand0:0x200000@0x0(u-boot),0x700000@0x200000(kernel),0x100000@0x900000(device-tree),0x7000000@0x1000000(rootfs)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 58848K/65536K available (4118K kernel code, 225K rwdata, 1192K rodata, 160K init, 220K bss, 6688K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc4800000 - 0xff800000 ( 944 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0537dc4 (5312 kB)
.init : 0xc0538000 - 0xc0560000 ( 160 kB)
.data : 0xc0560000 - 0xc05985a0 ( 226 kB)
.bss : 0xc05985a0 - 0xc05cf810 ( 221 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
Build-time adjustment of leaf fanout to 32.
NR_IRQS:545
clocksource: nuc980-timer5: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 62215505635 ns
sched_clock: 24 bits at 120kHz, resolution 8333ns, wraps every 69905062489ns
Console: colour dummy device 80x30
console [ttyS0] enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x8400 - 0x843c
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations

nuc980_dt_device_init +
nuc980_dt_device_init -...

pinctrl-nuc980 apb:pinctrl@b0000000: initialized NUC980 pinctrl driver
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
PTP clock support registered
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource nuc980-timer5
NET: Registered protocol family 2
IP idents hash table entries: 2048 (order: 2, 16384 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
io scheduler noop registered (default)
nuc980_gpio_probe - pdev = b0004000.gpio
nuc980_dma_probe - pdev = b0008000.dma
nuc980-dma b0008000.dma: NUC980 DMA ready
b0070000.serial: ttyS0 at I/O 0xf0070000 (irq = 36, base_baud = 750000) is a NUC980
b0071000.serial: ttyS1 at I/O 0xf0071000 (irq = 37, base_baud = 9375000) is a NUC980
nuvoton-rng ahb:crypto_prng: nuvoton PRNG active
brd: module loaded
RX nuc980_qspi0_probe: dma0chan0 module removed
TX nuc980_qspi0_probe: dma0chan1 module removed
spi spi0.0: setup: ignoring unsupported mode bits a00
RX nuc980_spi0_probe: dma0chan2 module removed
TX nuc980_spi0_probe: dma0chan3 module removed
libphy: nuc980_rmii0: probed
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
usbcore: registered new interface driver qmi_wwan
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
usbcore: registered new interface driver cdc_wdm
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (1-port)
nuc980-i2c0 b0080000.i2c0: i2c-0: nuc980 I2C adapter
nuc980-i2c2 b0082000.i2c2: i2c-2: nuc980 I2C adapter
nuc980_sd_probe - pdev = b0018000.sdh
NUC980 Crypto engine enabled.
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
nand: Winbond W25N01GV 1G 3.3V
nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
nand: WARNING: spi0.0: the ECC used on your system is too weak compared to the one required by the NAND chip
Scanning device for bad blocks
mt29f spi0.0: read from cache failed!!
Bad eraseblock 0 at 0x000000000000
mt29f spi0.0: read from cache failed!!
...
...
...
mt29f spi0.0: read from cache failed!!
Bad eraseblock 1022 at 0x000007fc0000
mt29f spi0.0: read from cache failed!!
Bad eraseblock 1023 at 0x000007fe0000
4 cmdlinepart partitions found on MTD device nand0
Creating 4 MTD partitions on "nand0":
0x000000000000-0x000000200000 : "u-boot"
0x000000200000-0x000000900000 : "kernel"
0x000000900000-0x000000a00000 : "device-tree"
0x000001000000-0x000008000000 : "rootfs"
nuc980-audio ahb:sound: nau8822-hifi <-> b0020000.i2s mapping ok
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0 error: ubi_early_get_peb: no free eraseblocks
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -28
UBI error: cannot attach mtd3
ALSA device list:
#0: nuc980_IIS
UBIFS error (pid: 1): cannot open "ubi0:system", error -19VFS: Cannot open root device "ubi0:system" or unknown-block(0,0): error -19
Please append a correct "root=" boot option; here are the available partitions:
0100 16384 ram0 (driver?)
0101 16384 ram1 (driver?)
0102 16384 ram2 (driver?)
0103 16384 ram3 (driver?)
0104 16384 ram4 (driver?)
0105 16384 ram5 (driver?)
0106 16384 ram6 (driver?)
0107 16384 ram7 (driver?)
0108 16384 ram8 (driver?)
0109 16384 ram9 (driver?)
010a 16384 ram10 (driver?)
010b 16384 ram11 (driver?)
010c 16384 ram12 (driver?)
010d 16384 ram13 (driver?)
010e 16384 ram14 (driver?)
010f 16384 ram15 (driver?)
b300 7761920 mmcblk0 driver: mmcblk
b301 65536 mmcblk0p1 36d0d5ae-01
b302 7760896 mmcblk0p2 36d0d5ae-02
1f00 2048 mtdblock0 (driver?)
1f01 7168 mtdblock1 (driver?)
1f02 1024 mtdblock2 (driver?)
1f03 114688 mtdblock3 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.289 #18
Hardware name: Nuvoton NUC980 (Device Tree)
Backtrace:
[] (dump_backtrace) from [] (show_stack+0x18/0x1c)
r6:c3b97000 r5:c3b97000 r4:c04c58cc r3:00000000
[] (show_stack) from [] (dump_stack+0x20/0x28)
[] (dump_stack) from [] (panic+0xb0/0x240)
[] (panic) from [] (mount_block_root+0x224/0x2d8)
r3:00000001 r2:00000000 r1:c383fed8 r0:c04c58cc
r7:c3fee2e0
[] (mount_block_root) from [] (prepare_namespace+0x98/0x1c0)
r10:00000078 r9:c0557838 r8:c055e914 r7:c0557830 r6:c0557858 r5:c0557858
r4:c0557868
[] (prepare_namespace) from [] (kernel_init_freeable+0x1a8/0x1f0)
r6:c05985a0 r5:c05985a0 r4:00000007
[] (kernel_init_freeable) from [] (kernel_init+0x10/0xf4)
r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c040710c
r4:00000000
[] (kernel_init) from [] (ret_from_fork+0x14/0x3c)
r4:00000000 r3:ffffffff
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

it due to spi is configed in NORMAL mode, after enable quad mode in devicetree, everything should work well

qspi0: qspi0@b0060000 {
                        status = "okay";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&pinctrl_qspi0_quad>;
                        num_cs  = <2>;
                        lsb      = <0>;
                        txneg   = <1>;
                        rxneg   = <0>;
                        clkpol  = <0>;
                        divider = <4>;
                        sleep   = <0>;
                        txnum   = <0>;
                        txbitlen = <8>;
                        bus_num = <0>;
                        quad    = <1>; // enable SPI quad mode
                        flash: mt29f@0 {
                                compatible = "spinand,mt29f";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                reg = <0>;
                                spi-max-frequency = <12000000>;
                                spi-rx-bus-width = <4>;
                                spi-tx-bus-width = <4>;
                                partition@0 {
                                        label = "u-boot";
                                        reg = <0x00000000 0x00200000>;
                                };
                                partition@200000 {
                                        label = "kernel";
                                        reg = <0x00200000 0x01600000>;
                                };
                                partition@1600000 {
                                        label = "user";
                                        reg = <0x01600000 0x06A00000>;
                                };
                        };
                };