UBI issues with lpc32xx Was: UBI issues with 5.11.11

Trevor Woerner twoerner at gmail.com
Mon Apr 12 19:05:31 BST 2021


Hi Miquel,

On Mon 2021-04-12 @ 06:02:33 PM, Miquel Raynal wrote:
> I assumed I understood this trace well enough to write a patch. Can you
> please give this change a try?
> 
> If it does not fix your issue, would you mind tracing down the issue to
> the root dereference that produces this panic?

It looks, to me, that your patch solves the NULL dereference problem. But it
reveals a new one "Driver must set ecc.strength when using hardware ECC". Is
that something I should be setting in my device tree, or is that a driver
issue too?

> Also please share your entire boot log in case there is anything else
> interesting (and perhaps your NAND DT node as well).

New boot log:
	Booting Linux on physical CPU 0x0
	Linux version 5.10.0-rc6-yocto-standard (oe-user at oe-host) (arm-oe-linux-gnueabi-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.36.1.20210209) #1 PREEMPT Mon Apr 12 17:49:12 UTC 2021
	CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=0005317f
	CPU: VIVT data cache, VIVT instruction cache
	OF: fdt: Machine model: NAUTEL nape83 board based on NXP LPC3240
	Memory policy: Data cache writeback
	Zone ranges:
	  Normal   [mem 0x0000000080000000-0x0000000083ffffff]
	Movable zone start for each node
	Early memory node ranges
	  node   0: [mem 0x0000000080000000-0x0000000083ffffff]
	Initmem setup node 0 [mem 0x0000000080000000-0x0000000083ffffff]
	Built 1 zonelists, mobility grouping on.  Total pages: 16240
	Kernel command line: ubi.mtd=7,512 rootfstype=ubifs root=ubi0 rootwait rw console=ttyS0,115200n81
	Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
	Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
	mem auto-init: stack:off, heap alloc:off, heap free:off
	Memory: 57312K/65536K available (5341K kernel code, 432K rwdata, 1108K rodata, 196K init, 206K bss, 8224K reserved, 0K cma-reserved)
	rcu: Preemptible hierarchical RCU implementation.
		Trampoline variant of Tasks RCU enabled.
	rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
	NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
	random: get_random_bytes called from start_kernel+0x2bc/0x4d4 with crng_init=0
	clk_pll_recalc_rate: hclk_pll: PLL clocks are not in valid ranges: 0/0/0
	clocksource: lpc3220 timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 147020034397 ns
	Switching to timer-based delay loop, resolution 76ns
	sched_clock: 32 bits at 13MHz, resolution 76ns, wraps every 165191050201ns
	Console: colour dummy device 80x30
	Calibrating delay loop (skipped), value calculated using timer frequency.. 26.00 BogoMIPS (lpj=130000)
	pid_max: default: 32768 minimum: 301
	Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
	Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
	CPU: Testing write buffer coherency: ok
	Setting up static identity map for 0x80008400 - 0x8000843c
	rcu: Hierarchical SRCU implementation.
	devtmpfs: initialized
	VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 1
	clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
	futex hash table entries: 256 (order: -1, 3072 bytes, linear)
	NET: Registered protocol family 16
	DMA: preallocated 256 KiB pool for atomic coherent allocations
	cpuidle: using governor menu
	LPC32XX unique ID: 5565d99a09d8905d38df4d6190bb7480
	pl08xdmac pl08xdmac: initialized 8 virtual memcpy channels
	pl08xdmac pl08xdmac: initialized 2 virtual slave channels
	pl08xdmac pl08xdmac: DMA: PL080 rev0 at 0x31000000 irq 21
	SCSI subsystem initialized
	usbcore: registered new interface driver usbfs
	usbcore: registered new interface driver hub
	usbcore: registered new device driver usb
	Advanced Linux Sound Architecture Driver Initialized.
	clocksource: Switched to clocksource lpc3220 timer
	NET: Registered protocol family 2
	tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
	TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
	TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
	TCP: Hash tables configured (established 1024 bind 1024)
	UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
	UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
	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.
	workingset: timestamp_bits=14 max_order=14 bucket_order=0
	NET: Registered protocol family 38
	io scheduler mq-deadline registered
	io scheduler kyber registered
	Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
	printk: console [ttyS0] disabled
	40090000.serial: ttyS0 at MMIO 0x40090000 (irq = 24, base_baud = 812500) is a LPC3220
	printk: console [ttyS0] enabled
	40080000.serial: ttyS1 at MMIO 0x40080000 (irq = 25, base_baud = 812500) is a LPC3220
	40088000.serial: ttyS2 at MMIO 0x40088000 (irq = 26, base_baud = 812500) is a LPC3220
	40098000.serial: ttyS3 at MMIO 0x40098000 (irq = 27, base_baud = 812500) is a LPC3220
	40014000.serial: ttyTX0 at MMIO 0x40014000 (irq = 30, base_baud = 812500) is a lpc32xx_hsuart
	40018000.serial: ttyTX1 at MMIO 0x40018000 (irq = 31, base_baud = 812500) is a lpc32xx_hsuart
	4001c000.serial: ttyTX2 at MMIO 0x4001c000 (irq = 32, base_baud = 812500) is a lpc32xx_hsuart
	brd: module loaded
	loop: module loaded
	nand: device found, Manufacturer ID: 0x01, Chip ID: 0xdc
	nand: AMD/Spansion S34ML04G1
	nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
	------------[ cut here ]------------
	WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/nand_base.c:5781 nand_scan_with_ids+0xbf8/0x136c
	Driver must set ecc.strength when using hardware ECC
	CPU: 0 PID: 1 Comm: swapper Not tainted 5.10.0-rc6-yocto-standard #1
	Hardware name: LPC32XX SoC (Flattened Device Tree)
	[<c0011978>] (unwind_backtrace) from [<c00108a8>] (show_stack+0x10/0x14)
	[<c00108a8>] (show_stack) from [<c0531950>] (__warn+0xa8/0xd0)
	[<c0531950>] (__warn) from [<c05319f0>] (warn_slowpath_fmt+0x78/0xac)
	[<c05319f0>] (warn_slowpath_fmt) from [<c02d9fbc>] (nand_scan_with_ids+0xbf8/0x136c)
	[<c02d9fbc>] (nand_scan_with_ids) from [<c02e0bd4>] (lpc32xx_nand_probe+0x530/0x600)
	[<c02e0bd4>] (lpc32xx_nand_probe) from [<c02a0b98>] (platform_drv_probe+0x38/0x6c)
	[<c02a0b98>] (platform_drv_probe) from [<c029f614>] (really_probe+0x208/0x35c)
	[<c029f614>] (really_probe) from [<c029fbb4>] (device_driver_attach+0x44/0x5c)
	[<c029fbb4>] (device_driver_attach) from [<c029fc78>] (__driver_attach+0xac/0xb4)
	[<c029fc78>] (__driver_attach) from [<c029dde0>] (bus_for_each_dev+0x64/0xa4)
	[<c029dde0>] (bus_for_each_dev) from [<c029e52c>] (bus_add_driver+0x144/0x1a4)
	[<c029e52c>] (bus_add_driver) from [<c02a02a4>] (driver_register+0xac/0xf0)
	[<c02a02a4>] (driver_register) from [<c0683efc>] (do_one_initcall+0x74/0x194)
	[<c0683efc>] (do_one_initcall) from [<c06841d8>] (kernel_init_freeable+0x168/0x1b4)
	[<c06841d8>] (kernel_init_freeable) from [<c053b864>] (kernel_init+0x8/0xf8)
	[<c053b864>] (kernel_init) from [<c0008520>] (ret_from_fork+0x14/0x34)
	Exception stack(0xc0827fb0 to 0xc0827ff8)
	7fa0:                                     00000000 00000000 00000000 00000000
	7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
	---[ end trace 81018977b459f36a ]---
	lpc32xx-nand: probe of 20020000.flash failed with error -22
	libphy: Fixed MDIO Bus: probed
	ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
	ohci-nxp: OHCI NXP driver
	ISP1301 Vendor ID  : 0x0483
	ISP1301 Product ID : 0xa0c4
	ISP1301 Version ID : 0x4747
	usb-ohci 31020000.ohci: at 0x(ptrval), irq 0
	random: fast init done
	usb-ohci 31020000.ohci: OHCI Host Controller
	usb-ohci 31020000.ohci: new USB bus registered, assigned bus number 1
	usb-ohci 31020000.ohci: irq 22, io mem 0x31020000
	hub 1-0:1.0: USB hub found
	hub 1-0:1.0: 2 ports detected
	usbcore: registered new interface driver usb-storage
	udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers
	rtc-lpc32xx 40024000.rtc: registered as rtc0
	rtc-lpc32xx 40024000.rtc: setting system clock to 2021-04-12T17:50:29 UTC (1618249829)
	i2c /dev entries driver
	pnx4008-watchdog 4003c000.watchdog: heartbeat 19 sec
	usbcore: registered new interface driver usbhid
	usbhid: USB HID core driver
	IPVS: Registered protocols ()
	IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
	IPVS: ipvs loaded.
	ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully
	NET: Registered protocol family 10
	Segment Routing with IPv6
	sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
	NET: Registered protocol family 17
	Bridge firewalling registered
	UBI error: cannot open mtd 7, error -19
	ALSA device list:
	  No soundcards found.
	VFS: Cannot open root device "ubi0" or unknown-block(0,0): error -19
	Please append a correct "root=" boot option; here are the available partitions:
	0100           16384 ram0
	 (driver?)
	Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
	CPU: 0 PID: 1 Comm: swapper Tainted: G        W         5.10.0-rc6-yocto-standard #1
	Hardware name: LPC32XX SoC (Flattened Device Tree)
	[<c0011978>] (unwind_backtrace) from [<c00108a8>] (show_stack+0x10/0x14)
	[<c00108a8>] (show_stack) from [<c05316a8>] (panic+0x100/0x300)
	[<c05316a8>] (panic) from [<c0684688>] (mount_block_root+0x1dc/0x26c)
	[<c0684688>] (mount_block_root) from [<c06848f4>] (prepare_namespace+0x84/0x17c)
	[<c06848f4>] (prepare_namespace) from [<c053b864>] (kernel_init+0x8/0xf8)
	[<c053b864>] (kernel_init) from [<c0008520>] (ret_from_fork+0x14/0x34)
	Exception stack(0xc0827fb0 to 0xc0827ff8)
	7fa0:                                     00000000 00000000 00000000 00000000
	7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
	---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

