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.

Linux: AM437x QSPI boot issue

Other Parts Discussed in Thread: AM4376, AM4372

Tool/software: Linux

I'm using am4376 processor with sdk version 04.02.00.09 and encoutered a qspi nor booting issue.
I followed the following two guides to setup qspi boot. But mass warning/error occurred while loading jffs2 from nor flash.

processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide
processors.wiki.ti.com/.../Linux_Core_QSPI_User's_Guide

Everything was fine while booting from nfs.
But when I switched to qspiboot, everything went wrong after the warning message dump from kernel.
I also tried to trace the code in spi-nor.c. However I could not tell what the root cause was.
Can someone help me or any hint to solve the issue, thanks.


soc: am4376
sdk: 04.02.00.09
nor flash: MX66L51235FMI
linux defconfig: tisdk_am437x-evm_defconfig with jffs2 config added
device tree source: base on am437x-sk-evm.dts and am437x-idk-evm.dts. none of them works

my dts setting for qspi (everything is the same with original dts file, besides the partition size):

qspi_pins: qspi_pins {
    pinctrl-single,pins = <
        AM4372_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE3) /* gpmc_csn0.qspi_csn */
        AM4372_IOPAD(0x888, PIN_OUTPUT | MUX_MODE2) /* gpmc_csn3.qspi_clk */
        AM4372_IOPAD(0x890, PIN_INPUT | MUX_MODE3)  /* gpmc_advn_ale.qspi_d0 */
        AM4372_IOPAD(0x894, PIN_INPUT | MUX_MODE3)  /* gpmc_oen_ren.qspi_d1 */
        AM4372_IOPAD(0x898, PIN_INPUT | MUX_MODE3)  /* gpmc_wen.qspi_d2 */
        AM4372_IOPAD(0x89c, PIN_INPUT | MUX_MODE3)  /* gpmc_be0n_cle.qspi_d3 */
    >;
};

&qspi {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&qspi_pins>;

    spi-max-frequency = <48000000>;
    m25p80@0 {
        compatible = "mx66l51235l";
        spi-max-frequency = <48000000>;
        reg = <0>;
        spi-cpol;
        spi-cpha;
        spi-tx-bus-width = <1>;
        spi-rx-bus-width = <4>;
        #address-cells = <1>;
        #size-cells = <1>;

        /* MTD partition table.
         * The ROM checks the first 512KiB
         * for a valid file to boot(XIP).
         */
        partition@0 {
            label = "QSPI.U_BOOT";
            reg = <0x00000000 0x000080000>;
        };
        partition@1 {
            label = "QSPI.U_BOOT.backup";
            reg = <0x00080000 0x00080000>;
        };
        partition@2 {
            label = "QSPI.U_BOOT_ENV";
            reg = <0x00100000 0x00010000>;
        };
        partition@3 {
            label = "QSPI.FDT";
            reg = <0x00110000 0x00010000>;
        };
        partition@4 {
            label = "QSPI.KERNEL";
            reg = <0x00120000 0x0800000>;
        };
        partition@5 {
            label = "QSPI.FILESYSTEM";
            reg = <0x00920000 0x36E0000>;
        };
    };
};

