Page 1 of 1

Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Thu Jul 06, 2017 3:01 pm
by eiger824
Hello everyone!

I am trying to set up WiFi in my Wandboard Dual (Revision D1) using Yocto Pyro. From the linux-firmware recipe file I see that the .bin file for the bcm4339 chip is installed under /lib/firmware/brcm/, and fromt the nvram-config recipe file I see that the config file is installed under the same directory.

In fact, I had to create a separate .txt config file with the actual nvram config for the bcm4339 chip, since it was not there by default.

Anyhow, when I am modprobing the bcmdhd module I get the following output:

Code: Select all
root@wbd:~# modprobe bcmdhd firmware_path=/lib/firmware/brcm/brcmfmac4339-sdio.bin nvram_path=/lib/firmware/brcm/brcmfmac4339-sdio.txt
dhd_module_init in
Power-up adapter 'DHD generic adapter'
wifi_platform_bus_enumerate device present 1
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
mmc1: new high speed SDIO card at address 0001
brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 4339 rev 2 pmurev 23
random: nonblocking pool is initialized
brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Aug 28 2014 18:39:28 version 6.37.32.RC23.34.28 (r499539)
brcmfmac: brcmf_c_preinit_dcmds: Set event_msgs error (-52)
brcmfmac: brcmf_bus_start: failed: -52
brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding
failed to power up DHD generic adapter, 3 retry left
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed
wifi_platform_bus_enumerate device present 1
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
mmc1: new high speed SDIO card at address 0001
brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 4339 rev 2 pmurev 23
brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Aug 28 2014 18:39:28 version 6.37.32.RC23.34.28 (r499539)
brcmfmac: brcmf_c_preinit_dcmds: Set event_msgs error (-52)
brcmfmac: brcmf_bus_start: failed: -52
brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding
failed to power up DHD generic adapter, 2 retry left
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed
wifi_platform_bus_enumerate device present 1
mmc1: new high speed SDIO card at address 0001
failed to power up DHD generic adapter, 1 retry left
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed
wifi_platform_bus_enumerate device present 1
sdio_read_cis: 5 callbacks suppressed
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
mmc1: new high speed SDIO card at address 0001
net_ratelimit: 5 callbacks suppressed
brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 4339 rev 2 pmurev 23
brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Aug 28 2014 18:39:28 version 6.37.32.RC23.34.28 (r499539)
brcmfmac: brcmf_c_preinit_dcmds: Set event_msgs error (-52)
brcmfmac: brcmf_bus_start: failed: -52
brcmfmac: brcmf_sdio_firmware_callback: dongle is not responding
failed to power up DHD generic adapter, 0 retry left
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed
failed to power up DHD generic adapter, max retry reached**


It seems that it fails to find the dongle.

Anyone experiencing the same issue? Any help is much appreciated!

/eiger824

******************************************** UPDATE ********************************************
I checked and by running the kernel menuconfig I see the following 2 variables:
Code: Select all
CONFIG_BCMDHD_FW_PATH="/lib/firmware/brcm/fw_bcmdhd.bin"
CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/bcmdhd.cal"

Meaning that the bcmdhd driver will look for the firmware files at the specified paths.

I noticed that I had the 2 firmware files but with the names shipped from the linux-firmware recipe file and the nvram-config recipe files, so I created 2 symlinks with the names that the kernel expects to read which point to the actual firmware files, i.e.:
Code: Select all
root@wbd:/lib/firmware/brcm$ ln -s brcmfmac4339-sdio.bin fw_bcmdhd.bin
root@wbd:/lib/firmware/brcm$ ln -s brcmfmac4339-sdio.txt bcmdhd.cal

