Skip to contentSkip to conversation

ath10k: small fixes for SDIO support

PATCH In review Kalle Valo 1 participant 7 messages Feb 21, 2019 – Feb 26, 2019 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

cover ath10k: small fixes for SDIO support

Wen has refactored some of the Alagu's fixes and wrote one of his own. I then cleaned up the commit logs.

Alagu Sankar (3):
ath10k: sdio: set hi_acs_flags
ath10k: sdio: disable fwlog prints
ath10k: don't report unset rssi values to mac80211

Wen Gong (1):
ath10k: sdio: reset chip on power_down()

 drivers/net/wireless/ath/ath10k/core.c   | 19 ++++++++++++++++---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +++++++++---
 drivers/net/wireless/ath/ath10k/sdio.c   | 24 ++++++++++++++++--------
 3 files changed, 41 insertions(+), 14 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 ath10k: sdio: set hi_acs_flags

From: Alagu Sankar <[email protected]>

The SDIO firmware does not allow transmitting packets with the reduced tx completion HI_ACS option. SDIO firmware uses 1544 as alternate credit size, which is not big enough for the maximum sized mac80211 frames. Disable both these HI_ACS flags for SDIO.

---
 drivers/net/wireless/ath/ath10k/core.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +9 -3
index ac2cf3f1c7b4..0c62a61b5eac 100644
@@ -637,10 +637,16 @@ static void ath10k_init_sdio(struct ath10k *ar)
 	ath10k_bmi_write32(ar, hi_mbox_isr_yield_limit, 99);
 	ath10k_bmi_read32(ar, hi_acs_flags, &param);
 
-	param |= (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET |
-		  HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET |
-		  HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE);
+	/* Data transfer is not initiated, when reduced Tx completion
+	 * is used for SDIO. disable it until fixed
+	 */
+	param &= ~HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET;
 
+	/* Alternate credit size of 1544 as used by SDIO firmware is
+	 * not big enough for mac80211 / native wifi frames. disable it
+	 */
+	param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
+	param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;
 	ath10k_bmi_write32(ar, hi_acs_flags, param);
 }
 
Signature · 7 lines
2.7.4


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
author
#2 lore raw

Re: [PATCH 1/4] ath10k: sdio: set hi_acs_flags

Quoted 9 lines · Kalle Valo

The SDIO firmware does not allow transmitting packets with the reduced tx completion HI_ACS option. SDIO firmware uses 1544 as alternate credit size, which is not big enough for the maximum sized mac80211 frames. Disable both these HI_ACS flags for SDIO.

4 patches applied to ath-next branch of ath.git, thanks.

bf1f0a1a4da1 ath10k: sdio: set hi_acs_flags 6cd70c65647b ath10k: sdio: disable fwlog prints 55545b087012 ath10k: sdio: reset chip on power_down() 7d4445223031 ath10k: don't report unset rssi values to mac80211

Signature · 3 lines
https://patchwork.kernel.org/patch/10824323/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author
#3 lore raw

Re: [PATCH 1/4] ath10k: sdio: set hi_acs_flags

In reply to Kalle Valo
Quoted 9 lines · Kalle Valo

The SDIO firmware does not allow transmitting packets with the reduced tx completion HI_ACS option. SDIO firmware uses 1544 as alternate credit size, which is not big enough for the maximum sized mac80211 frames. Disable both these HI_ACS flags for SDIO.

4 patches applied to ath-next branch of ath.git, thanks.

bf1f0a1a4da1 ath10k: sdio: set hi_acs_flags 6cd70c65647b ath10k: sdio: disable fwlog prints 55545b087012 ath10k: sdio: reset chip on power_down() 7d4445223031 ath10k: don't report unset rssi values to mac80211

Signature · 9 lines
https://patchwork.kernel.org/patch/10824323/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
author
#4 lore raw

PATCH 2/4 ath10k: sdio: disable fwlog prints

In reply to Kalle Valo

From: Alagu Sankar <[email protected]>

The SDIO firmware may turn it on based on scratch registers so disable the firmware log to avoid that.

---
 drivers/net/wireless/ath/ath10k/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/ath/ath10k/core.c +7 -0
index 0c62a61b5eac..7ccd6741c5b0 100644
@@ -648,6 +648,13 @@ static void ath10k_init_sdio(struct ath10k *ar)
 	param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
 	param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;
 	ath10k_bmi_write32(ar, hi_acs_flags, param);
