linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation
@ 2020-09-09 15:36 Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 1/5] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels Bryan O'Donoghue
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:36 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

This series is four in a set of seven to add support for wcn3680 at 802.11ac
data-rates.

In this set we add the ability to configure up the wcn3680 PHY to get onto
80MHz channels. To do that, the upper unused bits of the hw_value field of
the struct ieee80211_channel are used to encode additional PHY settings.

Accessor macros are provided to encode and decode this additional
information. Depending on which channel we are on, we need to configure the
PHY into one of four modes representing four potential adjacent 20MHz
channels.

The modes describe where the primary channel sits in relation to the other
three channels giving us 20MHz + 20MHz + 20MHz + 20MHz to get 80MHz.

V4:
- No functional change.
  Sending out full set again using --base=ath-202009090652 to aid kernel
  test robot
- https://lore.kernel.org/linux-wireless/20200908182514.2870410-1-bryan.odonoghue@linaro.org/T/#t

v3:
- No difference between V3 and V2 below
https://lore.kernel.org/linux-wireless/20200829033947.2167817-1-bryan.odonoghue@linaro.org/T/#t

V2:
- No difference between V2 and V1 below

V1:
https://lore.kernel.org/linux-wireless/87eensldhi.fsf@codeaurora.org/T/#t

Bryan O'Donoghue (5):
  wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels
  wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number
  wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings
  wcn36xx: Encode PHY mode for 80MHz channel in hw_value
  wcn36xx: Set PHY into correct mode for 80MHz channel width

 drivers/net/wireless/ath/wcn36xx/main.c    | 50 +++++++++++-----------
 drivers/net/wireless/ath/wcn36xx/smd.c     | 15 +++++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  6 ++-
 3 files changed, 42 insertions(+), 29 deletions(-)


base-commit: 160b351d75cb50a0dd2abf9b63e1891935aa9e4a
prerequisite-patch-id: 9a4ac7faca179f6594c9b3a115ee69a2da540a69
prerequisite-patch-id: 183286f9c22d1aaa12f356651224e6b337ef1938
prerequisite-patch-id: af468d413daaf8d2aad195fcb43c6e66390d8468
prerequisite-patch-id: 1a7fb93ee5874d2d011409eaed0b4fd764666b9c
prerequisite-patch-id: 77cc008b21a650fa7a33c4acad2fb632b09634fd
prerequisite-patch-id: 988ae4802971d6895b03b2752122b2be42baf188
prerequisite-patch-id: a3ba2a1963e03e23e86c937cd4cfb649e1b819b2
prerequisite-patch-id: 8a1fe4f63bc80e9a8035aa52356da8c46eab8665
prerequisite-patch-id: d75c1a60d1ede373c1f3eb684bb15c853c88eedc
prerequisite-patch-id: 47145acae6e24e8e6580fca1dbddfbec24f7b50b
prerequisite-patch-id: 8c66bccb923be821cf109a3a0d3a1a028edb4930
prerequisite-patch-id: f078e5fdfe8c18936469bfb118a964db13ea729f
prerequisite-patch-id: 746f63cf58fa3bf62736435c81dba2558aba8e81
prerequisite-patch-id: 36a94e202cbdaee8e06f9a108b1c894bd1159e62
prerequisite-patch-id: 8a598e22a08b0ec233d0ec56eeb53673eb1b8feb
prerequisite-patch-id: b0eba574ddc35ecec2d0e39c0d3351d1b260420e
-- 
2.27.0


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

* [PATCH v4 1/5] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels
  2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
@ 2020-09-09 15:36 ` Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 2/5] wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number Bryan O'Donoghue
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:36 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

Adds HW_VALUE_CHANNEL(hw_value) an access macro that will be used to
extract the channel number from struct ieee80211_channel->hw_value in
preparation for also storing PHY settings for 802.11ac in the upper bits of
hw_value.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 2da81d9926c4..ebce1ed7adf7 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -83,7 +83,9 @@ enum wcn36xx_ampdu_state {
 	WCN36XX_AMPDU_OPERATIONAL,
 };
 
-#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value)
+#define HW_VALUE_CHANNEL(hw_value) ((hw_value) & 0xFF)
+#define WCN36XX_HW_CHANNEL(__wcn)\
+	HW_VALUE_CHANNEL(__wcn->hw->conf.chandef.chan->hw_value)
 #define WCN36XX_BAND(__wcn) (__wcn->hw->conf.chandef.chan->band)
 #define WCN36XX_CENTER_FREQ(__wcn) (__wcn->hw->conf.chandef.chan->center_freq)
 #define WCN36XX_LISTEN_INTERVAL(__wcn) (__wcn->hw->conf.listen_interval)
-- 
2.27.0


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

* [PATCH v4 2/5] wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number
  2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 1/5] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels Bryan O'Donoghue
@ 2020-09-09 15:36 ` Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 3/5] wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings Bryan O'Donoghue
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:36 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

