This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

wl18xx--getting "wlcore: ERROR request_irq() failed: -22"

Other Parts Discussed in Thread: WL1271, WL1835MOD

Hi All,

I am working on iMX6q processor and using yocto 1.6.1 with kernel 3.10.17(device tree based), with the wl18xx(1835) wifi module. So for wifi initialization i did changes in imx6qdl-sabresd.dtsi which is included in imx6q-sabresd.dts file.

 

Pin configuration are:-

4 data pin connected to SD2

wlan_en is always high

wlan_irq is on gpio2_IO07.. (irq number-100)

 

Below are the changes done by me:

for regulator:-

reg_3p3v: 3p3v {

            compatible = "regulator-fixed";

            regulator-name = "3p3v";

            regulator-min-microvolt = <3300000>;

            regulator-max-microvolt = <3300000>;

            regulator-always-on;

        };

        wilink_wl_en: tiwi_wlan {

            compatible = "regulator-fixed";

            regulator-name = "tiwi_wlan";

            regulator-min-microvolt = <1800000>;

            regulator-max-microvolt = <1800000>;

            startup-delay-us = <70000>;

            enable-active-high;

 

for irq:-

wlan {

        /* bogus */

        pinctrl-names = "default";

        /* ? */

        interrupt-parent = <&gpio2>;

        interrupts = <07 0x01>;

        interrupt-controller;

        #interrupt-cells = <2>;

        #reg = <0x20>;

        /* generic */

        compatible = "wlcore";

        status = "okay";

        /* actual used?! */

        irq = <100>;

        #board-tcxo-clock = <5>;

        board-ref-clock = <4>; /* BOARD reference clock, See /include/linux/wl12xx.h for more info*/

        platform-quirks = <1>;

    };

 

for platform data:-

&usdhc2 {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_usdhc2_1>;

        bus-width = <4>;

            non-removable;

            vmmc-supply = <&reg_3p3v>;

            vqmmc-supply = <&wilink_wl_en>;

            ocr-limit = <0x80>;

           #power-off-card;

        #no-1-8-v;

        #keep-power-in-suspend;

        enable-sdio-wakeup;

        status = "okay";

};

 

After these changes i am getting initialized SDIO card on mmc0 and able to load the wifi module, but getting the error,  request irq error, when inserting last module(wl18xx.ko) with the prints which i put in driver(wlcore/main.c).

 

root@imx6qsabresd:/ko_mod# insmod wlcore.ko

root@imx6qsabresd:/ko_mod# insmod wlcore_sdio.ko

mmc0: Switching to 3.3V signalling voltage  failed

root@imx6qsabresd:/ko_mod#

root@imx6qsabresd:/ko_mod# insmod wl18xx.ko

root@imx6qsabresd:/ko_mod# wlcore: wl18xx driver version: ol_r8.a8.04_32

     wlcore_nvs_cb: wl->irq: 100, wl->platform_quirks=1          (user print)

     wlcore_nvs_cb: irqflags: 1, wl->platform_quirks=1, wl12xx_macro=1     (user print)

     wlcore_nvs_cb: pdev->name=wl18xx     (user print)

wlcore: ERROR request_irq() failed: -22

 

I probed the slow_clk, sdio_clk, enable pins, all are coming fine, but not getting wlan_irq.

 

I am stuck here and confused about the values which i am using in dts are correct or not, mainly my queries are--

 

1.) what should be the reg value in wlan_irq function in dtsi file. It is required and from where i get the correct value of it. what are the significance of it?

2.) why this request_irq error are coming. There are need some more changes in dtsi file?

3.) Value of platform_quirk should be 1 or something else?

4.)Why i am getting "mmc0: Switching to 3.3V signalling voltage  failed" log ?

5.)I required board tcxo clock with board ref clock in wl18xx module?

 

Please help me and give the solution of my query, if i am missing something else other than this, please tell that too.

 

Thanks

ALKS

  • Hi,

    Please see the below wiki page:
    http://processors.wiki.ti.com/index.php/WiLink8_Release_Notes/R8.3SP1_kernel_3.8

    It contains information on the required steps to use the latest release with Kernel 3.8. It also has the device tree patches required to operate WL8

    Regards,
    Gigi Joseph.

  • Hi,

    Both the WL_EN and WL_IRQ need to be set in the dts file via the gpio element

    WL_IRQ is set via gpio and not the irq - here set to gpio5_8

    ++    wlcore {
    ++        compatible = "wlcore";
    ++        gpio = <136>;   // The wl8 driver expects gpio to be an integer, so gpio5_8 is (5-1)*32+8=136
    ++            // irq property must not be set as driver derives irq number from gpio if no irq set
    ++         /* use edge irqs for suspend/resume */
    ++        platform-quirks = <1>;
    ++
    ++        /* if a 12xx card is there, configure the clock to
    ++           WL12XX_REFCLOCK_38_XTAL */
    ++        board-ref-clock = <4>;
    ++
    ++    };
    ++
    ++

    The WL_EN pin is controlled via the regulator structure that you create, so here gpio is gpio5_13 and this will be toggled when the mmc driver is brought up. Here we use the gpio as if it were the enable for an external regulator used to power the mmc.


    ++    wlan_en_reg: fixedregulator@2 {
    ++        compatible = "regulator-fixed";
    ++        regulator-name = "wlan-en-regulator";
    ++        regulator-min-microvolt = <1800000>;
    ++        regulator-max-microvolt = <1800000>;
    ++
    ++        /* WLAN_EN GPIO for this board - Bank5, pin13 */
    ++        gpio = <&gpio5 13 0>;
    ++
    ++        /* WLAN card specific delay */
    ++        startup-delay-us = <70000>;
    ++        enable-active-high;
    ++    };
    ++

  • Hi lian,

    Thanks for your reply.

    I follow the post, but now i am getting crash in driver, and sdio read failed(-110) error.

    And not getting wlan_irq when i am probing it on oscilloscope.

    When i am inserting the wlcore_sdio.ko module:

    logs are:-

    ------------[ cut here ]------------
    WARNING: at /home/alok/Desktop/wl18xx_etc/compat_wireless/drivers/net/wireless/ti/wlcore/sdio.c:107 wl12xx_sdio_raw_read+0xb4/0x12c [wlcore_sd)
    Modules linked in: wl18xx(O) wlcore_sdio(O) wlcore(O) mac80211(O) cfg80211(O) compat(O)
    CPU: 2 PID: 27 Comm: kworker/2:1 Tainted: G           O 3.10.17-1.0.0_ga+g232293e #7
    Workqueue: events request_firmware_work_func
    [<80013ae0>] (unwind_backtrace+0x0/0xf4) from [<80011504>] (show_stack+0x10/0x14)
    [<80011504>] (show_stack+0x10/0x14) from [<800260d0>] (warn_slowpath_common+0x54/0x6c)
    [<800260d0>] (warn_slowpath_common+0x54/0x6c) from [<80026184>] (warn_slowpath_null+0x1c/0x24)
    [<80026184>] (warn_slowpath_null+0x1c/0x24) from [<7f0e42a8>] (wl12xx_sdio_raw_read+0xb4/0x12c [wlcore_sdio])
    [<7f0e42a8>] (wl12xx_sdio_raw_read+0xb4/0x12c [wlcore_sdio]) from [<7f0b7320>] (wlcore_nvs_cb+0x774/0x9d4 [wlcore])
    [<7f0b7320>] (wlcore_nvs_cb+0x774/0x9d4 [wlcore]) from [<80315b8c>] (request_firmware_work_func+0x38/0x58)
    [<80315b8c>] (request_firmware_work_func+0x38/0x58) from [<8003d49c>] (process_one_work+0xf8/0x360)
    [<8003d49c>] (process_one_work+0xf8/0x360) from [<8003e0f8>] (worker_thread+0x138/0x3d4)
    [<8003e0f8>] (worker_thread+0x138/0x3d4) from [<8004345c>] (kthread+0xb4/0xb8)
    [<8004345c>] (kthread+0xb4/0xb8) from [<8000e118>] (ret_from_fork+0x14/0x3c)
    ---[ end trace f9fb763a213117ed ]---
    wl1271_sdio mmc0:0001:2: sdio read failed (-110)
    wlcore: ERROR couldn't get hw info

    Thanks

    ALKS

  • Hi,

    That error means that the mmc driver tried to read from wl8 and failed.

    Most likely it is another DTS configuration that is needed to get the correct pin mux for mmc lines. Probe the mmc lines to see if there is any activity. Also check that WL_EN is being driven high, that the VBat and Vio lines are stable and that you have a 32k clock.

    Iain

  • Hi lian

    thanks for your support, now wifi is working

    alks

  • Hi lian,

    Now i am working on bluetooth on wilink8, wl1835mod.

    For that i do pin muxing and platform data initialization in dts file, bluetooth are connecting on uart5.. below are the my changes.

    platform data:----

    kim {

            compatible = "kim";
            nshutdown_gpio = <103>;
            dev_name = "/dev/ttymxc4";
            flow_control = <1>;
            baud_rate = <3000000>;
            };

            btwilink {

            compatible = "btwilink";
            };

    uart initialization :-

    &uart5 {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_uart5_1>;
            status = "okay";
    };

    pin muxing:-

    uart5 {
                    pinctrl_uart5_1: uart5grp-1 {
                            fsl,pins = <
                                    MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA 0x1b0b1
                                    MX6QDL_PAD_KEY_COL1__UART5_TX_DATA 0x1b0b1
                                    MX6QDL_PAD_KEY_ROW4__UART5_CTS_B   0x1b0b1
                                    MX6QDL_PAD_KEY_COL4__UART5_RTS_B   0x1b0b1
                                    MX6QDL_PAD_KEY_ROW0__GPIO4_IO07    0x1b0b1
                            >;
                    };
            };
    ------------------------------------------------------------

    bt enable pin is connected on gpio4_io07.

    i also did changes in linux menuconfig and select the required config options.

    But i am not geting kim node, after kernel boot.

    when i am runnning uim, i am getting "uim:unable to open /sys/devices/platform/kim/install(No such file or directory).


    Please give me some suggestion, and please verify that all the configuration are correct?

    Alks

  • Hi Alks,

    Can you create a new thread with this question please as it is a different topic and so will make it easier for other users. I'll answer on that one.

    Iain

  • Hi lian,

    Thanks for your reply.

    Yes i will create a new thread for that.

    Thanks

    Alks

  • I  am trying to get this radio up on a custom platform myself.  Is it possible to get a link to the full dtsi that this comes from so that I can see everything in context.  I haven't seen the devicetree bindings documentation anywhere, so I kinda feel I am stabbing in the dark at this point.

    I  have hogged these pins in the dts:

    pinctrl_hog: hoggrp {
             fsl,pins = <
                          MX6QDL_PAD_DISP0_DAT14__GPIO5_IO08 0x130b0
                          MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x1b0b1 /* WLAN_EN */
                          MX6QDL_PAD_EIM_A17__GPIO2_IO21 0x1b0b1 /* WLAN_IRQ */
             >;
    };

    And then set the regulator up as:

    wlan_wl_en_reg: 1p8v_WL {
    compatible = "regulator-fixed";
    regulator-name = "wlan-en-regulator";
    regulator-min-microvolt = <1800000>;
    regulator-max-microvolt = <1800000>;

    /* WLAN_EN GPIO for this board - Bank2, pin29 */
    gpio = <&gpio2 29 0>;
    /* WLAN card specific delay */
    startup-delay-us = <70000>;
    enable-active-high;
    };

    But I never see the enable go high.


    Adam

  • Hi Adam,

    I'm guessing you haven't tied the regulator to the SDHC port. Here are the three elements you need to add to bindings





    There are three elements to trigger wifi

    1 add wlcore which sets gpio pin for wl_irq, must be an integer

        wlcore {
            compatible = "wlcore";
            gpio = <136>;   // The wl8 driver expects gpio to be an integer, so gpio5_8 is (5-1)*32+8=136
                // irq property must not be set as driver derives irq number from gpio if no irq set
             /* use edge irqs for suspend/resume */
            platform-quirks = <1>;

            /* if a 12xx card is there, configure the clock to
               WL12XX_REFCLOCK_38_XTAL */
            board-ref-clock = <4>;
     
        };


    2. add a regulator to be attached to the SDHC port, this will drive the WL_EN gpio. The gpio is defined here
        wlan_en_reg: fixedregulator@2 {
            compatible = "regulator-fixed";
            regulator-name = "wlan-en-regulator";
            regulator-min-microvolt = <1800000>;
            regulator-max-microvolt = <1800000>;

            /* WLAN_EN GPIO for this board - Bank5, pin13 */
            gpio = <&gpio5 13 0>;

            /* WLAN card specific delay */
            startup-delay-us = <70000>;
            enable-active-high;
        };
        

    3. add the regulator to the SDHC port so that when SDHC driver probes it will trigger driving of WL_EN.

    &usdhc3 {    
         pinctrl-names = "default",
         pinctrl-0 = <&pinctrl_usdh
         pinctrl-1 = <&pinctrl_usdh
         pinctrl-2 = <&pinctrl_usdh
    //    cd-gpios = <&gpio3 22 0>;
        keep-power-in-suspend;
         enable-sdio-wakeup;
        vmmc-supply = <&wlan_en_reg>;        
            non-removable;    // non-removable is not a variable, the fact it is listed is all that is used by driver  
        cap-power-off-card;
          
         status = "okay";
     };

    Iain

  • Thanks for the guidance.  I have been fighting the EN line all day. At first it wasn't appearing in /sys/kernel/debug/gpio like all of the other similarly defined gpios in my system and was unresponsive to the manual gpio calls.  Well, not completely at least. 

    echo 61 > /sys/class/gpio/export

    would register it in the /sys/kernel/debug/gpio as the sysfs node

    and

    echo out > /sys/class/gpio/gpio61/direction

    would respond as well, but 

    echo 1 > /sys/class/gpio/gpio61/value

    had no effect on either the pin itself or the output of debug/gpio (always listed as lo)

    In my dtsi I have the following inclusions that have gotten me to this point:

    / {
        regulators {
        compatible = "simple-bus";

        wlan_wl_en_reg: 1p8v_WL {
             compatible = "regulator-fixed";
             regulator-name = "wlan-en-regulator";
             regulator-min-microvolt = <1800000>;
             regulator-max-microvolt = <1800000>;

    /* WLAN_EN GPIO for this board - Bank2, pin29 */
    gpio = <&gpio2 29 0>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_elarm_wl18xx_wifi_en>;
    /* WLAN card specific delay */
    startup-delay-us = <70000>;
    enable-active-high;

    }

    };


        wlcore {
              compatible = "wlcore";
              gpio = <53>; //IRQ is GPIO2_IO21 = (2-1)*32 + 21 = 53

    platform-quirks = <1>;
    board-ref-clock = <4>; /* BOARD reference clock, See /include/linux/wl12xx.h for more info*/
    status = "okay";

         };
    };

    &iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;

    elarm {

    pinctrl_elarm_usdhc3: elarm-usdhc3 {

    fsl,pins = <

    MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
    MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059
    MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
    MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
    MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
    MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x13059

    >;

    };

    pinctrl_elarm_wl18xx_wifi_en: elarm-wl18xx-wifi-en {

    fsl,pins = <MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x1b0b1 /* WLAN_EN */>;

    };

    };

    };

    &usdhc3 {

    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_elarm_usdhc3>;
    keep-power-in-suspend;
    enable-sdio-wakeup;
    vmmc-supply = <&wlan_wl_en_reg>;
    non-removable;
    cap-power-off-card;

    status = "okay";

    };

    Now it registers and can be seen in /sys/kernel/debug/gpio as:

    GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
    gpio-61 (wlan-en-regulator ) out hi

    But the output of the pin is still low.  I have traced my schematic and am sure I am sitting on the right pin with my scope.  Baffling to me.  Once I saw the state change in that gpio file, I was sure I was cooking with butter, but, alas, no.

    Any ideas as to why the pin is not moving or what I did wrong wrt the dts?  I have included all the parts of the dtsi that touch the wifi section.

    Adam

  • I should add that my EN line is landed to pad K23 (EIM_EB1) and my IRQ is landed to G24 (EIM_A17), GPIO2_IO29 and GPIO2_IO21 respectively.  My usdhc is landed to the natural pads for SD3

    I haven't spent much time on the IRQ yet as having the EN respond seems to be the first step.

    The platform I am extending is the Solidrun uSOM.


    Adam

  • Well, in true engineer form, I made the mistake of not checking that everything was seated properly.  Once I did, I did get some action on the line.  However, it was not at all what I suspected.


    The EN line goes high on nRESET being applied and is high through the whole of uBoot.  As soon as it goes to "Starting Kernel" the line drops and never goes high again (tested through multiple reboots with it hooked to a scope set to trigger and hold on a single rise.)

    cat /sys/kernel/debug/gpio now agrees with reality:

    GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
    gpio-61 (wlan-en-regulator ) out lo

    I am inserting modules manually. cat /etc/modules is:

    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    # Parameters can be specified after the module name.

    wl18xx
    wlcore
    wlcore_sdio

    and a running system lsmod:

    root@run_setuprole:~# lsmod
    Module Size Used by
    brcmfmac 156169 0
    brcmutil 4172 1 brcmfmac
    ov5640_camera_mipi 21019 0
    wlcore_sdio 3378 0
    wl18xx 59134 0
    wlcore 148840 1 wl18xx
    mac80211 276536 2 wl18xx,wlcore

    Using kernel 3.10.30.  Is there a set of patches that are specific to the iMX6 that I should be applying? I saw the 3.8 to future patches, but those seemed focused squarely on your OMAPs.  Is there a _ga version of a kernel that I should diff a set of files against to make sure I am patched up?

    Curiouser and Curiouser...

  • I've worked with 3.10.17_ga from Freescale.

    I'm not familiar with the board you mention and so can't really offer any help on dts setup. My only comment is that porting to a new platform is really all about getting the pin muxing right in dts. Typically, after that the wilink8 driver build and running just works.

    Iain

  • Pin muxing aside, does the dtsi I posted above look both necessary and complete with respect to what is needed for the card to start up?  

    When *should* the enable line go high if all is working? 70ms after starting the kernel?

    Thanks for helping,

    Adam 

  • So, to be clear, the fact that you have never heard of my particular base platform means that you will no longer even answer generic questions about the _form_ (which is defined by YOUR driver) of the DTS *and* general questions about when triggers *should* happen?

    I know you have an mx6 team working on integration of this module.  Can you please get me in touch with the actual engineers?  I don't have the option of not getting this to work because you have never heard of my platform.

    Adam

  • Adam,

    The enable pin should go high when the MMC driver is started, it is nothing specific to WL8.

    A sanity check for your MMC port setup and WL_EN mechanism would be to put a standard SD card into USDHC3 and check that it mounts normally and you should see WL_EN being driven high when driver starts.

    I'm assuming here that you have an adapter board handling the level shifters between i.MX (@3.3V) and WL18xxCOM8 (@1.8V)

    From memory when the driver was correctly started and it had taken control of the WL_EN GPIO it was not possible to export it via /sys/kernel/debug/gpio.

    How have you built your drivers?

    1. You need to build via a script as described at http://processors.wiki.ti.com/index.php/WL18xx_System_Build_Scripts#Building_R8.4 in order to get the correct versions

    2. You need to set  the configs as shown in http://processors.wiki.ti.com/index.php/WL18xx_WiFi_Build_Process#Creating_configuration_file_.28.config.29_for_Linux_kernel.

    The build script will do a depmod and so all wl8 drivers should be loaded on demand as the kernel starts.

    Iain