The second panic, of course, will be fixed when the first one is resolved.

My NAND device tree:
	#include "lpc32xx.dtsi"

	/* 512MB Flash via SLC NAND controller */
	&slc {
		status = "okay";

		nxp,wdr-clks = <14>;
		nxp,wwidth = <70250000>;
		nxp,whold = <281000000>;
		nxp,wsetup = <100000000>;
		nxp,rdr-clks = <14>;
		nxp,rwidth = <93666666>;
		nxp,rhold = <281000000>;
		nxp,rsetup = <100000000>;
		nand-on-flash-bbt;
		gpios = <&gpio 5 19 1>; /* GPO_P3 19, active low */

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			mtd0 at 0       { label = "bootrom";   reg = <0x00000000 0x00020000>; };
			mtd1 at 20000   { label = "uboot";     reg = <0x00020000 0x00060000>; };
			mtd2 at 80000   { label = "fbkernel";  reg = <0x00080000 0x003c0000>; };
			mtd3 at 440000  { label = "fbrootfs";  reg = <0x00440000 0x004e0000>; };
			mtd4 at 920000  { label = "c_kernel";  reg = <0x00920000 0x003c0000>; };
			mtd5 at ce0000  { label = "c__atags";  reg = <0x00ce0000 0x00020000>; };
			mtd6 at d00000  { label = "c_rootfs";  reg = <0x00d00000 0x00300000>; };
			mtd7 at 1000000 { label = "mender";    reg = <0x01000000 0x1f000000>; };
		};
	};

Best regards,
	Trevor



More information about the linux-mtd mailing list