zjlywjh001 Posted April 14, 2019 Posted April 14, 2019 Hi all, Recently I tried to replace the wireless module on NanoPi Neo Air and met some very strange phenomenon. I just solder off the AP6212 module and then replace it with an AP6234 module. When I use the factory FriendlyCore system with brcmfmac43340-sdio.bin & brcmfmac43340-sdio.txt in /lib/firmware/brcm, everything works ok. But when I use armbian system, the wifi just not work. It always down after about 10 seconds when the bcm43340 firmware load. And I remember previously armbian system works fine for AP6212, but AP6212A not work and has the similar problem with AP6234. I just build the the armbian use the mainline 4.14.52 kernel too. I also try hardly to modify the the diffrences positions between the kernel from frendlyelec(https://github.com/friendlyarm/linux) and linux mainline v4.14.52 in armbian. But no matter how I tried to patch the kernel , the wireless module dosen't work ever. I also tried to replace zImage and modules in a armbian system with the the kernel build using https://github.com/friendlyarm/linux and everything works fine again.(dtb not replaced but also works fine) So I guess there must be some important differences between the kernel from frendlyelec and the mainline kernel from armbian. Could someone kind to infrom me the changes made by frendlyelec in the kernel? Thanks! The following are my log: [ 4.738978] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43340-sdio.bin for chip 0x00a94c(43340) rev 0x002 [ 4.985436] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Jun 17 2014 11:48:43 version 6.10.190.49 (r48582 [ 29.114569] brcmfmac: brcmf_sdio_kso_control: max tries: rd_val=0x0 err=0 [ 29.114727] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 29.114855] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 29.114978] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 29.115060] brcmfmac: brcmf_sdio_dpc: failed backplane access over SDIO, halting operation [ 29.115079] brcmfmac: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 29.115089] brcmfmac: brcmf_cfg80211_get_channel: chanspec failed (-110) [ 30.789332] brcmfmac: brcmf_sdio_kso_control: max tries: rd_val=0x0 err=0 [ 30.789499] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 30.789617] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.695981] brcmfmac: brcmf_sdio_kso_control: max tries: rd_val=0x0 err=0 [ 44.696144] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.696262] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.697108] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.697201] brcmfmac: brcmf_sdio_dpc: failed backplane access over SDIO, halting operation [ 44.697211] brcmfmac: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 44.697221] brcmfmac: brcmf_cfg80211_get_channel: chanspec failed (-110) [ 44.697436] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.697570] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 44.697725] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.718439] brcmfmac: brcmf_sdio_kso_control: max tries: rd_val=0x0 err=0 [ 56.718577] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.718685] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.718787] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.718857] brcmfmac: brcmf_sdio_dpc: failed backplane access over SDIO, halting operation [ 56.718867] brcmfmac: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 56.718875] brcmfmac: brcmf_cfg80211_get_channel: chanspec failed (-110) [ 56.718949] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.719052] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame [ 56.719153] brcmfmac: brcmf_sdio_txfail: sdio error, abort command and terminate frame Board: NanoPi Air
zjlywjh001 Posted April 15, 2019 Author Posted April 15, 2019 Finally I got the reason. It seemed that it is a bug in armbian mainline kernel. The LOSC_OUT_GATING_EN register does not be enabled to output the 32.768kHz clock to the wlan module. This clock is used as a low power clock in BCM SoCs. If the clock is missing, the module will down after it enter low power mode and never wake up. I don't know why AP6212 can work fine without this 32k clock. And finally I build a very simple patch to solve this problem: diff -ur a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c --- a/drivers/rtc/rtc-sun6i.c 2019-04-14 16:19:50.749519000 +0800 +++ b/drivers/rtc/rtc-sun6i.c 2019-04-15 22:29:13.670404000 +0800 @@ -215,6 +215,9 @@ /* Switch to the external, more precise, oscillator */ writel(SUN6I_LOSC_CTRL_KEY | SUN6I_LOSC_CTRL_EXT_OSC, rtc->base + SUN6I_LOSC_CTRL); + + writel(SUN6I_LOSC_OUT_GATING_EN, + rtc->base + SUN6I_LOSC_OUT_GATING); /* Yes, I know, this is ugly. */ sun6i_rtc = rtc; 1
martinayotte Posted April 15, 2019 Posted April 15, 2019 1 hour ago, zjlywjh001 said: The LOSC_OUT_GATING_EN register does not be enabled to output the 32.768kHz clock to the wlan module. Normally, as for many other boards, this gating is done by tweaking RTC node in DT, so no needs to change kernel code.
zjlywjh001 Posted April 15, 2019 Author Posted April 15, 2019 2 hours ago, martinayotte said: Normally, as for many other boards, this gating is done by tweaking RTC node in DT, so no needs to change kernel code. But why so strange in NanoPi Air boards?
martinayotte Posted April 15, 2019 Posted April 15, 2019 3 minutes ago, zjlywjh001 said: But why so strange in NanoPi Air boards? I don't know, maybe your image was older than when gating was added to all H3 ...
zjlywjh001 Posted April 16, 2019 Author Posted April 16, 2019 3 hours ago, martinayotte said: I don't know, maybe your image was older than when gating was added to all H3 ... But I use the master branch (with orange-pi-4.19 kernel) to build, still have the problem.
martinayotte Posted April 16, 2019 Posted April 16, 2019 13 hours ago, zjlywjh001 said: But I use the master branch (with orange-pi-4.19 kernel) to build, still have the problem. 4.19 is the "next" branch ... Did you tried the "dev" branch using 5.0.y ?
zjlywjh001 Posted April 16, 2019 Author Posted April 16, 2019 1 hour ago, martinayotte said: 4.19 is the "next" branch ... Did you tried the "dev" branch using 5.0.y ? No, the supported kernel in armbian now is 4.19.y. I'll try 5.0 later.
Recommended Posts