All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: nbd@nbd.name
Cc: sgruszka@redhat.com, linux-wireless@vger.kernel.org
Subject: [PATCH 20/26] mt76x0: phy: set antenna parameter according to wireless band
Date: Thu, 27 Sep 2018 11:01:49 +0200	[thread overview]
Message-ID: <ee8b0f6e71d6483d89d79a3d0c8315d74c1289b6.1538036134.git.lorenzo.bianconi@redhat.com> (raw)
In-Reply-To: <cover.1538036134.git.lorenzo.bianconi@redhat.com>

Move mt76x0_ant_select routine in __mt76x0_phy_set_channel in order to
configure antenna parameters according to the current wireless channel

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 .../net/wireless/mediatek/mt76/mt76x0/phy.c   | 31 ++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index d11fcf6c8967..fe754fe039cc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -548,6 +548,25 @@ mt76x0_phy_set_chan_bbp_params(struct mt76x0_dev *dev, u8 channel, u16 rf_bw_ban
 	}
 }
 
+static void mt76x0_ant_select(struct mt76x0_dev *dev)
+{
+	struct ieee80211_channel *chan = dev->mt76.chandef.chan;
+
+	/* single antenna mode */
+	if (chan->band == NL80211_BAND_2GHZ) {
+		mt76_rmw(dev, MT_COEXCFG3,
+			 BIT(5) | BIT(4) | BIT(3) | BIT(2), BIT(1));
+		mt76_rmw(dev, MT_WLAN_FUN_CTRL, BIT(5), BIT(6));
+	} else {
+		mt76_rmw(dev, MT_COEXCFG3, BIT(5) | BIT(2),
+			 BIT(4) | BIT(3));
+		mt76_clear(dev, MT_WLAN_FUN_CTRL,
+			   BIT(6) | BIT(5));
+	}
+	mt76_clear(dev, MT_CMB_CTRL, BIT(14) | BIT(12));
+	mt76_clear(dev, MT_COEXCFG0, BIT(2));
+}
+
 static void
 mt76x0_bbp_set_bw(struct mt76x0_dev *dev, enum nl80211_chan_width width)
 {
@@ -658,6 +677,7 @@ __mt76x0_phy_set_channel(struct mt76x0_dev *dev,
 	mt76x0_bbp_set_bw(dev, chandef->width);
 	mt76x0_bbp_set_ctrlch(dev, chandef->width, ch_group_index);
 	mt76x0_mac_set_ctrlch(dev, ch_group_index & 1);
+	mt76x0_ant_select(dev);
 
 	mt76_rmw(dev, MT_EXT_CCA_CFG,
 		 (MT_EXT_CCA_CFG_CCA0 |
@@ -915,21 +935,10 @@ mt76x0_rf_init(struct mt76x0_dev *dev)
 	rf_set(dev, MT_RF(0, 4), 0x80);
 }
 
-static void mt76x0_ant_select(struct mt76x0_dev *dev)
-{
-	/* Single antenna mode. */
-	mt76_rmw(dev, MT_WLAN_FUN_CTRL, BIT(5), BIT(6));
-	mt76_clear(dev, MT_CMB_CTRL, BIT(14) | BIT(12));
-	mt76_clear(dev, MT_COEXCFG0, BIT(2));
-	mt76_rmw(dev, MT_COEXCFG3, BIT(5) | BIT(4) | BIT(3) | BIT(2), BIT(1));
-}
-
 void mt76x0_phy_init(struct mt76x0_dev *dev)
 {
 	INIT_DELAYED_WORK(&dev->cal_work, mt76x0_phy_calibrate);
 
-	mt76x0_ant_select(dev);
-
 	mt76x0_rf_init(dev);
 
 	mt76x0_set_rx_chains(dev);
-- 
2.17.1


  parent reply	other threads:[~2018-09-27  9:02 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27  9:01 [PATCH 00/26] add mt76x0e hw initialization support Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 01/26] mt76x0: use mt76_poll in mt76x0_set_wlan_state Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 02/26] mt76: move wait_for_wpdma in mt76x02_dma.h Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 03/26] mt76: add mt76x02_dma_enable/mt76x02_dma_disable utility routines Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 04/26] mt76: move mt76x02_set_irq_mask in mt76x02_core.c Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 05/26] mt76: move queue initialization in mt76x02_dma.c Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 06/26] mt76: move mt76x02_beacon_offset in mt76x02_core.c Lorenzo Bianconi
2018-09-27 10:06   ` Stanislaw Gruszka
2018-09-27 15:14     ` Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 07/26] mt76: mmio: add implementation of wr_rp and rd_rp Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 08/26] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module Lorenzo Bianconi
2018-09-27 10:10   ` Stanislaw Gruszka
2018-09-27 15:15     ` Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 09/26] mt76x0: update initvals to latest version of vendor driver Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 10/26] mt76x0: pci: move mcu code in pci_mcu.c Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 11/26] mt76x0: usb: move mcu code in usb_mcu.c Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 12/26] mt76x0: use mt76x02 utility routines in mt76x0 init code Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 13/26] mt76x0: init: remove duplicated initialization Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 14/26] mt76x0: init: remove MT_PBF_SYS_CTRL configuration in mt76x0_reset_csr_bbp Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 15/26] mt76x0: init: reset beacon offset during bootstrap Lorenzo Bianconi
2018-09-27 10:14   ` Stanislaw Gruszka
2018-09-27 15:12     ` Lorenzo Bianconi
2018-09-27 10:15   ` Felix Fietkau
2018-09-27 15:12     ` Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 16/26] mt76x0: init rx filter in mt76x0_init_hardware Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 17/26] mt76: add mt76x02_mac_start routine Lorenzo Bianconi
2018-09-27 10:17   ` Stanislaw Gruszka
2018-09-27 15:10     ` Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 18/26] mt76x0: usb: move initialization code in usb_init.c Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 19/26] mt76x0: pci: add hw initialization at bootstrap Lorenzo Bianconi
2018-09-27 10:24   ` Stanislaw Gruszka
2018-09-27 15:18     ` Lorenzo Bianconi
2018-09-27  9:01 ` Lorenzo Bianconi [this message]
2018-09-27  9:01 ` [PATCH 21/26] mt76: move set_{tx,rx}_path routines in mt76x02-lib module Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 22/26] mt76x0: add ieee80211_ops ops pointer to mt76x0_alloc_device signature Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 23/26] mt76x0: pci: add mt76x0e_start callback Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 24/26] mt76x0: pci: add mt76x0e_stop callback Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 25/26] mt76: move eeprom_load routines in mt76x02_eeprom.c Lorenzo Bianconi
2018-09-27 10:30   ` Felix Fietkau
2018-09-27 14:46     ` Lorenzo Bianconi
2018-09-27  9:01 ` [PATCH 26/26] mt76x0: introduce mt76x0{e,u}_eeprom_init routines Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee8b0f6e71d6483d89d79a3d0c8315d74c1289b6.1538036134.git.lorenzo.bianconi@redhat.com \
    --to=lorenzo.bianconi@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.