Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 5/5] ath9k: reset buffer stale flag in ath_tx_get_tid_subframe
From: Felix Fietkau @ 2013-08-13 10:33 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville
In-Reply-To: <1376390010-81819-1-git-send-email-nbd@openwrt.org>

If that flag stays set for a buffer that already ran through the tx path
once, it might cause issues in tx completion processing. Better clear it
early to ensure that this does not happen

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/xmit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index cb06c1c..7223e30 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -888,6 +888,8 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
 		bf = fi->bf;
 		if (!fi->bf)
 			bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+		else
+			bf->bf_state.stale = false;
 
 		if (!bf) {
 			__skb_unlink(skb, *q);
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 4/5] ath9k: simplify ath_tid_drain
From: Felix Fietkau @ 2013-08-13 10:33 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville
In-Reply-To: <1376390010-81819-1-git-send-email-nbd@openwrt.org>

ath_tid_drain is only called when a station entry is being removed, so
there is no point in still tracking BAW state. Remove some unnecessary
code and a bogus TODO comment related to this.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/xmit.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 4fc80e3..cb06c1c 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -312,12 +312,6 @@ static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
 	}
 }
 
-/*
- * TODO: For frame(s) that are in the retry state, we will reuse the
- * sequence number(s) without setting the retry bit. The
- * alternative is to give up on these and BAR the receiver's window
- * forward.
- */
 static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
 			  struct ath_atx_tid *tid)
 
@@ -341,14 +335,8 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
 		}
 
 		list_add_tail(&bf->list, &bf_head);
-
-		ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
 		ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
 	}
-
-	tid->seq_next = tid->seq_start;
-	tid->baw_tail = tid->baw_head;
-	tid->bar_index = -1;
 }
 
 static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 2/5] ath9k: simplify debugfs chainmask handling
From: Felix Fietkau @ 2013-08-13 10:33 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville
In-Reply-To: <1376390010-81819-1-git-send-email-nbd@openwrt.org>

Writing to that file is unnecessary and quirky, the antenna API should
be used instead. Use debugfs_create_u8 to allow reading the values.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/debug.c | 92 ++--------------------------------
 1 file changed, 4 insertions(+), 88 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index e5c8333..c088744 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -88,90 +88,6 @@ static const struct file_operations fops_debug = {
 
 #define DMA_BUF_LEN 1024
 
-static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
-			     size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
-	struct ath_hw *ah = sc->sc_ah;
-	char buf[32];
-	unsigned int len;
-
-	len = sprintf(buf, "0x%08x\n", ah->txchainmask);
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
-			     size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
-	struct ath_hw *ah = sc->sc_ah;
-	unsigned long mask;
-	char buf[32];
-	ssize_t len;
-
-	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
-		return -EFAULT;
-
-	buf[len] = '\0';
-	if (kstrtoul(buf, 0, &mask))
-		return -EINVAL;
-
-	ah->txchainmask = mask;
-	ah->caps.tx_chainmask = mask;
-	return count;
-}
-
-static const struct file_operations fops_tx_chainmask = {
-	.read = read_file_tx_chainmask,
-	.write = write_file_tx_chainmask,
-	.open = simple_open,
-	.owner = THIS_MODULE,
-	.llseek = default_llseek,
-};
-
-
-static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
-			     size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
-	struct ath_hw *ah = sc->sc_ah;
-	char buf[32];
-	unsigned int len;
-
-	len = sprintf(buf, "0x%08x\n", ah->rxchainmask);
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-}
-
-static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
-			     size_t count, loff_t *ppos)
-{
-	struct ath_softc *sc = file->private_data;
-	struct ath_hw *ah = sc->sc_ah;
-	unsigned long mask;
-	char buf[32];
-	ssize_t len;
-
-	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
-		return -EFAULT;
-
-	buf[len] = '\0';
-	if (kstrtoul(buf, 0, &mask))
-		return -EINVAL;
-
-	ah->rxchainmask = mask;
-	ah->caps.rx_chainmask = mask;
-	return count;
-}
-
-static const struct file_operations fops_rx_chainmask = {
-	.read = read_file_rx_chainmask,
-	.write = write_file_rx_chainmask,
-	.open = simple_open,
-	.owner = THIS_MODULE,
-	.llseek = default_llseek,
-};
 
 static ssize_t read_file_ani(struct file *file, char __user *user_buf,
 			     size_t count, loff_t *ppos)
@@ -1896,10 +1812,10 @@ int ath9k_init_debug(struct ath_hw *ah)
 			    &fops_reset);
 	debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc,
 			    &fops_recv);
-	debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
-	debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
+	debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
+			  &ah->rxchainmask);
+	debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
+			  &ah->txchainmask);
 	debugfs_create_file("ani", S_IRUSR | S_IWUSR,
 			    sc->debug.debugfs_phy, sc, &fops_ani);
 	debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 1/5] ath9k: remove ath9k_sta_remove_debugfs
From: Felix Fietkau @ 2013-08-13 10:33 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville

mac80211 uses debugfs_remove_recursive, so there's no need for the
driver to do an explicit cleanup of its sta debugfs entry.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  4 ----
 drivers/net/wireless/ath/ath9k/debug.c | 12 +-----------
 drivers/net/wireless/ath/ath9k/debug.h |  4 ----
 drivers/net/wireless/ath/ath9k/main.c  |  1 -
 4 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 7b1d036..df1c495 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -262,10 +262,6 @@ struct ath_node {
 
 	bool sleeping;
 	bool no_ps_filter;
-
-#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
-	struct dentry *node_stat;
-#endif
 };
 
 struct ath_tx_control {
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index c10cec5..e5c8333 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1725,17 +1725,7 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
 			   struct dentry *dir)
 {
 	struct ath_node *an = (struct ath_node *)sta->drv_priv;
-	an->node_stat = debugfs_create_file("node_stat", S_IRUGO,
-					    dir, an, &fops_node_stat);
-}
-
-void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw,
-			      struct ieee80211_vif *vif,
-			      struct ieee80211_sta *sta,
-			      struct dentry *dir)
-{
-	struct ath_node *an = (struct ath_node *)sta->drv_priv;
-	debugfs_remove(an->node_stat);
+	debugfs_create_file("node_stat", S_IRUGO, dir, an, &fops_node_stat);
 }
 
 /* Ethtool support for get-stats */
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 01c5c6a..6e1556f 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -292,10 +292,6 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
 			   struct ieee80211_vif *vif,
 			   struct ieee80211_sta *sta,
 			   struct dentry *dir);
-void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw,
-			      struct ieee80211_vif *vif,
-			      struct ieee80211_sta *sta,
-			      struct dentry *dir);
 void ath_debug_send_fft_sample(struct ath_softc *sc,
 			       struct fft_sample_tlv *fft_sample);
 void ath9k_debug_stat_ant(struct ath_softc *sc,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 911744f..0bee105 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2364,7 +2364,6 @@ struct ieee80211_ops ath9k_ops = {
 
 #if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
 	.sta_add_debugfs    = ath9k_sta_add_debugfs,
-	.sta_remove_debugfs = ath9k_sta_remove_debugfs,
 #endif
 	.sw_scan_start	    = ath9k_sw_scan_start,
 	.sw_scan_complete   = ath9k_sw_scan_complete,
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH 3/5] ath9k: avoid accessing MRC registers on single-chain devices
From: Felix Fietkau @ 2013-08-13 10:33 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville
In-Reply-To: <1376390010-81819-1-git-send-email-nbd@openwrt.org>

They are not implemented, and accessing them might trigger errors

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 39c3730..18a5aa4 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -1172,6 +1172,10 @@ skip_ws_det:
 		 * is_on == 0 means MRC CCK is OFF (more noise imm)
 		 */
 		bool is_on = param ? 1 : 0;
+
+		if (ah->caps.rx_chainmask == 1)
+			break;
+
 		REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL,
 			      AR_PHY_MRC_CCK_ENABLE, is_on);
 		REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL,
-- 
1.8.0.2


^ permalink raw reply related

* Re: [wireless-regdb] [PATCH 00/53] wireless-regdb: latest updates
From: Bjørn Mork @ 2013-08-13 11:13 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless, wireless-regdb
In-Reply-To: <1374027522-18488-1-git-send-email-mcgrof@do-not-panic.com>

"Luis R. Rodriguez" <mcgrof@do-not-panic.com> writes:

> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>
> I saw one comment posted about the Indonesia patch, I fixed that.
> I also then ran some sanity tests with a new reglib addition
> wich I recently posted. This helped find two cases which
> required disabling VHT80 for two countries on a specific band.
> One was for US for 5690 and another for TW for 5290. In both cases
> the reason is due to the fact that the only way to use VHT80 is
> to combine two frequency ranges together that are contiguous and
> apply the most restrictive band rules for that range. We don't support
> this yet so just disable VHT80 in both cases. In the US case this
> also seems to be the preferred ruling.

Hello,

Out of personal interest I'm wondering why you excluded Norway and
Iceland from this series?  As EEA [1] members they pretty much follow
all relevant EU regulations, like for example the R&TTE directive.  And
the CEPT documents should also be pretty clear wrt VHT80 support.


[1] http://en.wikipedia.org/wiki/European_Economic_Area



Bjørn

^ permalink raw reply

* [PATCH] mac80211: implement STA CSA for drivers using channel contexts
From: Arik Nemtsov @ 2013-08-13 12:03 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Arik Nemtsov

Limit the current implementation to a single channel context used by
a single vif, thereby avoiding multi-vif/channel complexities.

Reuse the main function from AP CSA code, but move a portion out in
order to fit the STA scenario.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
This isn't very well tested yet, but seems to work with a TI wl18xx card.
The single-role/single-channel support is enough to pass the 11h certification.

 net/mac80211/cfg.c  |  5 +++++
 net/mac80211/chan.c |  5 -----
 net/mac80211/mlme.c | 55 +++++++++++++++++++++++++++++++++++++++--------------
 3 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7aa38ce..beb1c2a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2872,6 +2872,11 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
 	if (WARN_ON(err < 0))
 		return;
 
+	if (!local->use_chanctx) {
+		local->_oper_chandef = local->csa_chandef;
+		ieee80211_hw_config(local, 0);
+	}
+
 	err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
 	if (err < 0)
 		return;
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 3a4764b..03ba6b5 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -453,11 +453,6 @@ int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
 	chanctx_changed |= IEEE80211_CHANCTX_CHANGE_CHANNEL;
 	drv_change_chanctx(local, ctx, chanctx_changed);
 