Kernel booting message:

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.59 (user@userUbuntu) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 PREEMPT Fri Feb 23 08:44:38 CST 2018
[ 0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: TI AM437x
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 48 MiB at 0xbd000000
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM437x ES1.2 (neon)
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260416
[ 0.000000] Kernel command line: console=ttyO0,115200n8 spi-ti-qspi.enable_qspi=1 root=/dev/mtdblock5 rw rootfstype=jffs2 rootwait=1
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 977312K/1048576K available (7168K kernel code, 292K rwdata, 2400K rodata, 1024K init, 281K bss, 22112K reserved, 49152K cma-reserved, 212992K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0800000 (8160 kB)
[ 0.000000] .init : 0xc0b00000 - 0xc0c00000 (1024 kB)
[ 0.000000] .data : 0xc0c00000 - 0xc0c49048 ( 293 kB)
[ 0.000000] .bss : 0xc0c49048 - 0xc0c8f834 ( 282 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] L2C: platform modifies aux control register: 0x0e030000 -> 0x3e430000
[ 0.000000] L2C: DT/platform modifies aux control register: 0x0e030000 -> 0x3e430000
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] OMAP L2C310: ROM does not support power control setting
[ 0.000000] L2C-310 dynamic clock gating disabled, standby mode disabled
[ 0.000000] L2C-310 cache controller enabled, 16 ways, 256 kB
[ 0.000000] L2C-310: CACHE_ID 0x410000c9, AUX_CTRL 0x4e430000
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000011] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000028] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000035] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000371] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
[ 0.000381] OMAP clocksource: 32k_counter at 32768 Hz
[ 0.000701] Console: colour dummy device 80x30
[ 0.000727] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[ 0.000733] This ensures that you still see kernel messages. Please
[ 0.000738] update your kernel commandline.
[ 0.000757] Calibrating delay loop... 1987.37 BogoMIPS (lpj=9936896)
[ 0.060164] pid_max: default: 32768 minimum: 301
[ 0.060279] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.060291] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.061041] CPU: Testing write buffer coherency: ok
[ 0.061379] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.062132] EFI services will not be available.
[ 0.062913] devtmpfs: initialized
[ 0.072798] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 0.073086] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.073108] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.076313] pinctrl core: initialized pinctrl subsystem
[ 0.077384] NET: Registered protocol family 16
[ 0.078700] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.170176] cpuidle: using governor ladder
[ 0.200161] cpuidle: using governor menu
[ 0.206966] OMAP GPIO hardware version 0.1
[ 0.219054] No ATAGs?
[ 0.219082] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[ 0.219092] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.256458] edma 49000000.edma: TI EDMA DMA engine driver
[ 0.259422] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp@44000000/l4_wkup@44c00000/scm@210000/pinmux@800/i2c0_pins, deferring probe
[ 0.259475] omap_i2c 4802a000.i2c: could not find pctldev for node /ocp@44000000/l4_wkup@44c00000/scm@210000/pinmux@800/i2c1_pins, deferring probe
[ 0.259556] media: Linux media interface: v0.10
[ 0.259597] Linux video capture interface: v2.00
[ 0.259640] pps_core: LinuxPPS API ver. 1 registered
[ 0.259647] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.259667] PTP clock support registered
[ 0.259698] EDAC MC: Ver: 3.0.0
[ 0.260659] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[ 0.260960] Advanced Linux Sound Architecture Driver Initialized.
[ 0.262005] clocksource: Switched to clocksource timer1
[ 0.269924] NET: Registered protocol family 2
[ 0.270631] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.270696] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.270771] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.270912] UDP hash table entries: 512 (order: 1, 8192 bytes)
[ 0.270934] UDP-Lite hash table entries: 512 (order: 1, 8192 bytes)
[ 0.271078] NET: Registered protocol family 1
[ 0.271475] RPC: Registered named UNIX socket transport module.
[ 0.271486] RPC: Registered udp transport module.
[ 0.271492] RPC: Registered tcp transport module.
[ 0.271497] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.273723] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[ 0.278789] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.279548] NFS: Registering the id_resolver key type
[ 0.279580] Key type id_resolver registered
[ 0.279586] Key type id_legacy registered
[ 0.279631] ntfs: driver 2.1.32 [Flags: R/O].
[ 0.279840] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.281489] bounce: pool size: 64 pages
[ 0.281672] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[ 0.281684] io scheduler noop registered
[ 0.281691] io scheduler deadline registered
[ 0.281801] io scheduler cfq registered (default)
[ 0.283305] pinctrl-single 44e10800.pinmux: 199 pins at pa f9e10800 size 796
[ 0.330181] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
[ 0.332667] omap8250 44e09000.serial: No clock speed specified: using default: 48000000
[ 0.333428] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
[ 0.990589] console [ttyS0] enabled
[ 0.995570] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[ 1.002379] [drm] Initialized
[ 1.018227] brd: module loaded
[ 1.027101] loop: module loaded
[ 1.033127] m25p80 spi0.0: mx66l51235l (65536 Kbytes)
[ 1.038253] 6 ofpart partitions found on MTD device spi0.0
[ 1.043861] Creating 6 MTD partitions on "spi0.0":
[ 1.048678] 0x000000000000-0x000000080000 : "QSPI.U_BOOT"
[ 1.055207] 0x000000080000-0x000000100000 : "QSPI.U_BOOT.backup"
[ 1.062206] 0x000000100000-0x000000110000 : "QSPI.U_BOOT_ENV"
[ 1.068879] 0x000000110000-0x000000120000 : "QSPI.FDT"
[ 1.074998] 0x000000120000-0x000000920000 : "QSPI.KERNEL"
[ 1.081271] 0x000000920000-0x000004000000 : "QSPI.FILESYSTEM"
[ 1.088613] libphy: Fixed MDIO Bus: probed
[ 1.162069] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[ 1.168204] davinci_mdio 4a101000.mdio: detected phy mask fffffff9
[ 1.175867] libphy: 4a101000.mdio: probed
[ 1.179912] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[ 1.189699] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver Micrel KSZ9031 Gigabit PHY
[ 1.200129] cpsw 4a100000.ethernet: Detected MACID = bc:83:85:fa:60:3d
[ 1.206943] cpsw 4a100000.ethernet: device node lookup for pps timer failed
[ 1.214024] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
[ 1.221985] cpsw 4a100000.ethernet: cpsw: Detected MACID = bc:83:85:fa:60:3e
[ 1.230374] mousedev: PS/2 mouse device common for all mice
[ 1.236377] i2c /dev entries driver
[ 1.241482] cpuidle: enable-method property 'ti,am4372' found operations
[ 1.306149] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.314430] NET: Registered protocol family 10
[ 1.321405] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.330188] NET: Registered protocol family 17
[ 1.334993] Key type dns_resolver registered
[ 1.339542] omap_voltage_late_init: Voltage driver support not added
[ 1.366679] mmc0: new high speed MMC card at address 0001
[ 1.372770] mmcblk0: mmc0:0001 8GME4R 7.28 GiB
[ 1.377628] mmcblk0boot0: mmc0:0001 8GME4R partition 1 4.00 MiB
[ 1.384036] mmcblk0boot1: mmc0:0001 8GME4R partition 2 4.00 MiB
[ 1.391437] mmcblk0: p1 p2 p3 p4
[ 1.409940] at24 0-0050: 8192 byte 24c64 EEPROM, writable, 1 bytes/write
[ 1.417084] omap_i2c 44e0b000.i2c: bus 0 rev0.12 at 100 kHz
[ 1.508249] random: fast init done
[ 1.513280] omap_i2c 4802a000.i2c: bus 1 rev0.12 at 100 kHz
[ 1.520487] hctosys: unable to open rtc device (rtc0)
[ 1.526297] ALSA device list:
[ 1.529289] No soundcards found.
[ 2.082932] VFS: Mounted root (jffs2 filesystem) on device 31:5.
[ 2.090413] devtmpfs: mounted
[ 2.095826] Freeing unused kernel memory: 1024K

