al177 / esp8089

Linux kernel module driver for the ESP8089 WiFi chip
GNU General Public License v2.0
181 stars 114 forks source link

SDIO device disappears after a while #55

Open ab0tj opened 9 months ago

ab0tj commented 9 months ago

Using the driver on an Odroid Go Advance Black edition with mainline kernel 6.1.61, the driver works for a while but the SDIO device seems to drop off the bus after a while. The kernel tries to load the driver again but ends up panicking. The Rockchip BSP drover doesn't appear to have this issue. dmesg attached below

I patched the driver to drive the RST GPIO high instead of letting it float, but that did not help.

[  555.718794] esp_sdio_remove enter
[  555.719865] sif_disable_irq release irq failed
[  555.719895] ------------[ cut here ]------------
[  555.719900] WARNING: CPU: 2 PID: 389 at kernel/workqueue.c:3069 __flush_work.isra.0+0x318/0x350
[  555.719940] Modules linked in: 88x2bu(O) snd_seq snd_seq_device ipv6 iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_mangle exfat esp8089(O) mac80211 libarc4 hantro_vpu v4l2_vp9 cfg80211 videobuf2_dma_contig v4l2_h264
[  555.720025] CPU: 2 PID: 389 Comm: kworker/2:4 Tainted: G        W  O       6.1.60 #1
[  555.720035] Hardware name: ODROID-GO Advance Black Edition (DT)
[  555.720042] Workqueue: events_freezable mmc_rescan
[  555.720061] pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  555.720072] pc : __flush_work.isra.0+0x318/0x350
[  555.720083] lr : __cancel_work_timer+0x110/0x190
[  555.720094] sp : ffff80000985ba80
[  555.720099] x29: ffff80000985ba80 x28: ffff00000a0a5000 x27: ffff00003fd7aa00
[  555.720115] x26: ffff00003fd7aa78 x25: ffff000001288418 x24: ffff8000093a84b0
[  555.720130] x23: ffff8000093652e0 x22: 0000000000000001 x21: 0000000000000000
[  555.720145] x20: ffff0000048d2340 x19: ffff0000048d2340 x18: fffffffffffedf48
[  555.720160] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000030
[  555.720175] x14: fffffffffffedf78 x13: ffff80000924fd70 x12: 0000000000000990
[  555.720189] x11: 0000000000000040 x10: ffff80000924d0b0 x9 : ffff80000924d0a8
[  555.720204] x8 : ffff000000800028 x7 : 0000000000000000 x6 : 0000000000000000
[  555.720219] x5 : ffff000004965894 x4 : 0000000000000000 x3 : ffff000004965894
[  555.720233] x2 : 0000000000000011 x1 : ffff0000013e8000 x0 : 0000000000000000
[  555.720249] Call trace:
[  555.720253]  __flush_work.isra.0+0x318/0x350
[  555.720265]  __cancel_work_timer+0x110/0x190
[  555.720276]  cancel_work_sync+0x14/0x20
[  555.720287]  sip_detach+0x9c/0x230 [esp8089]
[  555.720316]  esp_sdio_remove+0x64/0x1bc [esp8089]
[  555.720336]  sdio_bus_remove+0x3c/0x174
[  555.720347]  device_remove+0x4c/0x80
[  555.720359]  device_release_driver_internal+0x1e4/0x250
[  555.720369]  device_release_driver+0x18/0x24
[  555.720378]  bus_remove_device+0xd0/0x15c
[  555.720387]  device_del+0x174/0x3a0
[  555.720400]  sdio_remove_func+0x48/0x70
[  555.720409]  mmc_sdio_detect+0x98/0x170
[  555.720418]  mmc_rescan+0x8c/0x320
[  555.720427]  process_one_work+0x1fc/0x3a0
[  555.720439]  worker_thread+0x170/0x4f4
[  555.720450]  kthread+0xd8/0xdc
[  555.720462]  ret_from_fork+0x10/0x20
[  555.720475] ---[ end trace 0000000000000000 ]---
[  555.832553] mmc1: card 0001 removed
[  555.845433] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[  555.882710] mmc1: queuing unknown CIS tuple 0x01 [d9 01 ff] (3 bytes)
[  555.890497] mmc1: queuing unknown CIS tuple 0x1a [01 01 00 02 07] (5 bytes)
[  555.894114] mmc1: queuing unknown CIS tuple 0x1b [c1 41 30 30 ff ff ff ff] (8 bytes)
[  555.895423] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[  555.896789] mmc1: new high speed SDIO card at address 0001
[  555.898079] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
[  555.898109] Mem abort info:
[  555.898113]   ESR = 0x0000000096000004
[  555.898119]   EC = 0x25: DABT (current EL), IL = 32 bits
[  555.898127]   SET = 0, FnV = 0
[  555.898132]   EA = 0, S1PTW = 0
[  555.898137]   FSC = 0x04: level 0 translation fault
[  555.898143] Data abort info:
[  555.898146]   ISV = 0, ISS = 0x00000004
[  555.898150]   CM = 0, WnR = 0
[  555.898155] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000009275000
[  555.898163] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
[  555.898183] Internal error: Oops: 0000000096000004 [#1] SMP
[  555.898201] Modules linked in: 88x2bu(O) snd_seq snd_seq_device ipv6 iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_mangle exfat esp8089(O) mac80211 libarc4 hantro_vpu v4l2_vp9 cfg80211 videobuf2_dma_contig v4l2_h264
[  555.898293] CPU: 2 PID: 389 Comm: kworker/2:4 Tainted: G        W  O       6.1.60 #1
[  555.898306] Hardware name: ODROID-GO Advance Black Edition (DT)
[  555.898319] Workqueue: events_freezable mmc_rescan
[  555.898353] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  555.898367] pc : esp_sdio_probe+0x54/0x400 [esp8089]
[  555.898403] lr : sdio_bus_probe+0x13c/0x1ec
[  555.898418] sp : ffff80000985ba30
[  555.898425] x29: ffff80000985ba30 x28: 0000000000000001 x27: 0000000000000001
[  555.898444] x26: ffff000001288000 x25: ffff800000b8b000 x24: ffff800000b883a8
[  555.898462] x23: ffff000013264808 x22: ffff000013264800 x21: ffff000013264800
[  555.898481] x20: ffff800000bb7a88 x19: 0000000000000000 x18: ffffffffffffffff
[  555.898498] x17: 0000000000000000 x16: 0000000000000000 x15: ffffffffffffffff
[  555.898516] x14: 0000000000000337 x13: 0000000000000337 x12: 0000000000000001
[  555.898534] x11: 0000000000000001 x10: 0000000000000960 x9 : ffff80000985b730
[  555.898552] x8 : ffff0000013e89c0 x7 : ffff00003fd7b080 x6 : 000000031f7fe34d
[  555.898570] x5 : 00ffffffffffffff x4 : 00021bde407ce5db x3 : 0000000000000018
[  555.898588] x2 : ffff800000b7e230 x1 : ffff000004935800 x0 : 0000000000000003
[  555.898608] Call trace:
[  555.898615]  esp_sdio_probe+0x54/0x400 [esp8089]
[  555.898645]  sdio_bus_probe+0x13c/0x1ec
[  555.898657]  really_probe+0xc0/0x3dc
[  555.898674]  __driver_probe_device+0x7c/0x160
[  555.898686]  driver_probe_device+0x3c/0x110
[  555.898699]  __device_attach_driver+0xbc/0x160
[  555.898712]  bus_for_each_drv+0x78/0xd0
[  555.898724]  __device_attach+0x9c/0x1c0
[  555.898736]  device_initial_probe+0x14/0x20
[  555.898748]  bus_probe_device+0x9c/0xa4
[  555.898760]  device_add+0x3a8/0x7d0
[  555.898772]  sdio_add_func+0x6c/0x8c
[  555.898783]  mmc_attach_sdio+0x1b0/0x3f0
[  555.898795]  mmc_rescan+0x230/0x320
[  555.898810]  process_one_work+0x1fc/0x3a0
[  555.898828]  worker_thread+0x170/0x4f4
[  555.898842]  kthread+0xd8/0xdc
[  555.898859]  ret_from_fork+0x10/0x20
[  555.898882] Code: 34000a80 f9401293 910022b7 f900129f (f9400676) 
[  555.898896] ---[ end trace 0000000000000000 ]---
ab0tj commented 9 months ago

Just wanted to add that this is not a problem with Armbian's implementation of the driver. Using that driver also fixed an issue where my RX rate would stay locked at 2Mbps and couldn't go higher. If I can find the difference that causes the issues I'll report back.