newracom / nrc7292_sw_pkg

NRC7292 Software Package for Host mode (Linux OS)
http://www.newracom.com/product
GNU General Public License v2.0
58 stars 27 forks source link

Still having issues with driver failing to load. #61

Closed synaption closed 1 year ago

synaption commented 2 years ago

I was hoping that something would happen to fix this issue but I finally got around to building the latest version of the driver and I am still having the problem where the driver does not load about half of the time. Below is my dmesg.

sudo insmod /home/pi/nrc_pkg/sw/driver/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

[   35.501069] ------------[ cut here ]------------
[   35.505702] WARNING: CPU: 3 PID: 510 at ../newah_driver-custom/nrc-hif-cspi.c:364 _c_spi_read_regs+0x204/0x230 [nrc]
[   35.516287] Modules linked in: nrc(O+) fsl_jr_uio caam_jr caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine rng_core authenc libdes imx8mq_interconnect imx_interconnect imx8m_ddrc caam secvio error governor_userspace imx_bus snd_soc_fsl_sai crct10dif_ce ax88179_178a imx_sdma snd_i2smic_rpi(O) fuse
[   35.543360] CPU: 3 PID: 510 Comm: insmod Tainted: G           O      5.15.32 #1
[   35.550669] Hardware name: Google i.MX8MQ Phanbell (DT)
[   35.555893] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   35.562855] pc : _c_spi_read_regs+0x204/0x230 [nrc]
[   35.567768] lr : _c_spi_read_regs+0x194/0x230 [nrc]
[   35.572680] sp : ffff80000b153340
[   35.575991] x29: ffff80000b153340 x28: 0000000000000013 x27: 0000000000000100
[   35.583131] x26: ffff8000013cfec0 x25: ffff8000013d0000 x24: ffff000005972a00
[   35.590271] x23: ffff000005972b10 x22: ffff00000559e800 x21: 0000000000000010
[   35.597409] x20: 0000000000000000 x19: ffff000005972b10 x18: 0000000000000020
[   35.604550] x17: 0000000000001298 x16: 0000000000001258 x15: 00000000000002a7
[   35.611689] x14: 00000000000001a1 x13: 0000000000000000 x12: 0000000000000007
[   35.618827] x11: 0000000000000000 x10: 00000000000002a7 x9 : 0000000000000000
[   35.625966] x8 : ffff00003fd99f00 x7 : 0000000000000000 x6 : 0000000000000000
[   35.633105] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff000004ceeb80
[   35.640244] x2 : 0000000000000000 x1 : ffff000008358dc0 x0 : 00000000000000ff
[   35.647385] Call trace:
[   35.649830]  _c_spi_read_regs+0x204/0x230 [nrc]
[   35.654398]  c_spi_read_regs+0x2c/0x70 [nrc]
[   35.658704]  c_spi_probe+0xb0/0x200 [nrc]
[   35.662747]  spi_probe+0x88/0xf0
[   35.665980]  really_probe.part.0+0x9c/0x310
[   35.670167]  __driver_probe_device+0x98/0x150
[   35.674526]  driver_probe_device+0xc8/0x160
[   35.678709]  __driver_attach+0xfc/0x190
[   35.682547]  bus_for_each_dev+0x70/0xd0
[   35.686383]  driver_attach+0x28/0x40
[   35.689960]  bus_add_driver+0x108/0x1f0
[   35.693797]  driver_register+0x7c/0x130
[   35.697634]  __spi_register_driver+0xcc/0xe0
[   35.701905]  nrc_hif_cspi_init+0xd4/0x150 [nrc]
[   35.706470]  nrc_hif_init+0x1c/0xd0 [nrc]
[   35.710514]  nrc_platform_probe+0x5c/0x120 [nrc]
[   35.715166]  platform_probe+0x6c/0xe0
[   35.718830]  really_probe.part.0+0x9c/0x310
[   35.723015]  __driver_probe_device+0x98/0x150
[   35.727373]  driver_probe_device+0xc8/0x160
[   35.731557]  __driver_attach+0xfc/0x190
[   35.735394]  bus_for_each_dev+0x70/0xd0
[   35.739230]  driver_attach+0x28/0x40
[   35.742806]  bus_add_driver+0x108/0x1f0
[   35.746643]  driver_register+0x7c/0x130
[   35.750480]  __platform_driver_register+0x2c/0x40
[   35.755187]  nrc_init+0x5c/0x1000 [nrc]
[   35.759058]  do_one_initcall+0x50/0x1b0
[   35.762895]  do_init_module+0x44/0x240
[   35.766647]  load_module+0x1f70/0x2680
[   35.770397]  __do_sys_finit_module+0xb8/0x100
[   35.774755]  __arm64_sys_finit_module+0x24/0x30
[   35.779286]  invoke_syscall+0x48/0x120
[   35.783037]  el0_svc_common.constprop.0+0xcc/0xf0
[   35.787743]  do_el0_svc+0x28/0x90
[   35.791057]  el0_svc+0x20/0x60
[   35.794114]  el0t_64_sync_handler+0x1a8/0x1b0
[   35.798470]  el0t_64_sync+0x1a0/0x1a4
[   35.802133] ---[ end trace f940fce3dceca63c ]---
[   35.806836] [Error] failed to read register(0x0).
[   35.811554] nrc-cspi: probe of spi0.0 failed with error -22
[   35.817318] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000314
[   35.817318] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000078
[   35.817323] Mem abort info:
[   35.826121] Mem abort info:
[   35.826123]   ESR = 0x96000004
[   35.826126]   EC = 0x25: DABT (current EL), IL = 32 bits
[   35.826129]   SET = 0, FnV = 0
[   35.826132]   EA = 0, S1PTW = 0
[   35.826134]   FSC = 0x04: level 0 translation fault
[   35.826137] Data abort info:
[   35.826138]   ISV = 0, ISS = 0x00000004
[   35.826140]   CM = 0, WnR = 0
[   35.826139] imx-sdma 30bd0000.dma-controller: All bds consumed,restart now.
[   35.826143] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000045bda000
[   35.826148] [0000000000000314] pgd=0000000000000000, p4d=0000000000000000
[   35.826156] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[   35.826160] Modules linked in: nrc(O+) fsl_jr_uio caam_jr caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine rng_core authenc libdes
[   35.834991]   ESR = 0x96000004
[   35.837749]  imx8mq_interconnect imx_interconnect imx8m_ddrc caam secvio error governor_userspace imx_bus snd_soc_fsl_sai crct10dif_ce ax88179_178a imx_sdma snd_i2smic_rpi(O) fuse
[   35.840608]   EC = 0x25: DABT (current EL), IL = 32 bits
[   35.843616] CPU: 3 PID: 510 Comm: insmod Tainted: G        W  O      5.15.32 #1
[   35.843622] Hardware name: Google i.MX8MQ Phanbell (DT)
[   35.843625] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   35.843631] pc : spi_start+0xa4/0x1b0 [nrc]
[   35.848978]   SET = 0, FnV = 0
[   35.851993] lr : spi_start+0x94/0x1b0 [nrc]
[   35.855166]   EA = 0, S1PTW = 0
[   35.860022] sp : ffff80000b1538a0
[   35.860024] x29: ffff80000b1538a0 x28: 0000000000000013 x27: 0000000000000100
[   35.860033] x26: ffff8000013cfec0 x25: ffff800008133d70 x24: 0000000000000027
[   35.860041] x23: 0000000000000033 x22: 0000000000000000 x21: ffff8000013d1cc0
[   35.860051] x20: ffff000005972a00
[   35.862952]   FSC = 0x04: level 0 translation fault
[   35.866755]  x19: ffff000005972a90 x18: 0000000000000020
[   35.866762] x17: 5300737265766972 x16: 643d4d4554535953 x15: 00000002e8c8ae48
[   35.866771] x14: 00000000000003bc x13: 0000000000000001 x12: 0000000000000000
[   35.866779] x11: 0000000000000000
[   35.869759] Data abort info:
[   35.876697]  x10: 00000000000003c6 x9 : 0000000000000000
[   35.876703] x8 : ffff00003fd71f80 x7 : 0000000000000000 x6 : 0000000000000000
[   35.876711] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff8000362f0000
[   35.876719] x2 : 0000000000200003 x1 : 0000000000000003 x0 : 0000000000000000
[   35.883181]   ISV = 0, ISS = 0x00000004

