After upgrading from 16M flash to 32M flash, the system cannot reboot

I have a board with 16M winbond flash, use OpenWrt 22.03.4. Run reboot command and upgrade firmware works fine.

But after I upgraded the 16M flash to 32M, reboot command doesn't reboot the system, and upgrading the firmware doesn't reboot it either.

The board flash dts config as follow:

&spi0 {
        status = "okay";

        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <40000000>;

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

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                        };

                        factory: partition@40000 {
                                label = "factory";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };

                        partition@50000 {
                                compatible = "denx,uimage";
                                reg = <0x50000 0>;
                                label = "firmware";
                        };
                };
        };
};

I modify IMAGE_SIZE=32M:

target/linux/ramips/image/mt76x8.mk
 define Device/strong-4g
   DEVICE_VENDOR := Strong
   DEVICE_MODEL := 4G
   DEVICE_PACKAGES := uboot-envtools kmod-usb2
   #IMAGE_SIZE := 16064k
   IMAGE_SIZE := 32448k     // change to 32M
 endef
 TARGET_DEVICES += strong-4g

On 32M flash, run reboot, the serialport output:

root@OpenWrt:/# reboot
root@OpenWrt:/# [  203.666972] device wlan0 left promiscuous mode
[  203.675997] br-lan: port 2(wlan0) entered disabled state
[  204.611752] device eth0.1 left promiscuous mode
[  204.620944] br-lan: port 1(eth0.1) entered disabled state
[  204.825560] device eth0 left promiscuous mode
[  209.327991] reboot: Restarting system

After outputting the reboot: Restarting system message, the led is off, the hardware is not booted, and serialport is no output.

Flashing firmware image, serial output:

[  165.030847] device wlan0 left promiscuous mode
[  165.039878] br-lan: port 2(wlan0) entered disabled state
Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
Sun Apr  9 12:33:06 UTC 2023 upgrade: Sending TERM to remaining processes ...
Sun Apr  9 12:33:06 UTC 2023 upgrade: Sending signal TERM to ntpd (2187)
Sun Apr  9 12:33:06 UTC 2023 upgrade: Sending signal TERM to ntpd (2254)
Sun Apr  9 12:33:10 UTC 2023 upgrade: Sending KILL to remaining processes ...
Sun Apr  9 12:33:10 UTC 2023 upgrade: Sending signal KILL to ntpd (2187)
Sun Apr  9 12:33:10 UTC 2023 upgrade: Sending signal KILL to ntpd (2254)
[  176.092161] stage2 (3048): drop_caches: 3
Sun Apr  9 12:33:16 UTC 2023 upgrade: Switching to ramdisk...
mount: mounting /dev/mtdblock6 on /overlay failed: Resource busy
[  180.282552] VFS: Busy inodes after unmount of jffs2. Self-destruct in 5 seconds.  Have a nice day...
Sun Apr  9 12:33:20 UTC 2023 upgrade: Performing system upgrade...
[  180.376120] do_stage2 (3048): drop_caches: 3
Unlocking firmware ...

Writing from <stdin> to firmware ...
Sun Apr  9 12:34:08 UTC 2023 upgrade: Upgrade completed
Sun Apr  9 12:34:09 UTC 2023 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umoun[  229.073633] reboot: Restarting system
t: can't unmount /tmp: Resource busy

The led is off, the system is not booting, and there is no output from the serial port.

Where is the problem?

I see the OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions message in the boot output:

[    0.534116] printk: console [ttyS0] disabled
[    0.542607] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.560420] printk: console [ttyS0] enabled
[    0.560420] printk: console [ttyS0] enabled
[    0.576887] printk: bootconsole [early0] disabled
[    0.576887] printk: bootconsole [early0] disabled
[    0.596359] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
[    0.615366] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.642425] spi-nor spi0.0: w25q256 (32768 Kbytes)
[    0.652053] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.664720] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    0.679236] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    0.694304] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    0.708871] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    0.723609] Creating 4 MTD partitions on "spi0.0":
[    0.733154] 0x000000000000-0x000000030000 : "u-boot"
[    0.746643] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.758679] 0x000000040000-0x000000050000 : "factory"
[    0.771802] 0x000000050000-0x000002000000 : "firmware"
[    0.783504] 2 uimage-fw partitions found on MTD device firmware
[    0.795332] Creating 2 MTD partitions on "firmware":
[    0.805181] 0x000000000000-0x000000218997 : "kernel"
[    0.815015] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    0.834453] 0x000000218997-0x000001fb0000 : "rootfs"
[    0.844368] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    0.863875] mtd: setting mtd5 (rootfs) as root device
[    0.874989] 1 squashfs-split partitions found on MTD device rootfs
[    0.887318] 0x000000850000-0x000001fb0000 : "rootfs_data"
[    0.956013] rt3050-esw 10110000.esw: mediatek esw at 0xb0110000, irq 25 initialized
[    0.972176] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.990952] NET: Registered protocol family 10
[    1.006659] Segment Routing with IPv6
[    1.014165] NET: Registered protocol family 17
[    1.023105] 8021q: 802.1Q VLAN Support v1.8