-	if (!local->use_chanctx) {
-		local->_oper_chandef = *chandef;
-		ieee80211_hw_config(local, 0);
-	}
-
 	ieee80211_recalc_chanctx_chantype(local, ctx);
 	ieee80211_recalc_smps_chanctx(local, ctx);
 	ieee80211_recalc_radar_chanctx(local, ctx);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 45a87ee..750bf55 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -926,6 +926,8 @@ static void ieee80211_chswitch_work(struct work_struct *work)
 		container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work);
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+	u32 changed = 0;
+	int ret;
 
 	if (!ieee80211_sdata_running(sdata))
 		return;
@@ -934,24 +936,38 @@ static void ieee80211_chswitch_work(struct work_struct *work)
 	if (!ifmgd->associated)
 		goto out;
 
-	local->_oper_chandef = local->csa_chandef;
+	ret = ieee80211_vif_change_channel(sdata, &local->csa_chandef,
+					   &changed);
+	if (ret) {
+		sdata_info(sdata,
+			   "vif channel switch failed, disconnecting\n");
+		ieee80211_queue_work(&sdata->local->hw,
+				     &ifmgd->csa_connection_drop_work);
+		goto out;
+	}
 
-	if (!local->ops->channel_switch) {
-		/* call "hw_config" only if doing sw channel switch */
-		ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
-	} else {
-		/* update the device channel directly */
-		local->hw.conf.chandef = local->_oper_chandef;
+	if (!local->use_chanctx) {
+		local->_oper_chandef = local->csa_chandef;
+		/* Call "hw_config" only if doing sw channel switch.
+		 * Otherwise update the channel directly */
+		if (!local->ops->channel_switch)
+			ieee80211_hw_config(local, 0);
+		else
+			local->hw.conf.chandef = local->_oper_chandef;
 	}
 
 	/* XXX: shouldn't really modify cfg80211-owned data! */
-	ifmgd->associated->channel = local->_oper_chandef.chan;
+	ifmgd->associated->channel = local->csa_chandef.chan;
 
 	/* XXX: wait for a beacon first? */
 	ieee80211_wake_queues_by_reason(&local->hw,
 					IEEE80211_MAX_QUEUE_MAP,
 					IEEE80211_QUEUE_STOP_REASON_CSA);
+
+	ieee80211_bss_info_change_notify(sdata, changed);
+
  out:
+	sdata->vif.csa_active = false;
 	ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
 	sdata_unlock(sdata);
 }
@@ -1180,17 +1196,27 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
 	}
 
 	ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED;
+	sdata->vif.csa_active = true;
 
+	mutex_lock(&local->chanctx_mtx);
 	if (local->use_chanctx) {
-		sdata_info(sdata,
-			   "not handling channel switch with channel contexts\n");
-		ieee80211_queue_work(&local->hw,
-				     &ifmgd->csa_connection_drop_work);
-		return;
+		u32 num_chanctx = 0;
+		list_for_each_entry(chanctx, &local->chanctx_list, list)
+		       num_chanctx++;
+
+		if (num_chanctx > 1) {
+			sdata_info(sdata,
+				   "not handling chan-switch with channel contexts multi-vif\n");
+			ieee80211_queue_work(&local->hw,
+					     &ifmgd->csa_connection_drop_work);
+			mutex_unlock(&local->chanctx_mtx);
+			return;
+		}
 	}
 
-	mutex_lock(&local->chanctx_mtx);
 	if (WARN_ON(!rcu_access_pointer(sdata->vif.chanctx_conf))) {
+		ieee80211_queue_work(&local->hw,
+				     &ifmgd->csa_connection_drop_work);
 		mutex_unlock(&local->chanctx_mtx);
 		return;
 	}
@@ -2163,6 +2189,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
 			       WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
 			       true, frame_buf);
 	ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
+	sdata->vif.csa_active = false;
 	ieee80211_wake_queues_by_reason(&sdata->local->hw,
 					IEEE80211_MAX_QUEUE_MAP,
 					IEEE80211_QUEUE_STOP_REASON_CSA);
-- 
1.8.1.2


^ permalink raw reply related

* [PATCH] wil6210: fix for HW csum
From: Vladimir Kondratiev @ 2013-08-13 12:25 UTC (permalink / raw)
  To: John W . Linville
  Cc: Kirshenbaum Erez, Vladimir Kondratiev, linux-wireless,
	Luis R . Rodriguez, wil6210

Following is fix for HW csum calculation. User visible
impact is quite severe: before this patch, TCP iperf
Windows -> Linux would stall in about 1sec.

Vladimir Kondratiev (1):
  wil6210: let IP stack re-check HW TCP/UDP csum errors

 drivers/net/wireless/ath/wil6210/txrx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
1.8.1.2


^ permalink raw reply

* [PATCH] wil6210: let IP stack re-check HW TCP/UDP csum errors
From: Vladimir Kondratiev @ 2013-08-13 12:25 UTC (permalink / raw)
  To: John W . Linville
  Cc: Kirshenbaum Erez, Vladimir Kondratiev, linux-wireless,
	Luis R . Rodriguez, wil6210
In-Reply-To: <1376396732-26632-1-git-send-email-qca_vkondrat@qca.qualcomm.com>

Fix for TCP iperf from Windows to Linux stall after about 1sec

Hardware reports false errors in some situations:

Microsoft IP stack, in violation of RFC 1624, set TCP checksum that should be 0x0
as 0xffff. hardware report Rx csum error. If HW csum absolutely trusted,
this frame can be never received, as re-transmitted one will have same csum problem.
In addition, it mess up block ack reorder buffer, as if packet dropped, it is not score boarded
there.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/txrx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index ea1abeb..d505b26 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -416,13 +416,13 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
 	 */
 	if (d->dma.status & RX_DMA_STATUS_L4_IDENT) {
 		/* L4 protocol identified, csum calculated */
-		if ((d->dma.error & RX_DMA_ERROR_L4_ERR) == 0) {
+		if ((d->dma.error & RX_DMA_ERROR_L4_ERR) == 0)
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
-		} else {
-			wil_err(wil, "Incorrect checksum reported\n");
-			kfree_skb(skb);
-			return NULL;
-		}
+		/* If HW reports bad checksum, let IP stack re-check it
+		 * For example, HW don't understand Microsoft IP stack that
+		 * mis-calculates TCP checksum - if it should be 0x0,
+		 * it writes 0xffff in violation of RFC 1624
+		 */
 	}
 
 	ds_bits = wil_rxdesc_ds_bits(d);
-- 
1.8.1.2


^ permalink raw reply related

* Re: [PATCH 3/5] ath9k: avoid accessing MRC registers on single-chain devices
From: Sujith Manoharan @ 2013-08-13 12:49 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, linville
In-Reply-To: <1376390010-81819-3-git-send-email-nbd@openwrt.org>

Felix Fietkau wrote:
> They are not implemented, and accessing them might trigger errors
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> ---
>  drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> index 39c3730..18a5aa4 100644
> --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> @@ -1172,6 +1172,10 @@ skip_ws_det:
>  		 * is_on == 0 means MRC CCK is OFF (more noise imm)
>  		 */
>  		bool is_on = param ? 1 : 0;
> +
> +		if (ah->caps.rx_chainmask == 1)
> +			break;
> +

This is done in ath9k_hw_set_cck_nil(). All the 1-chain devices are handled
except AR9330. Maybe the chainmask check can be moved there ?

Sujith

^ permalink raw reply

* Re: brcsmac kernel panic
From: Arend van Spriel @ 2013-08-13 13:41 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-wireless, linux-kernel
In-Reply-To: <52094156.7010905@monom.org>

On 08/12/2013 10:11 PM, Daniel Wagner wrote:
> Hi Arend,
>
> On 08/12/2013 12:38 PM, Arend van Spriel wrote:
>> On 08/11/2013 06:21 PM, Daniel Wagner wrote:
>>> I just updated my laptop (MacBook Air 2012) from 3.11-rc3+ to 3.11-rc4+
>>> and since then brcsmac crashes short after enabling it. Unfortunately, I
>>> did also change some config flags in the area of cpufreq (enabling
>>> p-state driver) so the configuration is not exactly the same. Before I
>>> try to figure out what I have changed, I am posting the picture of the
>>> crash. Maybe it is something obvious.
>>>
>>> v3.11-rc4-197-gd92581f
>>> http://www.monom.org/misc/brcmsmac/v3.11-rc4.config
>>> http://www.monom.org/misc/brcmsmac/IMAG0064.jpg
>>
>> Thanks, Daniel
>>
>> I was looking at this issue two weeks ago and just got back from my
>> vacation. Can you apply the patch and send me a kernel log?
>
> Sure, the patch does the trick, the panic is gone.

Unfortunately, it results in a lot of error print and phy tx errors that 
has been reported by others. I think the two are related, but I have not 
root caused it yet. Your laptop may be usable now, but wireless 
performance is probably bad.

Too bad I can not reproduce the issue over here. Are you willing to test 
some patches when I got a better grasp on the issue?

Regards,
Arend

>> Sharing pictures, huh. What about this one :-p
>
> No no, that isn't me, that is someone else! :P
>
> cheers,
> daniel
>
>



^ permalink raw reply

* Re: brcsmac kernel panic
From: Daniel Wagner @ 2013-08-13 13:55 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linux-wireless, linux-kernel
In-Reply-To: <520A3784.2060108@broadcom.com>

On 08/13/2013 03:41 PM, Arend van Spriel wrote:
> On 08/12/2013 10:11 PM, Daniel Wagner wrote:
>> On 08/12/2013 12:38 PM, Arend van Spriel wrote:
>>> On 08/11/2013 06:21 PM, Daniel Wagner wrote:
>>>> I just updated my laptop (MacBook Air 2012) from 3.11-rc3+ to 3.11-rc4+
>>>> and since then brcsmac crashes short after enabling it.
>>>> Unfortunately, I
>>>> did also change some config flags in the area of cpufreq (enabling
>>>> p-state driver) so the configuration is not exactly the same. Before I
>>>> try to figure out what I have changed, I am posting the picture of the
>>>> crash. Maybe it is something obvious.
>>>>
>>>> v3.11-rc4-197-gd92581f
>>>> http://www.monom.org/misc/brcmsmac/v3.11-rc4.config
>>>> http://www.monom.org/misc/brcmsmac/IMAG0064.jpg
>>>
>>> Thanks, Daniel
>>>
>>> I was looking at this issue two weeks ago and just got back from my
>>> vacation. Can you apply the patch and send me a kernel log?
>>
>> Sure, the patch does the trick, the panic is gone.
>
> Unfortunately, it results in a lot of error print and phy tx errors that
> has been reported by others. I think the two are related, but I have not
> root caused it yet. Your laptop may be usable now, but wireless
> performance is probably bad.
>
> Too bad I can not reproduce the issue over here. Are you willing to test
> some patches when I got a better grasp on the issue?

