[PATCH 2/2] ath79: mikrotik: Change the moment of routerboot partition parser init
Denis K
denis281089 at gmail.com
Thu Nov 11 07:45:25 PST 2021
Hello, Thibaut!
> because the driver depends on SPI routines, it should be linked and loaded after SPI
> rb_hardconfig should never be loaded where it is: platform drivers (where it is currently hooked)
are linked much later in kernel
Maybe the order of init functions of SPI and routerboot depends on a link
order. But SPI probe function can be called in any time: before or after
routerboot init. Adding one more driver -- a new rb91x-key somehow
shifts init timings so SPI _probe_ (not init) now is called after routerboot
init. I suppose that SPI probe is called later now due to several deferred
probes (spi, gpio-latch and rb91x-nand), you can see this in the attached
dmesg:
[ 0.348321] gpio-latch gpio_latch: failed to get gpio 7: -517
[ 0.355504] gpio-rb91x-key gpio_key: probe ok
...
[ 0.405835] rb91x-nand nand_gpio: failed to get gpios: -517
...
[ 0.806348] rb_hardconfig_init: get_mtd_device_nm returns error: -19
...
[ 0.909300] gpio-latch gpio_latch: probe ok
[ 0.927785] spi-nor spi0.0: w25x05 (64 Kbytes)
[ 0.932811] 1 routerbootpart partitions found on MTD device spi0.0
[ 0.939189] Creating 1 MTD partitions on "spi0.0":
[ 0.944193] 0x000000000000-0x000000010000 : "partitions"
[ 0.952617] 4 routerbootpart partitions found on MTD device partitions
[ 0.959369] Creating 4 MTD partitions on "partitions":
[ 0.964750] 0x000000000000-0x00000000c000 : "routerboot"
[ 0.971481] 0x00000000c000-0x00000000d000 : "hard_config"
[ 0.978215] 0x00000000d000-0x00000000e000 : "bios"
[ 0.984340] 0x00000000e000-0x00000000f000 : "soft_config"
[ 0.991016] spi-nor spi0.0: probe ok
...
[ 1.118306] rb91x-nand nand_gpio: probe ok
> I see this is using kernel 5.10 but afaict master is still using 5.4 for ath79.
> Maybe this is related?
The same thing is when kernel 5.4 is used (see the attachment).
I see two ways to eliminate this race condition:
1) late_initcall of routerboot module, only a single line need to be changed,
2) Somehow add a probe function to routerboot module. May be it should be
called from routerboot_partitions_parse function (from
mtd/parsers/routerbootpart.c).
Regards, Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmesg.5.4.gz
Type: application/gzip
Size: 4971 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20211111/d3f4825b/attachment.gz>
More information about the openwrt-devel
mailing list