S32G3: Linux driver spi-nor crashes

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32G3: Linux driver spi-nor crashes

3,111 次查看
andopando
Contributor I

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.

0 项奖励
回复
2 回复数

3,069 次查看
chenyin_h
NXP Employee
NXP Employee

Hello, @andopando 

Thanks for the post.

With pure BSP40 running on the RDB3, seems no issues with the operation you had made:

chenyin_h_0-1726801614341.png

May I know where is the bootloader from? is it the bootloader example from NXP?(any version of GoldVIP or Integration reference examples?) any modification made on it?

From your description, no any M7 application running simultaneously with BSP, right?

Thanks for the clarification.

 

BR

Chenyin

0 项奖励
回复

2,854 次查看
fanhaisen
Contributor I

I have the save problem, log as follow:

Auto Linux BSP 39.0 s32g274ardb2 ttyLF0

s32g274ardb2 login: root
root@s32g274ardb2:~# uname -a
Linux s32g274ardb2 5.15.129-rt67+gcdac05068 #26 SMP PREEMPT Tue Nov 19 10:49:48 CST 2024 aarch64 aarch64 aarch64 GNU/Linux
root@s32g274ardb2:~# mtd_debug erase /dev/mtd0 0 0x10000
Erased 65536 bytes from address 0x00000000 in flash
root@s32g274ardb2:~# cat /proc/mtd
dev: size erasesize name
mtd0: 04000000 00001000 "Flash-Image"
mtd1: 00280000 00001000 "FIP"
mtd2: 00010000 00001000 "U-Boot-Env"
mtd3: 00ed0000 00001000 "Kernel"
mtd4: 00030000 00001000 "DTB"
mtd5: 01f10000 00001000 "Rootfs"
mtd6: 00f60000 00001000 "PFE-Firmware"
root@s32g274ardb2:~# hexdump -v -n 0x100 /dev/mtd0
[ 6.006540] s32cc-dwmac 4033c000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 6.011375] s32cc-dwmac 4033c000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-1
[ 6.015975] s32cc-dwmac 4033c000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-2
[ 6.020101] s32cc-dwmac 4033c000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-3
[ 6.025215] s32cc-dwmac 4033c000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-4
[ 6.030970] s32cc-dwmac 4033c000.ethernet eth0: Enabling Safety Features
[ 6.031112] s32cc-dwmac 4033c000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 6.032861] s32cc-dwmac 4033c000.ethernet eth0: registered PTP clock
[ 6.040671] s32cc-dwmac 4033c000.ethernet eth0: FPE workqueue start
[ 6.040699] s32cc-dwmac 4033c000.ethernet eth0: configuring for fixed/sgmii link mode
[ 6.040938] s32cc-dwmac 4033c000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[ 6.041690] 8021q: adding VLAN 0 to HW filter on device eth0
[ 185.777707] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
[ 185.871415] Modules linked in: sja1110(O) ipc_shm_dev(O) ipc_shm_cdev(O)
[ 185.878097] CPU: 1 PID: 326 Comm: hexdump Tainted: G O 5.15.129-rt67+gcdac05068 #26
[ 185.887035] Hardware name: NXP S32G274A-XWD (DT)
[ 185.891637] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 185.898579] pc : __memcpy_fromio+0x48/0xa0
[ 185.902657] lr : fsl_qspi_exec_op+0x99c/0xcf0
[ 185.906999] sp : ffffffc0097a36f0
[ 185.910296] x29: ffffffc0097a36f0 x28: ffffff8802fb0000 x27: ffffff8800da6800
[ 185.917413] x26: ffffffc0097a3df0 x25: ffffff8800da4800 x24: 000000000000000e
[ 185.924533] x23: ffffffc020000000 x22: ffffff8800d9e658 x21: 0000000000000000
[ 185.931648] x20: ffffffc0097a3aa0 x19: ffffff8800d9e600 x18: 0000000000000001
[ 185.938766] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[ 185.945884] x14: 0000000000000000 x13: 00000000ffffff00 x12: 0000000000000018
[ 185.953001] x11: 000000000000001c x10: ffffffc008fed410 x9 : 000000008280000c
[ 185.960119] x8 : 0000000038bcaf12 x7 : 00000000626cb461 x6 : 0000000000001000
[ 185.967237] x5 : 0000000000000018 x4 : ffffffc020000000 x3 : ffffff8802fb1000
[ 185.974354] x2 : 0000000000001000 x1 : ffffffc020000000 x0 : ffffff8802fb0000
[ 185.981474] Call trace:
[ 185.983906] __memcpy_fromio+0x48/0xa0
[ 185.987636] spi_mem_exec_op+0x3d8/0x454
[ 185.991541] spi_mem_no_dirmap_read+0x98/0xb0
[ 185.995881] spi_mem_dirmap_read+0xd4/0x13c
[ 186.000047] spi_nor_read_data+0x10c/0x180
[ 186.004127] spi_nor_read+0xb4/0x160
[ 186.007685] mtd_read_oob_std+0x7c/0x8c
[ 186.011505] mtd_read_oob+0x7c/0x134
[ 186.015064] mtd_read+0x64/0xa0
[ 186.018188] mtdchar_read+0xd4/0x294
[ 186.021747] vfs_read+0x90/0x1b0
[ 186.024959] ksys_read+0x68/0xf4
[ 186.028170] __arm64_sys_read+0x1c/0x2c
[ 186.031990] invoke_syscall+0x48/0x114
[ 186.035722] el0_svc_common.constprop.0+0x44/0xfc
[ 186.040409] do_el0_svc+0x28/0xa0
[ 186.043707] el0_svc+0x28/0x80
[ 186.046745] el0t_64_sync_handler+0xa4/0x130
[ 186.050999] el0t_64_sync+0x1a0/0x1a4
[ 186.054652] Code: aa0103e4 927df0c6 910020c6 8b060003 (f9400085)
[ 186.060726] ---[ end trace f6094964d8960e36 ]---
[ 187.060840] printk: enabled sync mode
[ 187.068792] printk: console [ttyLF0]: printing thread stopped
Segmentation fault

Message from syslogd@ at Sat Apr 30 04:00:34 2022 ...
: Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP

Message from syslogd@ at Sat Apr 30 04:00:34 2022 ...
: Code: aa0103e4 927df0c6 910020c6 8b060003 (f9400085)
root@s32g274ardb2:~#

标记 (1)
0 项奖励
回复