Sure, let there be patches. :)

cheers,
daniel


^ permalink raw reply

* Re: [PATCH] ath10k: check allocation errors in CE
From: Kalle Valo @ 2013-08-13 14:47 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: ath10k, linux-wireless
In-Reply-To: <1376030353-32421-1-git-send-email-janusz.dziedzic@tieto.com>

Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:

> Handle pci_alloc_consistent(), kmalloc()
> errors in copy engine module.
> Found during code review.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>

Thanks, applied.

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH] backports: rename some mem functions to not break custom kernels
From: Arik Nemtsov @ 2013-08-13 14:47 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless, mcgrof, backports@vger.kernel.org
In-Reply-To: <52090C37.2000103@hauke-m.de>

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On Mon, Aug 12, 2013 at 7:24 PM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> adding the LINUX_BACKPORT() line should be enough to rename it
> everywhere in backprots, so you do not have to modify
> backport/compat/backport-3.11.c or manually add the prefix anywhere else.
>
> Could you try if this fixes your problems with phys_wc_to_mtrr_index:
>
>  ...
> +#define phys_wc_to_mtrr_index LINUX_BACKPORT(phys_wc_to_mtrr_index)
>  #ifdef CONFIG_MTRR
>  extern int phys_wc_to_mtrr_index(int handle);
>  #else
>  static inline int phys_wc_to_mtrr_index(int handle)
>  {
>         return -1;
>  }
>  #endif /* CONFIG_MTRR */
>

Thanks. It seems to do the trick. The attached patch solves the issue.
Luis - any comments on this one?

Regards,
Arik

[-- Attachment #2: 0001-backports-rename-some-mem-functions-to-not-break-cus.patch --]
[-- Type: application/octet-stream, Size: 1891 bytes --]

From ffcb716aaf2a3fe61af29e74fe23c4688f39a53d Mon Sep 17 00:00:00 2001
From: Arik Nemtsov <arik@wizery.com>
Date: Tue, 6 Aug 2013 18:28:56 +0300
Subject: [PATCH] backports: rename some mem functions to not break custom
 kernels

When custom patches are cherry-picked to a kernel, some symbols exported
by backports may clash with the built-in ones. Rename the backports
symbols using the standard backport_ prefix to prevent that.

The offending symbols were exported by the patch below:

commit 2ce5c22448bb45998318267c00b5d6ef9cff3170
Author: Hauke Mehrtens <hauke@hauke-m.de>
Date:   Thu Jun 6 13:48:04 2013 +0200

    backports: backport some memory functions

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 backport/backport-include/asm/mtrr.h | 1 +
 backport/backport-include/linux/io.h | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/backport/backport-include/asm/mtrr.h b/backport/backport-include/asm/mtrr.h
index cf0f6fd..861438a 100644
--- a/backport/backport-include/asm/mtrr.h
+++ b/backport/backport-include/asm/mtrr.h
@@ -7,6 +7,7 @@
  * The following functions are for use by other drivers that cannot use
  * arch_phys_wc_add and arch_phys_wc_del.
  */
+#define phys_wc_to_mtrr_index LINUX_BACKPORT(phys_wc_to_mtrr_index)
 #ifdef CONFIG_MTRR
 extern int phys_wc_to_mtrr_index(int handle);
 #else
diff --git a/backport/backport-include/linux/io.h b/backport/backport-include/linux/io.h
index 9a5b308..5447df8 100644
--- a/backport/backport-include/linux/io.h
+++ b/backport/backport-include/linux/io.h
@@ -13,6 +13,9 @@
  * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
  * to have no effect.
  */
+#define arch_phys_wc_add LINUX_BACKPORT(arch_phys_wc_add)
+#define arch_phys_wc_del LINUX_BACKPORT(arch_phys_wc_del)
+
 #ifndef arch_phys_wc_add
 #ifdef CONFIG_MTRR
 extern int __must_check arch_phys_wc_add(unsigned long base,
-- 
1.8.1.2


^ permalink raw reply related

* Signal loss rtl8723ae wifi driver
From: Phillip Moss @ 2013-08-13 16:23 UTC (permalink / raw)
  To: linux-wireless; +Cc: Larry.Finger

Hi all,
I have a rtl8723ae wifi card on my laptop. When connecting to any wifi Access Point 
the wifi signal fluctuates from full strength to very low.  In order to connect and 
stay connected I must be no farther than two meters from my router otherwise I get
disconnected. I have tried the kernel driver on multiple distros as well as the
vendor drivers for older kernel versions. All seem to have the same problem. The card
works ok on Windows 7 with vendor drivers. I have also tried compiling
backports-3.10-rc1-2 with no luck. During a signal loss period I get no logs but if I
take the laptop too far from the AP dmesg reports:

[  764.163774] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  764.192783] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  764.200572] wlp3s0: authenticated
[  764.203290] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  764.225178] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0
aid=2) [  764.225452] wlp3s0: associated
[  764.225459] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
[  772.036168] wlp3s0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
[  772.077800] cfg80211: Calling CRDA to update world regulatory domain
[  775.286474] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  775.315559] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  775.321158] wlp3s0: authenticated
[  775.322689] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  775.426155] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 2/3)
[  775.529550] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 3/3)
[  775.633015] wlp3s0: association with xx:xx:xx:xx:xx:xx timed out
[  786.622957] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  786.651896] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  786.662445] wlp3s0: authenticated
[  786.665720] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  786.673076] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0
aid=2) [  786.673305] wlp3s0: associated
[  814.496149] wlp3s0: Connection to AP xx:xx:xx:xx:xx:xx lost
[  814.589627] cfg80211: Calling CRDA to update world regulatory domain
[  815.974548] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  816.003540] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  816.012928] wlp3s0: authenticated
[  816.014009] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  816.117439] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 2/3)
[  816.220847] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 3/3)
[  816.324220] wlp3s0: association with xx:xx:xx:xx:xx:xx timed out
[  817.806001] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  817.835045] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  817.935652] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 2/3)
[  818.039082] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 3/3)
[  818.142458] wlp3s0: authentication with xx:xx:xx:xx:xx:xx timed out
[  820.148096] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  820.177057] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  820.183705] wlp3s0: authenticated
[  820.184179] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  820.287650] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 2/3)
[  820.391074] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 3/3)
[  820.494461] wlp3s0: association with xx:xx:xx:xx:xx:xx timed out
[  826.476820] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  826.505764] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  826.606337] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 2/3)
[  826.709744] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 3/3)
[  826.813199] wlp3s0: authentication with xx:xx:xx:xx:xx:xx timed out
[  837.813007] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  837.842080] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  837.857000] wlp3s0: authenticated
[  837.859229] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  837.866815] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0
aid=2) [  837.867038] wlp3s0: associated
[  845.599874] wlp3s0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
[  845.627330] cfg80211: Calling CRDA to update world regulatory domain
[  857.376412] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx
[  857.405387] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)
[  857.410017] wlp3s0: authenticated
[  857.412546] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)
[  857.415665] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0
aid=2) [  857.415902] wlp3s0: associated

The issue is exactly the same as discribed here:
http://askubuntu.com/questions/289414/rtl8723ae-driver-problem-ubuntu-13-04
Does anyone know what might be wrong?
Cheers for the help.

^ permalink raw reply

* [PATCH 1/2 v2] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER
From: Malcolm Priestley @ 2013-08-13 18:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

All structure members of BEACON_BUFFER/TX_BUFFER should be packed.

Only the first 4 members of these structures are live.

The forth member is referenced at run-time by packed structures.
typedef struct tagSTxBufHead
typedef struct tagSTxShortBufHead
in desc.h

If these structures are not packed the alignment of these members
will be wrong.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rxtx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index dd7e85d..d854b38 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -609,7 +609,7 @@ typedef struct tagSTX_BUFFER
     // Actual message
     TX_BUFFER_CONTAINER             BufferHeader;
 
-} TX_BUFFER, *PTX_BUFFER;
+} __packed TX_BUFFER, *PTX_BUFFER;
 
 //
 // Remote NDIS message format
@@ -626,7 +626,7 @@ typedef struct tagSBEACON_BUFFER
     // Actual message
     TX_BUFFER_CONTAINER             BufferHeader;
 
-} BEACON_BUFFER, *PBEACON_BUFFER;
+} __packed BEACON_BUFFER, *PBEACON_BUFFER;
 
 void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
 int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb);
-- 
1.8.1.2



^ permalink raw reply related

* [PATCH 2/2 v2] staging: vt6656: rxtx.h dead code typedef union tagUTX_BUFFER_CONTAINER
From: Malcolm Priestley @ 2013-08-13 18:52 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

This is part of the Remote NDIS message format with patch

vt6656: rxtx.c: s_vGetFreeContext use single tx memset.

there is not need for this structure and its members.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rxtx.h | 573 ------------------------------------------
 1 file changed, 573 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index d854b38..3e2a877 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -32,568 +32,6 @@
 #include "device.h"
 #include "wcmd.h"
 
