-1

I have a spi driver for an nrc7292. When I load it on a pi3 or 4 it works every time, but when I load it on a cm4 it only loads correctly about half the time. What could possibly be different? Once loaded it works great. Below is the output of a failed insmod command.

sudo insmod /lib/modules/$(uname -r)/extra/nrc.ko  hifspeed=10000000 spi_bus_num=0 spi_cs_num=0 spi_gpio_irq=5 spi_polling_interval=0 fw_name=uni_s1g.bin auto_ba=1 sw_enc=1 listen_interval=1000
[   57.032406] start FW 330
[   57.238227] nrc-cspi spi0.0: SPI transfer timed out
[   57.243265] spi_master spi0: failed to transfer one message from queue
[   57.250102] ------------[ cut here ]------------
[   57.254756] WARNING: CPU: 0 PID: 34 at ../newah_driver-custom/nrc-hif-cspi.c:364 _c_spi_read_regs+0x208/0x230 [nrc]
[   57.265317] Modules linked in: nrc(O) iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 8021q garp stp llc snd_soc_hdmi_codec v3d raspberrypi_hwmon gpu_sched brcmfmac brcmutil bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_isp(C) i2c_brcmstb bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 spi_bcm2835 videobuf2_common vc4 snd_soc_bcm2835_i2s snd_bcm2835(C) cec vc_sm_cma(C) videodev mc drm_kms_helper drm rpivid_mem snd_soc_simple_card drm_panel_orientation_quirks snd_soc_simple_card_utils pps_gpio snd_soc_core syscopyarea sysfillrect sysimgblt fb_sys_fops backlight snd_compress snd_pcm_dmaengine nvmem_rmem uio_pdrv_genirq uio snd_pcm snd_timer snd sch_fq_codel snd_i2smic_rpi(O) mac80211 libarc4 cfg80211 rfkill fuse ipv6
[   57.334815] CPU: 0 PID: 34 Comm: kworker/0:1 Tainted: G         C O      5.15.32-v8 #1
[   57.342749] Hardware name: Raspberry Pi Compute Module 4 Rev 1.0 (DT)
[   57.349196] Workqueue: events nrc_check_start [nrc]
[   57.354145] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   57.361118] pc : _c_spi_read_regs+0x208/0x230 [nrc]
[   57.366064] lr : _c_spi_read_regs+0x19c/0x230 [nrc]
[   57.371004] sp : ffffffc00978b950
[   57.374320] x29: ffffffc00978b950 x28: 0000000000000000 x27: 0000000000000000
[   57.381476] x26: ffffffc009563848 x25: ffffff80fb78b305 x24: 0000000000000001
[   57.388630] x23: 0000000000000000 x22: ffffff8045646000 x21: 0000000000000020
[   57.395783] x20: 0000000000000010 x19: ffffffc00978bc88 x18: ffffffc08978b4d7
[   57.402935] x17: 0000000000000001 x16: 0000000000000001 x15: 076d07200765076e
[   57.410088] x14: 076f072007720765 x13: 076d07200765076e x12: 076f072007720765
[   57.417240] x11: 0720072007200720 x10: 0000000000000000 x9 : ffffffc00881029c
[   57.424393] x8 : 0000000000000004 x7 : 0000000000000003 x6 : ffffffc009379000
[   57.431545] x5 : ffffffc009379238 x4 : 0000000000000000 x3 : ffffff8045641b38
[   57.438697] x2 : 0000000000000000 x1 : ffffff8040328000 x0 : 00000000000000ff
[   57.445849] Call trace:
[   57.448297]  _c_spi_read_regs+0x208/0x230 [nrc]
[   57.452892]  c_spi_read_regs+0x34/0x70 [nrc]
[   57.457225]  spi_wait_ack+0x54/0xb0 [nrc]
[   57.461295]  nrc_fw_check_next_frag+0x108/0x140 [nrc]
[   57.466407]  nrc_download_fw+0x2fc/0x380 [nrc]
[   57.470909]  nrc_check_start+0x63c/0x790 [nrc]
[   57.475412]  process_one_work+0x1dc/0x490
[   57.479436]  worker_thread+0x144/0x470
[   57.483192]  kthread+0x144/0x160
[   57.486430]  ret_from_fork+0x10/0x20
[   57.490014] ---[ end trace 5f765400c22e14eb ]---
[   57.494784] ------------[ cut here ]------------
[   57.499422] kernel BUG at ../newah_driver-custom/nrc-fw.c:193!
[   57.505261] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[   57.510756] Modules linked in: nrc(O) iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 8021q garp stp llc snd_soc_hdmi_codec v3d raspberrypi_hwmon gpu_sched brcmfmac brcmutil bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_isp(C) i2c_brcmstb bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 spi_bcm2835 videobuf2_common vc4 snd_soc_bcm2835_i2s snd_bcm2835(C) cec vc_sm_cma(C) videodev mc drm_kms_helper drm rpivid_mem snd_soc_simple_card drm_panel_orientation_quirks snd_soc_simple_card_utils pps_gpio snd_soc_core syscopyarea sysfillrect sysimgblt fb_sys_fops backlight snd_compress snd_pcm_dmaengine nvmem_rmem uio_pdrv_genirq uio snd_pcm snd_timer snd sch_fq_codel snd_i2smic_rpi(O) mac80211 libarc4 cfg80211 rfkill fuse ipv6
[   57.580222] CPU: 0 PID: 34 Comm: kworker/0:1 Tainted: G        WC O      5.15.32-v8 #1
[   57.588152] Hardware name: Raspberry Pi Compute Module 4 Rev 1.0 (DT)
[   57.594598] Workqueue: events nrc_check_start [nrc]
[   57.599556] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   57.606529] pc : nrc_fw_check_next_frag+0x12c/0x140 [nrc]
[   57.611992] lr : nrc_fw_check_next_frag+0x108/0x140 [nrc]
[   57.617452] sp : ffffffc00978bcb0
[   57.620768] x29: ffffffc00978bcb0 x28: 0000000000000000 x27: 0000000000000000
[   57.627922] x26: ffffffc009563848 x25: ffffff80fb78b305 x24: 0000000000000001
[   57.635075] x23: 0000000000000000 x22: ffffff804541f680 x21: ffffff8045791fc0
[   57.642228] x20: ffffff804560d200 x19: ffffff804541f580 x18: ffffffc08978b4d7
[   57.649380] x17: 0000000000000001 x16: 0000000000000001 x15: 076d07200765076e
[   57.656533] x14: 076f072007720765 x13: 076d07200765076e x12: 076f072007720765
[   57.663686] x11: 0720072007200720 x10: 0000000000000000 x9 : ffffffc001254908
[   57.670838] x8 : ffffff8040328000 x7 : 0000000000000003 x6 : ffffffc009379000
[   57.677990] x5 : ffffffc009379238 x4 : 0000000000000000 x3 : 00000000000004f6
[   57.685142] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 00000000fffffffb
[   57.692295] Call trace:
[   57.694742]  nrc_fw_check_next_frag+0x12c/0x140 [nrc]
[   57.699856]  nrc_download_fw+0x2fc/0x380 [nrc]
[   57.704359]  nrc_check_start+0x63c/0x790 [nrc]
[   57.708862]  process_one_work+0x1dc/0x490
[   57.712887]  worker_thread+0x144/0x470
[   57.716643]  kthread+0x144/0x160
[   57.719881]  ret_from_fork+0x10/0x20
[   57.723472] Code: d4210000 52800000 17ffffd8 d4210000 (d4210000) 
[   57.729574] ---[ end trace 5f765400c22e14ec ]---
[   57.734196] note: kworker/0:1[34] exited with preempt_count 1
[   57.740544] ------------[ cut here ]------------
[   57.745187] WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:613 rcu_eqs_enter.constprop.0+0xf4/0x110
[   57.754007] Modules linked in: nrc(O) iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 8021q garp stp llc snd_soc_hdmi_codec v3d raspberrypi_hwmon gpu_sched brcmfmac brcmutil bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_isp(C) i2c_brcmstb bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 spi_bcm2835 videobuf2_common vc4 snd_soc_bcm2835_i2s snd_bcm2835(C) cec vc_sm_cma(C) videodev mc drm_kms_helper drm rpivid_mem snd_soc_simple_card drm_panel_orientation_quirks snd_soc_simple_card_utils pps_gpio snd_soc_core syscopyarea sysfillrect sysimgblt fb_sys_fops backlight snd_compress snd_pcm_dmaengine nvmem_rmem uio_pdrv_genirq uio snd_pcm snd_timer snd sch_fq_codel snd_i2smic_rpi(O) mac80211 libarc4 cfg80211 rfkill fuse ipv6
[   57.823477] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D WC O      5.15.32-v8 #1
[   57.831147] Hardware name: Raspberry Pi Compute Module 4 Rev 1.0 (DT)
[   57.837592] pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   57.844565] pc : rcu_eqs_enter.constprop.0+0xf4/0x110
[   57.849631] lr : rcu_eqs_enter.constprop.0+0x1c/0x110
[   57.854694] sp : ffffffc009373d20
[   57.858010] x29: ffffffc009373d20 x28: 00000000011c0018 x27: ffffffc008e5a5d8
[   57.865163] x26: ffffffc009380040 x25: 0000000000000000 x24: 0000000000000000
[   57.872317] x23: ffffffc008ea7050 x22: ffffffc0090ac878 x21: ffffffc0093789e0
[   57.879470] x20: ffffffc009378aec x19: ffffff80fb7887c0 x18: 0000000000000000
[   57.886622] x17: 0000000000000000 x16: 0000000000000000 x15: 0000007f942f1b78
[   57.893775] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000001
[   57.900928] x11: ffffff80fb7dbb80 x10: 00000000000019d0 x9 : ffffffc008b96f58
[   57.908081] x8 : ffffffc009381a70 x7 : 0000000000000000 x6 : ffffffc009379000
[   57.915233] x5 : ffffffc009379238 x4 : 0000000000000001 x3 : ffffffc00909c008
[   57.922385] x2 : 4000000000000000 x1 : ffffffc0093797f8 x0 : 4000000000000002
[   57.929538] Call trace:
[   57.931986]  rcu_eqs_enter.constprop.0+0xf4/0x110
[   57.936705]  rcu_idle_enter+0x1c/0x30
[   57.940379]  default_idle_call+0x38/0x19c
[   57.944398]  do_idle+0x258/0x2a0
[   57.947632]  cpu_startup_entry+0x30/0x90
[   57.951561]  rest_init+0xec/0x100
[   57.954888]  arch_call_rest_init+0x1c/0x28
[   57.958997]  start_kernel+0x6bc/0x6fc
[   57.962669]  __primary_switched+0xa4/0xac
[   57.966689] ---[ end trace 5f765400c22e14ed ]---

Could this have something to do with a shared hardware resource with the emmc?

1 Answer 1

0

Wifi uses spi0.0 on the CM4.. that's a conflict.

1
  • Very interesting. This project is on the back back back burner atm, so I wont be able to check, but that was keeping me up at night. Commented Mar 30, 2023 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.