This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UBIFS mount over SPI NOR flash

Other Parts Discussed in Thread: ASH, TPS65910

Hi All

I am using W25Q64CV SPI NOR flash on am335x evm processor. I have performed MTD partition from u-boot and and passing the arguments from command line to kernel. The problem I am facing is UBIFS mount of the ubinized  filesystem as seen in kernel log. The filesystem is fine when in sdcard boot. I have added some debug messages manually in the kernel code and it shows till ui_io_read function.

My bootargs:

setenv spiargs 'setenv bootargs console=${console} noinitrd ip=off mem=256M ${mtdparts} ${optargs} ubi.mtd=4,64 rootfstype=ubifs root=/dev/mtdblock4 init=/bin/ash'

setenv spiboot "echo Booting from SPI ...; run spiargs; sf probe ${spibusno}:0; sf read ${fdtaddr} 0xA1000 0x10000; sf read ${loadaddr} 0xC0000 0x320000; bootz ${loadaddr} - ${fdtaddr}"

run spiboot

******************************************************************************

Below shows some of U-boot information

U-Boot# sf probe 0
SF: Detected W25Q64CV with page size 256 Bytes, erase size 4 KiB, total 8 MiB
U-Boot# mtdparts

device nor0 <w25q64cv-flash.0>, # parts = 5
 #: name                size            offset          mask_flags
 0: MLO                  0x00020000      0x00000000      0
 1: u-boot               0x00080000      0x00020000      0
 2: dtb                     0x00020000      0x000a0000      0
 3: kernel                0x00320000      0x000c0000      0
 4: rootfs                0x00420000      0x003e0000      0

active partition: nor0,0 - (MLO) 0x00020000 @ 0x00000000

defaults:
mtdids  : nor0=w25q64cv-flash.0
mtdparts: mtdparts=w25q64cv-flash.0:128k(MLO),512k(u-boot),128k(dtb),3200k(kernel),-(rootfs)


From U-boot when I do UBI part rootfs (mtdblock 4) after sf erase command

U-Boot# ubi part rootfs
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   65536 bytes (64 KiB)
UBI: logical eraseblock size:     65408 bytes
UBI: smallest flash I/O unit:       1
UBI: VID header offset:             64 (aligned 64)
UBI: data offset:                        128
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=4"
UBI: MTD device size:               4 MiB
UBI: number of good PEBs:        66
UBI: number of bad 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: 66
UBI: number of PEBs reserved for bad PEB handling: 0
UBI: max/mean erase counter: 4/1
U-Boot#

U-Boot# ubi create rootfs
No size specified -> Using max size (4055296)
Creating dynamic volume rootfs of size 4055296
U-Boot# fatload mmc 0 ${loadaddr} ubi.img
reading ubi.img
3080192 bytes read in 291 ms (10.1 MiB/s)
U-Boot# ubi write ${loadaddr} rootfs 0x2f0000
3080192 bytes written to volume rootfs
******************************************************************

******************************************************************

MY UBIFS commands using the above information is

mkfs.ubifs -r image/ -m 1 -e 65408 -c 62 ubifs.img

ubinize -o ubi.img -m 1 -p 64KiB -O 64 ubinize.cfg

///ubinize.cfg///