-//
-// RTS buffer header
-//
-typedef struct tagSRTSDataF {
-    u16    wFrameControl;
-    u16    wDurationID;
-    u8    abyRA[ETH_ALEN];
-    u8    abyTA[ETH_ALEN];
-} SRTSDataF, *PSRTSDataF;
-
-//
-// CTS buffer header
-//
-typedef struct tagSCTSDataF {
-    u16    wFrameControl;
-    u16    wDurationID;
-    u8    abyRA[ETH_ALEN];
-    u16    wReserved;
-} SCTSDataF, *PSCTSDataF;
-
-//
-// MICHDR data header
-//
-typedef struct tagSMICHDR {
-	u32 adwHDR0[4];
-	u32 adwHDR1[4];
-	u32 adwHDR2[4];
-} SMICHDR, *PSMICHDR;
-
-typedef struct tagSTX_NAF_G_RTS
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ba;
-    u16            wRTSTxRrvTime_aa;
-    u16            wRTSTxRrvTime_bb;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    //RTS
-    u8            byRTSSignalField_b;
-    u8            byRTSServiceField_b;
-    u16            wRTSTransmitLength_b;
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_ba;
-    u16            wRTSDuration_aa;
-    u16            wRTSDuration_bb;
-    u16            wReserved3;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_NAF_G_RTS, *PTX_NAF_G_RTS;
-
-typedef struct tagSTX_NAF_G_RTS_MIC
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ba;
-    u16            wRTSTxRrvTime_aa;
-    u16            wRTSTxRrvTime_bb;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //RTS
-    u8            byRTSSignalField_b;
-    u8            byRTSServiceField_b;
-    u16            wRTSTransmitLength_b;
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_ba;
-    u16            wRTSDuration_aa;
-    u16            wRTSDuration_bb;
-    u16            wReserved3;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_NAF_G_RTS_MIC, *PTX_NAF_G_RTS_MIC;
-
-typedef struct tagSTX_NAF_G_CTS
-{
-    //RsvTime
-    u16            wCTSTxRrvTime_ba;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    //CTS
-    u8            byCTSSignalField_b;
-    u8            byCTSServiceField_b;
-    u16            wCTSTransmitLength_b;
-    u16            wCTSDuration_ba;
-    u16            wReserved3;
-    SCTSDataF       sCTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_NAF_G_CTS, *PTX_NAF_G_CTS;
-
-typedef struct tagSTX_NAF_G_CTS_MIC
-{
-    //RsvTime
-    u16            wCTSTxRrvTime_ba;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //CTS
-    u8            byCTSSignalField_b;
-    u8            byCTSServiceField_b;
-    u16            wCTSTransmitLength_b;
-    u16            wCTSDuration_ba;
-    u16            wReserved3;
-    SCTSDataF       sCTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_NAF_G_CTS_MIC, *PTX_NAF_G_CTS_MIC;
-
-typedef struct tagSTX_NAF_G_BEACON
-{
-    u16            wFIFOCtl;
-    u16            wTimeStamp;
-
-    //CTS
-    u8            byCTSSignalField_b;
-    u8            byCTSServiceField_b;
-    u16            wCTSTransmitLength_b;
-    u16            wCTSDuration_ba;
-    u16            wReserved1;
-    SCTSDataF       sCTS;
-
-    //Data
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_a;
-    u16            wTimeStampOff_a;
-
-} TX_NAF_G_BEACON, *PTX_NAF_G_BEACON;
-
-typedef struct tagSTX_NAF_AB_RTS
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ab;
-    u16            wTxRrvTime_ab;
-
-    //RTS
-    u8            byRTSSignalField_ab;
-    u8            byRTSServiceField_ab;
-    u16            wRTSTransmitLength_ab;
-    u16            wRTSDuration_ab;
-    u16            wReserved2;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_ab;
-    u8            byServiceField_ab;
-    u16            wTransmitLength_ab;
-    u16            wDuration_ab;
-    u16            wTimeStampOff_ab;
-
-} TX_NAF_AB_RTS, *PTX_NAF_AB_RTS;
-
-typedef struct tagSTX_NAF_AB_RTS_MIC
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ab;
-    u16            wTxRrvTime_ab;
-
-    SMICHDR         sMICHDR;
-
-    //RTS
-    u8            byRTSSignalField_ab;
-    u8            byRTSServiceField_ab;
-    u16            wRTSTransmitLength_ab;
-    u16            wRTSDuration_ab;
-    u16            wReserved2;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_ab;
-    u8            byServiceField_ab;
-    u16            wTransmitLength_ab;
-    u16            wDuration_ab;
-    u16            wTimeStampOff_ab;
-
-} TX_NAF_AB_RTS_MIC, *PTX_NAF_AB_RTS_MIC;
-
-typedef struct tagSTX_NAF_AB_CTS
-{
-    //RsvTime
-    u16            wReserved2;
-    u16            wTxRrvTime_ab;
-
-    //Data
-    u8            bySignalField_ab;
-    u8            byServiceField_ab;
-    u16            wTransmitLength_ab;
-    u16            wDuration_ab;
-    u16            wTimeStampOff_ab;
-
-} TX_NAF_AB_CTS, *PTX_NAF_AB_CTS;
-
-typedef struct tagSTX_NAF_AB_CTS_MIC
-{
-    //RsvTime
-    u16            wReserved2;
-    u16            wTxRrvTime_ab;
-
-    SMICHDR         sMICHDR;
-
-    //Data
-    u8            bySignalField_ab;
-    u8            byServiceField_ab;
-    u16            wTransmitLength_ab;
-    u16            wDuration_ab;
-    u16            wTimeStampOff_ab;
-
-} TX_NAF_AB_CTS_MIC, *PTX_NAF_AB_CTS_MIC;
-
-typedef struct tagSTX_NAF_AB_BEACON
-{
-    u16            wFIFOCtl;
-    u16            wTimeStamp;
-
-   //Data
-    u8            bySignalField_ab;
-    u8            byServiceField_ab;
-    u16            wTransmitLength_ab;
-    u16            wDuration_ab;
-    u16            wTimeStampOff_ab;
-
-} TX_NAF_AB_BEACON, *PTX_NAF_AB_BEACON;
-
-typedef struct tagSTX_AF_G_RTS
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ba;
-    u16            wRTSTxRrvTime_aa;
-    u16            wRTSTxRrvTime_bb;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    //RTS
-    u8            byRTSSignalField_b;
-    u8            byRTSServiceField_b;
-    u16            wRTSTransmitLength_b;
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_ba;
-    u16            wRTSDuration_aa;
-    u16            wRTSDuration_bb;
-    u16            wReserved3;
-    u16            wRTSDuration_ba_f0;
-    u16            wRTSDuration_aa_f0;
-    u16            wRTSDuration_ba_f1;
-    u16            wRTSDuration_aa_f1;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_AF_G_RTS, *PTX_AF_G_RTS;
-
-typedef struct tagSTX_AF_G_RTS_MIC
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_ba;
-    u16            wRTSTxRrvTime_aa;
-    u16            wRTSTxRrvTime_bb;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //RTS
-    u8            byRTSSignalField_b;
-    u8            byRTSServiceField_b;
-    u16            wRTSTransmitLength_b;
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_ba;
-    u16            wRTSDuration_aa;
-    u16            wRTSDuration_bb;
-    u16            wReserved3;
-    u16            wRTSDuration_ba_f0;
-    u16            wRTSDuration_aa_f0;
-    u16            wRTSDuration_ba_f1;
-    u16            wRTSDuration_aa_f1;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_AF_G_RTS_MIC, *PTX_AF_G_RTS_MIC;
-
-typedef struct tagSTX_AF_G_CTS
-{
-    //RsvTime
-    u16            wCTSTxRrvTime_ba;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    //CTS
-    u8            byCTSSignalField_b;
-    u8            byCTSServiceField_b;
-    u16            wCTSTransmitLength_b;
-    u16            wCTSDuration_ba;
-    u16            wReserved3;
-    u16            wCTSDuration_ba_f0;
-    u16            wCTSDuration_ba_f1;
-    SCTSDataF       sCTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_AF_G_CTS, *PTX_AF_G_CTS;
-
-typedef struct tagSTX_AF_G_CTS_MIC
-{
-    //RsvTime
-    u16            wCTSTxRrvTime_ba;
-    u16            wReserved2;
-    u16            wTxRrvTime_b;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //CTS
-    u8            byCTSSignalField_b;
-    u8            byCTSServiceField_b;
-    u16            wCTSTransmitLength_b;
-    u16            wCTSDuration_ba;
-    u16            wReserved3;
-    u16            wCTSDuration_ba_f0;
-    u16            wCTSDuration_ba_f1;
-    SCTSDataF       sCTS;
-
-    //Data
-    u8            bySignalField_b;
-    u8            byServiceField_b;
-    u16            wTransmitLength_b;
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_b;
-    u16            wDuration_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-    u16            wTimeStampOff_b;
-    u16            wTimeStampOff_a;
-
-} TX_AF_G_CTS_MIC, *PTX_AF_G_CTS_MIC;
-
-typedef struct tagSTX_AF_A_RTS
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_a;
-    u16            wTxRrvTime_a;
-
-    //RTS
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_a;
-    u16            wReserved2;
-    u16            wRTSDuration_a_f0;
-    u16            wRTSDuration_a_f1;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_a;
-    u16            wTimeStampOff_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-
-} TX_AF_A_RTS, *PTX_AF_A_RTS;
-
-typedef struct tagSTX_AF_A_RTS_MIC
-{
-    //RsvTime
-    u16            wRTSTxRrvTime_a;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //RTS
-    u8            byRTSSignalField_a;
-    u8            byRTSServiceField_a;
-    u16            wRTSTransmitLength_a;
-    u16            wRTSDuration_a;
-    u16            wReserved2;
-    u16            wRTSDuration_a_f0;
-    u16            wRTSDuration_a_f1;
-    SRTSDataF       sRTS;
-
-    //Data
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_a;
-    u16            wTimeStampOff_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-
-} TX_AF_A_RTS_MIC, *PTX_AF_A_RTS_MIC;
-
-typedef struct tagSTX_AF_A_CTS
-{
-    //RsvTime
-    u16            wReserved2;
-    u16            wTxRrvTime_a;
-
-    //Data
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_a;
-    u16            wTimeStampOff_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-
-} TX_AF_A_CTS, *PTX_AF_A_CTS;
-
-typedef struct tagSTX_AF_A_CTS_MIC
-{
-    //RsvTime
-    u16            wReserved2;
-    u16            wTxRrvTime_a;
-
-    SMICHDR         sMICHDR;
-
-    //Data
-    u8            bySignalField_a;
-    u8            byServiceField_a;
-    u16            wTransmitLength_a;
-    u16            wDuration_a;
-    u16            wTimeStampOff_a;
-    u16            wDuration_a_f0;
-    u16            wDuration_a_f1;
-
-} TX_AF_A_CTS_MIC, *PTX_AF_A_CTS_MIC;
-
-//
-// union with all of the TX Buffer Type
-//
-typedef union tagUTX_BUFFER_CONTAINER
-{
-    TX_NAF_G_RTS                    RTS_G;
-    TX_NAF_G_RTS_MIC                RTS_G_MIC;
-    TX_NAF_G_CTS                    CTS_G;
-    TX_NAF_G_CTS_MIC                CTS_G_MIC;
-    //TX_NAF_G_BEACON                 Beacon_G;
-    TX_NAF_AB_RTS                   RTS_AB;
-    TX_NAF_AB_RTS_MIC               RTS_AB_MIC;
-    TX_NAF_AB_CTS                   CTS_AB;
-    TX_NAF_AB_CTS_MIC               CTS_AB_MIC;
-    //TX_NAF_AB_BEACON                Beacon_AB;
-    TX_AF_G_RTS                     RTS_G_AutoFB;
-    TX_AF_G_RTS_MIC                 RTS_G_AutoFB_MIC;
-    TX_AF_G_CTS                     CTS_G_AutoFB;
-    TX_AF_G_CTS_MIC                 CTS_G_AutoFB_MIC;
-    TX_AF_A_RTS                     RTS_A_AutoFB;
-    TX_AF_A_RTS_MIC                 RTS_A_AutoFB_MIC;
-    TX_AF_A_CTS                     CTS_A_AutoFB;
-    TX_AF_A_CTS_MIC                 CTS_A_AutoFB_MIC;
-
-} TX_BUFFER_CONTAINER, *PTX_BUFFER_CONTAINER;
-
-//
-// Remote NDIS message format
-//
 typedef struct tagSTX_BUFFER
 {
     u8                            byType;
@@ -605,15 +43,8 @@ typedef struct tagSTX_BUFFER
     u16                            wTimeStamp;
     u16                            wFragCtl;
     u16                            wReserved;
-
-    // Actual message
-    TX_BUFFER_CONTAINER             BufferHeader;
-
 } __packed TX_BUFFER, *PTX_BUFFER;
 
