linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: lorenzo.bianconi@redhat.com, sean.wang@mediatek.com,
	ryder.lee@mediatek.com, linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: [PATCH v4 15/25] mt76: mt7615: add mt7663e support to mt7615_reg_map
Date: Tue, 17 Mar 2020 17:41:22 +0100	[thread overview]
Message-ID: <e398194b0e22dec05de83b5d8733bc55a2bb4d4d.1584463004.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1584463004.git.lorenzo@kernel.org>

Introduce mt7663e support to mt7615_reg_map routine in order to reuse it
adding support for mt7663e driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mmio.c   | 12 +++++++++---
 drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h |  5 +++++
 drivers/net/wireless/mediatek/mt76/mt7615/regs.h   |  3 +++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
index fb4a76270ad4..43c8b29020f5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c
@@ -30,9 +30,15 @@ const u32 mt7615e_reg_map[] = {
 
 u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr)
 {
-	u32 base = addr & MT_MCU_PCIE_REMAP_2_BASE;
-	u32 offset = addr & MT_MCU_PCIE_REMAP_2_OFFSET;
-
+	u32 base, offset;
+
+	if (is_mt7663(&dev->mt76)) {
+		base = addr & MT7663_MCU_PCIE_REMAP_2_BASE;
+		offset = addr & MT7663_MCU_PCIE_REMAP_2_OFFSET;
+	} else {
+		base = addr & MT_MCU_PCIE_REMAP_2_BASE;
+		offset = addr & MT_MCU_PCIE_REMAP_2_OFFSET;
+	}
 	mt76_wr(dev, MT_MCU_PCIE_REMAP_2, base);
 
 	return MT_PCIE_REMAP_BASE_2 + offset;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index c03ad0409f43..143fa63517ff 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -343,6 +343,11 @@ static inline bool is_mt7615(struct mt76_dev *dev)
 	return mt76_chip(dev) == 0x7615;
 }
 
+static inline bool is_mt7663(struct mt76_dev *dev)
+{
+	return mt76_chip(dev) == 0x7663;
+}
+
 static inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask)
 {
 	mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, 0, mask);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h
index b422a9c71089..928e5a841885 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h
@@ -55,6 +55,9 @@ enum mt7615_reg_base {
 
 #define MT_HIF(ofs)			((dev)->reg_map[MT_HIF_BASE] + (ofs))
 
+#define MT7663_MCU_PCIE_REMAP_2_OFFSET	GENMASK(15, 0)
+#define MT7663_MCU_PCIE_REMAP_2_BASE	GENMASK(31, 16)
+
 #define MT_CFG_LPCR_HOST		MT_HIF(0x1f0)
 #define MT_CFG_LPCR_HOST_FW_OWN		BIT(0)
 #define MT_CFG_LPCR_HOST_DRV_OWN	BIT(1)
-- 
2.25.1


  parent reply	other threads:[~2020-03-17 16:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 16:41 [PATCH v4 00/25] Introduce mt7663e support to mt7615 driver Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 01/25] mt76: mt7615: introduce mt7615_mcu_fill_msg Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 02/25] mt76: mt7615: introduce mt7615_mcu_wait_response Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 03/25] mt76: mt7615: cleanup fw queue just for mmio devices Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 04/25] mt76: mt7615: introduce mt7615_init_device routine Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 05/25] mt76: always init to 0 mcu messages Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 06/25] mt76: mt7615: introduce mt7615_mcu_send_message routine Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 07/25] mt76: mt7615: add mt7615_mcu_ops data structure Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 08/25] mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 09/25] mt76: mt7615: move mt7615_mcu_set_sta in mt7615_mcu_ops Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 10/25] mt76: mt7615: rely on skb API for mt7615_mcu_set_eeprom Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 11/25] mt76: mt7615: rework mt7615_mcu_set_bss_info using skb APIs Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 12/25] mt76: mt7615: move more mcu commands in mt7615_mcu_ops data structure Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 13/25] mt76: mt7615: introduce MCU_FW_PREFIX for fw mcu commands Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 14/25] mt76: mt7615: introduce mt7615_register_map Lorenzo Bianconi
2020-03-17 16:41 ` Lorenzo Bianconi [this message]
2020-03-17 16:41 ` [PATCH v4 16/25] mt76: mt7615: add mt7663e support to mt7615_{driver,firmware}_own Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 17/25] mt76: mt7615: add mt7663e support to mt7615_mcu_set_eeprom Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 18/25] mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 19/25] mt76: mt7615: introduce mt7615_init_mac_chain routine Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 20/25] mt76: mt7615: introduce uni cmd command types Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 21/25] mt76: mt7615: introduce set_bmc and st_sta for uni commands Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 22/25] mt76: mt7615: add more uni mcu commands Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 23/25] mt76: mt7615: introduce set_ba uni command Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 24/25] mt76: mt7615: get rid of sta_rec_wtbl data structure Lorenzo Bianconi
2020-03-17 16:41 ` [PATCH v4 25/25] mt76: mt7615: introduce mt7663e support 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=e398194b0e22dec05de83b5d8733bc55a2bb4d4d.1584463004.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.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 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).