Then I rebooted the board and got the following output on dmesg:
Code: Select all
[    4.295950] dhd_module_init in
[    4.298326] Power-up adapter 'DHD generic adapter'
[    4.301889] wifi_platform_bus_enumerate device present 1
[    4.324810] systemd[1]: Created slice system-getty.slice.
[    4.346674] systemd[1]: Starting Remount Root and Kernel File Systems...
[    4.348640] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    4.357468] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    4.379515] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    4.383557] EXT4-fs (mmcblk2p2): re-mounted. Opts: (null)
[    4.399173] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    4.404634] systemd[1]: Listening on Syslog Socket.
[    4.427507] systemd[1]: Starting Journal Service...
[    4.444666] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    4.474506] systemd[1]: Reached target Swap.
[    4.493538] mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
[    4.498424] mmc1: new high speed SDIO card at address 0001
[    4.504428] systemd[1]: Mounting Temporary Directory...
[    4.527648] systemd[1]: Mounted Debug File System.
[    4.535850] F1 signature OK, socitype:0x1 chip:0x4339 rev:0x1 pkg:0x2
[    4.544539] systemd[1]: Mounted Temporary Directory.
[    4.549475] DHD: dongle ram size is set to 786432(orig 786432) at 0x180000
[    4.555886] wifi_platform_get_mac_addr
[    4.560789] fw path is /lib/firmware/brcm/fw_bcmdhd.bin
[    4.565057] nvram_path is /lib/firmware/brcm/bcmdhd.cal
[    4.569313] CFG80211-ERROR) wl_setup_wiphy : Registering Vendor80211)
[    4.575720] systemd[1]: Started Remount Root and Kernel File Systems.
[    4.581606] wl_create_event_handler(): thread:wl_event_handler:b1 started
[    4.588172] CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xa87c143c
[    4.600136] dhd_attach(): thread:dhd_watchdog_thread:b2 started
[    4.604947] dhd_attach(): thread:dhd_dpc:b3 started
[    4.608765] dhd_deferred_work_init: work queue initialized
[    4.615166] systemd[1]: Starting udev Coldplug all Devices...
[    4.630189] fw path is /lib/firmware/brcm/fw_bcmdhd.bin
[    4.636546] systemd[1]: Starting Create Static Device Nodes in /dev...
[    4.643447] nvram_path is /lib/firmware/brcm/bcmdhd.cal
[    4.726521] systemd[1]: Started Create Static Device Nodes in /dev.
[    4.755011] systemd[1]: Reached target Local File Systems (Pre).
[    4.786194] systemd[1]: Mounting /var/volatile...
[    4.797434] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.
[    4.807959] systemd[1]: Starting udev Kernel Device Manager...
[    4.836149] systemd[1]: Mounted /var/volatile.
[    4.854964] systemd[1]: Started Journal Service.
[    4.985696] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[    4.998365] wifi_platform_get_mac_addr
[    5.012316] dhd_get_concurrent_capabilites: Get P2P failed (error=-23)
[    5.031141] Firmware up: op_mode=0x0001, MAC=b0:f1:ec:3c:16:c7
[    5.070881] dhd_preinit_ioctls Set Event mask failed -14
[    5.083785] dhdsdio_probe: dhd_bus_start failed
[    5.095194] dhd_wlfc_deinit():3256, Already disabled!
[    5.126037] systemd-journald[174]: Received request to flush runtime journal from PID 1
[    5.174534] dhd_detach(): thread:dhd_watchdog_thread:b2 terminated OK
[    5.181569] dhd_dpc_thread: Unexpected up_cnt 0
[    5.186970] dhd_detach(): thread:dhd_dpc:b3 terminated OK
[    5.206732] CFG80211-ERROR) wl_event_handler : was terminated
[    5.213023] wl_destroy_event_handler(): thread:wl_event_handler:b1 terminated OK
[    5.294851] bcmsdh_sdmmc: probe of mmc1:0001:2 failed with error -12
[    6.694718] cfg80211: World regulatory domain updated:
[    6.698588] cfg80211:  DFS Master region: unset
[    6.701657] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    6.712078] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    6.719496] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz, 92000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    6.728549] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    6.735622] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    6.743815] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    6.752639] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    6.759499] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    6.766246] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   17.294181] dhd_wifi_platform_load_sdio: sdio_register_driver timeout or error
[   17.301766] wifi_platform_bus_enumerate device present 0
[   17.344578] mmc1: card 0001 removed
[   17.356642] bcmdhd_wlan: probe of bcmdhd_wlan@0 failed with error -62
[   17.435945] galcore: clk_get vg clock failed, disable vg!
[   17.460621] Galcore version 5.0.11.41671

Now it seems to find the dongle. I feel that I am getting closer, but still I have no idea about why the driver fails to register the wlan0 interface.

Thanks in advance again!


***************************************** UPDATE 2 *****************************************
Hello again!

Yeah, I don't just want to give up and wait for an answer (maybe in a couple of years hehe) so I kept digging and just before user-space boots up I see that
Code: Select all
...
wlreg_on: disabling
...

And taking a look at the dts file for the wandboard revision d1 (arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi), it is indeed the regulator used for the bcm4339 chip:
Code: Select all
...
bcmdhd_wlan_0: bcmdhd_wlan@0 {
       compatible = "android,bcmdhd_wlan";
       pinctrl-names = "default";
       pinctrl-0 = <&pinctrl_wifi_ctrl>;
       wlreg_on-supply = <&wlreg_on>;
    };