[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=4MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
vol_alignment=1

******************************************************************


After the ubi write and setting the spi args I give spiboot for starting from SPI flash.However kernel hangs with below prints.

Attaching the portion of log I have obtained

Kernel Log....

[    1.516377] m25p80 spi1.0: w25q64cv (8192 Kbytes)
[    1.521292]
[    1.521292] Debug:mtdpart_setup_real start()
[    1.527344]
[    1.527344] Debug:mtdpart_partition()
[    1.532726]
[    1.532726] Debug:mtdpart_partition()
[    1.538085]
[    1.538085] Debug:mtdpart_partition()
[    1.543458]
[    1.543458] Debug:mtdpart_partition()
[    1.548818]
[    1.548818] Debug:mtdpart_partition()
[    1.554243]
[    1.554243] mtdpart_setup_real_end()

[    1.566010] 5 ofpart partitions found on MTD device spi1.0
[    1.571747] Creating 5 MTD partitions on "spi1.0":
[    1.576758] 0x000000000000-0x000000020000 : "MLO"
[    1.583398] 0x000000020000-0x0000000a0000 : "u-boot"
[    1.590087] 0x0000000a0000-0x0000000c0000 : "dtb"
[    1.596546] 0x0000000c0000-0x0000003e0000 : "kernel"
[    1.603278] 0x0000003e0000-0x000000800000 : "rootfs"
[    1.611183] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.618062] ehci-pci: EHCI PCI platform driver
[    1.622951] ehci-omap: OMAP-EHCI Host Controller driver
[    1.628910] usbcore: registered new interface driver cdc_wdm
[    1.635073] usbcore: registered new interface driver usb-storage
[    1.642528] mousedev: PS/2 mouse device common for all mice
[    1.648882] i2c-core: driver [rtc-ds1307] using legacy suspend method
[    1.655646] i2c-core: driver [rtc-ds1307] using legacy resume method
[    1.663198] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
[    1.671571] i2c /dev entries driver
[    1.676978] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    1.686045] omap_hsmmc 48060000.mmc: unable to get vmmc regulator -517
[    1.693177] platform 48060000.mmc: Driver omap_hsmmc requests probe deferral
[    1.822302] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[    1.832956] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[    1.839403] omap_hsmmc 47810000.mmc: card claims to support voltages below defined range
[    1.849254] usbcore: registered new interface driver usbhid
[    1.855111] usbhid: USB HID core driver
[    1.859379] platform 44d00000.wkup_m3: Driver wkup_m3 requests probe deferral
[    1.867761] oprofile: using arm/armv7
[    1.872997] PM: bootloader does not support rtc-only!
[    1.878307] ThumbEE CPU extension supported.
[    1.882947] Registering SWP/SWPB emulation handler
[    1.889786] lis3_reg: disabling
[    1.893205] vbat: disabling
[    1.896144] regulator-dummy: disabling
[    1.900481] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.905889] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.914694] tps65910 0-002d: No interrupt support, no core IRQ
[    1.922646] mmc0: queuing unknown CIS tuple 0x91 (3 bytes)
[    1.929957] mmc0: new SDIO card at address 0001
[    1.934733] vrtc: 1800 mV
[    1.937853] vrtc: supplied by vbat
[    1.945020] vio: at 1800 mV
[    1.948135] vio: supplied by vbat
[    1.953484] vdd_mpu: 912 <--> 1375 mV at 1137 mV
[    1.958485] vdd_mpu: supplied by vbat
[    1.964184] vdd_core: 912 <--> 1150 mV at 1137 mV
[    1.969269] vdd_core: supplied by vbat
[    1.974697] vdd3: 5000 mV
[    1.978901] vdig1: at 1800 mV
[    1.982203] vdig1: supplied by vbat
[    1.987236] vdig2: at 1800 mV
[    1.990503] vdig2: supplied by vbat
[    1.995567] vpll: at 1800 mV
[    1.998749] vpll: supplied by vbat
[    2.003747] vdac: at 1800 mV
[    2.006924] vdac: supplied by vbat
[    2.011882] vaux1: at 1800 mV
[    2.015148] vaux1: supplied by vbat
[    2.020171] vaux2: at 3300 mV
[    2.023472] vaux2: supplied by vbat
[    2.028547] vaux33: at 3300 mV
[    2.031925] vaux33: supplied by vbat
[    2.037044] vmmc: 1800 <--> 3300 mV at 3300 mV
[    2.042093] vmmc: supplied by vbat
[    2.046986] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    2.053198] pinctrl-single 44e10800.pinmux: pin 44e10958.0 already requested by 44e10800.pinmux; cannot claim for 4802a000.i2c
[    2.065127] pinctrl-single 44e10800.pinmux: pin-86 (4802a000.i2c) status -22
[    2.072500] pinctrl-single 44e10800.pinmux: could not request pin 86 (44e10958.0) from group pinmux_i2c1_pins  on device pinctrl-single
[    2.085216] omap_i2c 4802a000.i2c: Error applying setting, reverse things back
[    2.095524] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[    2.141969]  remoteproc0: wkup_m3 is available
[    2.146620]  remoteproc0: Note: remoteproc is still under development and considered experimental.
[    2.156014]  remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[    2.167025]  remoteproc0: Direct firmware load failed with error -2
[    2.173636]  remoteproc0: Falling back to user helper
[    2.183066] UBI: attaching mtd4 to ubi0
[    2.187094] UBI:
[    2.187094] Debug:io_init_end
[    2.187094]
[    2.193935] UBI:
[    2.193935] Debug:vmalloc_end
[    2.193935]
[    2.270736] mmc1: new SDHC card at address e624
[    2.281536] mmcblk0: mmc1:e624 SD04G 3.69 GiB
[    2.293286]  mmcblk0: p1 p2
[    2.512350] UBI: scanning is finished
[    2.516178] UBI: div_u64_end
[    2.519180] UBI: late_analysis_end
[    2.522754] UBI: ubi_rb_entry_end
[    2.526212] UBI: list_for_each_entry_1
[    2.530119] UBI: list_for_each_entry_2
[    2.534157] UBI: list_for_each_entry_3
[    2.538067] UBI: self_check_end
[    2.541340] UBI: ubi_free_hdr_end
[    2.544810] UBI: kfree_end
[    2.547630] UBI: scan_all_end
[    2.550720] UBI: dbg_gen_end
[    2.553732] UBI: cpu_to_be32_end
[    2.557094] UBI: ALIGN_end
[    2.559912] UBI: ubi_find_av_end
[    2.563284] UBI: UBI_else_!av_end
[    2.566737] UBI: process_lvol_start
[    2.570371] UBI: check layout volume
[    2.574148] UBI: vzalloc_end
[    2.577150] UBI: ui_io_read_start
[    2.580705] Unable to handle kernel paging request at virtual address cfe12060
[    2.588241] pgd = c0004000
[    2.591062] [cfe12060] *pgd=00000000
[    2.594803] Internal error: Oops: 5 [#1] ARM
[    2.599257] Modules linked in:
[    2.602453] CPU: 0 PID: 508 Comm: spi1 Not tainted 3.14.26-g07d13c6-dirty #22
[    2.609901] task: cd92e400 ti: cda36000 task.ti: cda36000
[    2.615555] PC is at dma_cache_maint_page+0x64/0x160
[    2.620736] LR is at arm_dma_map_page+0x7c/0x8c
[    2.625464] pc : [<c0016aec>]    lr : [<c0016cc0>]    psr: 60000113
[    2.625464] sp : cda37dd8  ip : 00000000  fp : cda37e0c
[    2.637440] r10: 00000002  r9 : c0594018  r8 : 00090903
[    2.642890] r7 : 00000f74  r6 : 00010903  r5 : c0594b00  r4 : 00000000
[    2.649700] r3 : cfc00000  r2 : 00080000  r1 : 00000394  r0 : 00212060
[    2.656513] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[    2.664140] Control: 10c5387d  Table: 80004019  DAC: 00000015
[    2.670135] Process spi1 (pid: 508, stack limit = 0xcda36238)
[    2.676130] Stack: (0xcda37dd8 to 0xcda38000)
[    2.680676] 7dc0:                                                       cda37e2c cda37de8
[    2.689214] 7de0: c006ec94 00000000 cfe12060 cd87dc20 cd87dbfc 00000000 c0594b00 cd9ff900
[    2.697750] 7e00: cda37e2c cda37e10 c0016cc0 c0016a94 c001aa74 cd92e400 00000f74 90903000
[    2.706286] 7e20: cda37f1c cda37e30 c031407c c0016c50 00000002 00000000 c0057830 cd86ec30
[    2.714823] 7e40: ffffffff cfc00000 cda37e7c cda17800 c03e979c c001333c ffffffff cd87c01c
[    2.723360] 7e60: cd92e400 c059f408 00000000 00000001 cda37e94 cda37e80 ffffffff 00000000
[    2.731897] 7e80: cd92e400 c059f408 cda37f2c cda37e98 cda17a00 c0053544 00000000 c05d63e8
[    2.740437] 7ea0: cda37efc cda37eb0 c02be540 c02be458 cda36000 cd8cb080 00000080 fa200000
[    2.748973] 7ec0: 0000001c c05c24a0 cda37ef4 cda37ed8 c00085e8 60000113 cd8cb010 c05d63e8
[    2.757510] 7ee0: 00000001 00000000 00000000 c05d63e8 cda37f1c cda17994 cda17800 c05d63e8
[    2.766046] 7f00: 00000001 00000000 00000000 c05d63e8 cda37f3c cda37f20 c031127c c0313ed4
[    2.774584] 7f20: c03110f4 cda17980 cda36000 c05d63e8 cda37f64 cda37f40 c004cc10 c0311100
[    2.783121] 7f40: 00000000 cda43c00 cda17980 c004cbb8 00000000 00000000 cda37fac cda37f68
[    2.791659] 7f60: c004ce1c c004cbc4 00000000 00000000 00000000 cda17980 00000000 cda37f7c
[    2.800196] 7f80: cda37f7c 00000000 cda37f88 cda37f88 cda43c00 c004cd58 00000000 00000000
[    2.808734] 7fa0: 00000000 cda37fb0 c000e578 c004cd64 00000000 00000000 00000000 00000000
[    2.817271] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.825807] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00400002 0000828a
[    2.834336] Backtrace:
[    2.836900] [<c0016a88>] (dma_cache_maint_page) from [<c0016cc0>] (arm_dma_map_page+0x7c/0x8c)
[    2.845885]  r10:cd9ff900 r9:c0594b00 r8:00000000 r7:cd87dbfc r6:cd87dc20 r5:cfe12060
[    2.854079]  r4:00000000
[    2.856739] [<c0016c44>] (arm_dma_map_page) from [<c031407c>] (omap2_mcspi_transfer_one_message+0x1b4/0x137c)
[    2.867083]  r5:90903000 r4:00000f74
[    2.870826] [<c0313ec8>] (omap2_mcspi_transfer_one_message) from [<c031127c>] (spi_pump_messages+0x188/0x200)
[    2.881169]  r10:c05d63e8 r9:00000000 r8:00000000 r7:00000001 r6:c05d63e8 r5:cda17800
[    2.889362]  r4:cda17994
[    2.892016] [<c03110f4>] (spi_pump_messages) from [<c004cc10>] (kthread_worker_fn+0x58/0x130)
[    2.900909]  r6:c05d63e8 r5:cda36000 r4:cda17980 r3:c03110f4
[    2.906836] [<c004cbb8>] (kthread_worker_fn) from [<c004ce1c>] (kthread+0xc4/0xe0)
[    2.914733]  r10:00000000 r8:00000000 r7:c004cbb8 r6:cda17980 r5:cda43c00 r4:00000000
[    2.922943] [<c004cd58>] (kthread) from [<c000e578>] (ret_from_fork+0x14/0x3c)
[    2.930476]  r7:00000000 r6:00000000 r5:c004cd58 r4:cda43c00
[    2.936405] Code: e08882c0 e1866002 e3a01fe5 e0666008 (e7932286)
[    2.942769] ---[ end trace 9a78d2757aea4543 ]---

Can someone help how to mount my filesystem. Do I need to make any change in kernel or is it ubinizing issue?

Best Regards

Jeffin