Hi,
I'm having trouble with the spi-nor driver in Linux on the S32G399ARDB3.
I'm using BSP40 (kernel 5.15.145) with the fsl-image-base build but have tried other BSPs and kernels, more on that below.
I'm trying to use external NOR flash (MX25UW51245G) from linux. The issue is that the spi-nor driver (might be from other drivers it calls into) crashes when it's being loaded in as a module via modprobe or when its compiled built in. I'm not using any custom builds or hardware this is just BSP40 yocto build on an RDB3 with the nxp M7 bootloader.
No M7 firmware is actually being loaded and executed as that part of flash was previously erased with S32FlashTool.
Uboot has no trouble reading and writing environment variables to the nor flash.
Other things I've tried:
- Changing Kernel config so that mtd device support is compiled in as a module instead of built-in (CONFIG_MTD=m)
- This one is a bit weird. Sometimes I can modprobe the driver in without crashing but when using any of the mtd_utils tools (nand*, mtd_debug) it would crash.
- Different BSP versions built with yocto as per the github instructions (fsl-image-base)
- BSP39: Kernel 5.15.129 crashes
- BSP39: Kernel 5.10.194 works
- BSP38: Kernel 5.10.184 works
- BSP38: Kernel 5.15.119 crashes
- Reducing qspi clock to 133MHz as some other forum posts suggested did not help
I've found the 5.10.X kernels to work where as the 5.15.X (and onwards? haven't tried newer) kernels to not work so well. After a bit of investigation it seems the spi-fsl-qspi driver in the kernel is different between 5.10.X and 5.15.X although I didn't dig too deep and im not sure thats the cause.
I've attached:
1. Kernel boot log from BSP40 with kernel 5.15.145 where mtd support was built in
2. Kernel trace from crash caused by mtd_debug read after (somehow) successfully modprobing in spi-nor. mtd support compiled as module.