...
...
wlreg_on: fixedregulator@100 {
          compatible = "regulator-fixed";
          regulator-min-microvolt = <5000000>;
          regulator-max-microvolt = <5000000>;
          regulator-name = "wlreg_on";
          gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
          enable-active-high;
       };

From the fragment the regulator seems to be controlled by GPIO1_26, so I guess that this GPIO1_26 is maybe LOW at that point? Meaning that the chip never gets powered up? From the other hand, though, in the iMX Linux Reference Manual (Document Number: IMXLXRM, Rev. 0, 03/2016) specifies that

"For device tree, the BCMDHD driver requires the following nodes to be defined in the
device tree. For example,
Code: Select all
regulators {
     compatible = "simple-bus";
     #address-cells = <1>;
     #size-cells = <0>;
     wlreg_on: fixedregulator@100 {
         compatible = "regulator-fixed";
         regulator-min-microvolt = <5000000>;
         regulator-max-microvolt = <5000000>;
         regulator-name = "wlreg_on";
         gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>;
         enable-active-high;
     };
 };
 bcmdhd_wlan_0: bcmdhd_wlan@0 {
     compatible = "android,bcmdhd_wlan";
     wlreg_on-supply = <&wlreg_on>;
 };

"


It looks like it is indeed GPIO4_21 the one responsible for controlling the power. I don't really which of the GPIO bank/number is actually controlling the regulator. Any hints?

/eiger824

Re: Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Wed Jul 12, 2017 7:02 am
by eiger824
Hej!

Still no success. This is the most recent log when I modprobe the module:

Code: Select all
dhd_module_init in
Power-up adapter 'DHD generic adapter'
wifi_platform_bus_enumerate device present 1
mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
mmc1: queuing unknown CIS tuple 0x91 (3 bytes)
mmc1: new high speed SDIO card at address 0001
F1 signature OK, socitype:0x1 chip:0x4339 rev:0x1 pkg:0x2
DHD: dongle ram size is set to 786432(orig 786432) at 0x180000
wifi_platform_get_mac_addr
fw path is /lib/firmware/brcm/fw_bcmdhd.bin
nvram_path is /lib/firmware/brcm/bcmdhd.cal
CFG80211-ERROR) wl_setup_wiphy : Registering Vendor80211)
wl_create_event_handler(): thread:wl_event_handler:14a started
CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xa91a143c
dhd_attach(): thread:dhd_watchdog_thread:14b started
dhd_attach(): thread:dhd_dpc:14c started
dhd_deferred_work_init: work queue initialized
fw path is /lib/firmware/brcm/fw_bcmdhd.bin
nvram_path is /lib/firmware/brcm/bcmdhd.cal
dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.
random: nonblocking pool is initialized
dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
wifi_platform_get_mac_addr
dhd_get_concurrent_capabilites: Get P2P failed (error=-23)
Firmware up: op_mode=0x0001, MAC=b0:f1:ec:3c:16:c7
dhd_preinit_ioctls Set Event mask failed -14
dhdsdio_probe: dhd_bus_start failed
dhd_wlfc_deinit():3256, Already disabled!
dhd_detach(): thread:dhd_watchdog_thread:14b terminated OK
dhd_dpc_thread: Unexpected up_cnt 0
dhd_detach(): thread:dhd_dpc:14c terminated OK
CFG80211-ERROR) wl_event_handler : was terminated
wl_destroy_event_handler(): thread:wl_event_handler:14a terminated OK
bcmsdh_sdmmc: probe of mmc1:0001:2 failed with error -12

dhd_wifi_platform_load_sdio: sdio_register_driver timeout or error
wifi_platform_bus_enumerate device present 0
mmc1: card 0001 removed
bcmdhd_wlan: probe of bcmdhd_wlan@0 failed with error -62


Any ideas?

/eiger824

Re: Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Thu Aug 03, 2017 10:49 am
by Richard
Hello eiger824:


In the device tree of wandboard rev.D1, the "WL_REG_ON" pin of AP6335 is connected to "ENET_RXD1" of SOC and "ENET_RXD1" is muxed to "GPIO1_IO26".
https://github.com/wandboard-org/linux/blob/wandboard_imx_4.1.15_1.1.0_ga/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi

Code: Select all
wlreg_on: fixedregulator@100 {
   compatible = "regulator-fixed";
   regulator-min-microvolt = <5000000>;
   regulator-max-microvolt = <5000000>;
   regulator-name = "wlreg_on";
   gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
   enable-active-high;
};