[   35.889943] Call trace:
[   35.889946]  spi_start+0xa4/0x1b0 [nrc]
[   35.895567]   CM = 0, WnR = 0
[   35.908045]  nrc_hif_init+0xb4/0xd0 [nrc]
[   35.908066] imx-sdma 30bd0000.dma-controller: All bds consumed,restart now.
[   35.908084]  nrc_platform_probe+0x5c/0x120 [nrc]
[   35.911173] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000454c6000
[   35.927127]  platform_probe+0x6c/0xe0
[   35.927138]  really_probe.part.0+0x9c/0x310
[   35.927144]  __driver_probe_device+0x98/0x150
[   35.932456] [0000000000000078] pgd=0000000000000000
[   35.939752]  driver_probe_device+0xc8/0x160
[   35.939758]  __driver_attach+0xfc/0x190
[   35.939765]  bus_for_each_dev+0x70/0xd0
[   35.945005] , p4d=0000000000000000
[   35.951942]  driver_attach+0x28/0x40
[   35.951948]  bus_add_driver+0x108/0x1f0
[   35.951953]  driver_register+0x7c/0x130
[   35.951959]  __platform_driver_register+0x2c/0x40

[   35.959188]  nrc_init+0x5c/0x1000 [nrc]
[   36.141919]  do_one_initcall+0x50/0x1b0
[   36.145757]  do_init_module+0x44/0x240
[   36.149509]  load_module+0x1f70/0x2680
[   36.153260]  __do_sys_finit_module+0xb8/0x100
[   36.157618]  __arm64_sys_finit_module+0x24/0x30
[   36.162150]  invoke_syscall+0x48/0x120
[   36.165900]  el0_svc_common.constprop.0+0xcc/0xf0
[   36.170606]  do_el0_svc+0x28/0x90
[   36.173921]  el0_svc+0x20/0x60
[   36.176978]  el0t_64_sync_handler+0x1a8/0x1b0
[   36.181334]  el0t_64_sync+0x1a0/0x1a4
[   36.184999] Code: b9000abf b9414a60 7100001f 540003ac (b94316c0) 
[   36.191093] ---[ end trace f940fce3dceca63d ]---
[   36.195708] Internal error: Oops: 96000004 [#2] PREEMPT SMP
[   36.201284] Modules linked in: nrc(O+) fsl_jr_uio caam_jr caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine rng_core authenc libdes imx8mq_interconnect imx_interconnect imx8m_ddrc caam secvio error governor_userspace imx_bus snd_soc_fsl_sai crct10dif_ce ax88179_178a imx_sdma snd_i2smic_rpi(O) fuse
[   36.228360] CPU: 1 PID: 513 Comm: nrc-spi-rx Tainted: G      D W  O      5.15.32 #1
[   36.236017] Hardware name: Google i.MX8MQ Phanbell (DT)
[   36.241241] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   36.248202] pc : spi_rx_thread+0x7c/0x950 [nrc]
[   36.252788] lr : spi_rx_thread+0x54/0x950 [nrc]
[   36.257354] sp : ffff80000b2a3db0
[   36.260666] x29: ffff80000b2a3db0 x28: 0000000000000000 x27: 0000000000000000
[   36.267806] x26: 0000000000000000 x25: ffff8000013d1cc0 x24: ffff00000937a020
[   36.274944] x23: ffff8000013bd2a0 x22: ffff80000b1537e8 x21: ffff0000080f2940
[   36.282083] x20: ffff000005972a00 x19: ffff000005972a90 x18: 0000000000000000
[   36.289222] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[   36.296361] x14: 00000000000003ae x13: 0000000000000001 x12: 0000000000000000
[   36.303501] x11: 0000000000000001 x10: 0000000000000950 x9 : ffff80000b2a3da0
[   36.310639] x8 : ffff0000080f32f0 x7 : ffff00003fd71f00 x6 : 0000000000000000
[   36.317778] x5 : 00000000410fd030 x4 : 0000000000000000 x3 : ffff0000080f3024
[   36.324917] x2 : 0000000000000a20 x1 : 0000000000000000 x0 : 0000000000000000
[   36.332056] Call trace:
[   36.334502]  spi_rx_thread+0x7c/0x950 [nrc]
[   36.338721]  kthread+0x154/0x160
[   36.341954]  ret_from_fork+0x10/0x20
[   36.345535] Code: 35000780 531e7421 52814402 d2800000 (f9403f56) 
[   36.351629] ---[ end trace f940fce3dceca63e ]---
[   62.429477] cfg80211: failed to load regulatory.db
synaption commented 2 years ago

nrc_simple.ko seems to load reliably.

synaption commented 2 years ago

a solution that would allow me to rmmod and load again without rebooting would be sufficient for my purposes. Currently I get the below error.

$ sudo rmmod -fv nrc 
rmmod: ERROR: could not remove 'nrc': Device or resource busy
rmmod: ERROR: could not remove module nrc: Device or resource busy
synaption commented 1 year ago

Being carful to rmmod the driver before shutdown alleviates this problem in my current circumstances. I am guessing it has something to do with trying to load the firmware when it is already loaded.