3 Replies Latest reply on Aug 30, 2017 1:58 AM by jayakumar

    "failed to power up wifi chip" with bcmdhd/1dx/6sl on 4.1.15

    jayakumar

      Hi,

       

      I'm working with an i.mx6sololite (6sl) board with a LBEE5KL1DX (1dx / bcm4343w) wifi module. I am developing with Linux 4.1.15 BSP from NXP.

       

      My driver build config is:

      CONFIG_BCMDHD=m

      CONFIG_BCMDHD_SDIO=m

      # CONFIG_BCM4339 is not set

      # CONFIG_BCM4354 is not set

      CONFIG_BCMDHD_FW_PATH="/lib/firmware/bcm/1DX_BCM4343W/fw_bcmdhd.bin"

      CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/bcm/1DX_BCM4343W/bcmdhd.1DX.SDIO.cal"

       

      My device tree setup is:

              bcmdhd_wlan_0: bcmdhd_wlan@0 {

                      compatible = "android,bcmdhd_wlan";

                      gpios = <&gpio5 7 0>; /* WIFI_HOST_WAKE */

                      wlreg_on-supply = <&wlreg_on>;

                      interrupt-parent = <&gpio5>;

                      interrupts = <7 0>;

              };

       

                      wlreg_on: fixedregulator@100 {

                              compatible = "regulator-fixed";

                              regulator-min-microvolt = <3300000>;

                              regulator-max-microvolt = <3300000>;

                              regulator-name = "wlreg_on";

                              gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; //active high /* this is WL_REG_ON/WIFI_REG_ON/SD1_DAT7/GPIO5_IO10 */

                              startup-delay-us = <100>;

                              enable-active-high;

                      };

       

      &usdhc3 {

              pinctrl-names = "default";

              pinctrl-0 = <&pinctrl_usdhc3>;

              no-1-8-v;

              non-removable;

              pm-ignore-notify;

              bus-width = <4>;

              vmmc-supply = <&wlreg_on>;

              keep-power-in-suspend;

              enable-sdio-wakeup;

              status = "okay";

              needs-special-hs-handling;

              wifi-host;

      };

       

      In trying to bringup the interface with ifconfig wlan0 up, I'm finding that I'm getting a failure message. The output I see is as follows:

      root@imx6slevk:~# modprobe bcmdhd dyndbg=+p

      dhd_module_init in

      Power-up adapter 'DHD generic adapter'

      wifi_platform_bus_enumerate device present 1

      F1 signature OK, socitype:0x1 chip:0xa9a6 rev:0x1 pkg:0x3

      DHD: dongle ram size is set to 524288(orig 524288) at 0x0

      wifi_platform_get_mac_addr

      CFG80211-ERROR) wl_setup_wiphy : Registering Vendor80211)

      wl_create_event_handler(): thread:wl_event_handler:193 started

      CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xa8d6143c

      dhd_attach(): thread:dhd_watchdog_thread:194 started

      dhd_attach(): thread:dhd_dpc:195 started

      dhd_deferred_work_init: work queue initialized

      Dongle Host Driver, version 1.141.92 (r)

      Compiled in drivers/net/wireless/bcmdhd

      Register interface [wlan0]  MAC: 00:90:4c:11:22:33

       

       

      CFG80211-ERROR) wl_event_handler : was terminated

      wl_destroy_event_handler(): thread:wl_event_handler:193 terminated OK

      dhd_prot_ioctl : bus is down. we have nothing to do

       

       

      root@imx6slevk:~# ifconfig wlan0 up

       

       

      Dongle Host Driver, version 1.141.92 (r)

      Compiled in drivers/net/wireless/bcmdhd

      wl_android_wifi_on in

      mmc2: Error resetting SDIO communications (-110)

       

       

      failed to power up wifi chip, retry again (4 left) **

       

       

      mmc2: Error resetting SDIO communications (-110)

       

       

      failed to power up wifi chip, retry again (3 left) **

       

       

      mmc2: Error resetting SDIO communications (-110)

       

       

      failed to power up wifi chip, retry again (2 left) **

       

       

      mmc2: Error resetting SDIO communications (-110)

       

       

      failed to power up wifi chip, retry again (1 left) **

       

       

      mmc2: Error resetting SDIO communications (-110)

       

       

      failed to power up wifi chip, retry again (0 left) **

       

       

       

       

      failed to power up wifi chip, max retry reached **

       

       

      dhd_open : wl_android_wifi_on failed (-110)

      wl_android_wifi_off in

      ifconfig: SIOCSIFFLAGS: Operation not permitted

       

       

      On this board, VBAT is connected to persistent 3.3V so no regulator control is needed.

       

      I added debug in the function wifi_platform_set_power() in drivers/net/wireless/bcmdhd/dhd_linux_platdev.c and I found:

      wifi_platform_set_power: 166

      wifi_platform_set_power: 174

      wifi_platform_set_power: 176 err=0

      wifi_platform_set_power: 179

      wifi_platform_set_power: 226 err=0 is_power_on=0, true=1

       

      which is from:

      int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec)

      {

              DHD_ERROR(("%s: %d\n", __FUNCTION__, __LINE__)); <- 166

      #ifdef CONFIG_DTS

              if (on) {

              DHD_ERROR(("%s: %d\n", __FUNCTION__, __LINE__));

                      err = regulator_enable(wifi_regulator);

                      is_power_on = TRUE;

              }

              else {

              DHD_ERROR(("%s: %d\n", __FUNCTION__, __LINE__)); <- 174

                      err = regulator_disable(wifi_regulator);

              DHD_ERROR(("%s: %d err=%d\n", __FUNCTION__, __LINE__, err)); <- 176

                      is_power_on = FALSE;

              }

              DHD_ERROR(("%s: %d\n", __FUNCTION__, __LINE__)); <- 179

              if (err < 0)

                      DHD_ERROR(("%s: regulator enable/disable failed", __FUNCTION__));

      ..

              DHD_ERROR(("%s: %d err=%d is_power_on=%d, true=%d\n", __FUNCTION__, __LINE__, err, is_power_on, TRUE)); <- 226

              return err;

      }

       

      I'm trying to figure out what exactly the root cause of the problem is. Is the driver trying to turn on an internal 1dx regulator and failing?

       

      Is there a particular signal/pin I should probe to try and understand what's going on? I looked at WIFI_REG_ON (GPIO5_10) and it is high.

       

      Thanks.

        • 1. Re: "failed to power up wifi chip" with bcmdhd/1dx/6sl on 4.1.15
          jayakumar

          I was able to narrow down the cause further.

           

          The start of the problem comes from wl_android.c:int wl_android_wifi_on(struct net_device *dev)

                          do {

                                  dhd_net_wifi_platform_set_power(dev, TRUE, WIFI_TURNON_DELAY);

          #ifdef BCMSDIO

                                  ret = dhd_net_bus_resume(dev, 0);

          #endif

           

          The dhd_net_bus_resume is failing with -110 (etimedout) because it calls sdioh_start() which fails when calling sdio_reset_comm:

           

          mmc_send_io_op_cond: err=-110

          sdio_reset_comm:801: err=-110

          mmc2: Error resetting SDIO communications (-110)

          sdioh_start Failed, error = -110

           

          The call to sdio_reset_comm has this comment:

                          /* Since the power to the chip is killed, we will have

                                  re enumerate the device again. Set the block size

                                  and enable the fucntion 1 for in preparation for

                                  downloading the code

                          */

                          /* sdio_reset_comm() - has been fixed in latest kernel/msm.git for Linux

                             2.6.27. The implementation prior to that is buggy, and needs broadcom's

                             patch for it

                          */

                          if ((ret = sdio_reset_comm(sd->func[0]->card))) {

                                  sd_err(("%s Failed, error = %d\n", __FUNCTION__, ret));

                                  return ret;

                          }

           

          I tried to debug sdio_reset_comm further and it fails due to:

                  err = mmc_send_io_op_cond(host, 0, &ocr);

           

          That gives -etimedout.

           

          I would welcome any ideas or suggestions. I'm not sure why the sdio_reset_comm is failing.

           

          Thanks!

          • 2. Re: "failed to power up wifi chip" with bcmdhd/1dx/6sl on 4.1.15
            ghouse

            Hi jayakumar

             

            I hope you are using V1 Adapter for soloLite Hw setup. This is defined in Table 3 of the quickstart guide and also section 2.2. And that you are using the correct cal file. for soloLite the default one is OOB_IRQ.

            1. i.MX 6SoloLite EVK

            V1

            OOB IRQ

            NXP DTB file only configures Wi-Fi. Hardware supports Bluetooth but a modified DTB file is required – provided by Murata in Quick Start Binary Patch.

             

             

            The firmware files are defined in table 3.

            Table 6.

            1. i.MX 6SoloLite EVK
            2. 3.14.52_1.1.0/
            3. 4.1.15_2.0.0

            1CK, ZP,

            1DX,1FX

            /lib/firmware/bcm/<Module>_<Chipset>/bcmdhd.<Module>.OOB.cal

            /lib/firmware/bcm/<Module>_<Chipset>/fw_bcmdhd.bin

            1. zImage.OOB_IRQ_Level

            imx6sl-evk-btwifi.dtb

             

             

            Have you implemented the necessary steps from section 4.6. Make sure that you are following steps for flashing the card. 

            Check if you have set the uboot fdt_file variable correctly

            setenv fdt_file imx6sl-evk-btwifi.dtb

             

            You have to point to correct firmware and cal file. this command mentioned in the userguide should point to correct firmware.

            $ echo /lib/firmware/bcm/ZP_BCM4339/fw_bcmdhd.bin > /sys/module/bcmdhd/parameters/firmware_path

            $ echo /lib/firmware/bcm/ZP_BCM4339/bcmdhd.ZP.SDIO.cal > /sys/module/bcmdhd/parameters/nvram_path

             

            This has to be done before you do ifconfig wlan0 up.

             

            you can see some threads like these on this forum - Re: Murata 1DX EVK with Sabre quad board WiFi nvram issue

            1 of 1 people found this helpful
            • 3. Re: "failed to power up wifi chip" with bcmdhd/1dx/6sl on 4.1.15
              jayakumar

              Thanks ghouse.

               

              I was able to get it working. One clarification, in your post, I think you assumed we are using the NXP 6slevk with 4339 but we are not. We are using a custom 6sl board with 1DX.

               

              The root cause for my problem was that I was using the SDIO cal file instead. I now have it working and am able to ping. However, I am seeing a repetitive message about "could not set regulator OCR". Eg:

               

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              Successfully initialized wpa_supplicant

              rfkill: Cannot open RFKILL control device

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              CFG80211-ERROR) wl_notify_scan_status : scan is not ready

              CFG80211-ERROR) wl_cfg80211_connect : Connecting withc8:b3:73:4c:e8:a4 channel (1) ssid "time3D0", len (7)

              wl_bss_connect_done succeeded with c8:b3:73:4c:e8:a4

              wl_bss_connect_done succeeded with c8:b3:73:4c:e8:a4

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

              sdhci-esdhc-imx 2198000.usdhc: could not set regulator OCR (-22)

               

              I am unsure why this message occurs. I believe it is related to the voltage setting in wlreg_on in the dts. I currently have:

                              wlreg_on: fixedregulator@100 {

                                      compatible = "regulator-fixed";

                                      regulator-min-microvolt = <5000000>;

                                      regulator-max-microvolt = <5000000>;

                                      regulator-name = "wlreg_on";

                                      gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; //active high /* this is WL_REG_ON/WIFI_REG_ON/SD1_DAT7/GPIO5_IO10 */

                                      startup-delay-us = <100>;

                                      enable-active-high;

                              };

               

              On our board, the VBAT and VDDIO for the 1DX is 3.08V from a fixed voltage source.  If I change the min/max-microvolt to be 3300000, then I get the reset failure and failure to bring up the interface. If I change min to be 3.3V and max to be 5V, I get a hang. I would welcome any advice/suggestions on what could be causing this.

               

              Thanks! ghouse