The definition of "WL_REG_ON" in the AP6335 datasheet.
http://www.gigafu.com.tw/upload/2014Dec/pdf/201412191837321539935494_1.pdf
Code: Select all
WL_REG_ON:  Used  by  the  PMU  to  power  up  or  power  down  the  internal 
regulators  used  by  the  WLAN  section.  W
hen  this  pin  is  high,  the  regulators  are 
enabled  and  the  WLAN  section 
is  out  of  reset.  When  this  pin  is  low  the  WLAN 
section is in reset.   "


You also need to turn on the power switch of wifi_3.3V.
wifi_3.3V is the pull-up voltage of the I/O of AP6335.
It's also activated in the device tree.
Code: Select all
gpio-edm {
      compatible = "gpio-edm";
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_ext_gpio>;

      wifi_on {
         label = "wifi_on";
         gpios = <&gpio6 0 1>;
         dir   = "out";
                };
}


Please take care the pins related to wifi.
Code: Select all
pinctrl_wifi_ctrl: wifi_ctrlgrp {
         fsl,pins = <
            MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00   0x000b0      /* WIFI_ON, wifi-power */
            MX6QDL_PAD_ENET_RXD1__GPIO1_IO26   0x000b0      /* wifi-reg-on */
            MX6QDL_PAD_ENET_TXD1__GPIO1_IO29   0x80000000   /* wifi-host-wake - input */
>;


It's difficult to figure out why the wifi driver fails, and the errors may result from many different aspects of reason(wifi driver, firmware or hardware).
I see somebody get brcmfmac on AP6335 by increasing the default timeouts of SDIO command.
I'm not sure if can solve your problem, just for your reference.
https://patchwork.kernel.org/patch/8106601/

Richard

Re: Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Wed Aug 09, 2017 8:29 pm
by eiger824
Hej Richard!

Thanks for your reply! I'll check out my setup and see if there is some mismatch with the pins in the dts file.

I'll keep posting here.

Cheers,
/eiger824

Re: Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Fri Sep 01, 2017 10:33 pm
by mstoilov
Could you please advise how to configure Wandboard Dual Rev.D1 as Access Point.
My old configuration (for Rev.C1) doesn't work anymore. When I try to use fw_bcmdhd_apsta.bin for BCM4339 I get
kernel crash:
[<80608370>] (skb_panic) from [<8060a3fc>] (skb_push+0x40/0x44)
[<8060a3fc>] (skb_push) from [<7f09981c>] (dhdsdio_txpkt.constprop.8+0x100/0xaa8 [bcmdhd])
[<7f09981c>] (dhdsdio_txpkt.constprop.8 [bcmdhd]) from [<7f09a328>] (dhdsdio_sendfromq+0x164/0x3f4 [bcmdhd])
[<7f09a328>] (dhdsdio_sendfromq [bcmdhd]) from [<7f09c59c>] (dhdsdio_dpc+0x2d0/0x1010 [bcmdhd])
[<7f09c59c>] (dhdsdio_dpc [bcmdhd]) from [<7f05453c>] (dhd_dpc_thread+0xf0/0x134 [bcmdhd])
[<7f05453c>] (dhd_dpc_thread [bcmdhd]) from [<8004d69c>] (kthread+0xdc/0xf4)
[<8004d69c>] (kthread) from [<8000f428>] (ret_from_fork+0x14/0x2c)
Code: e58d500c e58dc014 e58d4010 eb0712ed (e7f001f2)
---[ end trace 42c46ec8db9460c5 ]---

Re: Wandboard Dual Rev.D1 WiFi with Yocto Pyro

PostPosted: Sat Sep 02, 2017 3:40 am
by mstoilov
Answering my own question, in case somebody else is looking for this information:

I was able to get the AP working by using the kernel from:
https://github.com/TechNexion/linux/tre ... 5_2.0.0_ga (branch tn-imx_4.1.15_2.0.0_ga)

configured bcmdhd to compile as module and used the firmware files: nvram_ap6335.txt and fw_bcm4339a0_ag_apsta.bin
The bcmdhd.ko needs to be passed parameter op_mode=2 to start in AP mode. The firmware files need to be
placed in the /lib/firmware/brcm directory.

linux cookbook pdf

PostPosted: Sat May 05, 2018 6:37 am
by waqasjunaid
As all of you are speaking about the wandboard dual in linux environment, linux cookbook pdf is a book which might be helpful for linux users.