Add broken-flash-reset inito flash@0 node. Something like:

        flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <40000000>;
                broken-flash-reset;
1 Like

After adding broken-flash-reset into flash@0, the reboot command works fine. However, there is a warnning at boot time, Is this warnning normal? Can I ignore it?

[    0.560558] printk: console [ttyS0] enabled
[    0.560558] printk: console [ttyS0] enabled
[    0.577026] printk: bootconsole [early0] disabled
[    0.577026] printk: bootconsole [early0] disabled
[    0.596500] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
[    0.615514] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.642555] ------------[ cut here ]------------
[    0.651807] WARNING: CPU: 0 PID: 1 at drivers/mtd/spi-nor/core.c:3008 spi_nor_init+0x1b8/0x1c0
[    0.668881] enabling reset hack; may not recover from unexpected reboots
[    0.682152] Modules linked in:
[    0.688217] CPU: 0 PID: 1 Comm: swapper Not tainted 5.10.176 #0
[    0.699941] Stack : 806d0000 805e0a34 00000000 00000000 80c1b9e4 80810000 80650000 805b9b5c
[    0.716518]         80c28328 80651de7 808133b4 00000001 80840000 00000001 80c1b998 4078a0e1
[    0.733091]         00000000 00000000 805b9b5c 80c1b838 ffffefff 00000000 00000000 ffffffea
[    0.749671]         00000000 80c1b844 0000004d 80659028 00000000 00000009 80c1ba78 803520d4
[    0.766249]         00000009 80840000 80966154 80d9da00 00000018 8031769c 00000000 80810000
[    0.782830]         ...
[    0.787670] Call Trace:
[    0.792538] [<80007250>] show_stack+0x30/0x100
[    0.801356] [<80026e38>] __warn+0xb0/0x11c
[    0.809475] [<80026f30>] warn_slowpath_fmt+0x8c/0xac
[    0.819317] [<803520d4>] spi_nor_init+0x1b8/0x1c0
[    0.828641] [<803530ac>] spi_nor_scan+0x6e0/0xb1c
[    0.837965] [<8035357c>] spi_nor_probe+0x94/0x314
[    0.847279] [<803279c0>] really_probe+0x108/0x4d8
[    0.856626] [<80325628>] bus_for_each_drv+0x70/0xb0
[    0.866300] [<80327fc4>] __device_attach+0x114/0x1cc
[    0.876142] [<80326930>] bus_probe_device+0xa0/0xbc
[    0.885814] [<80322580>] device_add+0x390/0x7a8
[    0.894813] [<8035b45c>] spi_add_device+0xc0/0x1c8
[    0.904309] [<8035be9c>] spi_register_controller+0x7fc/0xb34
[    0.915528] [<8035e42c>] mt7621_spi_probe+0x190/0x1e8
[    0.925547] [<80329d74>] platform_drv_probe+0x28/0x80
[    0.935559] [<803279c0>] really_probe+0x108/0x4d8
[    0.944883] [<803284f8>] device_driver_attach+0x124/0x134
[    0.955581] [<80328584>] __driver_attach+0x7c/0x158
[    0.965253] [<8032557c>] bus_for_each_dev+0x68/0xa4
[    0.974928] [<80326c04>] bus_add_driver+0x150/0x238
[    0.984598] [<80328d68>] driver_register+0x98/0x154
[    0.994266] [<80000638>] do_one_initcall+0x50/0x1b4
[    1.003944] [<806e2f74>] kernel_init_freeable+0x1e0/0x278
[    1.014662] [<805294b8>] kernel_init+0x10/0xf8
[    1.023474] [<800026b8>] ret_from_kernel_thread+0x14/0x1c
[    1.034170]
[    1.037160] ---[ end trace 21a91fbfdfe86154 ]---
[    1.046855] spi-nor spi0.0: w25q256 (32768 Kbytes)
[    1.056486] 4 fixed-partitions partitions found on MTD device spi0.0
[    1.069160] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.083690] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.098774] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.113341] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.128108] Creating 4 MTD partitions on "spi0.0":
[    1.137607] 0x000000000000-0x000000030000 : "u-boot"
[    1.150877] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.162762] 0x000000040000-0x000000050000 : "factory"
[    1.175949] 0x000000050000-0x000002000000 : "firmware"
[    1.187609] 2 uimage-fw partitions found on MTD device firmware
[    1.199443] Creating 2 MTD partitions on "firmware":
[    1.209296] 0x000000000000-0x000000218994 : "kernel"
[    1.219129] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    1.238679] 0x000000218994-0x000001fb0000 : "rootfs"
[    1.248616] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    1.269072] mtd: setting mtd5 (rootfs) as root device

I wrote 10M of data to /root/outputfile and dmesg looked at it and found no warnings.

# dd if=/dev/random of=/root/outputfile bs=1M count=10

Only printed once on startup.

I found the same warning output issue: Hi-Link HLK-7621a boot issues - #4 by mpratt14

For warnning output, I can not worry about it.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.