+
+	/* Explicitly set fwlog prints to zero as target may turn it on
+	 * based on scratch registers.
+	 */
+	ath10k_bmi_read32(ar, hi_option_flag, &param);
+	param |= HI_OPTION_DISABLE_DBGLOG;
+	ath10k_bmi_write32(ar, hi_option_flag, param);
 }
 
 static int ath10k_init_configure_target(struct ath10k *ar)
Signature · 7 lines
2.7.4


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
author
#5 lore raw

PATCH 3/4 ath10k: sdio: reset chip on power_down()

In reply to Kalle Valo

From: Wen Gong <[email protected]>

The target device needs to be reset during power_down(), otherwise only the first power_up() will work. And as ath10k calls power_up() during driver initialisation the driver would be otherwise unusable.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00005-QCARMSWP-1.

---
 drivers/net/wireless/ath/ath10k/sdio.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/sdio.c +16 -8
index d62502f386f2..fae56c67766f 100644
@@ -1382,6 +1382,12 @@ static int ath10k_sdio_hif_power_up(struct ath10k *ar,
 
 	ath10k_dbg(ar, ATH10K_DBG_BOOT, "sdio power on\n");
 
+	ret = ath10k_sdio_config(ar);
+	if (ret) {
+		ath10k_err(ar, "failed to config sdio: %d\n", ret);
+		return ret;
+	}
+
 	sdio_claim_host(func);
 
 	ret = sdio_enable_func(func);
@@ -1419,11 +1425,19 @@ static void ath10k_sdio_hif_power_down(struct ath10k *ar)
 
 	/* Disable the card */
 	sdio_claim_host(ar_sdio->func);
+
 	ret = sdio_disable_func(ar_sdio->func);
-	sdio_release_host(ar_sdio->func);
+	if (ret) {
+		ath10k_warn(ar, "unable to disable sdio function: %d\n", ret);
+		sdio_release_host(ar_sdio->func);
+		return;
+	}
 
+	ret = mmc_hw_reset(ar_sdio->func->card->host);
 	if (ret)
-		ath10k_warn(ar, "unable to disable sdio function: %d\n", ret);
+		ath10k_warn(ar, "unable to reset sdio: %d\n", ret);
+
+	sdio_release_host(ar_sdio->func);
 
 	ar_sdio->is_disabled = true;
 }
@@ -2028,12 +2042,6 @@ static int ath10k_sdio_probe(struct sdio_func *func,
 
 	ath10k_sdio_set_mbox_info(ar);
 
-	ret = ath10k_sdio_config(ar);
-	if (ret) {
-		ath10k_err(ar, "failed to config sdio: %d\n", ret);
-		goto err_free_wq;
-	}
-
 	bus_params.dev_type = ATH10K_DEV_TYPE_HL;
 	/* TODO: don't know yet how to get chip_id with SDIO */
 	bus_params.chip_id = 0;
Signature · 7 lines
2.7.4


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
author
#6 lore raw

PATCH 4/4 ath10k: don't report unset rssi values to mac80211

In reply to Kalle Valo

From: Alagu Sankar <[email protected]>

The SDIO firmware does not provide RSSI value to the host, it's only set to zero. In that case don't report the value to mac80211. One risk here is that value zero might be a valid value with other firmware, currently there's no way to detect that.

Without the fix, the rssi value indicated by iw changes between the actual value and -95.

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00005-QCARMSWP-1.

---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/htt_rx.c +9 -3
index 4fc885617de1..62479b037210 100644
@@ -2119,9 +2119,15 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt,
 	hdr = (struct ieee80211_hdr *)skb->data;
 	rx_status = IEEE80211_SKB_RXCB(skb);
 	rx_status->chains |= BIT(0);
-	rx_status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
-			    rx->ppdu.combined_rssi;
-	rx_status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
+	if (rx->ppdu.combined_rssi == 0) {
+		/* SDIO firmware does not provide signal */
+		rx_status->signal = 0;
+		rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
+	} else {
+		rx_status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
+			rx->ppdu.combined_rssi;
+		rx_status->flag &= ~RX_FLAG_NO_SIGNAL_VAL;
+	}
 
 	spin_lock_bh(&ar->data_lock);
 	ch = ar->scan_channel;
Signature · 1 line
2.7.4