Uses HW_VALUE_CHANNEL() to extract the channel number from a
struct ieee80211_channel->hw_value. Once done we can use the upper bits of
the hw_value to encode PHY related data.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index ce6536a3185c..a28bf52a60c5 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -760,8 +760,10 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 
 	msg_body->num_channel = min_t(u8, req->n_channels,
 				     sizeof(msg_body->channels));
-	for (i = 0; i < msg_body->num_channel; i++)
-		msg_body->channels[i] = req->channels[i]->hw_value;
+	for (i = 0; i < msg_body->num_channel; i++) {
+		msg_body->channels[i] =
+			HW_VALUE_CHANNEL(req->channels[i]->hw_value);
+	}
 
 	msg_body->header.len -= WCN36XX_MAX_SCAN_IE_LEN;
 
-- 
2.27.0


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

* [PATCH v4 3/5] wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings
  2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 1/5] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 2/5] wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number Bryan O'Donoghue
@ 2020-09-09 15:36 ` Bryan O'Donoghue
  2020-09-09 15:36 ` [PATCH v4 4/5] wcn36xx: Encode PHY mode for 80MHz channel in hw_value Bryan O'Donoghue
  2020-09-09 15:37 ` [PATCH v4 5/5] wcn36xx: Set PHY into correct mode for 80MHz channel width Bryan O'Donoghue
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:36 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

Adds HW_VALUE_PHY(hw_value) an access macro that will be used to
extract a hardware specific PHY setting for a given channel.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index ebce1ed7adf7..71fa9992b118 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -83,6 +83,8 @@ enum wcn36xx_ampdu_state {
 	WCN36XX_AMPDU_OPERATIONAL,
 };
 
+#define HW_VALUE_PHY_SHIFT 8
+#define HW_VALUE_PHY(hw_value) ((hw_value) >> HW_VALUE_PHY_SHIFT)
 #define HW_VALUE_CHANNEL(hw_value) ((hw_value) & 0xFF)
 #define WCN36XX_HW_CHANNEL(__wcn)\
 	HW_VALUE_CHANNEL(__wcn->hw->conf.chandef.chan->hw_value)
-- 
2.27.0


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

* [PATCH v4 4/5] wcn36xx: Encode PHY mode for 80MHz channel in hw_value
  2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
                   ` (2 preceding siblings ...)
  2020-09-09 15:36 ` [PATCH v4 3/5] wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings Bryan O'Donoghue
@ 2020-09-09 15:36 ` Bryan O'Donoghue
  2020-09-09 15:37 ` [PATCH v4 5/5] wcn36xx: Set PHY into correct mode for 80MHz channel width Bryan O'Donoghue
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:36 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

This commit encodes the 802.11ac PHY mode for a given channel in the upper
bits of the hw_value field. This allows for a neat read-out and application
of the relevant PHY setting.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 50 ++++++++++++-------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index ab6685dc956b..36cfa7043bc3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -39,10 +39,10 @@ MODULE_PARM_DESC(debug_mask, "Debugging mask");
 	.max_power = 25, \
 }
 
-#define CHAN5G(_freq, _idx) { \
+#define CHAN5G(_freq, _idx, _phy_val) { \
 	.band = NL80211_BAND_5GHZ, \
 	.center_freq = (_freq), \
-	.hw_value = (_idx), \
+	.hw_value = (_phy_val) << HW_VALUE_PHY_SHIFT | HW_VALUE_CHANNEL(_idx), \
 	.max_power = 25, \
 }
 
@@ -67,29 +67,29 @@ static struct ieee80211_channel wcn_2ghz_channels[] = {
 };
 
 static struct ieee80211_channel wcn_5ghz_channels[] = {
-	CHAN5G(5180, 36),
-	CHAN5G(5200, 40),
-	CHAN5G(5220, 44),
-	CHAN5G(5240, 48),
-	CHAN5G(5260, 52),
-	CHAN5G(5280, 56),
-	CHAN5G(5300, 60),
-	CHAN5G(5320, 64),
-	CHAN5G(5500, 100),
-	CHAN5G(5520, 104),
-	CHAN5G(5540, 108),
-	CHAN5G(5560, 112),
-	CHAN5G(5580, 116),
-	CHAN5G(5600, 120),
-	CHAN5G(5620, 124),
-	CHAN5G(5640, 128),
-	CHAN5G(5660, 132),
-	CHAN5G(5700, 140),
-	CHAN5G(5745, 149),
-	CHAN5G(5765, 153),
-	CHAN5G(5785, 157),
-	CHAN5G(5805, 161),
-	CHAN5G(5825, 165)
+	CHAN5G(5180, 36, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5200, 40, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW),
+	CHAN5G(5220, 44, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5240, 48, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH),
+	CHAN5G(5260, 52, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5280, 56, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW),
+	CHAN5G(5300, 60, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5320, 64, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH),
+	CHAN5G(5500, 100, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5520, 104, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW),
+	CHAN5G(5540, 108, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5560, 112, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH),
+	CHAN5G(5580, 116, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5600, 120, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW),
+	CHAN5G(5620, 124, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5640, 128, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH),
+	CHAN5G(5660, 132, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5700, 140, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5745, 149, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW),
+	CHAN5G(5765, 153, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW),
+	CHAN5G(5785, 157, PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH),
+	CHAN5G(5805, 161, PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH),
+	CHAN5G(5825, 165, 0)
 };
 
 #define RATE(_bitrate, _hw_rate, _flags) { \
-- 
2.27.0


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

* [PATCH v4 5/5] wcn36xx: Set PHY into correct mode for 80MHz channel width
  2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
                   ` (3 preceding siblings ...)
  2020-09-09 15:36 ` [PATCH v4 4/5] wcn36xx: Encode PHY mode for 80MHz channel in hw_value Bryan O'Donoghue
@ 2020-09-09 15:37 ` Bryan O'Donoghue
  4 siblings, 0 replies; 6+ messages in thread
