Power & Source of Big Ideas

Very stange when replace AP6212 with AP6234 on a NanoPiAir

Moderators: chensy, FATechsupport

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 10 seconds when the bcm43340 firmware load.

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
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:

Code: Select all

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;

Who is online

In total there are 37 users online :: 0 registered, 0 hidden and 37 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 37 guests