What does the presence of SPI-NOR Bad Cell Count mean for a firmware?

I found a driver patch for this spi-nor chip that's currently in a 2022 manufactured Totolink X5000R and I've baked it in my own personal build of the firmware. I have the exam same log for the 5.10.x and 5.15.x Linux kernel versions of the firmware. Any help to further enhance the support would be great. I would love to put a pull request of the support for this spi-nor but I want to make sure it is safe for others to use the 5.10 and 5.15 mtd patch files. Thanks!

Edit: Both version of the patch works on my router and I have no issues at all whereas prior to the patch the router would bootloop.

Kernel Log

kern.info kernel: [    1.466936] spi-nor spi0.0: zb25vq128 (16384 Kbytes)
kern.notice kernel: [    1.472032] 4 fixed-partitions partitions found on MTD device spi0.0
kern.err kernel: [    1.478400] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
kern.err kernel: [    1.485741] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
kern.err kernel: [    1.493565] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
kern.err kernel: [    1.500990] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
kern.notice kernel: [    1.508564] Creating 4 MTD partitions on "spi0.0":
kern.notice kernel: [    1.513396] 0x000000000000-0x000000030000 : "u-boot"
kern.notice kernel: [    1.519474] 0x000000030000-0x000000040000 : "u-boot-env"
kern.notice kernel: [    1.525742] 0x000000040000-0x000000050000 : "factory"
kern.notice kernel: [    1.531906] 0x000000050000-0x000001000000 : "firmware"
kern.notice kernel: [    1.538191] 2 uimage-fw partitions found on MTD device firmware
kern.notice kernel: [    1.544182] Creating 2 MTD partitions on "firmware":
kern.notice kernel: [    1.549161] 0x000000000000-0x0000002c931e : "kernel"
kern.warn kernel: [    1.554116] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
kern.notice kernel: [    1.563391] 0x0000002c931e-0x000000fb0000 : "rootfs"
kern.warn kernel: [    1.568392] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only

I think it's pretty harmless, from 22.03 on I've seen it on more or less every NOR device I manage:

root@EAP615-nikai:~# dmesg -l err
[    0.953659] mt7621-pci 1e140000.pcie: pcie2 no card, disable it (RST & CLK)
[    1.472922] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[    1.480256] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[    1.488072] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions
[    1.495469] OF: Bad cell count for /palmbus@1e000000/spi@b00/flash@0/partitions

(Full dmesg here so this won't work on Busybox dmesg.)

Alright, thanks. Then I'll request the pull requests for the spi-nor support for my device.

1 Like

I think this relates to the partitions node not including the appropriate #size overrides, hence it inherits from the above SPI bus nodes.. It should really have something like this

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

			partition@0 {
				reg = <0x0 0x100000>

Without the address/size cell entries it will likely just have address-cells = 1 and size-cells = 0 (hence why the partition definitions don't match)

1 Like