4.14 kernel MTD device order issues

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

jay214128
Posts: 20
Joined: Fri Jan 23, 2015 3:29 am

4.14 kernel MTD device order issues

Tue Nov 13, 2018 6:41 pm

I am using the AT91SAM9G45 and 9G25 SOCs. I have both SPI data flash (with 3 MTD partitions) and NAND flash (with 4 MTD partitions). Previously, with the 4.4 and 4.9 kernels, the NAND driver would load first, followed by the SPI data flash driver. This resulted in the correct MTD partition order (4 NAND, 3 data flash).

With the 4.14 kernel, the SPI data flash driver is loading first. This results in the MTD partitions being in the wrong order. The kernel command line contains
root=/dev/mtdblock2 rw rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs0
line to tell the kernel where to find the root FS, but when the drivers load in the wrong order, the kernel tries to mount the wrong partition, which fails.

How can I specify/control which driver gets loaded first?

The DTB contains partition information for both the SPI data flash and NAND flash MTD partitions. The kernel command line also contains the partition information for the NAND flash (same values as the DTB), which take precedence over those in the DTB.
jay214128
Posts: 20
Joined: Fri Jan 23, 2015 3:29 am

Re: 4.14 kernel MTD device order issues

Thu Nov 15, 2018 4:52 pm

I have a work around for now. I changed the mtd_dataflash driver (CONFIG_MTD_DATAFLASH) and the spi-nor driver (CONFIG_MTD_SPI_NOR) to be built as loadable modules instead of built-ins. This guarantees that they cannot be loaded before the NAND driver, since the ROOT FS is on the NAND. I also needed to add an init script to check for and modprobe the appropriate driver based on which dataflash/NOR flash part is installed on the actual board.

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 3 guests