Everything looks fine until loading nor driver from here

Starting logging: OK
[ 2.687522] ------------[ cut here ]------------
[ 2.698920] WARNING: CPU: 0 PID: 97 at drivers/mtd/spi-nor/spi-nor.c:1177 spi_nor_write+0x13c/0x1b8
[ 2.708287] Writing at offset 168 into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.[ 2.719874] Modules linked in:
[ 2.722995] CPU: 0 PID: 97 Comm: touch Not tainted 4.9.59 #1
[ 2.728680] Hardware name: Generic AM43 (Flattened Device Tree)
[ 2.735256] Backtrace:
[ 2.737833] [<c010b7d0>] (dump_backtrace) from [<c010ba8c>] (show_stack+0x18/0x1c)
[ 2.745831] r7:00000009 r6:00000000 r5:c09e2b38 r4:eead9c00
[ 2.751736] [<c010ba74>] (show_stack) from [<c03d5df4>] (dump_stack+0x24/0x28)
[ 2.759256] [<c03d5dd0>] (dump_stack) from [<c012d9a0>] (__warn+0xe8/0x100)
[ 2.766415] [<c012d8b8>] (__warn) from [<c012d9f8>] (warn_slowpath_fmt+0x40/0x48)
[ 2.774069] r9:00000000 r8:eead9cec r7:00000044 r6:ee954018 r5:00000000 r4:c09e2bbc
[ 2.781864] [<c012d9bc>] (warn_slowpath_fmt) from [<c0582d44>] (spi_nor_write+0x13c/0x1b8)
[ 2.790353] r3:000000a8 r2:c09e2bbc
[ 2.794067] r4:000000a8
[ 2.796634] [<c0582c08>] (spi_nor_write) from [<c056a2e8>] (part_write+0x48/0x50)
[ 2.804337] r10:eead9cec r9:00000000 r8:002b97a8 r7:00000000 r6:00000000 r5:00000000
[ 2.812322] r4:00920000
[ 2.814878] [<c056a2a0>] (part_write) from [<c056691c>] (mtd_write+0x88/0xa0)
[ 2.822216] r5:00000000 r4:c056a2a0
[ 2.825816] [<c0566894>] (mtd_write) from [<c0566f38>] (mtd_writev+0xac/0x100)
[ 2.833238] r7:00000001 r6:00000000 r5:00000001 r4:eead9dd0
[ 2.838946] [<c0566e8c>] (mtd_writev) from [<c034cfdc>] (jffs2_flash_direct_writev+0x28/0x30)
[ 2.847694] r10:00000044 r9:eead9dd0 r8:002b97a8 r7:eea2a800 r6:eea90ca0 r5:00000000
[ 2.855677] r4:002b97a8
[ 2.858237] [<c034cfb4>] (jffs2_flash_direct_writev) from [<c034ef80>] (jffs2_flash_writev+0x454/0x4f0)
[ 2.867842] r5:00000000 r4:002b97a8
[ 2.871445] [<c034eb2c>] (jffs2_flash_writev) from [<c0347518>] (jffs2_write_dnode+0xec/0x344)
[ 2.880301] r10:00000044 r9:00000000 r8:eeca95a0 r7:eea2a800 r6:eea90ca0 r5:eea2f100
[ 2.888296] r4:002b97a8
[ 2.890853] [<c034742c>] (jffs2_write_dnode) from [<c034c028>] (jffs2_do_setattr+0x290/0x574)
[ 2.899592] r10:00000000 r9:eea2a800 r8:eead9ec8 r7:00000000 r6:00000000 r5:eeca95c8
[ 2.907577] r4:eea2f100
[ 2.910133] [<c034bd98>] (jffs2_do_setattr) from [<c034c338>] (jffs2_setattr+0x2c/0x50)
[ 2.918345] r10:eead9ec8 r9:00000000 r8:eead9ec4 r7:eeca6aa0 r6:eead9e88 r5:eeca95c8
[ 2.926326] r4:eead9ec8
[ 2.928894] [<c034c30c>] (jffs2_setattr) from [<c0235090>] (notify_change+0x1cc/0x3e4)
[ 2.937020] r5:eeca95c8 r4:00020070
[ 2.940632] [<c0234ec4>] (notify_change) from [<c0249484>] (utimes_common+0xac/0x178)
[ 2.948675] r10:00000000 r9:bedf1f7a r8:ffffff9c r7:00000000 r6:eead9f28 r5:eeca962c
[ 2.956658] r4:00000000
[ 2.959215] [<c02493d8>] (utimes_common) from [<c0249608>] (do_utimes+0xb8/0x150)
[ 2.966901] r7:00000000 r6:00000000 r5:00000001 r4:00000000
[ 2.972726] [<c0249550>] (do_utimes) from [<c0249858>] (SyS_futimesat+0xd0/0x10c)
[ 2.980248] r9:eead8000 r8:c0107e84 r7:0000010d r6:00000000 r5:bedf1f7a r4:ffffff9c
[ 2.988205] [<c0249788>] (SyS_futimesat) from [<c02498b0>] (SyS_utimes+0x1c/0x20)
[ 2.995840] r6:00000000 r5:bedf1c90 r4:bedf1e98
[ 3.000494] [<c0249894>] (SyS_utimes) from [<c0107cc0>] (ret_fast_syscall+0x0/0x3c)
[ 3.008454] ---[ end trace cd06a67d3ded56a6 ]---
Initializing random number generator... done.

Even the error message dumped, system was able to boot to filesystem. But somehow all the drivers weren't be able to load currently.

Welcome to Buildroot
buildroot login: