@@ -516,6 +516,19 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
return dev->rev & 0xffff;
}
+static inline bool is_mt7612(struct mt76_dev *dev)
+{
+ return mt76_chip(dev) == 0x7612;
+}
+
+static inline bool is_mt76x2(struct mt76_dev *dev)
+{
+ return mt76_chip(dev) == 0x7612 ||
+ mt76_chip(dev) == 0x7602 ||
+ mt76_chip(dev) == 0x7662 ||
+ mt76_chip(dev) == 0x7632;
+}
+
#define mt76xx_chip(dev) mt76_chip(&((dev)->mt76))
#define mt76xx_rev(dev) mt76_rev(&((dev)->mt76))
@@ -109,11 +109,6 @@ struct mt76x2_dev {
struct mt76x2_dfs_pattern_detector dfs_pd;
};
-static inline bool is_mt7612(struct mt76x2_dev *dev)
-{
- return mt76_chip(&dev->mt76) == 0x7612;
-}
-
static inline bool mt76x2_channel_silent(struct mt76x2_dev *dev)
{
struct ieee80211_channel *chan = dev->mt76.chandef.chan;
@@ -108,7 +108,7 @@ static int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
MT_MAC_SYS_CTRL_RESET_CSR |
MT_MAC_SYS_CTRL_RESET_BBP);
- if (is_mt7612(dev))
+ if (is_mt7612(&dev->mt76))
mt76_clear(dev, MT_COEXCFG0, MT_COEXCFG0_COEX_EN);
mt76_set(dev, MT_EXT_CCA_CFG, 0x0000f000);
@@ -28,7 +28,7 @@ mt76pci_load_rom_patch(struct mt76x2_dev *dev)
{
const struct firmware *fw = NULL;
struct mt76x02_patch_header *hdr;
- bool rom_protect = !is_mt7612(dev);
+ bool rom_protect = !is_mt7612(&dev->mt76);
int len, ret = 0;
__le32 *cur;
u32 patch_mask, patch_reg;
@@ -103,7 +103,7 @@ int mt76x2u_mac_reset(struct mt76x2_dev *dev)
MT_MAC_SYS_CTRL_RESET_CSR |
MT_MAC_SYS_CTRL_RESET_BBP);
- if (is_mt7612(dev))
+ if (is_mt7612(&dev->mt76))
mt76_clear(dev, MT_COEXCFG0, MT_COEXCFG0_COEX_EN);
mt76_set(dev, MT_EXT_CCA_CFG, 0xf000);
@@ -91,7 +91,7 @@ static void mt76x2u_mcu_reset_wmt(struct mt76x2_dev *dev)
static int mt76x2u_mcu_load_rom_patch(struct mt76x2_dev *dev)
{
- bool rom_protect = !is_mt7612(dev);
+ bool rom_protect = !is_mt7612(&dev->mt76);
struct mt76x02_patch_header *hdr;
u32 val, patch_mask, patch_reg;
const struct firmware *fw;
Add is_mt76x2 utility routine to check if device chip id is mt76x2. Moreover move is_mt7612 in mt76.h. This is a preliminary patch to share write_txwi routine between mt76x2 and mt76x0 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- drivers/net/wireless/mediatek/mt76/mt76.h | 13 +++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h | 5 ----- .../net/wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2/usb_mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2/usb_mcu.c | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-)