From: Bryan O'Donoghue @ 2020-09-09 15:37 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless; +Cc: bryan.odonoghue, shawn.guo, loic.poulain

For the 80MHz channel we need to set the PHY mode to one of four PHY modes
that span the 80MHz range.

This patch latches the hw_value PHY field previously defined for 5GHz
channels directly to the parameter passed to the firmware.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index a28bf52a60c5..55d2609bd9a1 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1487,6 +1487,7 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
 	struct wcn36xx_hal_config_bss_params_v1 *bss;
 	struct wcn36xx_hal_config_bss_params bss_v0;
 	struct wcn36xx_hal_config_sta_params_v1 *sta;
+	struct cfg80211_chan_def *chandef;
 	int ret;
 
 	msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL);
@@ -1526,7 +1527,13 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
 	bss->dtim_period = bss_v0.dtim_period;
 	bss->tx_channel_width_set = bss_v0.tx_channel_width_set;
 	bss->oper_channel = bss_v0.oper_channel;
-	bss->ext_channel = bss_v0.ext_channel;
+
+	if (wcn->hw->conf.chandef.width == NL80211_CHAN_WIDTH_80) {
+		chandef = &wcn->hw->conf.chandef;
+		bss->ext_channel = HW_VALUE_PHY(chandef->chan->hw_value);
+	} else {
+		bss->ext_channel = bss_v0.ext_channel;
+	}
 
 	bss->reserved = bss_v0.reserved;
 
-- 
2.27.0


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

end of thread, other threads:[~2020-09-09 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 15:36 [PATCH v4 0/5] wcn36xx: PHY modifications to support 80MHz operation Bryan O'Donoghue
2020-09-09 15:36 ` [PATCH v4 1/5] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels Bryan O'Donoghue
2020-09-09 15:36 ` [PATCH v4 2/5] wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number Bryan O'Donoghue
2020-09-09 15:36 ` [PATCH v4 3/5] wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings Bryan O'Donoghue
2020-09-09 15:36 ` [PATCH v4 4/5] wcn36xx: Encode PHY mode for 80MHz channel in hw_value Bryan O'Donoghue
2020-09-09 15:37 ` [PATCH v4 5/5] wcn36xx: Set PHY into correct mode for 80MHz channel width Bryan O'Donoghue

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