-//
-// Remote NDIS message format
-//
 typedef struct tagSBEACON_BUFFER
 {
     u8                            byType;
@@ -622,10 +53,6 @@ typedef struct tagSBEACON_BUFFER
 
     u16                            wFIFOCtl;
     u16                            wTimeStamp;
-
-    // Actual message
-    TX_BUFFER_CONTAINER             BufferHeader;
-
 } __packed BEACON_BUFFER, *PBEACON_BUFFER;
 
 void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
-- 
1.8.1.2



^ permalink raw reply related

* [PATCH v2 rebased] staging: vt6656: rxtx.c s:_uGetDataDuration simplify structure.
From: Malcolm Priestley @ 2013-08-13 18:59 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

A value is only returned when bNeedAck is true.

Only when byDurType == DATADUR_B is different.

Remove switch statement and simplify with if structure.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rxtx.c | 50 ++++++++-----------------------------------
 1 file changed, 9 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index c8e3e7e8..a701120 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -389,47 +389,15 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
 {
 	u32 uAckTime = 0;
 
-    switch (byDurType) {
-
-    case DATADUR_B:    //DATADUR_B
-            if (bNeedAck) {
-            	uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A:    //DATADUR_A
-            if(bNeedAck){
-            	uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A_F0:    //DATADUR_A_F0
-            if(bNeedAck){
-            	uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A_F1:    //DATADUR_A_F1
-            if(bNeedAck){
-            	uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    default:
-        break;
-    }
+	if (bNeedAck) {
+		if (byDurType == DATADUR_B)
+			uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+				byPktType, 14, pDevice->byTopCCKBasicRate);
+		else
+			uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+				byPktType, 14, pDevice->byTopOFDMBasicRate);
+		return pDevice->uSIFS + uAckTime;
+	}
 
 	return 0;
 }
-- 
1.8.1.2



^ permalink raw reply related

* [PATCH] ath9k_htc: do not use bulk on EP3 and EP4
From: Oleksij Rempel @ 2013-08-13 19:10 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, linville; +Cc: Oleksij Rempel

If usb auto suspend is enabled or system run in to suspend/resume
cycle, ath9k-htc adapter will stop to response. It is reproducible on xhci HCs.

Host part of problem:
XHCI do timing calculation based on Transfer Type and bInterval,
immediately after device was detected. Ath9k-htc try to overwrite
this parameters on module probe and some changes in FW,
since we do not initiate usb reset from the driver this changes
are not took to account. So, before any kind of suspend or reset,
host controller will operate with old parameters. Only after suspend/resume
and if interface id stay unchanged, new parameters will by applied. Host
will send bulk data with no intervals (?), which will cause
overflow on FIFO of EP4.

Firmware part of problem:
By default, ath9k-htc adapters configured with EP3 and EP4
as interrupt endpoints. Current firmware will try to overwrite
ConfigDescriptor to make EP3 and EP4 bulk. FIFO for this endpoints
stay not reconfigured, so under the hood it is still Int EP.

This patch is revert of 4a0e8ecca4ee commit which trying to
reduce CPU usage on some systems. Since it will produce more bug
as fixes, we will need to find other way to fix it.

here is comment from kernel source which has some more explanation:
* Some buggy high speed devices have bulk endpoints using
* maxpacket sizes other than 512.  High speed HCDs may not
* be able to handle that particular bug, so let's warn...

in our case EP3 and EP4 have maxpacket sizes = 64!!!

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 38 +++++++++-----------------------
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 5205a36..6d5d716 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -115,10 +115,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
 	cmd->skb = skb;
 	cmd->hif_dev = hif_dev;
 
-	usb_fill_bulk_urb(urb, hif_dev->udev,
-			 usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
+	usb_fill_int_urb(urb, hif_dev->udev,
+			 usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
 			 skb->data, skb->len,
-			 hif_usb_regout_cb, cmd);
+			 hif_usb_regout_cb, cmd, 1);
 
 	usb_anchor_urb(urb, &hif_dev->regout_submitted);
 	ret = usb_submit_urb(urb, GFP_KERNEL);
@@ -723,11 +723,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 			return;
 		}
 
-		usb_fill_bulk_urb(urb, hif_dev->udev,
-				 usb_rcvbulkpipe(hif_dev->udev,
+		usb_fill_int_urb(urb, hif_dev->udev,
+				 usb_rcvintpipe(hif_dev->udev,
 						 USB_REG_IN_PIPE),
 				 nskb->data, MAX_REG_IN_BUF_SIZE,
-				 ath9k_hif_usb_reg_in_cb, nskb);
+				 ath9k_hif_usb_reg_in_cb, nskb, 1);
 	}
 
 resubmit:
@@ -909,11 +909,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
 			goto err_skb;
 		}
 
-		usb_fill_bulk_urb(urb, hif_dev->udev,
-				  usb_rcvbulkpipe(hif_dev->udev,
+		usb_fill_int_urb(urb, hif_dev->udev,
+				  usb_rcvintpipe(hif_dev->udev,
 						  USB_REG_IN_PIPE),
 				  skb->data, MAX_REG_IN_BUF_SIZE,
-				  ath9k_hif_usb_reg_in_cb, skb);
+				  ath9k_hif_usb_reg_in_cb, skb, 1);
 
 		/* Anchor URB */
 		usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
@@ -1031,9 +1031,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
 
 static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
 {
-	struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
-	struct usb_endpoint_descriptor *endp;
-	int ret, idx;
+	int ret;
 
 	ret = ath9k_hif_usb_download_fw(hif_dev);
 	if (ret) {
@@ -1043,20 +1041,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
 		return ret;
 	}
 
-	/* On downloading the firmware to the target, the USB descriptor of EP4
-	 * is 'patched' to change the type of the endpoint to Bulk. This will
-	 * bring down CPU usage during the scan period.
-	 */
-	for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
-		endp = &alt->endpoint[idx].desc;
-		if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-				== USB_ENDPOINT_XFER_INT) {
-			endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
-			endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
-			endp->bInterval = 0;
-		}
-	}
-
 	/* Alloc URBs */
 	ret = ath9k_hif_usb_alloc_urbs(hif_dev);
 	if (ret) {
@@ -1268,7 +1252,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
 	if (!buf)
 		return;
 
-	ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
+	ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE),
 			   buf, 4, NULL, HZ);
 	if (ret)
 		dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
-- 
1.8.1.2


^ permalink raw reply related

* [PATCH] ath9k_htc: do not use bulk on EP3 and EP4
From: Oleksij Rempel @ 2013-08-13 19:10 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, linville; +Cc: Oleksij Rempel
In-Reply-To: <1376421020-11858-1-git-send-email-linux@rempel-privat.de>

If usb auto suspend is enabled or system run in to suspend/resume
cycle, ath9k-htc adapter will stop to response. It is reproducible on xhci HCs.

Host part of problem:
XHCI do timing calculation based on Transfer Type and bInterval,
immediately after device was detected. Ath9k-htc try to overwrite
this parameters on module probe and some changes in FW,
since we do not initiate usb reset from the driver this changes
are not took to account. So, before any kind of suspend or reset,
host controller will operate with old parameters. Only after suspend/resume
and if interface id stay unchanged, new parameters will by applied. Host
will send bulk data with no intervals (?), which will cause
overflow on FIFO of EP4.

Firmware part of problem:
By default, ath9k-htc adapters configured with EP3 and EP4
as interrupt endpoints. Current firmware will try to overwrite
ConfigDescriptor to make EP3 and EP4 bulk. FIFO for this endpoints
stay not reconfigured, so under the hood it is still Int EP.

This patch is revert of 4a0e8ecca4ee commit which trying to
reduce CPU usage on some systems. Since it will produce more bug
as fixes, we will need to find other way to fix it.

here is comment from kernel source which has some more explanation:
* Some buggy high speed devices have bulk endpoints using
* maxpacket sizes other than 512.  High speed HCDs may not
* be able to handle that particular bug, so let's warn...

in our case EP3 and EP4 have maxpacket sizes = 64!!!

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 38 +++++++++-----------------------
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 5205a36..6d5d716 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -115,10 +115,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
 	cmd->skb = skb;
 	cmd->hif_dev = hif_dev;
 
-	usb_fill_bulk_urb(urb, hif_dev->udev,
-			 usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE),
+	usb_fill_int_urb(urb, hif_dev->udev,
+			 usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
 			 skb->data, skb->len,
-			 hif_usb_regout_cb, cmd);
+			 hif_usb_regout_cb, cmd, 1);
 
 	usb_anchor_urb(urb, &hif_dev->regout_submitted);
 	ret = usb_submit_urb(urb, GFP_KERNEL);
@@ -723,11 +723,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 			return;
 		}
 
-		usb_fill_bulk_urb(urb, hif_dev->udev,
-				 usb_rcvbulkpipe(hif_dev->udev,
+		usb_fill_int_urb(urb, hif_dev->udev,
+				 usb_rcvintpipe(hif_dev->udev,
 						 USB_REG_IN_PIPE),
 				 nskb->data, MAX_REG_IN_BUF_SIZE,
-				 ath9k_hif_usb_reg_in_cb, nskb);
+				 ath9k_hif_usb_reg_in_cb, nskb, 1);
 	}
 
 resubmit:
