orangepi-xunlong / orangepi-build

Orange Pi build for H2+, H3, H5, H6, H616, RK3328, RK3399 and RK3588(s)
http://www.orangepi.cn/
GNU General Public License v2.0
634 stars 272 forks source link

Incorrect initialization of wifi/bt chip in OrangePi 3B official image (linux6.6.0-rc5) #112

Open al37919 opened 8 months ago

al37919 commented 8 months ago

I have problem with official image: Orangepi3b_1.0.0_debian_bookworm_desktop_xfce_linux6.6.0-rc5.img Some startups result in incorrect initialization of wifi/bt chip. The short excerpt from dmesg is here:

[    6.966407] WCN_ERR: read marlin3E chip id fail, ret=-110
[    6.966511] WCN: marlin_scan_finish!
[    6.966519] sdiohal:probe ok
[    6.966720] sdiohal:scan end!
[    6.966735] WCN: then marlin start to download
[    6.971620] WCN: marlin_request_firmware from /lib/firmware/wcnmodem.bin start!
[    6.971780] kworker/0:0: vmalloc error: size 18446744073709551615, exceeds total pages, mode:0xcc0(GFP_KERNEL), nodemask=(null),cpuset=/,mems_allowed=0
[    6.971840] CPU: 0 PID: 8 Comm: kworker/0:0 Not tainted 6.6.0-rc5-rockchip-rk356x #1.0.0
[    6.971853] Hardware name: Rockchip RK3566 OPi 3B (DT)
[    6.971860] Workqueue: events pre_btwifi_download_sdio
[    6.971890] Call trace:
[    6.971894]  dump_backtrace+0x98/0x118
[    6.971910]  show_stack+0x18/0x24
[    6.971920]  dump_stack_lvl+0x48/0x60
[    6.971932]  dump_stack+0x18/0x24
[    6.971940]  warn_alloc+0xfc/0x1a8
[    6.971953]  __vmalloc_node_range+0x6fc/0x744
[    6.971968]  __vmalloc_node+0x54/0x64
[    6.971979]  vmalloc+0x24/0x30
[    6.971990]  load_firmware_data_path+0x64/0x220
[    6.972004]  pre_btwifi_download_sdio+0xf4/0x1334
[    6.972018]  process_scheduled_works+0x188/0x3f8
[    6.972033]  worker_thread+0x170/0x2e4
[    6.972044]  kthread+0x100/0x114
[    6.972055]  ret_from_fork+0x10/0x20
[    6.972069] Mem-Info:
[    6.972079] active_anon:1479 inactive_anon:178 isolated_anon:0
                active_file:4288 inactive_file:3090 isolated_file:0
                unevictable:2027 dirty:0 writeback:0
                slab_reclaimable:3272 slab_unreclaimable:6017
                mapped:3118 shmem:1450 pagetables:98
                sec_pagetables:0 bounce:0
                kernel_misc_reclaimable:0
                free:459308 free_pcp:2700 free_cma:30716

The long output of 'orangepimonitor -U' including 4 failures and 2 successful boots is provided here: https://pastebin.com/KgM4JEqi

al37919 commented 7 months ago

This issue is caused by incorrect detection of uwe5622 hardware. The first sign of failure in dmesg output is:

[    6.829202] sdiohal:sdiohal_scan_card
[    6.830872] sdiohal:sdiohal_probe: func->class=0, vendor=0x0000, device=0x0000, func_num=0x0001, clock=150000000
[    6.831338] sdiohal err:dt readl fail ret:-110, system_addr=0x4082c208

The workaround is:

diff --git a/drivers/net/wireless/uwe5622/unisocwcn/Makefile b/drivers/net/wireless/uwe5622/unisocwcn/Makefile
index 939acb5c9..f9c595747 100755
--- a/drivers/net/wireless/uwe5622/unisocwcn/Makefile
+++ b/drivers/net/wireless/uwe5622/unisocwcn/Makefile
@@ -68,12 +68,12 @@ endif

 ifeq ($(CONFIG_RK_WIFI_DEVICE_UWE5622),y)
 export CONFIG_WCN_SDIO = y
 #export CONFIG_WCN_USB = y
 # export CONFIG_WCN_GNSS = y
-ccflags-y += -DCONFIG_CHECK_DRIVER_BY_CHIPID
-#ccflags-y += -DCONFIG_UWE5622
+#ccflags-y += -DCONFIG_CHECK_DRIVER_BY_CHIPID
+ccflags-y += -DCONFIG_UWE5622
 BSP_CHIP_ID := uwe5622
 WCN_HW_TYPE := sdio
 endif

 ifeq ($(CONFIG_AW_WIFI_DEVICE_UWE5622),y)

After disabling of CONFIG_CHECK_DRIVER_BY_CHIPID 100% of startups are successful. The problem and workaround were described in detail here: https://forum.armbian.com/topic/30953-orangepi3b-initial-startup-is-ok-wifi-fails-after-reboot/#comment-173697 (post 4)