summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2023-06-28 10:05:54 +0300
committerFelix Fietkau <nbd@nbd.name>2023-07-26 12:36:10 +0300
commit1c42e0f283598b43b74318ef54f3d8a57ab46324 (patch)
treeb3d5a2859b6bf36968a41a98e2dd7018f31eaece /drivers/net
parent838cc6679733584d6f1c1e8423a1ad5aa5cb9ad0 (diff)
downloadlinux-1c42e0f283598b43b74318ef54f3d8a57ab46324.tar.xz
wifi: mt76: mt792x: move shared structure definition in mt792x.h
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h111
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt792x.h129
2 files changed, 130 insertions, 110 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
index e84c6a56d40e..b04d78a5d51a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
@@ -4,9 +4,7 @@
#ifndef __MT7921_H
#define __MT7921_H
-#include <linux/interrupt.h>
-#include <linux/ktime.h>
-#include "../mt76_connac_mcu.h"
+#include "../mt792x.h"
#include "regs.h"
#include "acpi_sar.h"
@@ -127,9 +125,6 @@ struct mt7921_sdio_intr {
#define to_rssi(field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
#define to_rcpi(rssi) (2 * (rssi) + 220)
-struct mt792x_vif;
-struct mt792x_sta;
-
enum mt7921_txq_id {
MT7921_TXQ_BAND0,
MT7921_TXQ_BAND1,
@@ -143,39 +138,6 @@ enum mt7921_rxq_id {
MT7921_RXQ_MCU_WM = 0,
};
-DECLARE_EWMA(avg_signal, 10, 8)
-
-struct mt792x_sta {
- struct mt76_wcid wcid; /* must be first */
-
- struct mt792x_vif *vif;
-
- u32 airtime_ac[8];
-
- int ack_signal;
- struct ewma_avg_signal avg_ack_signal;
-
- unsigned long last_txs;
-
- struct mt76_connac_sta_key_conf bip;
-};
-
-DECLARE_EWMA(rssi, 10, 8);
-
-struct mt792x_vif {
- struct mt76_vif mt76; /* must be first */
-
- struct mt792x_sta sta;
- struct mt792x_sta *wep_sta;
-
- struct mt792x_phy *phy;
-
- struct ewma_rssi rssi;
-
- struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
- struct ieee80211_chanctx_conf *ctx;
-};
-
enum {
MT7921_CLC_POWER,
MT7921_CLC_CHAN,
@@ -199,40 +161,6 @@ struct mt7921_clc {
u8 data[];
} __packed;
-struct mt792x_phy {
- struct mt76_phy *mt76;
- struct mt792x_dev *dev;
-
- struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
-
- u64 omac_mask;
-
- u16 noise;
-
- s16 coverage_class;
- u8 slottime;
-
- u32 rx_ampdu_ts;
- u32 ampdu_ref;
-
- struct mt76_mib_stats mib;
-
- u8 sta_work_count;
-
- struct sk_buff_head scan_event_list;
- struct delayed_work scan_work;
-#ifdef CONFIG_ACPI
- void *acpisar;
-#endif
- void *clc[MT7921_CLC_MAX_NUM];
-
- struct work_struct roc_work;
- struct timer_list roc_timer;
- wait_queue_head_t roc_wait;
- u8 roc_token_id;
- bool roc_grant;
-};
-
enum mt7921_eeprom_field {
MT_EE_CHIP_ID = 0x000,
MT_EE_VERSION = 0x002,
@@ -249,43 +177,6 @@ enum mt7921_eeprom_field {
#define mt7921_mcu_init(dev) ((dev)->hif_ops->mcu_init(dev))
#define __mt7921_mcu_drv_pmctrl(dev) ((dev)->hif_ops->drv_own(dev))
#define __mt7921_mcu_fw_pmctrl(dev) ((dev)->hif_ops->fw_own(dev))
-struct mt792x_hif_ops {
- int (*init_reset)(struct mt792x_dev *dev);
- int (*reset)(struct mt792x_dev *dev);
- int (*mcu_init)(struct mt792x_dev *dev);
- int (*drv_own)(struct mt792x_dev *dev);
- int (*fw_own)(struct mt792x_dev *dev);
-};
-
-struct mt792x_dev {
- union { /* must be first */
- struct mt76_dev mt76;
- struct mt76_phy mphy;
- };
-
- const struct mt76_bus_ops *bus_ops;
- struct mt792x_phy phy;
-
- struct work_struct reset_work;
- bool hw_full_reset:1;
- bool hw_init_done:1;
- bool fw_assert:1;
-
- struct work_struct init_work;
-
- u8 fw_debug;
- u8 fw_features;
-
- struct mt76_connac_pm pm;
- struct mt76_connac_coredump coredump;
- const struct mt792x_hif_ops *hif_ops;
-
- struct work_struct ipv6_ns_work;
- /* IPv6 addresses for WoWLAN */
- struct sk_buff_head ipv6_ns_list;
-
- enum environment_cap country_ie_env;
-};
enum {
TXPWR_USER,
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
new file mode 100644
index 000000000000..2c17c2e71af1
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -0,0 +1,129 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2023 MediaTek Inc. */
+
+#ifndef __MT792X_H
+#define __MT792X_H
+
+#include <linux/interrupt.h>
+#include <linux/ktime.h>
+
+#include "mt76_connac_mcu.h"
+
+struct mt792x_vif;
+struct mt792x_sta;
+
+enum {
+ MT792x_CLC_POWER,
+ MT792x_CLC_CHAN,
+ MT792x_CLC_MAX_NUM,
+};
+
+DECLARE_EWMA(avg_signal, 10, 8)
+
+struct mt792x_sta {
+ struct mt76_wcid wcid; /* must be first */
+
+ struct mt792x_vif *vif;
+
+ u32 airtime_ac[8];
+
+ int ack_signal;
+ struct ewma_avg_signal avg_ack_signal;
+
+ unsigned long last_txs;
+
+ struct mt76_connac_sta_key_conf bip;
+};
+
+DECLARE_EWMA(rssi, 10, 8);
+
+struct mt792x_vif {
+ struct mt76_vif mt76; /* must be first */
+
+ struct mt792x_sta sta;
+ struct mt792x_sta *wep_sta;
+
+ struct mt792x_phy *phy;
+
+ struct ewma_rssi rssi;
+
+ struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
+ struct ieee80211_chanctx_conf *ctx;
+};
+
+struct mt792x_phy {
+ struct mt76_phy *mt76;
+ struct mt792x_dev *dev;
+
+ struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
+
+ u64 omac_mask;
+
+ u16 noise;
+
+ s16 coverage_class;
+ u8 slottime;
+
+ u32 rx_ampdu_ts;
+ u32 ampdu_ref;
+
+ struct mt76_mib_stats mib;
+
+ u8 sta_work_count;
+
+ struct sk_buff_head scan_event_list;
+ struct delayed_work scan_work;
+#ifdef CONFIG_ACPI
+ void *acpisar;
+#endif
+ void *clc[MT792x_CLC_MAX_NUM];
+
+ struct work_struct roc_work;
+ struct timer_list roc_timer;
+ wait_queue_head_t roc_wait;
+ u8 roc_token_id;
+ bool roc_grant;
+};
+
+struct mt792x_hif_ops {
+ int (*init_reset)(struct mt792x_dev *dev);
+ int (*reset)(struct mt792x_dev *dev);
+ int (*mcu_init)(struct mt792x_dev *dev);
+ int (*drv_own)(struct mt792x_dev *dev);
+ int (*fw_own)(struct mt792x_dev *dev);
+};
+
+struct mt792x_dev {
+ union { /* must be first */
+ struct mt76_dev mt76;
+ struct mt76_phy mphy;
+ };
+
+ const struct mt76_bus_ops *bus_ops;
+ struct mt792x_phy phy;
+
+ struct work_struct reset_work;
+ bool hw_full_reset:1;
+ bool hw_init_done:1;
+ bool fw_assert:1;
+ bool has_eht:1;
+
+ struct work_struct init_work;
+
+ u8 fw_debug;
+ u8 fw_features;
+
+ struct mt76_connac_pm pm;
+ struct mt76_connac_coredump coredump;
+ const struct mt792x_hif_ops *hif_ops;
+
+ struct work_struct ipv6_ns_work;
+ /* IPv6 addresses for WoWLAN */
+ struct sk_buff_head ipv6_ns_list;
+
+ enum environment_cap country_ie_env;
+ u32 backup_l1;
+ u32 backup_l2;
+};
+
+#endif /* __MT7925_H */