@@ -909,11 +909,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
 			goto err_skb;
 		}
 
-		usb_fill_bulk_urb(urb, hif_dev->udev,
-				  usb_rcvbulkpipe(hif_dev->udev,
+		usb_fill_int_urb(urb, hif_dev->udev,
+				  usb_rcvintpipe(hif_dev->udev,
 						  USB_REG_IN_PIPE),
 				  skb->data, MAX_REG_IN_BUF_SIZE,
-				  ath9k_hif_usb_reg_in_cb, skb);
+				  ath9k_hif_usb_reg_in_cb, skb, 1);
 
 		/* Anchor URB */
 		usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
@@ -1031,9 +1031,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
 
 static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
 {
-	struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
-	struct usb_endpoint_descriptor *endp;
-	int ret, idx;
+	int ret;
 
 	ret = ath9k_hif_usb_download_fw(hif_dev);
 	if (ret) {
@@ -1043,20 +1041,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
 		return ret;
 	}
 
-	/* On downloading the firmware to the target, the USB descriptor of EP4
-	 * is 'patched' to change the type of the endpoint to Bulk. This will
-	 * bring down CPU usage during the scan period.
-	 */
-	for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
-		endp = &alt->endpoint[idx].desc;
-		if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-				== USB_ENDPOINT_XFER_INT) {
-			endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
-			endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
-			endp->bInterval = 0;
-		}
-	}
-
 	/* Alloc URBs */
 	ret = ath9k_hif_usb_alloc_urbs(hif_dev);
 	if (ret) {
@@ -1268,7 +1252,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
 	if (!buf)
 		return;
 
-	ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
+	ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE),
 			   buf, 4, NULL, HZ);
 	if (ret)
 		dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
-- 
1.8.1.2


^ permalink raw reply related

* [PATCH] staging: vt6656: rxtx.c s_uGetRTSCTSDuration return endian u16
From: Malcolm Priestley @ 2013-08-13 19:17 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

The return value of uGetRTSCTSDuration always needs to be
corrected to a u16 little endian corrected value.

Some places the endian correction is done on the next line

Change uGetRTSCTSDuration return u16 little endian corrected value.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rxtx.c | 93 +++++++++++++++++++++++++++++--------------
 1 file changed, 63 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index a701120..9cd4158 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -136,7 +136,7 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
 static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
 	u8 byPktType, int bNeedAck);
 
-static unsigned int s_uGetRTSCTSDuration(struct vnt_private *pDevice,
+static u16 s_uGetRTSCTSDuration(struct vnt_private *pDevice,
 	u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate,
 	int bNeedAck, u8 byFBOption);
 
@@ -403,7 +403,7 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
 }
 
 //byFreqType: 0=>5GHZ 1=>2.4GHZ
-static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
+static u16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
 	u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
 	u8 byFBOption)
 {
@@ -486,8 +486,7 @@ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
         break;
     }
 
-    return uDurTime;
-
+	return cpu_to_le16((u16)uDurTime);
 }
 
 static u32 s_uFillDataHead(struct vnt_private *pDevice,
@@ -641,9 +640,15 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             );
             pBuf->wTransmitLength_a = cpu_to_le16(wLen);
             //Get Duration
-            pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption));    //0:RTSDuration_bb, 1:2.4G, 1:CCKData
-            pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData
-            pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
+		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
+			cbFrameLength, PK_TYPE_11B,
+			pDevice->byTopCCKBasicRate, bNeedAck, byFBOption);
+		pBuf->wDuration_aa = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+			cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, RTSDUR_BA,
+			cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
 		pBuf->data.duration = pBuf->wDuration_aa;
 		/*Get RTS Frame body */
 		pBuf->data.frame_control = TYPE_CTL_RTS;
@@ -671,13 +676,27 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             );
             pBuf->wTransmitLength_a = cpu_to_le16(wLen);
             //Get Duration
-            pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption));    //0:RTSDuration_bb, 1:2.4G, 1:CCKData
-            pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData
-            pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData
-            pBuf->wRTSDuration_ba_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption));    //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData
-            pBuf->wRTSDuration_aa_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption));    //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData
-            pBuf->wRTSDuration_ba_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption));    //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData
-            pBuf->wRTSDuration_aa_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption));    //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData
+		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
+			cbFrameLength, PK_TYPE_11B,
+			pDevice->byTopCCKBasicRate, bNeedAck, byFBOption);
+		pBuf->wDuration_aa = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+			cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, RTSDUR_BA,
+			cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		pBuf->wRTSDuration_ba_f0 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
+		pBuf->wRTSDuration_aa_f0 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_AA_F0, cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		pBuf->wRTSDuration_ba_f1 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
+		pBuf->wRTSDuration_aa_f1 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
 		pBuf->data.duration = pBuf->wDuration_aa;
 		/*Get RTS Frame body*/
 		pBuf->data.frame_control = TYPE_CTL_RTS;
@@ -703,7 +722,9 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             );
             pBuf->wTransmitLength = cpu_to_le16(wLen);
             //Get Duration
-            pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
+		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+			cbFrameLength, byPktType, wCurrentRate,
+				bNeedAck, byFBOption);
 		pBuf->data.duration = pBuf->wDuration;
 		/* Get RTS Frame body */
 		pBuf->data.frame_control = TYPE_CTL_RTS;
@@ -727,9 +748,15 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             );
             pBuf->wTransmitLength = cpu_to_le16(wLen);
             //Get Duration
-            pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
-    	    pBuf->wRTSDuration_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
-    	    pBuf->wRTSDuration_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
+		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
+			cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
+		pBuf->wRTSDuration_f0 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_AA_F0, cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		pBuf->wRTSDuration_f1 = s_uGetRTSCTSDuration(pDevice,
+			RTSDUR_AA_F1, cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
 		pBuf->data.duration = pBuf->wDuration;
 		/* Get RTS Frame body */
 		pBuf->data.frame_control = TYPE_CTL_RTS;
@@ -754,7 +781,9 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         );
         pBuf->wTransmitLength = cpu_to_le16(wLen);
         //Get Duration
-        pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
+	pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
+		cbFrameLength, byPktType, wCurrentRate,
+		bNeedAck, byFBOption);
 
 	pBuf->data.duration = pBuf->wDuration;
 	/* Get RTS Frame body */
@@ -799,14 +828,17 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
             pBuf->wTransmitLength_b = cpu_to_le16(wLen);
-            pBuf->wDuration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
-            pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
-            //Get CTSDuration_ba_f0
-            pBuf->wCTSDuration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data
-            pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0);
-            //Get CTSDuration_ba_f1
-            pBuf->wCTSDuration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data
-            pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1);
+		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
+			cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
+		/* Get CTSDuration_ba_f0 */
+		pBuf->wCTSDuration_ba_f0 = s_uGetRTSCTSDuration(pDevice,
+			CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
+		/* Get CTSDuration_ba_f1 */
+		pBuf->wCTSDuration_ba_f1 = s_uGetRTSCTSDuration(pDevice,
+			CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate,
+			bNeedAck, byFBOption);
 		/* Get CTS Frame body */
 		pBuf->data.duration = pBuf->wDuration_ba;
 		pBuf->data.frame_control = TYPE_CTL_CTS;
@@ -818,9 +850,10 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
             pBuf->wTransmitLength_b = cpu_to_le16(wLen);
-            //Get CTSDuration_ba
-            pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
-            pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
+		/* Get CTSDuration_ba */
+		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice,
+			CTSDUR_BA, cbFrameLength, byPktType,
+			wCurrentRate, bNeedAck, byFBOption);
 		/*Get CTS Frame body*/
 		pBuf->data.duration = pBuf->wDuration_ba;
 		pBuf->data.frame_control = TYPE_CTL_CTS;
-- 
1.8.1.2



^ permalink raw reply related

* [RFT V2 01/13] brcmsmac: cosmetic change in phy_lcn.c
From: Arend van Spriel @ 2013-08-13 20:03 UTC (permalink / raw)
  To: linux-wireless
  Cc: Arend van Spriel, Jonas Gorski, David Herrmann,
	Maximilian Engelhardt, David Costa
In-Reply-To: <1376424220-10765-1-git-send-email-arend@broadcom.com>

Cleaning up some code fragments reducing indentation and uncluttering
some lines. Apart from whitespace there are no actual code changes
made.

Cc: Jonas Gorski <jogo@openwrt.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Maximilian Engelhardt <maxi@daemonizer.de>
Cc: David Costa <david@zarel.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c  |  213 ++++++++++----------
 1 file changed, 106 insertions(+), 107 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 3d6b16c..e646ba0 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1137,8 +1137,9 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
 	gain0_15 = ((biq1 & 0xf) << 12) |
 		   ((tia & 0xf) << 8) |
 		   ((lna2 & 0x3) << 6) |
-		   ((lna2 &
-		     0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0);
+		   ((lna2 & 0x3) << 4) |
+		   ((lna1 & 0x3) << 2) |
+		   ((lna1 & 0x3) << 0);
 
 	mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0);
 	mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0);
@@ -1368,126 +1369,124 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
 		goto cal_done;
 	}
 
