erstrom / linux-ath

Linux qca/ath wireless driver tree (based on git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git)
Other
21 stars 12 forks source link

Silex SX-SDMAC SDIO on iMX6 platform issues with mmc interrupt timeouts #13

Closed pfiser closed 5 years ago

pfiser commented 5 years ago

Hi,

I have a iMX6 platform with Silex SX-SDMAC (QCA9377) WiFi adapter connected over SDIO bus. The card is correctly recognised by the MMC subsystem:

root@phycard-imx6:~# cat /sys/kernel/debug/mmc0/ios              
clock:          50000000 Hz
actual clock:   49500000 Hz
vdd:            21 (3.3 ~ 3.4 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)

I am using kernel 4.14.39 (LTS). I have built ath10k SDIO drivers by using backports-5.2-stable and ported patches from this repository (branch v5.2-ath10k-sdio) to support HL (SDIO/USB).

When I insert modules I get:

root@phycard-imx6:~# modprobe ath10k_sdio
[  514.760064] Loading modules backported from Linux version v5.2.8-0-gd36a8d2fb62c
[  514.767516] Backport generated by backports.git v5.2.8-1-0-ga33d4e95
[  514.913676] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  514.935430] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  514.944233] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[  514.952893] cfg80211: failed to load regulatory.db
[  515.473688] ath10k_sdio mmc0:0001:1: WARNING: ath10k SDIO support is incomplete, don't expect anything to work!
[  515.537157] ath10k_sdio mmc0:0001:1: Direct firmware load for ath10k/pre-cal-sdio-mmc0:0001:1.bin failed with error -2
[  515.548033] ath10k_sdio mmc0:0001:1: Direct firmware load for ath10k/cal-sdio-mmc0:0001:1.bin failed with error -2
[  515.560334] ath10k_sdio mmc0:0001:1: Direct firmware load for ath10k/QCA9377/hw1.0/firmware-sdio-6.bin failed with error -2
[  515.836246] ath10k_sdio mmc0:0001:1: qca9377 hw1.1 sdio target 0x05020001 chip_id 0x00000000 sub 0000:0000
[  515.845946] ath10k_sdio mmc0:0001:1: kconfig debug 1 debugfs 1 tracing 0 dfs 0 testmode 1
[  515.858147] ath10k_sdio mmc0:0001:1: firmware ver  api 5 features ignore-otp crc32 c5ff8ffd
[  516.017295] ath10k_sdio mmc0:0001:1: Direct firmware load for ath10k/QCA9377/hw1.0/board-2.bin failed with error -2
[  516.031405] ath10k_sdio mmc0:0001:1: board_file api 1 bmi_id N/A crc32 8b670d68
[  517.236419] ath10k_sdio mmc0:0001:1: unsupported HTC service id: 1536

root@phycard-imx6:~# rfkill unblock wlan
[  535.769912] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
root@phycard-imx6:~# ifconfig wlan0 up
root@phycard-imx6:~# iw wlan0 scan | grep -i ssid
        SSID: prodesk
        SSID: Norik_2G
        SSID: Norik_Guest_2G
        SSID: T-2_38139f
        SSID: netis_7909CC
        SSID: Norik_5G
        SSID: HUAWEI-B952
root@phycard-imx6:~#

However, as soon as I try to disable interface by doing 'ifconfig wlan0 down' I get:

