linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ath10k: small fixes for SDIO support
@ 2019-02-21 16:21 Kalle Valo
  2019-02-21 16:21 ` [PATCH 1/4] ath10k: sdio: set hi_acs_flags Kalle Valo
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Kalle Valo @ 2019-02-21 16:21 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] ath10k: sdio: set hi_acs_flags
  2019-02-21 16:21 [PATCH 0/4] ath10k: small fixes for SDIO support Kalle Valo
@ 2019-02-21 16:21 ` Kalle Valo
  2019-02-26 13:02   ` Kalle Valo
  2019-02-21 16:21 ` [PATCH 2/4] ath10k: sdio: disable fwlog prints Kalle Valo
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2019-02-21 16:21 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Alagu Sankar, Wen Gong

From: Alagu Sankar <alagusankar@silex-india.com>

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.

Co-developed-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/core.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index ac2cf3f1c7b4..0c62a61b5eac 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] ath10k: sdio: disable fwlog prints
  2019-02-21 16:21 [PATCH 0/4] ath10k: small fixes for SDIO support Kalle Valo
  2019-02-21 16:21 ` [PATCH 1/4] ath10k: sdio: set hi_acs_flags Kalle Valo
@ 2019-02-21 16:21 ` Kalle Valo
  2019-02-21 16:21 ` [PATCH 3/4] ath10k: sdio: reset chip on power_down() Kalle Valo
  2019-02-21 16:21 ` [PATCH 4/4] ath10k: don't report unset rssi values to mac80211 Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-02-21 16:21 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Alagu Sankar, Wen Gong

From: Alagu Sankar <alagusankar@silex-india.com>

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

Co-developed-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 0c62a61b5eac..7ccd6741c5b0 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] ath10k: sdio: reset chip on power_down()
  2019-02-21 16:21 [PATCH 0/4] ath10k: small fixes for SDIO support Kalle Valo
  2019-02-21 16:21 ` [PATCH 1/4] ath10k: sdio: set hi_acs_flags Kalle Valo
  2019-02-21 16:21 ` [PATCH 2/4] ath10k: sdio: disable fwlog prints Kalle Valo
@ 2019-02-21 16:21 ` Kalle Valo
  2019-02-21 16:21 ` [PATCH 4/4] ath10k: don't report unset rssi values to mac80211 Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-02-21 16:21 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Wen Gong

From: Wen Gong <wgong@codeaurora.org>

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.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/sdio.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
index d62502f386f2..fae56c67766f 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] ath10k: don't report unset rssi values to mac80211
  2019-02-21 16:21 [PATCH 0/4] ath10k: small fixes for SDIO support Kalle Valo
                   ` (2 preceding siblings ...)
  2019-02-21 16:21 ` [PATCH 3/4] ath10k: sdio: reset chip on power_down() Kalle Valo
@ 2019-02-21 16:21 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-02-21 16:21 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Alagu Sankar, Wen Gong

From: Alagu Sankar <alagusankar@silex-india.com>

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.

Co-developed-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 4fc885617de1..62479b037210 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] ath10k: sdio: set hi_acs_flags
  2019-02-21 16:21 ` [PATCH 1/4] ath10k: sdio: set hi_acs_flags Kalle Valo
@ 2019-02-26 13:02   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-02-26 13:02 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless, Alagu Sankar, Wen Gong

Kalle Valo <kvalo@codeaurora.org> wrote:

> 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.
> 
> Co-developed-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

-- 
https://patchwork.kernel.org/patch/10824323/

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-26 13:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 16:21 [PATCH 0/4] ath10k: small fixes for SDIO support Kalle Valo
2019-02-21 16:21 ` [PATCH 1/4] ath10k: sdio: set hi_acs_flags Kalle Valo
2019-02-26 13:02   ` Kalle Valo
2019-02-21 16:21 ` [PATCH 2/4] ath10k: sdio: disable fwlog prints Kalle Valo
2019-02-21 16:21 ` [PATCH 3/4] ath10k: sdio: reset chip on power_down() Kalle Valo
2019-02-21 16:21 ` [PATCH 4/4] ath10k: don't report unset rssi values to mac80211 Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).