-	if (module == 1) {
+	WARN_ON(module != 1);
+	tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
+	wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
 
-		tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
-		wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
+	for (i = 0; i < 11; i++)
+		values_to_save[i] =
+			read_radio_reg(pi, rxiq_cal_rf_reg[i]);
+	Core1TxControl_old = read_phy_reg(pi, 0x631);
+
+	or_phy_reg(pi, 0x631, 0x0015);
+
+	RFOverride0_old = read_phy_reg(pi, 0x44c);
+	RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
+	rfoverride2_old = read_phy_reg(pi, 0x4b0);
+	rfoverride2val_old = read_phy_reg(pi, 0x4b1);
+	rfoverride3_old = read_phy_reg(pi, 0x4f9);
+	rfoverride3val_old = read_phy_reg(pi, 0x4fa);
+	rfoverride4_old = read_phy_reg(pi, 0x938);
+	rfoverride4val_old = read_phy_reg(pi, 0x939);
+	afectrlovr_old = read_phy_reg(pi, 0x43b);
+	afectrlovrval_old = read_phy_reg(pi, 0x43c);
+	old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
+	old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
 
-		for (i = 0; i < 11; i++)
-			values_to_save[i] =
-				read_radio_reg(pi, rxiq_cal_rf_reg[i]);
-		Core1TxControl_old = read_phy_reg(pi, 0x631);
-
-		or_phy_reg(pi, 0x631, 0x0015);
-
-		RFOverride0_old = read_phy_reg(pi, 0x44c);
-		RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
-		rfoverride2_old = read_phy_reg(pi, 0x4b0);
-		rfoverride2val_old = read_phy_reg(pi, 0x4b1);
-		rfoverride3_old = read_phy_reg(pi, 0x4f9);
-		rfoverride3val_old = read_phy_reg(pi, 0x4fa);
-		rfoverride4_old = read_phy_reg(pi, 0x938);
-		rfoverride4val_old = read_phy_reg(pi, 0x939);
-		afectrlovr_old = read_phy_reg(pi, 0x43b);
-		afectrlovrval_old = read_phy_reg(pi, 0x43c);
-		old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
-		old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
-
-		tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
-		if (tx_gain_override_old) {
-			wlc_lcnphy_get_tx_gain(pi, &old_gains);
-			tx_gain_index_old = pi_lcn->lcnphy_current_index;
-		}
+	tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
+	if (tx_gain_override_old) {
+		wlc_lcnphy_get_tx_gain(pi, &old_gains);
+		tx_gain_index_old = pi_lcn->lcnphy_current_index;
+	}
 
-		wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
+	wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
 
-		mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
-		mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
+	mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
+	mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
 
-		mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
-		mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
+	mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
+	mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
 
-		write_radio_reg(pi, RADIO_2064_REG116, 0x06);
-		write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
-		write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
-		write_radio_reg(pi, RADIO_2064_REG098, 0x03);
-		write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
-		mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
-		write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
-		write_radio_reg(pi, RADIO_2064_REG114, 0x01);
-		write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
-		write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
-
-		mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
-		mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
-		mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
-		mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
-		mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
-		mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
-		mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
-		mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
-		mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
-		mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
-
-		mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
-		mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
-
-		wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0);
-		write_phy_reg(pi, 0x6da, 0xffff);
-		or_phy_reg(pi, 0x6db, 0x3);
-		wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
-		wlc_lcnphy_rx_gain_override_enable(pi, true);
-
-		tia_gain = 8;
-		rx_pwr_threshold = 950;
-		while (tia_gain > 0) {
-			tia_gain -= 1;
-			wlc_lcnphy_set_rx_gain_by_distribution(pi,
-							       0, 0, 2, 2,
-							       (u16)
-							       tia_gain, 1, 0);
-			udelay(500);
+	write_radio_reg(pi, RADIO_2064_REG116, 0x06);
+	write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
+	write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
+	write_radio_reg(pi, RADIO_2064_REG098, 0x03);
+	write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
+	mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
+	write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
+	write_radio_reg(pi, RADIO_2064_REG114, 0x01);
+	write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
+	write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
+
+	mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
+	mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
+	mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
+	mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
+	mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
+	mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
+	mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
+	mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
+	mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
+	mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
 
-			received_power =
-				wlc_lcnphy_measure_digital_power(pi, 2000);
-			if (received_power < rx_pwr_threshold)
-				break;
-		}
-		result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff);
+	mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
+	mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
 
-		wlc_lcnphy_stop_tx_tone(pi);
+	wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0);
+	write_phy_reg(pi, 0x6da, 0xffff);
+	or_phy_reg(pi, 0x6db, 0x3);
+	wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
+	wlc_lcnphy_rx_gain_override_enable(pi, true);
 
-		write_phy_reg(pi, 0x631, Core1TxControl_old);
+	tia_gain = 8;
+	rx_pwr_threshold = 950;
+	while (tia_gain > 0) {
+		tia_gain -= 1;
+		wlc_lcnphy_set_rx_gain_by_distribution(pi,
+						       0, 0, 2, 2,
+						       (u16)
+						       tia_gain, 1, 0);
+		udelay(500);
 
-		write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
-		write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
-		write_phy_reg(pi, 0x4b0, rfoverride2_old);
-		write_phy_reg(pi, 0x4b1, rfoverride2val_old);
-		write_phy_reg(pi, 0x4f9, rfoverride3_old);
-		write_phy_reg(pi, 0x4fa, rfoverride3val_old);
-		write_phy_reg(pi, 0x938, rfoverride4_old);
-		write_phy_reg(pi, 0x939, rfoverride4val_old);
-		write_phy_reg(pi, 0x43b, afectrlovr_old);
-		write_phy_reg(pi, 0x43c, afectrlovrval_old);
-		write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
-		write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
+		received_power =
+			wlc_lcnphy_measure_digital_power(pi, 2000);
+		if (received_power < rx_pwr_threshold)
+			break;
+	}
+	result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff);
 
-		wlc_lcnphy_clear_trsw_override(pi);
+	wlc_lcnphy_stop_tx_tone(pi);
 
-		mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
+	write_phy_reg(pi, 0x631, Core1TxControl_old);
+
+	write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
+	write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
+	write_phy_reg(pi, 0x4b0, rfoverride2_old);
+	write_phy_reg(pi, 0x4b1, rfoverride2val_old);
+	write_phy_reg(pi, 0x4f9, rfoverride3_old);
+	write_phy_reg(pi, 0x4fa, rfoverride3val_old);
+	write_phy_reg(pi, 0x938, rfoverride4_old);
+	write_phy_reg(pi, 0x939, rfoverride4val_old);
+	write_phy_reg(pi, 0x43b, afectrlovr_old);
+	write_phy_reg(pi, 0x43c, afectrlovrval_old);
+	write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
+	write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
 
-		for (i = 0; i < 11; i++)
-			write_radio_reg(pi, rxiq_cal_rf_reg[i],
-					values_to_save[i]);
+	wlc_lcnphy_clear_trsw_override(pi);
 
-		if (tx_gain_override_old)
-			wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
-		else
-			wlc_lcnphy_disable_tx_gain_override(pi);
+	mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
 
-		wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
-		wlc_lcnphy_rx_gain_override_enable(pi, false);
-	}
+	for (i = 0; i < 11; i++)
+		write_radio_reg(pi, rxiq_cal_rf_reg[i],
+				values_to_save[i]);
+
+	if (tx_gain_override_old)
+		wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
+	else
+		wlc_lcnphy_disable_tx_gain_override(pi);
+
+	wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
+	wlc_lcnphy_rx_gain_override_enable(pi, false);
 
 cal_done:
 	kfree(ptr);
-- 
1.7.10.4



^ permalink raw reply related

* [RFT V2 06/13] brcmsmac: update transmit gain table for lcn phy
From: Arend van Spriel @ 2013-08-13 20:03 UTC (permalink / raw)
  To: linux-wireless
  Cc: Arend van Spriel, David Herrmann, Maximilian Engelhardt,
	David Costa
In-Reply-To: <1376424220-10765-1-git-send-email-arend@broadcom.com>

Update the transmit gain table for bcm4313 chip family.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Maximilian Engelhardt <maxi@daemonizer.de>
Cc: David Costa <david@zarel.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 .../wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c   |  216 ++++++++++----------
 1 file changed, 108 insertions(+), 108 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