root@phycard-imx6:~# ifconfig wlan0 down
[  582.875082] mmc0: Timeout waiting for hardware interrupt.
[  582.880512] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[  582.886971] mmc0: sdhci: Sys addr:  0x3d020010 | Version:  0x00000002
[  582.893426] mmc0: sdhci: Blk size:  0x00000100 | Blk cnt:  0x0000001f
[  582.899880] mmc0: sdhci: Argument:  0x1c10e81f | Trn mode: 0x00000033
[  582.906334] mmc0: sdhci: Present:   0x01fd820e | Host ctl: 0x00000013
[  582.912787] mmc0: sdhci: Power:     0x00000002 | Blk gap:  0x00000080
[  582.919241] mmc0: sdhci: Wake-up:   0x00000008 | Clock:    0x00000037
[  582.925689] mmc0: sdhci: Timeout:   0x0000000f | Int stat: 0x00000000
[  582.932134] mmc0: sdhci: Int enab:  0x107f100b | Sig enab: 0x107f100b
[  582.938577] mmc0: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000003
[  582.945021] mmc0: sdhci: Caps:      0x07eb0000 | Caps_1:   0x0000a007
[  582.951464] mmc0: sdhci: Cmd:       0x0000353a | Max curr: 0x00ffffff
[  582.957908] mmc0: sdhci: Resp[0]:   0x00001000 | Resp[1]:  0x00000000
[  582.964351] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  582.970793] mmc0: sdhci: Host ctl2: 0x00000000
[  582.975241] mmc0: sdhci: ADMA Err:  0x00000003 | ADMA Ptr: 0x48065204
[  582.981682] mmc0: sdhci: ============================================
[  582.988268] ath10k_warn: 114 callbacks suppressed
[  582.988282] ath10k_sdio mmc0:0001:1: failed to read from address 0x874: -110
[  583.000079] ath10k_sdio mmc0:0001:1: failed to read from mbox window data address: -110
[  583.000186] ath10k_sdio mmc0:0001:1: failed to read from address 0x800: -110
[  583.000201] ath10k_sdio mmc0:0001:1: failed to process pending SDIO interrupts: -110
[  583.022942] ath10k_sdio mmc0:0001:1: failed to read calibration data: -110
[  583.029968] ath10k_sdio mmc0:0001:1: failed to write to address 0x1c700: -110
[  583.037139] ath10k_sdio mmc0:0001:1: failed to write skb to 0x1c700 asynchronously: -110
[  583.045337] ath10k_sdio mmc0:0001:1: failed to write to address 0x1c700: -110
[  583.052480] ath10k_sdio mmc0:0001:1: failed to write skb to 0x1c700 asynchronously: -110
[  584.075166] ath10k_sdio mmc0:0001:1: suspend timed out - target pause event never came
[  584.200751] mmc0: queuing unknown CIS tuple 0x01 (3 bytes)
[  584.214753] mmc0: queuing unknown CIS tuple 0x1a (5 bytes)
[  584.224804] mmc0: queuing unknown CIS tuple 0x1b (8 bytes)
[  584.231360] mmc0: queuing unknown CIS tuple 0x14 (0 bytes)

Looks like the ath10k_sdio driver forgets to disable the SDIO interrupts and host controller complains about the timeout?

My device-tree for the MMC port:

&usdhc3 {
        bus-width = <4>;
        no-1-8-v;
        non-removable;
        keep-power-in-suspend;
        enable-sdio-wakeup;
        status = "okay";
};

Could @erstrom or @alagusankar help with this?

Is this expected in current state of experimental ath10k SDIO support?

pfiser commented 5 years ago

Replaying to myself :)

Here is a solution:

Author: Primoz Fiser <primoz.fiser@norik.com>
Date:   Tue Aug 27 17:26:17 2019 +0200

    Disable caldata prefetch for SDIO bus

    - when enabled on iMX6 platform we get:

            mmc0: Timeout waiting for hardware interrupt.

      if we try to disable wireless interface with:

            ifconfig wlan0 down

      Afterwards, the wireless interface & SDIO bus are
      left unresponsive and cannot be easily brought back
      to operation.

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 6942cd2..81f738a 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1255,6 +1255,9 @@ static int ath10k_debug_cal_data_fetch(struct ath10k *ar)
        if (ar->hw_params.cal_data_len == 0)
                return -EOPNOTSUPP;

+       if (ar->hif.bus == ATH10K_BUS_SDIO)
+               return -EINVAL;
+
        hi_addr = host_interest_item_address(HI_ITEM(hi_board_data));

        ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr));

I guess disabling caldata prefetch on SDIO bus interfaces fixes the problem.