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.

Linux/WL18XXCOM82SDMMC: Build the driver for Kernel 4.9

Part Number: WL18XXCOM82SDMMC
Other Parts Discussed in Thread: WL1835, WL1271

Tool/software: Linux

Hi Team,

I'm using WL18XXCOM82SDMMC and my linux kernel version is 4.9.

build_wl18xx.sh is not working properly in Kernel 4.9 and i found that, it support upto kernel 4.4. from this link https://e2e.ti.com/support/wireless_connectivity/wilink_wifi_bluetooth/f/307/t/622688

Is TI updated or any procedure to build the drivers for 4.9 kernel?, If not please give some suggestion and points need to be take care to build the driver in 4.9.

Platform:

Android 7.1.2

Kernel: 4.9.17

Thanks

Sangly.

  • Sangly,

    Due to Christmas, responses may be delayed to your question. Thank you for your patience.
  • Sangly,

    You will need to use in-tree WiLink8 device drivers. Build script does not support backports for kernel 4.9 . 

    Saurabh


  • Hi,

    Thanks for your reply.

    I've enabled the following configs in kernel,

    CONFIG_CFG80211=m
    CONFIG_CFG80211_DEFAULT_PS=y
    CONFIG_CFG80211_DEBUGFS=y
    CONFIG_MAC80211=m
    CONFIG_MAC80211_DEBUGFS=y
    CONFIG_MAC80211_MESSAGE_TRACING=y
    CONFIG_NL80211_TESTMODE=y
    CONFIG_WLAN=y
    CONFIG_WL_TI=y
    CONFIG_WL12XX=m
    CONFIG_WL18XX=m
    CONFIG_WLCORE=m
    CONFIG_WLCORE_SDIO=m

    CONFIG_BT_WILINK=y
    CONFIG_BT_HCIUART_LL=y    

    CONFIG_OF=y
    CONFIG_PROC_DEVICETREE=y

    CONFIG_CRYPTO_CCM=y
    CONFIG_CRYPTO_GCM=y
    CONFIG_CRYPTO_SEQIV=y    

    CONFIG_TI_ST=y
    CONFIG_ST_HCI=y

    and following driver got created in corresponding directory,

    mac80211.ko
    cfg80211.ko
    wlcore.ko
    wl12xx.ko
    wl18xx.ko
    wlcore_sdio.ko

    i'm loading the driver from android init.tc as,

        # wi-fi
        mkdir /data/misc/wifi/sockets 0770 wifi wifi
        mkdir /data/misc/dhcp 0770 dhcp dhcp
        insmod /system/lib/modules/cfg80211.ko
        insmod /system/lib/modules/mac80211.ko
        insmod /system/lib/modules/wlcore.ko
        insmod /system/lib/modules/wl12xx.ko
        insmod /system/lib/modules/wl18xx.ko board_type=hdk
        insmod /system/lib/modules/wlcore_sdio.ko

    I'm using NXP imx board and device tree configuration for WLAN as follows,


    DTS:
           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 - Bank6, pin12 */
                   gpio = <&gpio6 12 0>;

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

    &usdhc2 {
            pinctrl-names = "default", "state_100mhz", "state_200mhz";
            pinctrl-0 = <&pinctrl_usdhc2>;
            pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
            pinctrl-2 = <&pinctrl_usdhc2_200mhz>;

            enable-sdio-wakeup;
            keep-power-in-suspend;
            non-removable;
            cd-post;
            pm-ignore-notify;
            wifi-host;
            vmmc-supply = <&wlan_en_reg>;
            cap-power-off-card;
            bus-width = <4>;
            status = "okay";

            #address-cells = <1>;
            #size-cells = <0>;
            wlcore: wlcore@0 {
                    compatible = "ti,wl1835";
                    reg = <2>;
                    interrupt-parent = <&gpio6>;
                    interrupts = <22 IRQ_TYPE_EDGE_RISING>;
                    platform-quirks = <1>;
            };
    };

    pinctrl_usdhc2: usdhc2grp {
                            fsl,pins = <
                                    MX7D_PAD_SD2_CMD__SD2_CMD               0x59
                                    MX7D_PAD_SD2_CLK__SD2_CLK               0x19
                                    MX7D_PAD_SD2_DATA0__SD2_DATA0           0x59
                                    MX7D_PAD_SD2_DATA1__SD2_DATA1           0x59
                                    MX7D_PAD_SD2_DATA2__SD2_DATA2           0x59
                                    MX7D_PAD_SD2_DATA3__SD2_DATA3           0x59
                                    MX7D_PAD_SAI1_RX_DATA__GPIO6_IO12       0x19    /* WL_EN */
                    /*              MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13       0x59*/
                                    MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22       0x19    /* WL_IRQ */

                            >;
    };

    WLAN eval module is WG7833BEC8A and i'm connecting this module with my board using wires and wires are about 30cm length.

    When i boot the device and see the boot logs i couldn't see any logs related to wlcore driver.

    i added log (__func__ ) in all the init and probe functions in all the driver. When next boot i got "wl1271_init()" log only from wlcore/sdio.c and no others log from any driver.


    After wl1271_init() no logs from any any functions and i'm suspecting that sdio_probe not happened or chip not detected but no logs about those errors.

    i could you see the "wlan-en-regulator" in /sys/class/regulator/regulator.8 and state is "enabled".

    i could see the GPIO for WL_EN as

    gpiochip5: GPIOs 160-191, parent: platform/30250000.gpio, 30250000.gpio:
     gpio-172 (                    |wlan-en-regulator   ) out hi    


    no wlan0 entry in ifconfig -a

    What are the other points i've to check, or did i missed anything?

    Could you please help to bringup the WLAN.

    30cm wires are fine to connect SDIO signal?

  • Hi,
    From the device tree i've removed the option "cd-post;" then driver start to load the modules and probe.

    But now i've following issue,
    mmc1: new high speed SDIO card at address 0001
    logd.daemon: reinit
    type=1400 audit(11.760:4): avc: denied { create } for pid=235 comm="crda" scontext=u:r:ueventd:s0 tcontext=u:r:ueventd:s0 tclass=netlink_generic_socket permissive=0
    sabresd_7d:/ #
    wl1271_init()
    wl1271_probe()
    sdio_wlsd: func->class=0
    sdio_vendor: 0x0097
    sdio_device: 0x4076
    Function#: 0x0001
    wl1271_probe()
    sdio_wlsd: func->class=0
    sdio_vendor: 0x0097
    sdio_device: 0x4076
    Function#: 0x0002
    wlcore_probe_of()
    wl18xx_probe()
    wlcore_probe()
    wl18xx_driver wl18xx.0.auto: Direct firmware load for ti-connectivity/wl18xx-conf.bin failed with error -2
    wl18xx_driver wl18xx.0.auto: Falling back to user helper
    mmc1: mmc_power_restore_host: powering up
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 1 at drivers/net/wireless/ti/wlcore/sdio.c:107 wl12xx_sdio_raw_read+0xd0/0x158 [wlcore_sdio]
    Modules linked in: wlcore_sdio(+) wl18xx wl12xx wlcore mac80211 cfg80211
    CPU: 1 PID: 1 Comm: init Not tainted 4.9.17-gcb41b0b-dirty #19
    Hardware name: Freescale i.MX7 Dual (Device Tree)
    [<c0110e4c>] (unwind_backtrace) from [<c010ca80>] (show_stack+0x10/0x14)
    [<c010ca80>] (show_stack) from [<c0c12690>] (dump_stack+0x80/0x94)
    [<c0c12690>] (dump_stack) from [<c0135024>] (__warn+0xec/0x104)
    [<c0135024>] (__warn) from [<c0135134>] (warn_slowpath_null+0x20/0x28)
    [<c0135134>] (warn_slowpath_null) from [<bf1ea3dc>] (wl12xx_sdio_raw_read+0xd0/0x158 [wlcore_sdio])
    [<bf1ea3dc>] (wl12xx_sdio_raw_read [wlcore_sdio]) from [<bf184a18>] (wlcore_nvs_cb+0x278/0xae4 [wlcore])
    [<bf184a18>] (wlcore_nvs_cb [wlcore]) from [<bf18533c>] (wlcore_probe+0xb8/0xf8 [wlcore])
    [<bf18533c>] (wlcore_probe [wlcore]) from [<bf1cb2fc>] (wl18xx_probe+0x5c/0x90 [wl18xx])
    [<bf1cb2fc>] (wl18xx_probe [wl18xx]) from [<c064b4a0>] (platform_drv_probe+0x4c/0xb0)
    [<c064b4a0>] (platform_drv_probe) from [<c06496e4>] (driver_probe_device+0x234/0x2e0)
    [<c06496e4>] (driver_probe_device) from [<c0647638>] (bus_for_each_drv+0x74/0xb8)
    [<c0647638>] (bus_for_each_drv) from [<c0649380>] (__device_attach+0xd0/0x134)
    [<c0649380>] (__device_attach) from [<c06489cc>] (bus_probe_device+0x84/0x8c)
    [<c06489cc>] (bus_probe_device) from [<c0646700>] (device_add+0x400/0x58c)
    [<c0646700>] (device_add) from [<c064b220>] (platform_device_add+0xfc/0x224)
    [<c064b220>] (platform_device_add) from [<bf1ea710>] (wl1271_probe+0x2ac/0x31c [wlcore_sdio])
    [<bf1ea710>] (wl1271_probe [wlcore_sdio]) from [<c08bf5c8>] (sdio_bus_probe+0x100/0x118)
    [<c08bf5c8>] (sdio_bus_probe) from [<c06496e4>] (driver_probe_device+0x234/0x2e0)
    [<c06496e4>] (driver_probe_device) from [<c064983c>] (__driver_attach+0xac/0xb0)
    [<c064983c>] (__driver_attach) from [<c0647580>] (bus_for_each_dev+0x7c/0xc0)
    [<c0647580>] (bus_for_each_dev) from [<c0648cb0>] (bus_add_driver+0x1a4/0x21c)
    [<c0648cb0>] (bus_add_driver) from [<c064a494>] (driver_register+0x8c/0x110)
    [<c064a494>] (driver_register) from [<c0101874>] (do_one_initcall+0x50/0x194)
    ---[ end trace 0f826d5e1d60daaf ]---
    wl1271_sdio mmc1:0001:2: sdio read failed (-84)
    wlcore: ERROR couldn't get hw info
    mmc1: mmc_power_save_host: powering down
    imx-sii902x sound-hdmi: ASoC: CPU DAI 308c0000.sai not registered

    Based on the log i've following queries.
    1. I got the log "mmc1: new high speed SDIO card at address 0001" and i've printed the following lines from "wl1271_probe()"
    sdio_wlsd: func->class=0
    sdio_vendor: 0x0097
    sdio_device: 0x4076
    Function#: 0x0001
    Which means Wilink8 can be communicate from host and read the PID and VID?

    2. wl12xx_sdio_raw_read not happening via SDIO bus so i tried to slow down the SDIO clock to 10Mhz but no help, what else i need to do in host side.
    # cat /sys/kernel/debug/mmc1/ios
    clock: 10000000 Hz
    actual clock: 9818181 Hz
    vdd: 7 (1.65 - 1.95 V)
    bus mode: 2 (push-pull)
    chip select: 0 (don't care)
    power mode: 2 (on)
    bus width: 2 (4 bits)
    timing spec: 2 (sd high-speed)
    signal voltage: 0 (3.30 V)
    driver type: 0 (driver type B)

    Could you please tell me how to debug this read error in SW as well HW ?

    Note: i can see the signals in SDIO_CLK and SDIO_CMD pin using Oscilloscope.

    Thanks
    Sangly