index 36c41df..d7fa312 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
@@ -3031,134 +3031,134 @@ dot11lcnphy_2GHz_extPA_gaintable_rev0[128] = {
 };
 
 const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[128] = {
-	{7, 0, 31, 0, 72},
-	{7, 0, 31, 0, 70},
-	{7, 0, 31, 0, 68},
-	{7, 0, 30, 0, 67},
-	{7, 0, 29, 0, 68},
-	{7, 0, 28, 0, 68},
-	{7, 0, 27, 0, 69},
-	{7, 0, 26, 0, 70},
-	{7, 0, 25, 0, 70},
-	{7, 0, 24, 0, 71},
-	{7, 0, 23, 0, 72},
-	{7, 0, 23, 0, 70},
-	{7, 0, 22, 0, 71},
-	{7, 0, 21, 0, 72},
-	{7, 0, 21, 0, 70},
-	{7, 0, 21, 0, 68},
-	{7, 0, 21, 0, 66},
-	{7, 0, 21, 0, 64},
-	{7, 0, 21, 0, 63},
-	{7, 0, 20, 0, 64},
-	{7, 0, 19, 0, 65},
-	{7, 0, 19, 0, 64},
-	{7, 0, 18, 0, 65},
-	{7, 0, 18, 0, 64},
-	{7, 0, 17, 0, 65},
-	{7, 0, 17, 0, 64},
-	{7, 0, 16, 0, 65},
-	{7, 0, 16, 0, 64},
-	{7, 0, 16, 0, 62},
-	{7, 0, 16, 0, 60},
-	{7, 0, 16, 0, 58},
-	{7, 0, 15, 0, 61},
-	{7, 0, 15, 0, 59},
-	{7, 0, 14, 0, 61},
-	{7, 0, 14, 0, 60},
-	{7, 0, 14, 0, 58},
-	{7, 0, 13, 0, 60},
-	{7, 0, 13, 0, 59},
-	{7, 0, 12, 0, 62},
-	{7, 0, 12, 0, 60},
-	{7, 0, 12, 0, 58},
-	{7, 0, 11, 0, 62},
-	{7, 0, 11, 0, 60},
-	{7, 0, 11, 0, 59},
-	{7, 0, 11, 0, 57},
-	{7, 0, 10, 0, 61},
-	{7, 0, 10, 0, 59},
-	{7, 0, 10, 0, 57},
-	{7, 0, 9, 0, 62},
-	{7, 0, 9, 0, 60},
-	{7, 0, 9, 0, 58},
-	{7, 0, 9, 0, 57},
-	{7, 0, 8, 0, 62},
-	{7, 0, 8, 0, 60},
-	{7, 0, 8, 0, 58},
-	{7, 0, 8, 0, 57},
-	{7, 0, 8, 0, 55},
-	{7, 0, 7, 0, 61},
+	{15, 0, 31, 0, 72},
+	{15, 0, 31, 0, 70},
+	{15, 0, 31, 0, 68},
+	{15, 0, 30, 0, 68},
+	{15, 0, 29, 0, 69},
+	{15, 0, 28, 0, 69},
+	{15, 0, 27, 0, 70},
+	{15, 0, 26, 0, 70},
+	{15, 0, 25, 0, 71},
+	{15, 0, 24, 0, 72},
+	{15, 0, 23, 0, 73},
+	{15, 0, 23, 0, 71},
+	{15, 0, 22, 0, 72},
+	{15, 0, 21, 0, 73},
+	{15, 0, 21, 0, 71},
+	{15, 0, 21, 0, 69},
+	{15, 0, 21, 0, 67},
+	{15, 0, 21, 0, 65},
+	{15, 0, 21, 0, 63},
+	{15, 0, 20, 0, 65},
+	{15, 0, 19, 0, 66},
+	{15, 0, 19, 0, 64},
+	{15, 0, 18, 0, 66},
+	{15, 0, 18, 0, 64},
+	{15, 0, 17, 0, 66},
+	{15, 0, 17, 0, 64},
+	{15, 0, 16, 0, 66},
+	{15, 0, 16, 0, 64},
+	{15, 0, 16, 0, 62},
+	{15, 0, 16, 0, 61},
+	{15, 0, 16, 0, 59},
+	{15, 0, 15, 0, 61},
+	{15, 0, 15, 0, 59},
+	{15, 0, 14, 0, 62},
+	{15, 0, 14, 0, 60},
+	{15, 0, 14, 0, 58},
+	{15, 0, 13, 0, 61},
+	{15, 0, 13, 0, 59},
+	{15, 0, 12, 0, 62},
+	{15, 0, 12, 0, 61},
+	{15, 0, 12, 0, 59},
+	{15, 0, 11, 0, 62},
+	{15, 0, 11, 0, 61},
+	{15, 0, 11, 0, 59},
+	{15, 0, 11, 0, 57},
+	{15, 0, 10, 0, 61},
+	{15, 0, 10, 0, 59},
+	{15, 0, 10, 0, 58},
+	{15, 0, 9, 0, 62},
+	{15, 0, 9, 0, 61},
+	{15, 0, 9, 0, 59},
+	{15, 0, 9, 0, 57},
+	{15, 0, 8, 0, 62},
+	{15, 0, 8, 0, 61},
+	{15, 0, 8, 0, 59},
+	{15, 0, 8, 0, 57},
+	{15, 0, 8, 0, 56},
+	{15, 0, 8, 0, 54},
+	{15, 0, 8, 0, 53},
+	{15, 0, 8, 0, 51},
+	{15, 0, 8, 0, 50},
+	{7, 0, 7, 0, 69},
+	{7, 0, 7, 0, 67},
+	{7, 0, 7, 0, 65},
+	{7, 0, 7, 0, 64},
+	{7, 0, 7, 0, 62},
 	{7, 0, 7, 0, 60},
 	{7, 0, 7, 0, 58},
-	{7, 0, 7, 0, 56},
+	{7, 0, 7, 0, 57},
 	{7, 0, 7, 0, 55},
 	{7, 0, 6, 0, 62},
-	{7, 0, 6, 0, 60},
-	{7, 0, 6, 0, 58},
+	{7, 0, 6, 0, 61},
+	{7, 0, 6, 0, 59},
 	{7, 0, 6, 0, 57},
-	{7, 0, 6, 0, 55},
+	{7, 0, 6, 0, 56},
 	{7, 0, 6, 0, 54},
-	{7, 0, 6, 0, 52},
+	{7, 0, 6, 0, 53},
 	{7, 0, 5, 0, 61},
-	{7, 0, 5, 0, 59},
-	{7, 0, 5, 0, 57},
+	{7, 0, 5, 0, 60},
+	{7, 0, 5, 0, 58},
 	{7, 0, 5, 0, 56},
-	{7, 0, 5, 0, 54},
+	{7, 0, 5, 0, 55},
 	{7, 0, 5, 0, 53},
-	{7, 0, 5, 0, 51},
-	{7, 0, 4, 0, 62},
-	{7, 0, 4, 0, 60},
-	{7, 0, 4, 0, 58},
+	{7, 0, 5, 0, 52},
+	{7, 0, 5, 0, 50},
+	{7, 0, 5, 0, 49},
+	{7, 0, 5, 0, 47},
 	{7, 0, 4, 0, 57},
-	{7, 0, 4, 0, 55},
+	{7, 0, 4, 0, 56},
 	{7, 0, 4, 0, 54},
-	{7, 0, 4, 0, 52},
+	{7, 0, 4, 0, 53},
 	{7, 0, 4, 0, 51},
-	{7, 0, 4, 0, 49},
+	{7, 0, 4, 0, 50},
 	{7, 0, 4, 0, 48},
+	{7, 0, 4, 0, 47},
 	{7, 0, 4, 0, 46},
-	{7, 0, 3, 0, 60},
-	{7, 0, 3, 0, 58},
-	{7, 0, 3, 0, 57},
-	{7, 0, 3, 0, 55},
-	{7, 0, 3, 0, 54},
-	{7, 0, 3, 0, 52},
+	{7, 0, 4, 0, 44},
+	{7, 0, 4, 0, 43},
+	{7, 0, 4, 0, 42},
+	{7, 0, 4, 0, 41},
+	{7, 0, 4, 0, 40},
 	{7, 0, 3, 0, 51},
-	{7, 0, 3, 0, 49},
+	{7, 0, 3, 0, 50},
 	{7, 0, 3, 0, 48},
+	{7, 0, 3, 0, 47},
 	{7, 0, 3, 0, 46},
-	{7, 0, 3, 0, 45},
 	{7, 0, 3, 0, 44},
 	{7, 0, 3, 0, 43},
+	{7, 0, 3, 0, 42},
 	{7, 0, 3, 0, 41},
-	{7, 0, 2, 0, 61},
-	{7, 0, 2, 0, 59},
-	{7, 0, 2, 0, 57},
-	{7, 0, 2, 0, 56},
-	{7, 0, 2, 0, 54},
-	{7, 0, 2, 0, 53},
-	{7, 0, 2, 0, 51},
-	{7, 0, 2, 0, 50},
-	{7, 0, 2, 0, 48},
-	{7, 0, 2, 0, 47},
-	{7, 0, 2, 0, 46},
-	{7, 0, 2, 0, 44},
-	{7, 0, 2, 0, 43},
-	{7, 0, 2, 0, 42},
-	{7, 0, 2, 0, 41},
-	{7, 0, 2, 0, 39},
-	{7, 0, 2, 0, 38},
-	{7, 0, 2, 0, 37},
-	{7, 0, 2, 0, 36},
-	{7, 0, 2, 0, 35},
-	{7, 0, 2, 0, 34},
-	{7, 0, 2, 0, 33},
-	{7, 0, 2, 0, 32},
-	{7, 0, 1, 0, 63},
-	{7, 0, 1, 0, 61},
-	{7, 0, 1, 0, 59},
-	{7, 0, 1, 0, 57},
+	{3, 0, 3, 0, 56},
+	{3, 0, 3, 0, 54},
+	{3, 0, 3, 0, 53},
+	{3, 0, 3, 0, 51},
+	{3, 0, 3, 0, 50},
+	{3, 0, 3, 0, 48},
+	{3, 0, 3, 0, 47},
+	{3, 0, 3, 0, 46},
+	{3, 0, 3, 0, 44},
+	{3, 0, 3, 0, 43},
+	{3, 0, 3, 0, 42},
+	{3, 0, 3, 0, 41},
+	{3, 0, 3, 0, 39},
+	{3, 0, 3, 0, 38},
+	{3, 0, 3, 0, 37},
+	{3, 0, 3, 0, 36},
+	{3, 0, 3, 0, 35},
+	{3, 0, 3, 0, 34},
 };
 
 const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[128] = {
-- 
1.7.10.4



^ permalink raw reply related

* [RFT V2 08/13] brcmsmac: fix TSSI idle estimation
From: Arend van Spriel @ 2013-08-13 20:03 UTC (permalink / raw)
  To: linux-wireless
  Cc: Arend van Spriel, David Herrmann, Maximilian Engelhardt,
	David Costa
In-Reply-To: <1376424220-10765-1-git-send-email-arend@broadcom.com>

The baseband multiplier must be zero during TSSI idle estimation
and restored afterwards.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Maximilian Engelhardt <maxi@daemonizer.de>
Cc: David Costa <david@zarel.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 8099d74..96be1ba 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -2836,6 +2836,8 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
 		read_radio_reg(pi, RADIO_2064_REG007) & 1;
 	u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10;
 	u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4;
+	u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi);
+
 	idleTssi = read_phy_reg(pi, 0x4ab);
 	suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) &
 			 MCTL_EN_MAC));
@@ -2853,6 +2855,12 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
 	mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4);
 	mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2);
 	wlc_lcnphy_tssi_setup(pi);
+
+	mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0));
+	mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6));
+
+	wlc_lcnphy_set_bbmult(pi, 0x0);
+
 	wlc_phy_do_dummy_tx(pi, true, OFF);
 	idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0))
 		    >> 0);
@@ -2874,6 +2882,7 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
 
 	mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12);
 
+	wlc_lcnphy_set_bbmult(pi, SAVE_bbmult);
 	wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old);
 	wlc_lcnphy_set_tx_gain(pi, &old_gains);
 	wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl);
-- 
1.7.10.4



^ permalink raw reply related

* [RFT V2 11/13] brcmsmac: correct phy registers for TSSI-based power control
From: Arend van Spriel @ 2013-08-13 20:03 UTC (permalink / raw)
  To: linux-wireless
  Cc: Arend van Spriel, David Herrmann, Maximilian Engelhardt,
	David Costa
In-Reply-To: <1376424220-10765-1-git-send-email-arend@broadcom.com>

A number of additional phy registers needs to be programmed when
using TSSI-based power control.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Maximilian Engelhardt <maxi@daemonizer.de>
Cc: David Costa <david@zarel.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c  |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 732371c..a0a268d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -2020,6 +2020,16 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos)
 		} else {
 			mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1);
 			mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
+			mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0);
+			mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2);
+			mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0);
+			mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4);
+			mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
+			mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77);
+			mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1);
+			mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7);
+			mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1);
+			mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4);
 		}
 	} else {
 		mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2);
@@ -2106,6 +2116,7 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi)
 		    (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12));
 
 	mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5));
+	mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0));
 }
 
 static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
@@ -2218,6 +2229,10 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
 
 	mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8);
 
+	mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0);
+	mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
+	mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
+
 	wlc_lcnphy_pwrctrl_rssiparams(pi);
 }
 
@@ -3096,6 +3111,11 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi)
 			wlc_lcnphy_write_table(pi, &tab);
 			tab.tbl_offset++;
 		}
+		mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0);
+		mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0);
+		mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8);
+		mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4);
+		mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2);
 
 		mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7);
 
-- 
1.7.10.4



^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox