All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Sean Wang <sean.wang@mediatek.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Felix Fietkau <nbd@nbd.name>, Deren Wu <Deren.Wu@mediatek.com>
Subject: [PATCH 5.12 06/11] mt76: mt7921: introduce __mt7921_start utility routine
Date: Fri,  9 Jul 2021 15:21:43 +0200	[thread overview]
Message-ID: <20210709131557.974264191@linuxfoundation.org> (raw)
In-Reply-To: <20210709131549.679160341@linuxfoundation.org>

From: Lorenzo Bianconi <lorenzo@kernel.org>

commit 1f7396acfef4691b8cf4a3e631fd3f59d779c0f2 upstream.

This is a preliminary patch to introduce mt7921 chip reset support.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Cc: Deren Wu <Deren.Wu@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/mediatek/mt76/mt7921/main.c   |   35 ++++++++++++---------
 drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h |    1 
 2 files changed, 22 insertions(+), 14 deletions(-)

--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -168,33 +168,40 @@ void mt7921_set_stream_he_caps(struct mt
 	}
 }
 
-static int mt7921_start(struct ieee80211_hw *hw)
+int __mt7921_start(struct mt7921_phy *phy)
 {
-	struct mt7921_dev *dev = mt7921_hw_dev(hw);
-	struct mt7921_phy *phy = mt7921_hw_phy(hw);
+	struct mt76_phy *mphy = phy->mt76;
 	int err;
 
-	mt7921_mutex_acquire(dev);
-
-	err = mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, true, false);
+	err = mt76_connac_mcu_set_mac_enable(mphy->dev, 0, true, false);
 	if (err)
-		goto out;
+		return err;
 
-	err = mt76_connac_mcu_set_channel_domain(phy->mt76);
+	err = mt76_connac_mcu_set_channel_domain(mphy);
 	if (err)
-		goto out;
+		return err;
 
 	err = mt7921_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH);
 	if (err)
-		goto out;
+		return err;
 
 	mt7921_mac_reset_counters(phy);
-	set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
+	set_bit(MT76_STATE_RUNNING, &mphy->state);
 
-	ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
+	ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
 				     MT7921_WATCHDOG_TIME);
-out:
-	mt7921_mutex_release(dev);
+
+	return 0;
+}
+
+static int mt7921_start(struct ieee80211_hw *hw)
+{
+	struct mt7921_phy *phy = mt7921_hw_phy(hw);
+	int err;
+
+	mt7921_mutex_acquire(phy->dev);
+	err = __mt7921_start(phy);
+	mt7921_mutex_release(phy->dev);
 
 	return err;
 }
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -209,6 +209,7 @@ extern struct pci_driver mt7921_pci_driv
 
 u32 mt7921_reg_map(struct mt7921_dev *dev, u32 addr);
 
+int __mt7921_start(struct mt7921_phy *phy);
 int mt7921_register_device(struct mt7921_dev *dev);
 void mt7921_unregister_device(struct mt7921_dev *dev);
 int mt7921_eeprom_init(struct mt7921_dev *dev);



  parent reply	other threads:[~2021-07-09 13:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 13:21 [PATCH 5.12 00/11] 5.12.16-rc1 review Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 01/11] Hexagon: fix build errors Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 02/11] Hexagon: add target builtins to kernel Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 03/11] Hexagon: change jumps to must-extend in futex_atomic_* Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 04/11] mt76: mt7921: check mcu returned values in mt7921_start Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 05/11] mt76: mt7921: introduce mt7921_run_firmware utility routine Greg Kroah-Hartman
2021-07-09 13:21 ` Greg Kroah-Hartman [this message]
2021-07-09 13:21 ` [PATCH 5.12 07/11] mt76: dma: introduce mt76_dma_queue_reset routine Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 08/11] mt76: dma: export mt76_dma_rx_cleanup routine Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 09/11] mt76: mt7921: add wifi reset support Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 10/11] mt76: mt7921: abort uncompleted scan by wifi reset Greg Kroah-Hartman
2021-07-09 13:21 ` [PATCH 5.12 11/11] mt76: mt7921: get rid of mcu_reset function pointer Greg Kroah-Hartman
2021-07-09 17:11 ` [PATCH 5.12 00/11] 5.12.16-rc1 review Jon Hunter
2021-07-09 17:31 ` Fox Chen
2021-07-09 21:28 ` Shuah Khan
2021-07-09 22:31 ` Justin Forbes
2021-07-10 10:11 ` Naresh Kamboju
2021-07-10 19:57 ` Guenter Roeck
2021-07-11 22:28 ` Florian Fainelli

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=20210709131557.974264191@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=Deren.Wu@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=sean.wang@mediatek.com \
    --cc=stable@vger.kernel.org \
    /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.