Linux wireless drivers development
 help / color / mirror / Atom feed
* [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support
@ 2026-12-01 21:10 Alex Novak
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Alex Novak @ 2026-12-01 21:10 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless

Following up on my earlier thread "[RFC/INFO] Hardware quirks of
SmartChip S9082C (02e7:9082 RTL8189ES clone)" on linux-wireless, this
RFC series adds support for Realtek RTL8189ES (024c:8179) and the
SmartChip S9082C clone (02e7:9082) to rtw88.

To keep shared code changes minimal, all chip-specific behavior is
hidden behind chip_ops hooks and chip_info flags instead of inline chip
checks in the common paths:

- Patch 1 adds minimal core hooks and flags (RTW_CHIP_TYPE_8189E,
  efuse_inverted, fw_no_hdr, fill_txdesc, query_rx_desc,
  rtw_coex_supported(), and three SDIO callbacks: sdio_to_bus_offset,
  sdio_fixup_val, and sdio_enable_rx_agg).
- Patch 2 adds the RTL8189E register tables and S9082C init sequences.
- Patch 3 adds the RTL8189E/S9082C chip core, 32-byte TX / 24-byte RX
  descriptor helpers, and S9082C bit-reversed MAC/BB/RF, IQK/LCK
  calibration, and SDIO register callbacks.
- Patch 4 adds the rtw88_8189es SDIO driver glue, Kconfig, and Makefile
  wiring.

Testing status:
Compile- and static-tested only (no runtime test on hardware yet).
Each patch in the series is bisectable and verified via GitHub Actions
on x86_64 and arm64 with W=1, C=1 sparse (CF=-D__CHECK_ENDIAN__),
KCFLAGS="-Werror", checkpatch.pl --strict --codespell, and a config
matrix covering CONFIG_RTW88_8189ES=m, CONFIG_RTW88_8189ES=y,
CONFIG_RTW88_DEBUGFS=n, and CONFIG_PM=n (0 compiler errors, 0 sparse
warnings). Runtime probe and register-sequencing validation on an
Amlogic S905X board will be completed before any non-RFC [PATCH rtw-next
v1] submission.

I would appreciate feedback on two specific questions before testing on
hardware:

1. Is this split and encapsulation of the S9082C SDIO quirks via
   sdio_to_bus_offset, sdio_fixup_val, and sdio_enable_rx_agg in
   chip_ops acceptable for rtw88, or would a different abstraction be
   preferred?
2. Is the fw_no_hdr flag in chip_info together with the path
   "rtw88/s9082c_fw.bin" the preferred approach for handling headerless
   8051 firmware images in rtw88?

Alex Novak (4):
  wifi: rtw88: extend core hooks for 8189E and S9082C
  wifi: rtw88: add RTL8189E and S9082C register tables
  wifi: rtw88: add RTL8189E and S9082C chip core
  wifi: rtw88: add RTL8189ES and S9082C SDIO driver

 drivers/net/wireless/realtek/rtw88/Kconfig    |   16 +
 drivers/net/wireless/realtek/rtw88/Makefile   |    6 +
 drivers/net/wireless/realtek/rtw88/coex.c     |   34 +-
 drivers/net/wireless/realtek/rtw88/coex.h     |    5 +
 drivers/net/wireless/realtek/rtw88/efuse.c    |    7 +
 drivers/net/wireless/realtek/rtw88/mac.c      |    6 +-
 drivers/net/wireless/realtek/rtw88/main.c     |    3 +
 drivers/net/wireless/realtek/rtw88/main.h     |   15 +
 drivers/net/wireless/realtek/rtw88/phy.c      |    3 +-
 drivers/net/wireless/realtek/rtw88/rtw8189e.c | 1425 +++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8189e.h |   20 +
 .../wireless/realtek/rtw88/rtw8189e_table.c   | 2238 +++++++++++++++++
 .../wireless/realtek/rtw88/rtw8189e_table.h   |   52 +
 .../net/wireless/realtek/rtw88/rtw8189es.c    |   43 +
 drivers/net/wireless/realtek/rtw88/rx.c       |   13 +-
 drivers/net/wireless/realtek/rtw88/rx.h       |    4 +
 drivers/net/wireless/realtek/rtw88/sdio.c     |   29 +-
 drivers/net/wireless/realtek/rtw88/tx.c       |    5 +
 18 files changed, 3909 insertions(+), 15 deletions(-)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189es.c

-- 
2.56.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
@ 2026-12-01 21:11 ` Alex Novak
  2026-12-02  8:21   ` Luka Gejak
                     ` (2 more replies)
  2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: Alex Novak @ 2026-12-01 21:11 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless

Add minimal chip_ops hooks and chip_info flags needed by RTL8189ES and
SmartChip S9082C without adding per-chip quirks to shared paths:

- Add RTW_CHIP_TYPE_8189E, efuse_inverted, and fw_no_hdr in chip_info.
- Add fill_txdesc, query_rx_desc, sdio_to_bus_offset, sdio_fixup_val,
  and sdio_enable_rx_agg hooks in chip_ops, plus NULL guards in
  rtw_load_table() and rtw_phy_pwr_track().
- Add rtw_coex_supported() so chips without BT coexistence skip coex
  initialization, C2H handling, and periodic polling while keeping
  coex->stop_dm set.
- Export rtw_rx_fill_rx_status() for chip RX descriptor parsers.

Signed-off-by: Alex Novak <neur-alx@agentmail.to>
---
 drivers/net/wireless/realtek/rtw88/coex.c  | 34 +++++++++++++++++++---
 drivers/net/wireless/realtek/rtw88/coex.h  |  5 ++++
 drivers/net/wireless/realtek/rtw88/efuse.c |  7 +++++
 drivers/net/wireless/realtek/rtw88/mac.c   |  6 ++--
 drivers/net/wireless/realtek/rtw88/main.c  |  3 ++
 drivers/net/wireless/realtek/rtw88/main.h  | 15 ++++++++++
 drivers/net/wireless/realtek/rtw88/phy.c   |  3 +-
 drivers/net/wireless/realtek/rtw88/rx.c    | 13 ++++++---
 drivers/net/wireless/realtek/rtw88/rx.h    |  4 +++
 drivers/net/wireless/realtek/rtw88/sdio.c  | 29 +++++++++++++++---
 drivers/net/wireless/realtek/rtw88/tx.c    |  5 ++++
 11 files changed, 109 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
index 37c336d..6cc533a 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.c
+++ b/drivers/net/wireless/realtek/rtw88/coex.c
@@ -643,7 +643,8 @@ void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb)
 	struct rtw_coex *coex = &rtwdev->coex;
 	u8 *payload = get_payload_from_coex_resp(skb);
 
-	if (payload[0] != COEX_RESP_ACK_BY_WL_FW) {
+	if (!rtw_coex_supported(rtwdev) ||
+	    payload[0] != COEX_RESP_ACK_BY_WL_FW) {
 		dev_kfree_skb_any(skb);
 		return;
 	}
@@ -2555,7 +2556,7 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason)
 
 	lockdep_assert_held(&rtwdev->mutex);
 
-	if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
+	if (!rtw_coex_supported(rtwdev) || !test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
 		return;
 
 	coex_dm->reason = reason;
@@ -2710,6 +2711,9 @@ static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only)
 	struct rtw_coex *coex = &rtwdev->coex;
 	struct rtw_coex_stat *coex_stat = &coex->stat;
 
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
 
 	rtw_coex_init_coex_var(rtwdev);
@@ -2765,6 +2769,9 @@ void rtw_coex_power_on_setting(struct rtw_dev *rtwdev)
 	struct rtw_coex *coex = &rtwdev->coex;
 	u8 table_case = 1;
 
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
 
 	coex->stop_dm = true;
@@ -2789,6 +2796,9 @@ EXPORT_SYMBOL(rtw_coex_power_on_setting);
 
 void rtw_coex_power_off_setting(struct rtw_dev *rtwdev)
 {
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	rtw_write16(rtwdev, REG_WIFI_BT_INFO, BIT_BT_INT_EN);
 }
 EXPORT_SYMBOL(rtw_coex_power_off_setting);
@@ -3032,6 +3042,9 @@ void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
 	u8 i, rsp_source = 0, type;
 	bool inq_page = false;
 
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	rsp_source = buf[0] & 0xf;
 	if (rsp_source >= COEX_BTINFO_SRC_MAX)
 		return;
@@ -3304,6 +3317,9 @@ void rtw_coex_bt_hid_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
 	u8 sub_id = buf[2], gamehid_cnt = 0, handle, i;
 	bool cur_game_hid_exist, complete;
 
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	if (!chip->wl_mimo_ps_support &&
 	    (sub_id == COEX_BT_HIDINFO_LIST || sub_id == COEX_BT_HIDINFO_A))
 		return;
@@ -3392,7 +3408,8 @@ void rtw_coex_query_bt_hid_list(struct rtw_dev *rtwdev)
 	u8 i, handle;
 	bool complete;
 
-	if (!chip->wl_mimo_ps_support || coex_stat->wl_under_ips ||
+	if (!rtw_coex_supported(rtwdev) || !chip->wl_mimo_ps_support ||
+	    coex_stat->wl_under_ips ||
 	    (coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl))
 		return;
 
@@ -3425,6 +3442,9 @@ void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
 	u8 val;
 	int i;
 
+	if (!rtw_coex_supported(rtwdev))
+		return;
+
 	rtw_dbg(rtwdev, RTW_DBG_COEX,
 		"[BTCoex], WiFi Fw Dbg info = %8ph (len = %d)\n",
 		buf, length);
@@ -3458,7 +3478,8 @@ void rtw_coex_wl_status_check(struct rtw_dev *rtwdev)
 {
 	struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat;
 
-	if ((coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl) ||
+	if (!rtw_coex_supported(rtwdev) ||
+	    (coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl) ||
 	    coex_stat->wl_under_ips)
 		return;
 
@@ -3951,6 +3972,11 @@ void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m)
 	u32 lte_coex = 0, bt_coex = 0;
 	int i;
 
+	if (!rtw_coex_supported(rtwdev)) {
+		seq_puts(m, "BT coex not supported\n");
+		return;
+	}
+
 	score_board_BW = rtw_coex_read_scbd(rtwdev);
 	score_board_WB = coex_stat->score_board;
 	wl_reg_6c0 = rtw_read32(rtwdev, REG_BT_COEX_TABLE0);
diff --git a/drivers/net/wireless/realtek/rtw88/coex.h b/drivers/net/wireless/realtek/rtw88/coex.h
index c398be8..431933c 100644
--- a/drivers/net/wireless/realtek/rtw88/coex.h
+++ b/drivers/net/wireless/realtek/rtw88/coex.h
@@ -325,6 +325,11 @@ struct coex_rf_para {
 	u8 bt_lna_lvl;
 };
 
+static inline bool rtw_coex_supported(struct rtw_dev *rtwdev)
+{
+	return !!rtwdev->chip->ops->coex_set_init;
+}
+
 static inline void rtw_coex_set_init(struct rtw_dev *rtwdev)
 {
 	const struct rtw_chip_info *chip = rtwdev->chip;
diff --git a/drivers/net/wireless/realtek/rtw88/efuse.c b/drivers/net/wireless/realtek/rtw88/efuse.c
index 15c5720..90a010e 100644
--- a/drivers/net/wireless/realtek/rtw88/efuse.c
+++ b/drivers/net/wireless/realtek/rtw88/efuse.c
@@ -166,6 +166,13 @@ int rtw_parse_efuse_map(struct rtw_dev *rtwdev)
 		goto out_free;
 	}
 
+	if (chip->efuse_inverted) {
+		u32 i;
+
+		for (i = 0; i < phy_size; i++)
+			phy_map[i] = ~phy_map[i];
+	}
+
 	memset(log_map, 0xff, log_size);
 	ret = rtw_dump_logical_efuse_map(rtwdev, phy_map, log_map);
 	if (ret) {
diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index eaa928b..511e0b5 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -896,8 +896,10 @@ download_firmware_legacy(struct rtw_dev *rtwdev, const u8 *data, u32 size)
 	u32 total_page;
 	u32 last_page_size;
 
-	data += sizeof(struct rtw_fw_hdr_legacy);
-	size -= sizeof(struct rtw_fw_hdr_legacy);
+	if (!rtwdev->chip->fw_no_hdr) {
+		data += sizeof(struct rtw_fw_hdr_legacy);
+		size -= sizeof(struct rtw_fw_hdr_legacy);
+	}
 
 	total_page = size >> DLFW_PAGE_SIZE_SHIFT_LEGACY;
 	last_page_size = size & (DLFW_PAGE_SIZE_LEGACY - 1);
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 19b5c6f..5726f98 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1793,6 +1793,8 @@ static void __update_firmware_info_legacy(struct rtw_dev *rtwdev,
 				(struct rtw_fw_hdr_legacy *)fw->firmware->data;
 
 	fw->h2c_version = 0;
+	if (rtwdev->chip->fw_no_hdr)
+		return;
 	fw->version = le16_to_cpu(legacy->version);
 	fw->sub_version = legacy->subversion1;
 	fw->sub_index = legacy->subversion2;
@@ -2191,6 +2193,7 @@ int rtw_core_init(struct rtw_dev *rtwdev)
 	mutex_init(&rtwdev->hal.tx_power_mutex);
 
 	init_waitqueue_head(&rtwdev->coex.wait);
+	coex->stop_dm = !rtw_coex_supported(rtwdev);
 	init_completion(&rtwdev->lps_leave_check);
 	init_completion(&rtwdev->fw_scan_density);
 
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 1401eff..5adeea6 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -198,6 +198,7 @@ enum rtw_chip_type {
 	RTW_CHIP_TYPE_8821A,
 	RTW_CHIP_TYPE_8812A,
 	RTW_CHIP_TYPE_8814A,
+	RTW_CHIP_TYPE_8189E,
 };
 
 enum rtw_tx_queue_type {
@@ -912,10 +913,19 @@ struct rtw_chip_ops {
 	void (*config_txrx_mode)(struct rtw_dev *rtwdev, u8 tx_path,
 				 u8 rx_path, bool is_tx2_path);
 	void (*led_set)(struct led_classdev *led, enum led_brightness brightness);
+	void (*fill_txdesc)(struct rtw_dev *rtwdev,
+			    struct rtw_tx_pkt_info *pkt_info,
+			    struct sk_buff *skb);
+	int (*query_rx_desc)(struct rtw_dev *rtwdev, void *rx_desc8,
+			     struct rtw_rx_pkt_stat *pkt_stat,
+			     struct ieee80211_rx_status *rx_status);
 	/* for USB/SDIO only */
 	void (*fill_txdesc_checksum)(struct rtw_dev *rtwdev,
 				     struct rtw_tx_pkt_info *pkt_info,
 				     u8 *txdesc);
+	u32 (*sdio_to_bus_offset)(struct rtw_dev *rtwdev, u32 addr);
+	u32 (*sdio_fixup_val)(u32 val);
+	void (*sdio_enable_rx_agg)(struct rtw_dev *rtwdev);
 
 	/* for coex */
 	void (*coex_set_init)(struct rtw_dev *rtwdev);
@@ -1110,6 +1120,9 @@ struct rtw_table {
 static inline void rtw_load_table(struct rtw_dev *rtwdev,
 				  const struct rtw_table *tbl)
 {
+	if (!tbl)
+		return;
+
 	(*tbl->parse)(rtwdev, tbl);
 }
 
@@ -1251,6 +1264,8 @@ struct rtw_chip_info {
 	bool path_div_supported;
 	bool ht_supported;
 	bool vht_supported;
+	bool efuse_inverted;
+	bool fw_no_hdr;
 	u8 lps_deep_mode_supported;
 
 	/* init values */
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index e2515a6..8588061 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -852,7 +852,8 @@ EXPORT_SYMBOL(rtw_phy_cck_pd_set);
 
 static void rtw_phy_pwr_track(struct rtw_dev *rtwdev)
 {
-	rtwdev->chip->ops->pwr_track(rtwdev);
+	if (rtwdev->chip->ops->pwr_track)
+		rtwdev->chip->ops->pwr_track(rtwdev);
 }
 
 static void rtw_phy_ra_track(struct rtw_dev *rtwdev)
diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c
index fde21c8..75c8503 100644
--- a/drivers/net/wireless/realtek/rtw88/rx.c
+++ b/drivers/net/wireless/realtek/rtw88/rx.c
@@ -194,10 +194,10 @@ void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb,
 }
 EXPORT_SYMBOL(rtw_update_rx_freq_from_ie);
 
-static void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
-				  struct rtw_rx_pkt_stat *pkt_stat,
-				  struct ieee80211_hdr *hdr,
-				  struct ieee80211_rx_status *rx_status)
+void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
+			   struct rtw_rx_pkt_stat *pkt_stat,
+			   struct ieee80211_hdr *hdr,
+			   struct ieee80211_rx_status *rx_status)
 {
 	struct ieee80211_hw *hw = rtwdev->hw;
 	u8 path;
@@ -263,6 +263,7 @@ static void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
 		rtw_dbg(rtwdev, RTW_DBG_RX, "zero length packet");
 	}
 }
+EXPORT_SYMBOL(rtw_rx_fill_rx_status);
 
 int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
 			 struct rtw_rx_pkt_stat *pkt_stat,
@@ -274,6 +275,10 @@ int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
 	u32 enc_type, swdec;
 	void *phy_status;
 
+	if (rtwdev->chip->ops->query_rx_desc)
+		return rtwdev->chip->ops->query_rx_desc(rtwdev, rx_desc8,
+							pkt_stat, rx_status);
+
 	memset(pkt_stat, 0, sizeof(*pkt_stat));
 
 	pkt_stat->pkt_len = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PKT_LEN);
diff --git a/drivers/net/wireless/realtek/rtw88/rx.h b/drivers/net/wireless/realtek/rtw88/rx.h
index 74359f6..6633f04 100644
--- a/drivers/net/wireless/realtek/rtw88/rx.h
+++ b/drivers/net/wireless/realtek/rtw88/rx.h
@@ -45,6 +45,10 @@ struct rtw_rx_desc {
 
 void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
 		  struct sk_buff *skb);
+void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
+			   struct rtw_rx_pkt_stat *pkt_stat,
+			   struct ieee80211_hdr *hdr,
+			   struct ieee80211_rx_status *rx_status);
 int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
 			 struct rtw_rx_pkt_stat *pkt_stat,
 			 struct ieee80211_rx_status *rx_status);
diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
index 82d7de4..1324226 100644
--- a/drivers/net/wireless/realtek/rtw88/sdio.c
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c
@@ -38,8 +38,19 @@ static bool rtw_sdio_bus_claim_needed(struct rtw_sdio *rtwsdio)
 	       rtwsdio->irq_thread != current;
 }
 
+static u32 rtw_sdio_fixup_val(struct rtw_dev *rtwdev, u32 val)
+{
+	if (rtwdev->chip->ops->sdio_fixup_val)
+		return rtwdev->chip->ops->sdio_fixup_val(val);
+
+	return val;
+}
+
 static u32 rtw_sdio_to_bus_offset(struct rtw_dev *rtwdev, u32 addr)
 {
+	if (rtwdev->chip->ops->sdio_to_bus_offset)
+		return rtwdev->chip->ops->sdio_to_bus_offset(rtwdev, addr);
+
 	switch (addr & RTW_SDIO_BUS_MSK) {
 	case WLAN_IOREG_OFFSET:
 		addr &= WLAN_IOREG_REG_MSK;
@@ -700,6 +711,7 @@ static int rtw_sdio_check_free_txpg(struct rtw_dev *rtwdev, u8 queue,
 		u32 free_txpg;
 
 		free_txpg = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG);
+		free_txpg = rtw_sdio_fixup_val(rtwdev, free_txpg);
 
 		switch (queue) {
 		case RTW_TX_QUEUE_BCN:
@@ -954,7 +966,13 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev)
 {
 	u8 size, timeout;
 
+	if (rtwdev->chip->ops->sdio_enable_rx_agg) {
+		rtwdev->chip->ops->sdio_enable_rx_agg(rtwdev);
+		return;
+	}
+
 	switch (rtwdev->chip->id) {
+	case RTW_CHIP_TYPE_8189E:
 	case RTW_CHIP_TYPE_8723B:
 	case RTW_CHIP_TYPE_8703B:
 	case RTW_CHIP_TYPE_8821A:
@@ -991,7 +1009,8 @@ static void rtw_sdio_enable_interrupt(struct rtw_dev *rtwdev)
 {
 	struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
 
-	rtw_write32(rtwdev, REG_SDIO_HIMR, rtwsdio->irq_mask);
+	rtw_write32(rtwdev, REG_SDIO_HIMR,
+		    rtw_sdio_fixup_val(rtwdev, rtwsdio->irq_mask));
 }
 
 static void rtw_sdio_disable_interrupt(struct rtw_dev *rtwdev)
@@ -1489,6 +1508,7 @@ static void rtw_sdio_rx_isr_8051(struct rtw_dev *rtwdev)
 
 	do {
 		rx_len = rtw_read16(rtwdev, REG_SDIO_RX0_REQ_LEN);
+		rx_len = rtw_sdio_fixup_val(rtwdev, rx_len);
 		if (!rx_len)
 			break;
 
@@ -1508,7 +1528,8 @@ static void rtw_sdio_rx_isr_8051(struct rtw_dev *rtwdev)
 		 * rtw_rx_pkt_stat.pkt_len is zero or points beyond the
 		 * end of the buffer.
 		 */
-		hisr = rtw_read32(rtwdev, REG_SDIO_HISR);
+		hisr = rtw_sdio_fixup_val(rtwdev,
+					  rtw_read32(rtwdev, REG_SDIO_HISR));
 	} while (total_rx_bytes < SZ_64K && hisr & REG_SDIO_HISR_RX_REQUEST);
 }
 
@@ -1547,7 +1568,7 @@ static void rtw_sdio_handle_interrupt_8051(struct rtw_dev *rtwdev, u32 hisr)
 	if (rtw_is_8723bs(rtwdev))
 		hisr &= RTW_SDIO_HISR_CLEAR_MASK;
 
-	rtw_write32(rtwdev, REG_SDIO_HISR, hisr);
+	rtw_write32(rtwdev, REG_SDIO_HISR, rtw_sdio_fixup_val(rtwdev, hisr));
 }
 
 static void rtw_sdio_handle_interrupt_3081(struct rtw_dev *rtwdev, u32 hisr)
@@ -1599,7 +1620,7 @@ static void rtw_sdio_handle_interrupt(struct sdio_func *sdio_func)
 
 	rtwsdio->irq_thread = current;
 
-	hisr = rtw_read32(rtwdev, REG_SDIO_HISR);
+	hisr = rtw_sdio_fixup_val(rtwdev, rtw_read32(rtwdev, REG_SDIO_HISR));
 	if (hisr) {
 		if (rtw_chip_wcpu_8051(rtwdev))
 			rtw_sdio_handle_interrupt_8051(rtwdev, hisr);
diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
index b2d8005..32fa8d5 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ -40,6 +40,11 @@ void rtw_tx_fill_tx_desc(struct rtw_dev *rtwdev,
 	struct rtw_tx_desc *tx_desc = (struct rtw_tx_desc *)skb->data;
 	bool more_data = false;
 
+	if (rtwdev->chip->ops->fill_txdesc) {
+		rtwdev->chip->ops->fill_txdesc(rtwdev, pkt_info, skb);
+		return;
+	}
+
 	if (pkt_info->qsel == TX_DESC_QSEL_HIGH)
 		more_data = true;
 
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
@ 2026-12-01 21:11 ` Alex Novak
  2026-12-02  8:21   ` Luka Gejak
                     ` (2 more replies)
  2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: Alex Novak @ 2026-12-01 21:11 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless

Add the MAC, BB, AGC, RF path A, power-by-rate, and TX power limit
register tables for Realtek RTL8189E, along with the S9082C hardware
initialization sequences.

Signed-off-by: Alex Novak <neur-alx@agentmail.to>
---
 .../wireless/realtek/rtw88/rtw8189e_table.c   | 2238 +++++++++++++++++
 .../wireless/realtek/rtw88/rtw8189e_table.h   |   52 +
 2 files changed, 2290 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.h

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
new file mode 100644
index 0000000..28d9848
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
@@ -0,0 +1,2238 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
+ */
+
+#include "main.h"
+#include "phy.h"
+#include "rtw8189e_table.h"
+
+static const u32 rtw8189e_mac[] = {
+0x026, 0x00000041,
+		0x027, 0x00000035,
+	0x80000002,	0x00000000,	0x40000000,	0x00000000,
+		0x040, 0x0000000C,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0x040, 0x0000000C,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x040, 0x0000000C,
+	0xA0000000,	0x00000000,
+		0x040, 0x00000000,
+	0xB0000000,	0x00000000,
+		0x421, 0x0000000F,
+		0x428, 0x0000000A,
+		0x429, 0x00000010,
+		0x430, 0x00000000,
+		0x431, 0x00000001,
+		0x432, 0x00000002,
+		0x433, 0x00000004,
+		0x434, 0x00000005,
+		0x435, 0x00000006,
+		0x436, 0x00000007,
+		0x437, 0x00000008,
+		0x438, 0x00000000,
+		0x439, 0x00000000,
+		0x43A, 0x00000001,
+		0x43B, 0x00000002,
+		0x43C, 0x00000004,
+		0x43D, 0x00000005,
+		0x43E, 0x00000006,
+		0x43F, 0x00000007,
+		0x440, 0x0000005D,
+		0x441, 0x00000001,
+		0x442, 0x00000000,
+		0x444, 0x00000015,
+		0x445, 0x000000F0,
+		0x446, 0x0000000F,
+		0x447, 0x00000000,
+		0x458, 0x00000041,
+		0x459, 0x000000A8,
+		0x45A, 0x00000072,
+		0x45B, 0x000000B9,
+		0x460, 0x00000066,
+		0x461, 0x00000066,
+		0x480, 0x00000008,
+		0x4C8, 0x000000FF,
+		0x4C9, 0x00000008,
+		0x4CC, 0x000000FF,
+		0x4CD, 0x000000FF,
+		0x4CE, 0x00000001,
+		0x4D3, 0x00000001,
+		0x500, 0x00000026,
+		0x501, 0x000000A2,
+		0x502, 0x0000002F,
+		0x503, 0x00000000,
+		0x504, 0x00000028,
+		0x505, 0x000000A3,
+		0x506, 0x0000005E,
+		0x507, 0x00000000,
+		0x508, 0x0000002B,
+		0x509, 0x000000A4,
+		0x50A, 0x0000005E,
+		0x50B, 0x00000000,
+		0x50C, 0x0000004F,
+		0x50D, 0x000000A4,
+		0x50E, 0x00000000,
+		0x50F, 0x00000000,
+		0x512, 0x0000001C,
+		0x514, 0x0000000A,
+		0x516, 0x0000000A,
+		0x525, 0x0000004F,
+		0x550, 0x00000010,
+		0x551, 0x00000010,
+		0x559, 0x00000002,
+		0x55D, 0x000000FF,
+		0x605, 0x00000030,
+		0x608, 0x0000000E,
+		0x609, 0x0000002A,
+		0x620, 0x000000FF,
+		0x621, 0x000000FF,
+		0x622, 0x000000FF,
+		0x623, 0x000000FF,
+		0x624, 0x000000FF,
+		0x625, 0x000000FF,
+		0x626, 0x000000FF,
+		0x627, 0x000000FF,
+		0x63C, 0x00000008,
+		0x63D, 0x00000008,
+		0x63E, 0x0000000C,
+		0x63F, 0x0000000C,
+		0x640, 0x00000040,
+		0x652, 0x00000020,
+		0x66E, 0x00000005,
+		0x700, 0x00000021,
+		0x701, 0x00000043,
+		0x702, 0x00000065,
+		0x703, 0x00000087,
+		0x708, 0x00000021,
+		0x709, 0x00000043,
+		0x70A, 0x00000065,
+		0x70B, 0x00000087,
+};
+
+RTW_DECL_TABLE_PHY_COND(rtw8189e_mac, rtw_phy_cfg_mac);
+
+static const u32 rtw8189e_agc[] = {
+0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xF6000001,
+		0xC78, 0xF5010001,
+		0xC78, 0xF4020001,
+		0xC78, 0xF3030001,
+		0xC78, 0xF2040001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xF7000001,
+		0xC78, 0xF6010001,
+		0xC78, 0xF5020001,
+		0xC78, 0xF4030001,
+		0xC78, 0xF3040001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0xFB000001,
+		0xC78, 0xFA010001,
+		0xC78, 0xF9020001,
+		0xC78, 0xF8030001,
+		0xC78, 0xF7040001,
+	0xA0000000,	0x00000000,
+		0xC78, 0xFB000001,
+		0xC78, 0xFB010001,
+		0xC78, 0xFB020001,
+		0xC78, 0xFB030001,
+		0xC78, 0xFB040001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xF1050001,
+		0xC78, 0xF0060001,
+		0xC78, 0xEF070001,
+		0xC78, 0xEE080001,
+		0xC78, 0xED090001,
+		0xC78, 0xEC0A0001,
+		0xC78, 0xEB0B0001,
+		0xC78, 0xEA0C0001,
+		0xC78, 0xE90D0001,
+		0xC78, 0xE80E0001,
+		0xC78, 0xE70F0001,
+		0xC78, 0xE6100001,
+		0xC78, 0xE5110001,
+		0xC78, 0xE4120001,
+		0xC78, 0xE3130001,
+		0xC78, 0xE2140001,
+		0xC78, 0xC5150001,
+		0xC78, 0xC4160001,
+		0xC78, 0xC3170001,
+		0xC78, 0xC2180001,
+		0xC78, 0x88190001,
+		0xC78, 0x871A0001,
+		0xC78, 0x861B0001,
+		0xC78, 0x851C0001,
+		0xC78, 0x841D0001,
+		0xC78, 0x831E0001,
+		0xC78, 0x821F0001,
+		0xC78, 0x81200001,
+		0xC78, 0x80210001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xF2050001,
+		0xC78, 0xF1060001,
+		0xC78, 0xF0070001,
+		0xC78, 0xEF080001,
+		0xC78, 0xEE090001,
+		0xC78, 0xED0A0001,
+		0xC78, 0xEC0B0001,
+		0xC78, 0xEB0C0001,
+		0xC78, 0xEA0D0001,
+		0xC78, 0xE90E0001,
+		0xC78, 0xE80F0001,
+		0xC78, 0xE7100001,
+		0xC78, 0xE6110001,
+		0xC78, 0xE5120001,
+		0xC78, 0xE4130001,
+		0xC78, 0xE3140001,
+		0xC78, 0xE2150001,
+		0xC78, 0xE1160001,
+		0xC78, 0x89170001,
+		0xC78, 0x88180001,
+		0xC78, 0x87190001,
+		0xC78, 0x861A0001,
+		0xC78, 0x851B0001,
+		0xC78, 0x841C0001,
+		0xC78, 0x831D0001,
+		0xC78, 0x821E0001,
+		0xC78, 0x811F0001,
+		0xC78, 0x6B200001,
+		0xC78, 0x6A210001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0xF6050001,
+		0xC78, 0xF5060001,
+		0xC78, 0xF4070001,
+		0xC78, 0xF3080001,
+		0xC78, 0xF2090001,
+		0xC78, 0xF10A0001,
+		0xC78, 0xF00B0001,
+		0xC78, 0xEF0C0001,
+		0xC78, 0xEE0D0001,
+		0xC78, 0xED0E0001,
+		0xC78, 0xEC0F0001,
+		0xC78, 0xEB100001,
+		0xC78, 0xEA110001,
+		0xC78, 0xE9120001,
+		0xC78, 0xE8130001,
+		0xC78, 0xE7140001,
+		0xC78, 0xE6150001,
+		0xC78, 0xE5160001,
+		0xC78, 0xE4170001,
+		0xC78, 0xE3180001,
+		0xC78, 0xE2190001,
+		0xC78, 0xE11A0001,
+		0xC78, 0x8A1B0001,
+		0xC78, 0x891C0001,
+		0xC78, 0x881D0001,
+		0xC78, 0x871E0001,
+		0xC78, 0x861F0001,
+		0xC78, 0x85200001,
+		0xC78, 0x84210001,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xFA050001,
+		0xC78, 0xF9060001,
+		0xC78, 0xF8070001,
+		0xC78, 0xF7080001,
+		0xC78, 0xF6090001,
+		0xC78, 0xF50A0001,
+		0xC78, 0xF40B0001,
+		0xC78, 0xF30C0001,
+		0xC78, 0xF20D0001,
+		0xC78, 0xF10E0001,
+		0xC78, 0xF00F0001,
+		0xC78, 0xEF100001,
+		0xC78, 0xEE110001,
+		0xC78, 0xED120001,
+		0xC78, 0xEC130001,
+		0xC78, 0xEB140001,
+		0xC78, 0xEA150001,
+		0xC78, 0xE9160001,
+		0xC78, 0xE8170001,
+		0xC78, 0xE7180001,
+		0xC78, 0xE6190001,
+		0xC78, 0xE51A0001,
+		0xC78, 0xE41B0001,
+		0xC78, 0xC71C0001,
+		0xC78, 0xC61D0001,
+		0xC78, 0xC51E0001,
+		0xC78, 0xC41F0001,
+		0xC78, 0xC3200001,
+		0xC78, 0xC2210001,
+	0xA0000000,	0x00000000,
+		0xC78, 0xFB050001,
+		0xC78, 0xFA060001,
+		0xC78, 0xF9070001,
+		0xC78, 0xF8080001,
+		0xC78, 0xF7090001,
+		0xC78, 0xF60A0001,
+		0xC78, 0xF50B0001,
+		0xC78, 0xF40C0001,
+		0xC78, 0xF30D0001,
+		0xC78, 0xF20E0001,
+		0xC78, 0xF10F0001,
+		0xC78, 0xF0100001,
+		0xC78, 0xEF110001,
+		0xC78, 0xEE120001,
+		0xC78, 0xED130001,
+		0xC78, 0xEC140001,
+		0xC78, 0xEB150001,
+		0xC78, 0xEA160001,
+		0xC78, 0xE9170001,
+		0xC78, 0xE8180001,
+		0xC78, 0xE7190001,
+		0xC78, 0xE61A0001,
+		0xC78, 0xE51B0001,
+		0xC78, 0xE41C0001,
+		0xC78, 0xE31D0001,
+		0xC78, 0xE21E0001,
+		0xC78, 0xE11F0001,
+		0xC78, 0x8A200001,
+		0xC78, 0x89210001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x66220001,
+		0xC78, 0x65230001,
+		0xC78, 0x64240001,
+		0xC78, 0x63250001,
+		0xC78, 0x62260001,
+		0xC78, 0x61270001,
+		0xC78, 0x60280001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x69220001,
+		0xC78, 0x68230001,
+		0xC78, 0x67240001,
+		0xC78, 0x66250001,
+		0xC78, 0x65260001,
+		0xC78, 0x64270001,
+		0xC78, 0x63280001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x83220001,
+		0xC78, 0x82230001,
+		0xC78, 0x6B240001,
+		0xC78, 0x6A250001,
+		0xC78, 0x69260001,
+		0xC78, 0x68270001,
+		0xC78, 0x67280001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x88220001,
+		0xC78, 0x87230001,
+		0xC78, 0x86240001,
+		0xC78, 0x85250001,
+		0xC78, 0x84260001,
+		0xC78, 0x83270001,
+		0xC78, 0x82280001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x4A290001,
+		0xC78, 0x492A0001,
+		0xC78, 0x482B0001,
+		0xC78, 0x472C0001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x62290001,
+		0xC78, 0x612A0001,
+		0xC78, 0x462B0001,
+		0xC78, 0x452C0001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x66290001,
+		0xC78, 0x652A0001,
+		0xC78, 0x642B0001,
+		0xC78, 0x632C0001,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x81290001,
+		0xC78, 0x242A0001,
+		0xC78, 0x232B0001,
+		0xC78, 0x222C0001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x6B290001,
+		0xC78, 0x6A2A0001,
+		0xC78, 0x692B0001,
+		0xC78, 0x682C0001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x462D0001,
+		0xC78, 0x452E0001,
+		0xC78, 0x442F0001,
+		0xC78, 0x43300001,
+		0xC78, 0x42310001,
+		0xC78, 0x41320001,
+		0xC78, 0x40330001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x442D0001,
+		0xC78, 0x432E0001,
+		0xC78, 0x422F0001,
+		0xC78, 0x41300001,
+		0xC78, 0x40310001,
+		0xC78, 0x40320001,
+		0xC78, 0x40330001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x622D0001,
+		0xC78, 0x612E0001,
+		0xC78, 0x462F0001,
+		0xC78, 0x45300001,
+		0xC78, 0x44310001,
+		0xC78, 0x43320001,
+		0xC78, 0x42330001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x672D0001,
+		0xC78, 0x662E0001,
+		0xC78, 0x652F0001,
+		0xC78, 0x64300001,
+		0xC78, 0x63310001,
+		0xC78, 0x62320001,
+		0xC78, 0x61330001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x40340001,
+		0xC78, 0x40350001,
+		0xC78, 0x40360001,
+		0xC78, 0x40370001,
+		0xC78, 0x40380001,
+		0xC78, 0x40390001,
+		0xC78, 0x403A0001,
+		0xC78, 0x403B0001,
+		0xC78, 0x403C0001,
+		0xC78, 0x403D0001,
+		0xC78, 0x403E0001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x40340001,
+		0xC78, 0x40350001,
+		0xC78, 0x40360001,
+		0xC78, 0x40370001,
+		0xC78, 0x40380001,
+		0xC78, 0x40390001,
+		0xC78, 0x403A0001,
+		0xC78, 0x403B0001,
+		0xC78, 0x403C0001,
+		0xC78, 0x403D0001,
+		0xC78, 0x403E0001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x41340001,
+		0xC78, 0x40350001,
+		0xC78, 0x40360001,
+		0xC78, 0x40370001,
+		0xC78, 0x40380001,
+		0xC78, 0x40390001,
+		0xC78, 0x403A0001,
+		0xC78, 0x403B0001,
+		0xC78, 0x403C0001,
+		0xC78, 0x403D0001,
+		0xC78, 0x403E0001,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0x60340001,
+		0xC78, 0x4A350001,
+		0xC78, 0x49360001,
+		0xC78, 0x48370001,
+		0xC78, 0x47380001,
+		0xC78, 0x46390001,
+		0xC78, 0x453A0001,
+		0xC78, 0x443B0001,
+		0xC78, 0x433C0001,
+		0xC78, 0x423D0001,
+		0xC78, 0x413E0001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x46340001,
+		0xC78, 0x45350001,
+		0xC78, 0x44360001,
+		0xC78, 0x43370001,
+		0xC78, 0x42380001,
+		0xC78, 0x41390001,
+		0xC78, 0x403A0001,
+		0xC78, 0x403B0001,
+		0xC78, 0x403C0001,
+		0xC78, 0x403D0001,
+		0xC78, 0x403E0001,
+	0xB0000000,	0x00000000,
+	0x80000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x403F0001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x403F0001,
+	0xB0000000,	0x00000000,
+	0x88000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xFB400001,
+		0xC78, 0xFA410001,
+		0xC78, 0xF9420001,
+		0xC78, 0xF8430001,
+		0xC78, 0xF7440001,
+		0xC78, 0xF6450001,
+		0xC78, 0xF5460001,
+		0xC78, 0xF4470001,
+		0xC78, 0xF3480001,
+		0xC78, 0xF2490001,
+		0xC78, 0xF14A0001,
+		0xC78, 0xF04B0001,
+		0xC78, 0xEF4C0001,
+		0xC78, 0xEE4D0001,
+		0xC78, 0xED4E0001,
+		0xC78, 0xEC4F0001,
+		0xC78, 0xEB500001,
+		0xC78, 0xEA510001,
+		0xC78, 0xE9520001,
+		0xC78, 0xE8530001,
+		0xC78, 0xE7540001,
+		0xC78, 0xE6550001,
+		0xC78, 0xE5560001,
+		0xC78, 0xC6570001,
+		0xC78, 0xC5580001,
+		0xC78, 0xC4590001,
+		0xC78, 0xC35A0001,
+		0xC78, 0xC25B0001,
+		0xC78, 0xC15C0001,
+		0xC78, 0xC05D0001,
+		0xC78, 0xA35E0001,
+		0xC78, 0xA25F0001,
+		0xC78, 0xA1600001,
+		0xC78, 0x88610001,
+		0xC78, 0x87620001,
+		0xC78, 0x86630001,
+		0xC78, 0x85640001,
+		0xC78, 0x84650001,
+		0xC78, 0x83660001,
+		0xC78, 0x82670001,
+		0xC78, 0x66680001,
+		0xC78, 0x65690001,
+		0xC78, 0x646A0001,
+		0xC78, 0x636B0001,
+		0xC78, 0x626C0001,
+		0xC78, 0x616D0001,
+		0xC78, 0x486E0001,
+		0xC78, 0x476F0001,
+		0xC78, 0x46700001,
+		0xC78, 0x45710001,
+		0xC78, 0x44720001,
+		0xC78, 0x43730001,
+		0xC78, 0x42740001,
+		0xC78, 0x41750001,
+		0xC78, 0x40760001,
+		0xC78, 0x40770001,
+		0xC78, 0x40780001,
+		0xC78, 0x40790001,
+		0xC78, 0x407A0001,
+		0xC78, 0x407B0001,
+		0xC78, 0x407C0001,
+	0x90000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xFB400001,
+		0xC78, 0xFA410001,
+		0xC78, 0xF9420001,
+		0xC78, 0xF8430001,
+		0xC78, 0xF7440001,
+		0xC78, 0xF6450001,
+		0xC78, 0xF5460001,
+		0xC78, 0xF4470001,
+		0xC78, 0xF3480001,
+		0xC78, 0xF2490001,
+		0xC78, 0xF14A0001,
+		0xC78, 0xF04B0001,
+		0xC78, 0xEF4C0001,
+		0xC78, 0xEE4D0001,
+		0xC78, 0xED4E0001,
+		0xC78, 0xEC4F0001,
+		0xC78, 0xEB500001,
+		0xC78, 0xEA510001,
+		0xC78, 0xE9520001,
+		0xC78, 0xE8530001,
+		0xC78, 0xE7540001,
+		0xC78, 0xE6550001,
+		0xC78, 0xE5560001,
+		0xC78, 0xE4570001,
+		0xC78, 0xE3580001,
+		0xC78, 0xE2590001,
+		0xC78, 0xC35A0001,
+		0xC78, 0xC25B0001,
+		0xC78, 0xC15C0001,
+		0xC78, 0x8B5D0001,
+		0xC78, 0x8A5E0001,
+		0xC78, 0x895F0001,
+		0xC78, 0x88600001,
+		0xC78, 0x87610001,
+		0xC78, 0x86620001,
+		0xC78, 0x85630001,
+		0xC78, 0x84640001,
+		0xC78, 0x67650001,
+		0xC78, 0x66660001,
+		0xC78, 0x65670001,
+		0xC78, 0x64680001,
+		0xC78, 0x63690001,
+		0xC78, 0x626A0001,
+		0xC78, 0x616B0001,
+		0xC78, 0x606C0001,
+		0xC78, 0x466D0001,
+		0xC78, 0x456E0001,
+		0xC78, 0x446F0001,
+		0xC78, 0x43700001,
+		0xC78, 0x42710001,
+		0xC78, 0x41720001,
+		0xC78, 0x40730001,
+		0xC78, 0x40740001,
+		0xC78, 0x40750001,
+		0xC78, 0x40760001,
+		0xC78, 0x40770001,
+		0xC78, 0x40780001,
+		0xC78, 0x40790001,
+		0xC78, 0x407A0001,
+		0xC78, 0x407B0001,
+		0xC78, 0x407C0001,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0xFB400001,
+		0xC78, 0xFB410001,
+		0xC78, 0xFB420001,
+		0xC78, 0xFB430001,
+		0xC78, 0xFB440001,
+		0xC78, 0xFB450001,
+		0xC78, 0xFA460001,
+		0xC78, 0xF9470001,
+		0xC78, 0xF8480001,
+		0xC78, 0xF7490001,
+		0xC78, 0xF64A0001,
+		0xC78, 0xF54B0001,
+		0xC78, 0xF44C0001,
+		0xC78, 0xF34D0001,
+		0xC78, 0xF24E0001,
+		0xC78, 0xF14F0001,
+		0xC78, 0xF0500001,
+		0xC78, 0xEF510001,
+		0xC78, 0xEE520001,
+		0xC78, 0xED530001,
+		0xC78, 0xEC540001,
+		0xC78, 0xEB550001,
+		0xC78, 0xEA560001,
+		0xC78, 0xE9570001,
+		0xC78, 0xE8580001,
+		0xC78, 0xE7590001,
+		0xC78, 0xE65A0001,
+		0xC78, 0xE55B0001,
+		0xC78, 0xC65C0001,
+		0xC78, 0xC55D0001,
+		0xC78, 0xC45E0001,
+		0xC78, 0xC35F0001,
+		0xC78, 0xC2600001,
+		0xC78, 0xC1610001,
+		0xC78, 0xC0620001,
+		0xC78, 0xA3630001,
+		0xC78, 0xA2640001,
+		0xC78, 0xA1650001,
+		0xC78, 0x88660001,
+		0xC78, 0x87670001,
+		0xC78, 0x86680001,
+		0xC78, 0x85690001,
+		0xC78, 0x846A0001,
+		0xC78, 0x836B0001,
+		0xC78, 0x826C0001,
+		0xC78, 0x666D0001,
+		0xC78, 0x656E0001,
+		0xC78, 0x646F0001,
+		0xC78, 0x63700001,
+		0xC78, 0x62710001,
+		0xC78, 0x61720001,
+		0xC78, 0x48730001,
+		0xC78, 0x47740001,
+		0xC78, 0x46750001,
+		0xC78, 0x45760001,
+		0xC78, 0x44770001,
+		0xC78, 0x43780001,
+		0xC78, 0x42790001,
+		0xC78, 0x417A0001,
+		0xC78, 0x407B0001,
+		0xC78, 0x407C0001,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC78, 0xFF400001,
+		0xC78, 0xFF410001,
+		0xC78, 0xFE420001,
+		0xC78, 0xFD430001,
+		0xC78, 0xFC440001,
+		0xC78, 0xFB450001,
+		0xC78, 0xFA460001,
+		0xC78, 0xF9470001,
+		0xC78, 0xF8480001,
+		0xC78, 0xF7490001,
+		0xC78, 0xF64A0001,
+		0xC78, 0xF54B0001,
+		0xC78, 0xF44C0001,
+		0xC78, 0xF34D0001,
+		0xC78, 0xF24E0001,
+		0xC78, 0xF14F0001,
+		0xC78, 0xF0500001,
+		0xC78, 0xEF510001,
+		0xC78, 0xEE520001,
+		0xC78, 0xED530001,
+		0xC78, 0xEC540001,
+		0xC78, 0xEB550001,
+		0xC78, 0xEA560001,
+		0xC78, 0xE9570001,
+		0xC78, 0xE8580001,
+		0xC78, 0xE7590001,
+		0xC78, 0xE65A0001,
+		0xC78, 0xE55B0001,
+		0xC78, 0xE45C0001,
+		0xC78, 0xA85D0001,
+		0xC78, 0xA75E0001,
+		0xC78, 0xA65F0001,
+		0xC78, 0xA5600001,
+		0xC78, 0xA4610001,
+		0xC78, 0xA3620001,
+		0xC78, 0xA2630001,
+		0xC78, 0xA1640001,
+		0xC78, 0x28650001,
+		0xC78, 0x27660001,
+		0xC78, 0x26670001,
+		0xC78, 0x07680001,
+		0xC78, 0x06690001,
+		0xC78, 0x056A0001,
+		0xC78, 0x046B0001,
+		0xC78, 0x036C0001,
+		0xC78, 0x026D0001,
+		0xC78, 0x016E0001,
+		0xC78, 0x646F0001,
+		0xC78, 0x63700001,
+		0xC78, 0x62710001,
+		0xC78, 0x61720001,
+		0xC78, 0x47730001,
+		0xC78, 0x46740001,
+		0xC78, 0x45750001,
+		0xC78, 0x44760001,
+		0xC78, 0x43770001,
+		0xC78, 0x42780001,
+		0xC78, 0x41790001,
+		0xC78, 0x407A0001,
+		0xC78, 0x407B0001,
+		0xC78, 0x407C0001,
+	0xA0000000,	0x00000000,
+		0xC78, 0xFB400001,
+		0xC78, 0xFB410001,
+		0xC78, 0xFB420001,
+		0xC78, 0xFB430001,
+		0xC78, 0xFB440001,
+		0xC78, 0xFB450001,
+		0xC78, 0xFB460001,
+		0xC78, 0xFB470001,
+		0xC78, 0xFB480001,
+		0xC78, 0xFA490001,
+		0xC78, 0xF94A0001,
+		0xC78, 0xF84B0001,
+		0xC78, 0xF74C0001,
+		0xC78, 0xF64D0001,
+		0xC78, 0xF54E0001,
+		0xC78, 0xF44F0001,
+		0xC78, 0xF3500001,
+		0xC78, 0xF2510001,
+		0xC78, 0xF1520001,
+		0xC78, 0xF0530001,
+		0xC78, 0xEF540001,
+		0xC78, 0xEE550001,
+		0xC78, 0xED560001,
+		0xC78, 0xEC570001,
+		0xC78, 0xEB580001,
+		0xC78, 0xEA590001,
+		0xC78, 0xE95A0001,
+		0xC78, 0xE85B0001,
+		0xC78, 0xE75C0001,
+		0xC78, 0xE65D0001,
+		0xC78, 0xE55E0001,
+		0xC78, 0xE45F0001,
+		0xC78, 0xE3600001,
+		0xC78, 0xE2610001,
+		0xC78, 0xC3620001,
+		0xC78, 0xC2630001,
+		0xC78, 0xC1640001,
+		0xC78, 0x8B650001,
+		0xC78, 0x8A660001,
+		0xC78, 0x89670001,
+		0xC78, 0x88680001,
+		0xC78, 0x87690001,
+		0xC78, 0x866A0001,
+		0xC78, 0x856B0001,
+		0xC78, 0x846C0001,
+		0xC78, 0x676D0001,
+		0xC78, 0x666E0001,
+		0xC78, 0x656F0001,
+		0xC78, 0x64700001,
+		0xC78, 0x63710001,
+		0xC78, 0x62720001,
+		0xC78, 0x61730001,
+		0xC78, 0x60740001,
+		0xC78, 0x46750001,
+		0xC78, 0x45760001,
+		0xC78, 0x44770001,
+		0xC78, 0x43780001,
+		0xC78, 0x42790001,
+		0xC78, 0x417A0001,
+		0xC78, 0x407B0001,
+		0xC78, 0x407C0001,
+	0xB0000000,	0x00000000,
+	0x80000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC78, 0x407D0001,
+		0xC78, 0x407E0001,
+		0xC78, 0x407F0001,
+	0xA0000000,	0x00000000,
+		0xC78, 0x407D0001,
+		0xC78, 0x407E0001,
+		0xC78, 0x407F0001,
+	0xB0000000,	0x00000000,
+		0xC50, 0x69553422,
+		0xC50, 0x69553420,
+};
+
+RTW_DECL_TABLE_PHY_COND(rtw8189e_agc, rtw_phy_cfg_agc);
+
+static const u32 rtw8189e_bb[] = {
+0x800, 0x80040000,
+		0x804, 0x00000003,
+		0x808, 0x0000FC00,
+		0x80C, 0x0000000A,
+		0x810, 0x10001331,
+		0x814, 0x020C3D10,
+		0x818, 0x02200385,
+		0x81C, 0x00000000,
+		0x820, 0x01000100,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x824, 0x00390204,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x824, 0x00390004,
+	0xA0000000,	0x00000000,
+		0x824, 0x00390204,
+	0xB0000000,	0x00000000,
+		0x828, 0x00000000,
+		0x82C, 0x00000000,
+		0x830, 0x00000000,
+		0x834, 0x00000000,
+		0x838, 0x00000000,
+		0x83C, 0x00000000,
+		0x840, 0x00010000,
+		0x844, 0x00000000,
+		0x848, 0x00000000,
+		0x84C, 0x00000000,
+		0x850, 0x00000000,
+		0x854, 0x00000000,
+		0x858, 0x569A11A9,
+		0x85C, 0x01000014,
+		0x860, 0x66F60110,
+		0x864, 0x061F0649,
+		0x868, 0x00000000,
+		0x86C, 0x27272700,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x870, 0x07000300,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x870, 0x07000760,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x870, 0x07000760,
+	0xA0000000,	0x00000000,
+		0x870, 0x07000760,
+	0xB0000000,	0x00000000,
+		0x874, 0x25004000,
+		0x878, 0x00000808,
+		0x87C, 0x00000000,
+		0x880, 0xB0000C1C,
+		0x884, 0x00000001,
+		0x888, 0x00000000,
+		0x88C, 0xCCC000C0,
+		0x890, 0x00000800,
+		0x894, 0xFFFFFFFE,
+		0x898, 0x40302010,
+		0x89C, 0x00706050,
+		0x900, 0x00000000,
+		0x904, 0x00000023,
+		0x908, 0x00000000,
+		0x90C, 0x81121111,
+		0x910, 0x00000002,
+		0x914, 0x00000201,
+		0xA00, 0x00D047C8,
+		0xA04, 0x80FF800C,
+		0xA08, 0x8C838300,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xA0C, 0x2E34120F,
+	0xA0000000,	0x00000000,
+		0xA0C, 0x2E7F120F,
+	0xB0000000,	0x00000000,
+		0xA10, 0x9500BB7E,
+		0xA14, 0x1114D028,
+		0xA18, 0x00881117,
+		0xA1C, 0x89140F00,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xA20, 0x13130000,
+		0xA24, 0x060A0D10,
+		0xA28, 0x00000103,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xA20, 0x13130000,
+		0xA24, 0x060A0D10,
+		0xA28, 0x00000103,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xA20, 0x13130000,
+		0xA24, 0x060A0D10,
+		0xA28, 0x00000103,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0xA0000000,	0x00000000,
+		0xA20, 0x1A1B0000,
+		0xA24, 0x090E1317,
+		0xA28, 0x00000204,
+	0xB0000000,	0x00000000,
+		0xA2C, 0x00D30000,
+		0xA70, 0x101FBF00,
+		0xA74, 0x00000007,
+		0xA78, 0x00000900,
+		0xA7C, 0x225B0606,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xA80, 0x21807531,
+	0xA0000000,	0x00000000,
+		0xA80, 0x218075B1,
+	0xB0000000,	0x00000000,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xB2C, 0x00000000,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xB2C, 0x80000000,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xB2C, 0x80000000,
+	0xA0000000,	0x00000000,
+		0xB2C, 0x80000000,
+	0xB0000000,	0x00000000,
+		0xC00, 0x48071D40,
+		0xC04, 0x03A05611,
+		0xC08, 0x000000E4,
+		0xC0C, 0x6C6C6C6C,
+		0xC10, 0x08800000,
+		0xC14, 0x40000100,
+		0xC18, 0x08800000,
+		0xC1C, 0x40000100,
+		0xC20, 0x00000000,
+		0xC24, 0x00000000,
+		0xC28, 0x00000000,
+		0xC2C, 0x00000000,
+		0xC30, 0x69E9AC47,
+		0xC34, 0x469652AF,
+		0xC38, 0x49795994,
+		0xC3C, 0x0A97971C,
+		0xC40, 0x1F7C403F,
+		0xC44, 0x000100B7,
+		0xC48, 0xEC020107,
+		0xC4C, 0x007F037F,
+		0xC50, 0x69553420,
+		0xC54, 0x43BC0094,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xC58, 0x00013169,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC58, 0x00013169,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC58, 0x00013159,
+	0xA0000000,	0x00000000,
+		0xC58, 0x00013169,
+	0xB0000000,	0x00000000,
+		0xC5C, 0x00250492,
+		0xC60, 0x00000000,
+		0xC64, 0x7112848B,
+		0xC68, 0x47C00BFF,
+		0xC6C, 0x00000036,
+		0xC70, 0x2C7F000D,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xC74, 0x020610DB,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC74, 0x020610DB,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC74, 0x028610DB,
+	0xA0000000,	0x00000000,
+		0xC74, 0x020610DB,
+	0xB0000000,	0x00000000,
+		0xC78, 0x0000001F,
+		0xC7C, 0x00B91612,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xC80, 0x2D4000B5,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xC80, 0x2D4000B5,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xC80, 0x2D4000B5,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0xA0000000,	0x00000000,
+		0xC80, 0x390000E4,
+	0xB0000000,	0x00000000,
+		0xC84, 0x21F60000,
+		0xC88, 0x40000100,
+		0xC8C, 0x20200000,
+		0xC90, 0x00091521,
+		0xC94, 0x00000000,
+		0xC98, 0x00121820,
+		0xC9C, 0x00007F7F,
+		0xCA0, 0x00000000,
+		0xCA4, 0x000300A0,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xCA8, 0x00000000,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xCA8, 0x00000000,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xCA8, 0xFFFF0000,
+	0xA0000000,	0x00000000,
+		0xCA8, 0x00000000,
+	0xB0000000,	0x00000000,
+		0xCAC, 0x00000000,
+		0xCB0, 0x00000000,
+		0xCB4, 0x00000000,
+		0xCB8, 0x00000000,
+		0xCBC, 0x28000000,
+		0xCC0, 0x00000000,
+		0xCC4, 0x00000000,
+		0xCC8, 0x00000000,
+		0xCCC, 0x00000000,
+		0xCD0, 0x00000000,
+		0xCD4, 0x00000000,
+		0xCD8, 0x64B22427,
+		0xCDC, 0x00766932,
+		0xCE0, 0x00222222,
+		0xCE4, 0x00000000,
+		0xCE8, 0x37644302,
+		0xCEC, 0x2F97D40C,
+		0xD00, 0x00000740,
+		0xD04, 0x00020401,
+		0xD08, 0x0000907F,
+		0xD0C, 0x20010201,
+		0xD10, 0xA0633333,
+		0xD14, 0x3333BC43,
+		0xD18, 0x7A8F5B6F,
+		0xD2C, 0xCC979975,
+		0xD30, 0x00000000,
+		0xD34, 0x80608000,
+		0xD38, 0x00000000,
+		0xD3C, 0x00127353,
+		0xD40, 0x00000000,
+		0xD44, 0x00000000,
+		0xD48, 0x00000000,
+		0xD4C, 0x00000000,
+		0xD50, 0x6437140A,
+		0xD54, 0x00000000,
+		0xD58, 0x00000282,
+		0xD5C, 0x30032064,
+		0xD60, 0x4653DE68,
+		0xD64, 0x04518A3C,
+		0xD68, 0x00002101,
+		0xD6C, 0x2A201C16,
+		0xD70, 0x1812362E,
+		0xD74, 0x322C2220,
+		0xD78, 0x000E3C24,
+		0xE00, 0x2D2D2D2D,
+		0xE04, 0x2D2D2D2D,
+		0xE08, 0x0390272D,
+		0xE10, 0x2D2D2D2D,
+		0xE14, 0x2D2D2D2D,
+		0xE18, 0x2D2D2D2D,
+		0xE1C, 0x2D2D2D2D,
+		0xE28, 0x00000000,
+		0xE30, 0x1000DC1F,
+		0xE34, 0x10008C1F,
+		0xE38, 0x02140102,
+		0xE3C, 0x681604C2,
+		0xE40, 0x01007C00,
+		0xE44, 0x01004800,
+		0xE48, 0xFB000000,
+		0xE4C, 0x000028D1,
+		0xE50, 0x1000DC1F,
+		0xE54, 0x10008C1F,
+		0xE58, 0x02140102,
+		0xE5C, 0x28160D05,
+		0xE60, 0x00000048,
+		0xE68, 0x001B25A4,
+		0xE6C, 0x00C00014,
+		0xE70, 0x00C00014,
+		0xE74, 0x01000014,
+		0xE78, 0x01000014,
+		0xE7C, 0x01000014,
+		0xE80, 0x01000014,
+		0xE84, 0x00C00014,
+		0xE88, 0x01000014,
+		0xE8C, 0x00C00014,
+		0xED0, 0x00C00014,
+		0xED4, 0x00C00014,
+		0xED8, 0x00C00014,
+		0xEDC, 0x00000014,
+		0xEE0, 0x00000014,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x98000003,	0x00000001,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x98000001,	0x00000001,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0xEE8, 0x32555448,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0xEE8, 0x21555448,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0xEE8, 0x21555448,
+	0xA0000000,	0x00000000,
+		0xEE8, 0x21555448,
+	0xB0000000,	0x00000000,
+		0xEEC, 0x01C00014,
+		0xF14, 0x00000003,
+		0xF4C, 0x00000000,
+		0xF00, 0x00000300,
+};
+
+RTW_DECL_TABLE_PHY_COND(rtw8189e_bb, rtw_phy_cfg_bb);
+
+static const u32 rtw8189e_rf_a[] = {
+0x000, 0x00030000,
+		0x008, 0x00084000,
+		0x018, 0x00000407,
+		0x019, 0x00000012,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x01B, 0x00000084,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x01B, 0x00000084,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x01B, 0x00000084,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x01B, 0x00000084,
+	0x90000400,	0x00000000,	0x40000000,	0x00000000,
+	0xA0000000,	0x00000000,
+	0xB0000000,	0x00000000,
+		0x01E, 0x00080009,
+		0x01F, 0x00000880,
+		0x02F, 0x0001A060,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x000C0000,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x000C0000,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x000C0000,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x00000000,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x03F, 0x00000000,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x000C0000,
+	0x90000400,	0x00000000,	0x40000000,	0x00000000,
+		0x03F, 0x00000000,
+	0xA0000000,	0x00000000,
+		0x03F, 0x00000000,
+	0xB0000000,	0x00000000,
+		0x042, 0x000060C0,
+		0x057, 0x000D0000,
+		0x058, 0x000BE180,
+		0x067, 0x00001552,
+		0x083, 0x00000000,
+		0x0B0, 0x000FF8FC,
+		0x0B1, 0x00054400,
+		0x0B2, 0x000CCC19,
+		0x0B4, 0x00043003,
+		0x0B6, 0x0004953E,
+		0x0B7, 0x0001C718,
+		0x0B8, 0x000060FF,
+		0x0B9, 0x00080001,
+		0x0BA, 0x00040000,
+		0x0BB, 0x00000400,
+		0x0BF, 0x000C0000,
+		0x0C2, 0x00002400,
+		0x0C3, 0x00000009,
+		0x0C4, 0x00040C91,
+		0x0C5, 0x00099999,
+		0x0C6, 0x000000A3,
+		0x0C7, 0x00088820,
+		0x0C8, 0x00076C06,
+		0x0C9, 0x00000000,
+		0x0CA, 0x00080000,
+		0x0DF, 0x00000180,
+		0x0EF, 0x000001A0,
+		0x051, 0x0006B27D,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E4DD,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0x90000400,	0x00000000,	0x40000000,	0x00000000,
+		0x052, 0x0007E4DD,
+	0xA0000000,	0x00000000,
+		0x052, 0x0007E49D,
+	0xB0000000,	0x00000000,
+		0x053, 0x00000073,
+		0x056, 0x00051FF3,
+		0x035, 0x00000086,
+		0x035, 0x00000186,
+		0x035, 0x00000286,
+		0x036, 0x00001C25,
+		0x036, 0x00009C25,
+		0x036, 0x00011C25,
+		0x036, 0x00019C25,
+		0x0B6, 0x00048538,
+		0x018, 0x00000C07,
+		0x05A, 0x0004BD00,
+		0x019, 0x000739D0,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x034, 0x0000A095,
+		0x034, 0x00009092,
+		0x034, 0x0000808E,
+		0x034, 0x0000704F,
+		0x034, 0x0000604C,
+		0x034, 0x00005049,
+		0x034, 0x0000400C,
+		0x034, 0x00003009,
+		0x034, 0x00002006,
+		0x034, 0x00001003,
+		0x034, 0x00000000,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x034, 0x0000A095,
+		0x034, 0x00009092,
+		0x034, 0x0000808E,
+		0x034, 0x0000704F,
+		0x034, 0x0000604C,
+		0x034, 0x00005049,
+		0x034, 0x0000400C,
+		0x034, 0x00003009,
+		0x034, 0x00002006,
+		0x034, 0x00001003,
+		0x034, 0x00000000,
+	0xA0000000,	0x00000000,
+		0x034, 0x0000ADF3,
+		0x034, 0x00009DF0,
+		0x034, 0x00008DED,
+		0x034, 0x00007DEA,
+		0x034, 0x00006DE7,
+		0x034, 0x000054EE,
+		0x034, 0x000044EB,
+		0x034, 0x000034E8,
+		0x034, 0x0000246B,
+		0x034, 0x00001468,
+		0x034, 0x0000006D,
+	0xB0000000,	0x00000000,
+		0x000, 0x00030159,
+		0x084, 0x00068200,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x0008014E,
+		0x087, 0x0004DF80,
+	0x90000400,	0x00000000,	0x40000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0xA0000000,	0x00000000,
+		0x086, 0x000000CE,
+		0x087, 0x00048A00,
+	0xB0000000,	0x00000000,
+		0x08E, 0x00065540,
+		0x08F, 0x00088000,
+		0x0EF, 0x000020A0,
+	0x88000003,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0x98000001,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0x98000400,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0x90000002,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0x90000001,	0x00000001,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0x98000000,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F6030,
+		0x03B, 0x000E6030,
+		0x03B, 0x000D6030,
+		0x03B, 0x000C6030,
+		0x03B, 0x000BF030,
+		0x03B, 0x000A0020,
+		0x03B, 0x00090090,
+		0x03B, 0x0008F080,
+		0x03B, 0x0007A730,
+		0x03B, 0x000607B0,
+		0x03B, 0x0005F770,
+		0x03B, 0x00040060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020780,
+		0x03B, 0x000107A0,
+		0x03B, 0x0000F760,
+		0x0EF, 0x000000A0,
+	0x90000400,	0x00000000,	0x40000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0xA0000000,	0x00000000,
+		0x03B, 0x000F02B0,
+		0x03B, 0x000EF7B0,
+		0x03B, 0x000D4FB0,
+		0x03B, 0x000CF060,
+		0x03B, 0x000B0090,
+		0x03B, 0x000A0080,
+		0x03B, 0x00090080,
+		0x03B, 0x0008F780,
+		0x03B, 0x000722B0,
+		0x03B, 0x0006F7B0,
+		0x03B, 0x00054FB0,
+		0x03B, 0x0004F060,
+		0x03B, 0x00030090,
+		0x03B, 0x00020080,
+		0x03B, 0x00010080,
+		0x03B, 0x0000F780,
+		0x0EF, 0x000000A0,
+	0xB0000000,	0x00000000,
+		0x000, 0x00010159,
+		0x018, 0x0000F407,
+		0xFFE, 0x00000000,
+		0xFFE, 0x00000000,
+		0x01F, 0x00080003,
+		0xFFE, 0x00000000,
+		0xFFE, 0x00000000,
+		0x01E, 0x00000001,
+		0x01F, 0x00080000,
+		0x000, 0x00033E60,
+};
+
+RTW_DECL_TABLE_RF_RADIO(rtw8189e_rf_a, A);
+
+static const struct rtw_phy_pg_cfg_pair rtw8189e_bb_pg[] = {
+	{ 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00003800, },
+	{ 0, 0, 0, 0x0000086c, 0xffffff00, 0x32343600, },
+	{ 0, 0, 0, 0x00000e00, 0xffffffff, 0x40424446, },
+	{ 0, 0, 0, 0x00000e04, 0xffffffff, 0x28323638, },
+	{ 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244, },
+	{ 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436, },
+};
+
+RTW_DECL_TABLE_BB_PG(rtw8189e_bb_pg);
+
+static const struct rtw_txpwr_lmt_cfg_pair rtw8189e_txpwr_lmt[] = {
+	{0, 0, 0, 0, 1, 32},
+	{2, 0, 0, 0, 1, 26},
+	{1, 0, 0, 0, 1, 32},
+	{0, 0, 0, 0, 2, 32},
+	{2, 0, 0, 0, 2, 26},
+	{1, 0, 0, 0, 2, 32},
+	{0, 0, 0, 0, 3, 32},
+	{2, 0, 0, 0, 3, 26},
+	{1, 0, 0, 0, 3, 32},
+	{0, 0, 0, 0, 4, 32},
+	{2, 0, 0, 0, 4, 26},
+	{1, 0, 0, 0, 4, 32},
+	{0, 0, 0, 0, 5, 32},
+	{2, 0, 0, 0, 5, 26},
+	{1, 0, 0, 0, 5, 32},
+	{0, 0, 0, 0, 6, 32},
+	{2, 0, 0, 0, 6, 26},
+	{1, 0, 0, 0, 6, 32},
+	{0, 0, 0, 0, 7, 32},
+	{2, 0, 0, 0, 7, 26},
+	{1, 0, 0, 0, 7, 32},
+	{0, 0, 0, 0, 8, 32},
+	{2, 0, 0, 0, 8, 26},
+	{1, 0, 0, 0, 8, 32},
+	{0, 0, 0, 0, 9, 32},
+	{2, 0, 0, 0, 9, 26},
+	{1, 0, 0, 0, 9, 32},
+	{0, 0, 0, 0, 10, 32},
+	{2, 0, 0, 0, 10, 26},
+	{1, 0, 0, 0, 10, 32},
+	{0, 0, 0, 0, 11, 32},
+	{2, 0, 0, 0, 11, 26},
+	{1, 0, 0, 0, 11, 32},
+	{0, 0, 0, 0, 12, 63},
+	{2, 0, 0, 0, 12, 26},
+	{1, 0, 0, 0, 12, 32},
+	{0, 0, 0, 0, 13, 63},
+	{2, 0, 0, 0, 13, 26},
+	{1, 0, 0, 0, 13, 32},
+	{0, 0, 0, 0, 14, 63},
+	{2, 0, 0, 0, 14, 63},
+	{1, 0, 0, 0, 14, 32},
+	{0, 0, 0, 1, 1, 28},
+	{2, 0, 0, 1, 1, 30},
+	{1, 0, 0, 1, 1, 30},
+	{0, 0, 0, 1, 2, 28},
+	{2, 0, 0, 1, 2, 30},
+	{1, 0, 0, 1, 2, 30},
+	{0, 0, 0, 1, 3, 30},
+	{2, 0, 0, 1, 3, 30},
+	{1, 0, 0, 1, 3, 30},
+	{0, 0, 0, 1, 4, 30},
+	{2, 0, 0, 1, 4, 30},
+	{1, 0, 0, 1, 4, 30},
+	{0, 0, 0, 1, 5, 30},
+	{2, 0, 0, 1, 5, 30},
+	{1, 0, 0, 1, 5, 30},
+	{0, 0, 0, 1, 6, 30},
+	{2, 0, 0, 1, 6, 30},
+	{1, 0, 0, 1, 6, 30},
+	{0, 0, 0, 1, 7, 30},
+	{2, 0, 0, 1, 7, 30},
+	{1, 0, 0, 1, 7, 30},
+	{0, 0, 0, 1, 8, 30},
+	{2, 0, 0, 1, 8, 30},
+	{1, 0, 0, 1, 8, 30},
+	{0, 0, 0, 1, 9, 28},
+	{2, 0, 0, 1, 9, 30},
+	{1, 0, 0, 1, 9, 30},
+	{0, 0, 0, 1, 10, 28},
+	{2, 0, 0, 1, 10, 30},
+	{1, 0, 0, 1, 10, 30},
+	{0, 0, 0, 1, 11, 28},
+	{2, 0, 0, 1, 11, 30},
+	{1, 0, 0, 1, 11, 30},
+	{0, 0, 0, 1, 12, 63},
+	{2, 0, 0, 1, 12, 30},
+	{1, 0, 0, 1, 12, 30},
+	{0, 0, 0, 1, 13, 63},
+	{2, 0, 0, 1, 13, 30},
+	{1, 0, 0, 1, 13, 30},
+	{0, 0, 0, 1, 14, 63},
+	{2, 0, 0, 1, 14, 63},
+	{1, 0, 0, 1, 14, 63},
+	{0, 0, 0, 2, 1, 28},
+	{2, 0, 0, 2, 1, 30},
+	{1, 0, 0, 2, 1, 30},
+	{0, 0, 0, 2, 2, 28},
+	{2, 0, 0, 2, 2, 30},
+	{1, 0, 0, 2, 2, 30},
+	{0, 0, 0, 2, 3, 30},
+	{2, 0, 0, 2, 3, 30},
+	{1, 0, 0, 2, 3, 30},
+	{0, 0, 0, 2, 4, 30},
+	{2, 0, 0, 2, 4, 30},
+	{1, 0, 0, 2, 4, 30},
+	{0, 0, 0, 2, 5, 30},
+	{2, 0, 0, 2, 5, 30},
+	{1, 0, 0, 2, 5, 30},
+	{0, 0, 0, 2, 6, 30},
+	{2, 0, 0, 2, 6, 30},
+	{1, 0, 0, 2, 6, 30},
+	{0, 0, 0, 2, 7, 30},
+	{2, 0, 0, 2, 7, 30},
+	{1, 0, 0, 2, 7, 30},
+	{0, 0, 0, 2, 8, 30},
+	{2, 0, 0, 2, 8, 30},
+	{1, 0, 0, 2, 8, 30},
+	{0, 0, 0, 2, 9, 28},
+	{2, 0, 0, 2, 9, 30},
+	{1, 0, 0, 2, 9, 30},
+	{0, 0, 0, 2, 10, 28},
+	{2, 0, 0, 2, 10, 30},
+	{1, 0, 0, 2, 10, 30},
+	{0, 0, 0, 2, 11, 28},
+	{2, 0, 0, 2, 11, 30},
+	{1, 0, 0, 2, 11, 30},
+	{0, 0, 0, 2, 12, 63},
+	{2, 0, 0, 2, 12, 30},
+	{1, 0, 0, 2, 12, 30},
+	{0, 0, 0, 2, 13, 63},
+	{2, 0, 0, 2, 13, 30},
+	{1, 0, 0, 2, 13, 30},
+	{0, 0, 0, 2, 14, 63},
+	{2, 0, 0, 2, 14, 63},
+	{1, 0, 0, 2, 14, 63},
+	{0, 0, 1, 2, 1, 63},
+	{2, 0, 1, 2, 1, 63},
+	{1, 0, 1, 2, 1, 63},
+	{0, 0, 1, 2, 2, 63},
+	{2, 0, 1, 2, 2, 63},
+	{1, 0, 1, 2, 2, 63},
+	{0, 0, 1, 2, 3, 26},
+	{2, 0, 1, 2, 3, 26},
+	{1, 0, 1, 2, 3, 26},
+	{0, 0, 1, 2, 4, 26},
+	{2, 0, 1, 2, 4, 26},
+	{1, 0, 1, 2, 4, 26},
+	{0, 0, 1, 2, 5, 26},
+	{2, 0, 1, 2, 5, 26},
+	{1, 0, 1, 2, 5, 26},
+	{0, 0, 1, 2, 6, 26},
+	{2, 0, 1, 2, 6, 26},
+	{1, 0, 1, 2, 6, 26},
+	{0, 0, 1, 2, 7, 26},
+	{2, 0, 1, 2, 7, 26},
+	{1, 0, 1, 2, 7, 26},
+	{0, 0, 1, 2, 8, 26},
+	{2, 0, 1, 2, 8, 26},
+	{1, 0, 1, 2, 8, 26},
+	{0, 0, 1, 2, 9, 26},
+	{2, 0, 1, 2, 9, 26},
+	{1, 0, 1, 2, 9, 26},
+	{0, 0, 1, 2, 10, 26},
+	{2, 0, 1, 2, 10, 26},
+	{1, 0, 1, 2, 10, 26},
+	{0, 0, 1, 2, 11, 26},
+	{2, 0, 1, 2, 11, 26},
+	{1, 0, 1, 2, 11, 26},
+	{0, 0, 1, 2, 12, 63},
+	{2, 0, 1, 2, 12, 26},
+	{1, 0, 1, 2, 12, 26},
+	{0, 0, 1, 2, 13, 63},
+	{2, 0, 1, 2, 13, 26},
+	{1, 0, 1, 2, 13, 26},
+	{0, 0, 1, 2, 14, 63},
+	{2, 0, 1, 2, 14, 63},
+	{1, 0, 1, 2, 14, 63},
+};
+
+RTW_DECL_TABLE_TXPWR_LMT(rtw8189e_txpwr_lmt);
+
+const struct s9082c_rf_step s9082c_rf_init_seq[] = {
+	{ 0x00c00000, 0 },
+	{ 0x00110200, 0 },
+	{ 0x800120e0, 0 },
+	{ 0x80090048, 0 },
+	{ 0x800d0021, 0 },
+	{ 0x80170090, 0 },
+	{ 0x800f1001, 0 },
+	{ 0x408f0506, 0 },
+	{ 0xc03f0000, 0 },
+	{ 0x20040603, 0 },
+	{ 0xa0be0000, 0 },
+	{ 0xa0d18701, 0 },
+	{ 0x600ea84a, 0 },
+	{ 0x100c0000, 0 },
+	{ 0xd0f01f3f, 0 },
+	{ 0xd0a82200, 0 },
+	{ 0xd0343398, 0 },
+	{ 0xd0220cc0, 0 },
+	{ 0xd026a97c, 0 },
+	{ 0xd08ee318, 0 },
+	{ 0xd00106ff, 0 },
+	{ 0xd0190080, 0 },
+	{ 0xd0250000, 0 },
+	{ 0xd00d2000, 0 },
+	{ 0xd03f0000, 0 },
+	{ 0x30042400, 0 },
+	{ 0x300c0090, 0 },
+	{ 0x30223089, 0 },
+	{ 0x309a9999, 0 },
+	{ 0x300600c5, 0 },
+	{ 0x301e1104, 0 },
+	{ 0x30e13660, 0 },
+	{ 0x30090000, 0 },
+	{ 0x30150000, 0 },
+	{ 0xb00f8001, 0 },
+	{ 0x700f8005, 0 },
+	{ 0xa0684dbe, 0 },
+	{ 0xa0e427bb, 0 },
+	{ 0xa00c00ce, 0 },
+	{ 0xa0a6f8cf, 0 },
+	{ 0xc00a0061, 0 },
+	{ 0xc00a8061, 0 },
+	{ 0xc00a4061, 0 },
+	{ 0xc00638a4, 0 },
+	{ 0xc00639a4, 0 },
+	{ 0xc08638a4, 0 },
+	{ 0xc08639a4, 0 },
+	{ 0xd026a11c, 0 },
+	{ 0x800130e0, 0 },
+	{ 0xa025bd00, 0 },
+	{ 0x80e99c0b, 0 },
+	{ 0xc002b5cf, 0 },
+	{ 0xc002b90f, 0 },
+	{ 0xc002b1b7, 0 },
+	{ 0xc002be57, 0 },
+	{ 0xc002b6e7, 0 },
+	{ 0xc0022a77, 0 },
+	{ 0xc00222d7, 0 },
+	{ 0xc0022c17, 0 },
+	{ 0xc00224d6, 0 },
+	{ 0xc0022816, 0 },
+	{ 0xc00200b6, 0 },
+	{ 0x00c0809a, 0 },
+	{ 0x10624100, 0 },
+	{ 0x10060073, 0 },
+	{ 0x102e5100, 0 },
+	{ 0x1067aa02, 0 },
+	{ 0x101f0100, 0 },
+	{ 0x700f0405, 0 },
+	{ 0xc0fd400d, 0 },
+	{ 0xc07def0d, 0 },
+	{ 0xc0bdf20d, 0 },
+	{ 0xc03d0f06, 0 },
+	{ 0xc0dd0009, 0 },
+	{ 0xc05d0001, 0 },
+	{ 0xc09d0001, 0 },
+	{ 0xc01def01, 0 },
+	{ 0xc0ed440d, 0 },
+	{ 0xc06def0d, 0 },
+	{ 0xc0adf20d, 0 },
+	{ 0xc02d0f06, 0 },
+	{ 0xc0cd0009, 0 },
+	{ 0xc04d0001, 0 },
+	{ 0xc08d0001, 0 },
+	{ 0xc00def01, 0 },
+	{ 0x700f0005, 0 },
+	{ 0x0080809a, 0 },
+	{ 0x80012fe0, 100 },
+	{ 0x801f00c0, 100 },
+	{ 0x80070080, 0 },
+	{ 0x801f0000, 0 },
+	{ 0x00c07c06, 0 },
+};
+
+const struct s9082c_mac_step s9082c_mac_init_seq[] = {
+	{ 0x4380, 0x0000e500 },
+	{ 0x4384, 0x0f200100 },
+	{ 0x43e0, 0x103c0107 },
+	{ 0x4430, 0x20408000 },
+	{ 0x4434, 0x10e060a0 },
+	{ 0x4438, 0x40800000 },
+	{ 0x443c, 0xe060a020 },
+	{ 0x4444, 0x00f00fa8 },
+	{ 0x4458, 0x9d4e1541 },
+	{ 0x4468, 0x20106666 },
+	{ 0x446c, 0x2018cccc },
+	{ 0x4470, 0x0070ac52 },
+	{ 0x4478, 0x00000020 },
+	{ 0x4500, 0x00f44564 },
+	{ 0x4504, 0x007ac514 },
+	{ 0x4508, 0x007a25d4 },
+	{ 0x450c, 0x000025f2 },
+	{ 0x4620, 0xffffffff },
+	{ 0x4624, 0xffffffff },
+	{ 0x463c, 0x30301010 },
+	{ 0x4700, 0xe1a6c284 },
+	{ 0x4708, 0xe1a6c284 },
+	{ 0x47bc, 0x00203030 },
+	{ 0x47c0, 0x00008240 },
+	{ 0x47c8, 0xe01200f0 },
+};
+
+const struct s9082c_phy_step s9082c_phy_init_seq[] = {
+	{ S9082C_OP_BB_SET, 0x4800, 0xffff0000, 0x5b2e8004 },
+	{ S9082C_OP_BB_SET, 0x4800, 0x0000ffff, 0x26680000 },
+	{ S9082C_OP_BB_SET, 0x4804, 0xffff0000, 0x8a520000 },
+	{ S9082C_OP_BB_SET, 0x4804, 0x0000ffff, 0xed1a0003 },
+	{ S9082C_OP_BB_SET, 0x4808, 0xffff0000, 0xfc180000 },
+	{ S9082C_OP_BB_SET, 0x4808, 0x0000ffff, 0x3200fc00 },
+	{ S9082C_OP_BB_SET, 0x480c, 0xffff0000, 0x0b0a0000 },
+	{ S9082C_OP_BB_SET, 0x480c, 0x0000ffff, 0x3b01000a },
+	{ S9082C_OP_BB_SET, 0x4810, 0xffff0000, 0x12121000 },
+	{ S9082C_OP_BB_SET, 0x4810, 0x0000ffff, 0x12131331 },
+	{ S9082C_OP_BB_SET, 0x4814, 0xffff0000, 0x3f10020c },
+	{ S9082C_OP_BB_SET, 0x4814, 0x0000ffff, 0x022d3d10 },
+	{ S9082C_OP_BB_SET, 0x4818, 0xffff0000, 0x02210220 },
+	{ S9082C_OP_BB_SET, 0x4818, 0x0000ffff, 0x02230385 },
+	{ S9082C_OP_BB_SET, 0x481c, 0xffff0000, 0x22020000 },
+	{ S9082C_OP_BB_SET, 0x481c, 0x0000ffff, 0x22030000 },
+	{ S9082C_OP_BB_SET, 0x4820, 0xffff0000, 0x22100100 },
+	{ S9082C_OP_BB_SET, 0x4820, 0x0000ffff, 0x21000100 },
+	{ S9082C_OP_BB_ND, 0x4824, 0xffff0000, 0x00250039 },
+	{ S9082C_OP_BB_ND, 0x4824, 0x0000ffff, 0x00280204 },
+	{ S9082C_OP_BB_SET, 0x4828, 0xffff0000, 0x3ff00000 },
+	{ S9082C_OP_BB_SET, 0x4828, 0x0000ffff, 0x3ffe0000 },
+	{ S9082C_OP_BB_ND, 0x482c, 0xffff0000, 0x3ff30000 },
+	{ S9082C_OP_BB_ND, 0x482c, 0x0000ffff, 0x3ffa0000 },
+	{ S9082C_OP_BB_SET, 0x4830, 0xffff0000, 0x2af00000 },
+	{ S9082C_OP_BB_SET, 0x4830, 0x0000ffff, 0x2ef00000 },
+	{ S9082C_OP_BB_SET, 0x4834, 0xffff0000, 0x3d250000 },
+	{ S9082C_OP_BB_SET, 0x4834, 0x0000ffff, 0x3da50000 },
+	{ S9082C_OP_BB_SET, 0x4838, 0xffff0000, 0x02e00000 },
+	{ S9082C_OP_BB_SET, 0x4838, 0x0000ffff, 0x02f10000 },
+	{ S9082C_OP_BB_SET, 0x483c, 0xffff0000, 0x00200000 },
+	{ S9082C_OP_BB_SET, 0x483c, 0x0000ffff, 0x01200000 },
+	{ S9082C_OP_BB_SET, 0x4840, 0xffff0000, 0x50500001 },
+	{ S9082C_OP_BB_SET, 0x4840, 0x0000ffff, 0x50510000 },
+	{ S9082C_OP_BB_SET, 0x4844, 0xffff0000, 0x7e100000 },
+	{ S9082C_OP_BB_SET, 0x4844, 0x0000ffff, 0x7e010000 },
+	{ S9082C_OP_BB_SET, 0x4848, 0xffff0000, 0x10200000 },
+	{ S9082C_OP_BB_SET, 0x4848, 0x0000ffff, 0x10210000 },
+	{ S9082C_OP_BB_SET, 0x484c, 0xffff0000, 0xe0400000 },
+	{ S9082C_OP_BB_SET, 0x484c, 0x0000ffff, 0xe0800000 },
+	{ S9082C_OP_BB_SET, 0x4850, 0xffff0000, 0x49100000 },
+	{ S9082C_OP_BB_SET, 0x4850, 0x0000ffff, 0x4e100000 },
+	{ S9082C_OP_BB_SET, 0x4854, 0xffff0000, 0xa11a0000 },
+	{ S9082C_OP_BB_SET, 0x4854, 0x0000ffff, 0xa24a0000 },
+	{ S9082C_OP_BB_SET, 0x4858, 0xffff0000, 0xaee0569a },
+	{ S9082C_OP_BB_SET, 0x4858, 0x0000ffff, 0xa2e011a9 },
+	{ S9082C_OP_BB_SET, 0x485c, 0xffff0000, 0x11040100 },
+	{ S9082C_OP_BB_SET, 0x485c, 0x0000ffff, 0x11000014 },
+	{ S9082C_OP_BB_SET, 0x4860, 0xffff0000, 0x66e066f6 },
+	{ S9082C_OP_BB_SET, 0x4860, 0x0000ffff, 0x66f00110 },
+	{ S9082C_OP_BB_SET, 0x4864, 0xffff0000, 0x060f061f },
+	{ S9082C_OP_BB_SET, 0x4864, 0x0000ffff, 0x060f0649 },
+	{ S9082C_OP_DIRECT, 0x4868, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x486c, 0xffffffff, 0xe4e4e400 },
+	{ S9082C_OP_BB_SET, 0x4870, 0xffff0000, 0x07e00700 },
+	{ S9082C_OP_BB_SET, 0x4870, 0x0000ffff, 0x07100760 },
+	{ S9082C_OP_BB_SET, 0x4874, 0xffff0000, 0x25102500 },
+	{ S9082C_OP_BB_SET, 0x4874, 0x0000ffff, 0x25804000 },
+	{ S9082C_OP_BB_SET, 0x4878, 0xffff0000, 0x07210000 },
+	{ S9082C_OP_BB_SET, 0x4878, 0x0000ffff, 0x07210808 },
+	{ S9082C_OP_BB_SET, 0x487c, 0xffff0000, 0x10100000 },
+	{ S9082C_OP_BB_SET, 0x487c, 0x0000ffff, 0x11100000 },
+	{ S9082C_OP_DIRECT, 0x4880, 0xffffffff, 0x0d003038 },
+	{ S9082C_OP_DIRECT, 0x4884, 0xffffffff, 0x00000080 },
+	{ S9082C_OP_DIRECT, 0x4888, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x488c, 0xffff0000, 0xccc0ccc0 },
+	{ S9082C_OP_BB_SET, 0x488c, 0x0000ffff, 0xccc100c0 },
+	{ S9082C_OP_BB_SET, 0x4890, 0xffff0000, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4890, 0x0000ffff, 0x00000800 },
+	{ S9082C_OP_BB_SET, 0x4894, 0xffff0000, 0xeffeffff },
+	{ S9082C_OP_BB_SET, 0x4894, 0x0000ffff, 0xfffefffe },
+	{ S9082C_OP_BB_SET, 0x4898, 0xffff0000, 0x4a314030 },
+	{ S9082C_OP_BB_SET, 0x4898, 0x0000ffff, 0x4a302010 },
+	{ S9082C_OP_DIRECT, 0x489c, 0xffffffff, 0x000e060a },
+	{ S9082C_OP_DIRECT, 0x48a4, 0xffffffff, 0x0e0e050a },
+	{ S9082C_OP_BB_SET, 0x4900, 0xffff0000, 0x72890000 },
+	{ S9082C_OP_BB_SET, 0x4900, 0x0000ffff, 0x71090000 },
+	{ S9082C_OP_BB_SET, 0x4904, 0xffff0000, 0x02020000 },
+	{ S9082C_OP_BB_SET, 0x4904, 0x0000ffff, 0x02040023 },
+	{ S9082C_OP_BB_SET, 0x4908, 0xffff0000, 0x40710000 },
+	{ S9082C_OP_BB_SET, 0x4908, 0x0000ffff, 0x44710000 },
+	{ S9082C_OP_DIRECT, 0x490c, 0xffffffff, 0x81488888 },
+	{ S9082C_OP_DIRECT, 0x4910, 0xffffffff, 0x00000040 },
+	{ S9082C_OP_DIRECT, 0x4914, 0xffffffff, 0x00004080 },
+	{ S9082C_OP_BB_SET, 0x4a00, 0xffff0000, 0x00de00d0 },
+	{ S9082C_OP_BB_SET, 0x4a00, 0x0000ffff, 0x00de47c8 },
+	{ S9082C_OP_BB_SET, 0x4a04, 0xffff0000, 0x800880ff },
+	{ S9082C_OP_BB_SET, 0x4a04, 0x0000ffff, 0x8002800c },
+	{ S9082C_OP_DIRECT, 0x4a08, 0xffffffff, 0x31c1c100 },
+	{ S9082C_OP_DIRECT, 0x4a0c, 0xffffffff, 0x74fe48f0 },
+	{ S9082C_OP_DIRECT, 0x4a10, 0xffffffff, 0xa900dd1e },
+	{ S9082C_OP_DIRECT, 0x4a14, 0xffffffff, 0x88280b14 },
+	{ S9082C_OP_DIRECT, 0x4a18, 0xffffffff, 0x001188e8 },
+	{ S9082C_OP_BB_SET, 0x4a1c, 0xffff0000, 0x00e08914 },
+	{ S9082C_OP_BB_SET, 0x4a1c, 0x0000ffff, 0x00e10f00 },
+	{ S9082C_OP_DIRECT, 0x4a20, 0xffffffff, 0x1a1b0000 },
+	{ S9082C_OP_DIRECT, 0x4a24, 0xffffffff, 0x090e1317 },
+	{ S9082C_OP_DIRECT, 0x4a28, 0xffffffff, 0x00000204 },
+	{ S9082C_OP_BB_SET, 0x4a2c, 0xffff0000, 0x003000d3 },
+	{ S9082C_OP_BB_SET, 0x4a2c, 0x0000ffff, 0x003e0000 },
+	{ S9082C_OP_BB_SET, 0x4a70, 0xffff0000, 0x1010101f },
+	{ S9082C_OP_BB_SET, 0x4a70, 0x0000ffff, 0x1012bf00 },
+	{ S9082C_OP_BB_SET, 0x4a74, 0xffff0000, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4a74, 0x0000ffff, 0x00000007 },
+	{ S9082C_OP_DIRECT, 0x4a78, 0xffffffff, 0x00009000 },
+	{ S9082C_OP_DIRECT, 0x4a7c, 0xffffffff, 0x44da6060 },
+	{ S9082C_OP_BB_SET, 0x4a80, 0xffff0000, 0x11202180 },
+	{ S9082C_OP_BB_SET, 0x4a80, 0x0000ffff, 0x110075b1 },
+	{ S9082C_OP_BB_SET, 0x4b2c, 0xffff0000, 0x02f58000 },
+	{ S9082C_OP_BB_SET, 0x4b2c, 0x0000ffff, 0x82f50000 },
+	{ S9082C_OP_BB_SET, 0x4c00, 0xffff0000, 0x11054807 },
+	{ S9082C_OP_BB_SET, 0x4c00, 0x0000ffff, 0x18051d40 },
+	{ S9082C_OP_DIRECT, 0x4c04, 0xffffffff, 0xc0056a88 },
+	{ S9082C_OP_DIRECT, 0x4c08, 0xffffffff, 0x00000027 },
+	{ S9082C_OP_DIRECT, 0x4c0c, 0xffffffff, 0x36363636 },
+	{ S9082C_OP_BB_SET, 0x4c10, 0xffff0000, 0x00200880 },
+	{ S9082C_OP_BB_SET, 0x4c10, 0x0000ffff, 0x08200000 },
+	{ S9082C_OP_BB_SET, 0x4c14, 0xffff0000, 0x01004000 },
+	{ S9082C_OP_BB_SET, 0x4c14, 0x0000ffff, 0x41000100 },
+	{ S9082C_OP_BB_SET, 0x4c18, 0xffff0000, 0x00280880 },
+	{ S9082C_OP_BB_SET, 0x4c18, 0x0000ffff, 0x08280000 },
+	{ S9082C_OP_DIRECT, 0x4c1c, 0xffffffff, 0x02008000 },
+	{ S9082C_OP_DIRECT, 0x4c20, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4c24, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4c28, 0xffff0000, 0x09a00000 },
+	{ S9082C_OP_BB_SET, 0x4c28, 0x0000ffff, 0x09e00000 },
+	{ S9082C_OP_BB_SET, 0x4c2c, 0xffff0000, 0x25100000 },
+	{ S9082C_OP_BB_SET, 0x4c2c, 0x0000ffff, 0x25500000 },
+	{ S9082C_OP_BB_SET, 0x4c30, 0xffff0000, 0x19a069e9 },
+	{ S9082C_OP_BB_SET, 0x4c30, 0x0000ffff, 0x19a0ac47 },
+	{ S9082C_OP_DIRECT, 0x4c34, 0xffffffff, 0x62694af5 },
+	{ S9082C_OP_DIRECT, 0x4c38, 0xffffffff, 0x929e9a29 },
+	{ S9082C_OP_DIRECT, 0x4c3c, 0xffffffff, 0x50e9e938 },
+	{ S9082C_OP_BB_SET, 0x4c40, 0xffff0000, 0x407c1f7c },
+	{ S9082C_OP_BB_SET, 0x4c40, 0x0000ffff, 0x407c403f },
+	{ S9082C_OP_BB_SET, 0x4c44, 0xffff0000, 0x00800001 },
+	{ S9082C_OP_BB_SET, 0x4c44, 0x0000ffff, 0x009000b7 },
+	{ S9082C_OP_BB_SET, 0x4c48, 0xffff0000, 0x00e0ec02 },
+	{ S9082C_OP_BB_SET, 0x4c48, 0x0000ffff, 0x00e00107 },
+	{ S9082C_OP_DIRECT, 0x4c4c, 0xffffffff, 0x007f037f },
+	{ S9082C_OP_DIRECT, 0x4c50, 0xffffffff, 0x69553420 },
+	{ S9082C_OP_DIRECT, 0x4c54, 0xffffffff, 0xc23d0029 },
+	{ S9082C_OP_DIRECT, 0x4c58, 0xffffffff, 0x00013159 },
+	{ S9082C_OP_DIRECT, 0x4c5c, 0xffffffff, 0x00a42049 },
+	{ S9082C_OP_DIRECT, 0x4c60, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4c64, 0xffffffff, 0x8e4821d1 },
+	{ S9082C_OP_DIRECT, 0x4c68, 0xffffffff, 0xe203d0ff },
+	{ S9082C_OP_BB_SET, 0x4c6c, 0xffff0000, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4c6c, 0x0000ffff, 0x00000036 },
+	{ S9082C_OP_BB_SET, 0x4c70, 0xffff0000, 0x80112c7f },
+	{ S9082C_OP_BB_SET, 0x4c70, 0x0000ffff, 0x8001000d },
+	{ S9082C_OP_BB_SET, 0x4c74, 0xffff0000, 0x10470286 },
+	{ S9082C_OP_BB_SET, 0x4c74, 0x0000ffff, 0x108710db },
+	{ S9082C_OP_DIRECT, 0x4c78, 0xffffffff, 0x000000f8 },
+	{ S9082C_OP_DIRECT, 0x4c7c, 0xffffffff, 0x009d6848 },
+	{ S9082C_OP_DIRECT, 0x4c80, 0xffffffff, 0x390000e4 },
+	{ S9082C_OP_BB_SET, 0x4c84, 0xffff0000, 0x2e1121f6 },
+	{ S9082C_OP_BB_SET, 0x4c84, 0x0000ffff, 0x2e100000 },
+	{ S9082C_OP_BB_ND, 0x4c88, 0xffff0000, 0x00104000 },
+	{ S9082C_OP_BB_ND, 0x4c88, 0x0000ffff, 0x00100100 },
+	{ S9082C_OP_DIRECT, 0x4c8c, 0xffffffff, 0x04040000 },
+	{ S9082C_OP_DIRECT, 0x4c90, 0xffffffff, 0x0090a884 },
+	{ S9082C_OP_DIRECT, 0x4c94, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4c98, 0xffffffff, 0x00481804 },
+	{ S9082C_OP_DIRECT, 0x4c9c, 0xffffffff, 0x0000fefe },
+	{ S9082C_OP_BB_SET, 0x4ca0, 0xffff0000, 0x105d0000 },
+	{ S9082C_OP_BB_SET, 0x4ca0, 0x0000ffff, 0x115d0000 },
+	{ S9082C_OP_BB_SET, 0x4ca4, 0xffff0000, 0x00120003 },
+	{ S9082C_OP_BB_SET, 0x4ca4, 0x0000ffff, 0x004200a0 },
+	{ S9082C_OP_DIRECT, 0x4ca8, 0xffffffff, 0xffff0000 },
+	{ S9082C_OP_DIRECT, 0x4cac, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4cb0, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4cb4, 0xffff0000, 0x19e00000 },
+	{ S9082C_OP_BB_SET, 0x4cb4, 0x0000ffff, 0x11e00000 },
+	{ S9082C_OP_BB_SET, 0x4cb8, 0xffff0000, 0xef000000 },
+	{ S9082C_OP_BB_SET, 0x4cb8, 0x0000ffff, 0xef080000 },
+	{ S9082C_OP_DIRECT, 0x4cbc, 0xffffffff, 0x14000000 },
+	{ S9082C_OP_DIRECT, 0x4cc0, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4cc4, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4cc8, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4ccc, 0xffff0000, 0x6b050000 },
+	{ S9082C_OP_BB_SET, 0x4ccc, 0x0000ffff, 0x6e050000 },
+	{ S9082C_OP_BB_SET, 0x4cd0, 0xffff0000, 0x28000000 },
+	{ S9082C_OP_BB_SET, 0x4cd0, 0x0000ffff, 0x88100000 },
+	{ S9082C_OP_BB_SET, 0x4cd4, 0xffff0000, 0xc4800000 },
+	{ S9082C_OP_BB_SET, 0x4cd4, 0x0000ffff, 0xc4100000 },
+	{ S9082C_OP_DIRECT, 0x4cd8, 0xffffffff, 0x264d24e4 },
+	{ S9082C_OP_DIRECT, 0x4cdc, 0xffffffff, 0x006e964c },
+	{ S9082C_OP_DIRECT, 0x4ce0, 0xffffffff, 0x00444444 },
+	{ S9082C_OP_DIRECT, 0x4ce4, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4ce8, 0xffffffff, 0xec26c240 },
+	{ S9082C_OP_DIRECT, 0x4cec, 0xffffffff, 0xf4e92b30 },
+	{ S9082C_OP_BB_SET, 0x4d00, 0xffff0000, 0x09180000 },
+	{ S9082C_OP_BB_SET, 0x4d00, 0x0000ffff, 0x09180740 },
+	{ S9082C_OP_BB_SET, 0x4d04, 0xffff0000, 0x00100002 },
+	{ S9082C_OP_BB_SET, 0x4d04, 0x0000ffff, 0x13100401 },
+	{ S9082C_OP_BB_SET, 0x4d08, 0xffff0000, 0x10020000 },
+	{ S9082C_OP_BB_SET, 0x4d08, 0x0000ffff, 0x1002907f },
+	{ S9082C_OP_DIRECT, 0x4d0c, 0xffffffff, 0x04804080 },
+	{ S9082C_OP_DIRECT, 0x4d10, 0xffffffff, 0x05c6cccc },
+	{ S9082C_OP_DIRECT, 0x4d14, 0xffffffff, 0xcccc3dc2 },
+	{ S9082C_OP_DIRECT, 0x4d18, 0xffffffff, 0x5ef1daf6 },
+	{ S9082C_OP_DIRECT, 0x4d2c, 0xffffffff, 0x33e999ae },
+	{ S9082C_OP_BB_SET, 0x4d30, 0xffff0000, 0x3e100000 },
+	{ S9082C_OP_BB_SET, 0x4d30, 0x0000ffff, 0x3f3f0000 },
+	{ S9082C_OP_BB_SET, 0x4d34, 0xffff0000, 0x90618060 },
+	{ S9082C_OP_BB_SET, 0x4d34, 0x0000ffff, 0x90648000 },
+	{ S9082C_OP_BB_SET, 0x4d38, 0xffff0000, 0x80010000 },
+	{ S9082C_OP_BB_SET, 0x4d38, 0x0000ffff, 0x80910000 },
+	{ S9082C_OP_DIRECT, 0x4d3c, 0xffffffff, 0x0048ceca },
+	{ S9082C_OP_DIRECT, 0x4d40, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4d44, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4d48, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4d4c, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4d50, 0xffffffff, 0x26ec2850 },
+	{ S9082C_OP_DIRECT, 0x4d54, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_DIRECT, 0x4d58, 0xffffffff, 0x00004041 },
+	{ S9082C_OP_DIRECT, 0x4d5c, 0xffffffff, 0x0cc00426 },
+	{ S9082C_OP_BB_SET, 0x4d60, 0xffff0000, 0x00204653 },
+	{ S9082C_OP_BB_SET, 0x4d60, 0x0000ffff, 0x0200de68 },
+	{ S9082C_OP_BB_SET, 0x4d64, 0xffff0000, 0x00900451 },
+	{ S9082C_OP_BB_SET, 0x4d64, 0x0000ffff, 0x09908a3c },
+	{ S9082C_OP_BB_SET, 0x4d68, 0xffff0000, 0x21000000 },
+	{ S9082C_OP_BB_SET, 0x4d68, 0x0000ffff, 0x00002101 },
+	{ S9082C_OP_DIRECT, 0x4d6c, 0xffffffff, 0x54043868 },
+	{ S9082C_OP_DIRECT, 0x4d70, 0xffffffff, 0x18486c74 },
+	{ S9082C_OP_DIRECT, 0x4d74, 0xffffffff, 0x4c344404 },
+	{ S9082C_OP_DIRECT, 0x4d78, 0xffffffff, 0x00703c24 },
+	{ S9082C_OP_DIRECT, 0x4e00, 0xffffffff, 0x2d2d2d2d },
+	{ S9082C_OP_BB_SET, 0x4e04, 0xffff0000, 0x2e2e2d2d },
+	{ S9082C_OP_BB_SET, 0x4e04, 0x0000ffff, 0x3f3f2d2d },
+	{ S9082C_OP_BB_SET, 0x4e08, 0xffff0000, 0x09390390 },
+	{ S9082C_OP_BB_SET, 0x4e08, 0x0000ffff, 0x3939272d },
+	{ S9082C_OP_BB_SET, 0x4e10, 0xffff0000, 0x2e2e2d2d },
+	{ S9082C_OP_BB_SET, 0x4e10, 0x0000ffff, 0x3e3e2d2d },
+	{ S9082C_OP_DIRECT, 0x4e14, 0xffffffff, 0xb4b4b4b4 },
+	{ S9082C_OP_DIRECT, 0x4e18, 0xffffffff, 0xb4b4b4b4 },
+	{ S9082C_OP_DIRECT, 0x4e1c, 0xffffffff, 0xb4b4b4b4 },
+	{ S9082C_OP_DIRECT, 0x4e28, 0xffffffff, 0x00000000 },
+	{ S9082C_OP_BB_SET, 0x4e30, 0xffff0000, 0x10001000 },
+	{ S9082C_OP_BB_SET, 0x4e30, 0x0000ffff, 0x1000dc1f },
+	{ S9082C_OP_BB_SET, 0x4e34, 0xffff0000, 0x10001000 },
+	{ S9082C_OP_BB_SET, 0x4e34, 0x0000ffff, 0x10108c1f },
+	{ S9082C_OP_BB_SET, 0x4e38, 0xffff0000, 0x20120214 },
+	{ S9082C_OP_BB_SET, 0x4e38, 0x0000ffff, 0x20100102 },
+	{ S9082C_OP_DIRECT, 0x4e3c, 0xffffffff, 0x16682043 },
+	{ S9082C_OP_DIRECT, 0x4e40, 0xffffffff, 0x80003e00 },
+	{ S9082C_OP_DIRECT, 0x4e44, 0xffffffff, 0x80001200 },
+	{ S9082C_OP_DIRECT, 0x4e48, 0xffffffff, 0xdf000000 },
+	{ S9082C_OP_DIRECT, 0x4e4c, 0xffffffff, 0x0000148b },
+	{ S9082C_OP_BB_SET, 0x4e50, 0xffff0000, 0x10101000 },
+	{ S9082C_OP_BB_SET, 0x4e50, 0x0000ffff, 0x1010dc1f },
+	{ S9082C_OP_BB_SET, 0x4e54, 0xffff0000, 0x10011000 },
+	{ S9082C_OP_BB_SET, 0x4e54, 0x0000ffff, 0x10018c1f },
+	{ S9082C_OP_DIRECT, 0x4e58, 0xffffffff, 0x40288040 },
+	{ S9082C_OP_DIRECT, 0x4e5c, 0xffffffff, 0x1468b0a0 },
+	{ S9082C_OP_DIRECT, 0x4e60, 0xffffffff, 0x00000012 },
+	{ S9082C_OP_DIRECT, 0x4e68, 0xffffffff, 0x00d8a425 },
+	{ S9082C_OP_DIRECT, 0x4e6c, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4e70, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4e74, 0xffffffff, 0x80000028 },
+	{ S9082C_OP_DIRECT, 0x4e78, 0xffffffff, 0x80000028 },
+	{ S9082C_OP_DIRECT, 0x4e7c, 0xffffffff, 0x80000028 },
+	{ S9082C_OP_DIRECT, 0x4e80, 0xffffffff, 0x80000028 },
+	{ S9082C_OP_DIRECT, 0x4e84, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4e88, 0xffffffff, 0x80000028 },
+	{ S9082C_OP_DIRECT, 0x4e8c, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4ed0, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4ed4, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_DIRECT, 0x4ed8, 0xffffffff, 0x00030028 },
+	{ S9082C_OP_BB_SET, 0x4edc, 0xffff0000, 0x2ee00000 },
+	{ S9082C_OP_BB_SET, 0x4edc, 0x0000ffff, 0x2ee00014 },
+	{ S9082C_OP_BB_SET, 0x4ee0, 0xffff0000, 0x2ee00000 },
+	{ S9082C_OP_BB_SET, 0x4ee0, 0x0000ffff, 0x2ee00014 },
+	{ S9082C_OP_BB_SET, 0x4ee8, 0xffff0000, 0x20102155 },
+	{ S9082C_OP_BB_SET, 0x4ee8, 0x0000ffff, 0x20105448 },
+	{ S9082C_OP_BB_SET, 0x4eec, 0xffff0000, 0x01c001c0 },
+	{ S9082C_OP_BB_SET, 0x4eec, 0x0000ffff, 0x01c00014 },
+	{ S9082C_OP_BB_SET, 0x4f14, 0xffff0000, 0x00300000 },
+	{ S9082C_OP_BB_SET, 0x4f14, 0x0000ffff, 0x003f0003 },
+	{ S9082C_OP_BB_SET, 0x4f4c, 0xffff0000, 0xe0100000 },
+	{ S9082C_OP_BB_SET, 0x4f4c, 0x0000ffff, 0x90100000 },
+	{ S9082C_OP_BB_SET, 0x4f00, 0xffff0000, 0x10e00000 },
+	{ S9082C_OP_BB_SET, 0x4f00, 0x0000ffff, 0x10e00300 },
+};
+
+const struct s9082c_agc_step s9082c_agc_init_seq[] = {
+	{ 0x4c78, 0xdf000080 },
+	{ 0x4c78, 0xdf800080 },
+	{ 0x4c78, 0xdf400080 },
+	{ 0x4c78, 0xdfc00080 },
+	{ 0x4c78, 0xdf200080 },
+	{ 0x4c78, 0x5fa00080 },
+	{ 0x4c78, 0x9f600080 },
+	{ 0x4c78, 0x1fe00080 },
+	{ 0x4c78, 0xef100080 },
+	{ 0x4c78, 0x6f900080 },
+	{ 0x4c78, 0xaf500080 },
+	{ 0x4c78, 0x2fd00080 },
+	{ 0x4c78, 0xcf300080 },
+	{ 0x4c78, 0x4fb00080 },
+	{ 0x4c78, 0x8f700080 },
+	{ 0x4c78, 0x0ff00080 },
+	{ 0x4c78, 0xf7080080 },
+	{ 0x4c78, 0x77880080 },
+	{ 0x4c78, 0xb7480080 },
+	{ 0x4c78, 0x37c80080 },
+	{ 0x4c78, 0xd7280080 },
+	{ 0x4c78, 0x57a80080 },
+	{ 0x4c78, 0x97680080 },
+	{ 0x4c78, 0x17e80080 },
+	{ 0x4c78, 0xe7180080 },
+	{ 0x4c78, 0x67980080 },
+	{ 0x4c78, 0xa7580080 },
+	{ 0x4c78, 0x27d80080 },
+	{ 0x4c78, 0xe3380080 },
+	{ 0x4c78, 0x63b80080 },
+	{ 0x4c78, 0xa3780080 },
+	{ 0x4c78, 0x23f80080 },
+	{ 0x4c78, 0xc3040080 },
+	{ 0x4c78, 0x43840080 },
+	{ 0x4c78, 0x11440080 },
+	{ 0x4c78, 0xe1c40080 },
+	{ 0x4c78, 0x61240080 },
+	{ 0x4c78, 0xa1a40080 },
+	{ 0x4c78, 0x21640080 },
+	{ 0x4c78, 0xc1e40080 },
+	{ 0x4c78, 0x41140080 },
+	{ 0x4c78, 0x81940080 },
+	{ 0x4c78, 0x24540080 },
+	{ 0x4c78, 0xc4d40080 },
+	{ 0x4c78, 0x44340080 },
+	{ 0x4c78, 0xe6b40080 },
+	{ 0x4c78, 0x66740080 },
+	{ 0x4c78, 0xa6f40080 },
+	{ 0x4c78, 0x260c0080 },
+	{ 0x4c78, 0xc68c0080 },
+	{ 0x4c78, 0x464c0080 },
+	{ 0x4c78, 0x86cc0080 },
+	{ 0x4c78, 0x062c0080 },
+	{ 0x4c78, 0x52ac0080 },
+	{ 0x4c78, 0x926c0080 },
+	{ 0x4c78, 0x12ec0080 },
+	{ 0x4c78, 0xe21c0080 },
+	{ 0x4c78, 0x629c0080 },
+	{ 0x4c78, 0xa25c0080 },
+	{ 0x4c78, 0x22dc0080 },
+	{ 0x4c78, 0xc23c0080 },
+	{ 0x4c78, 0x42bc0080 },
+	{ 0x4c78, 0x827c0080 },
+	{ 0x4c78, 0x02fc0080 },
+	{ 0x4c78, 0xdf020080 },
+	{ 0x4c78, 0xdf820080 },
+	{ 0x4c78, 0xdf420080 },
+	{ 0x4c78, 0xdfc20080 },
+	{ 0x4c78, 0xdf220080 },
+	{ 0x4c78, 0xdfa20080 },
+	{ 0x4c78, 0x5f620080 },
+	{ 0x4c78, 0x9fe20080 },
+	{ 0x4c78, 0x1f120080 },
+	{ 0x4c78, 0xef920080 },
+	{ 0x4c78, 0x6f520080 },
+	{ 0x4c78, 0xafd20080 },
+	{ 0x4c78, 0x2f320080 },
+	{ 0x4c78, 0xcfb20080 },
+	{ 0x4c78, 0x4f720080 },
+	{ 0x4c78, 0x8ff20080 },
+	{ 0x4c78, 0x0f0a0080 },
+	{ 0x4c78, 0xf78a0080 },
+	{ 0x4c78, 0x774a0080 },
+	{ 0x4c78, 0xb7ca0080 },
+	{ 0x4c78, 0x372a0080 },
+	{ 0x4c78, 0xd7aa0080 },
+	{ 0x4c78, 0x576a0080 },
+	{ 0x4c78, 0x97ea0080 },
+	{ 0x4c78, 0x171a0080 },
+	{ 0x4c78, 0xe79a0080 },
+	{ 0x4c78, 0x675a0080 },
+	{ 0x4c78, 0xa7da0080 },
+	{ 0x4c78, 0x633a0080 },
+	{ 0x4c78, 0xa3ba0080 },
+	{ 0x4c78, 0x237a0080 },
+	{ 0x4c78, 0xc3fa0080 },
+	{ 0x4c78, 0x43060080 },
+	{ 0x4c78, 0x83860080 },
+	{ 0x4c78, 0x03460080 },
+	{ 0x4c78, 0xc5c60080 },
+	{ 0x4c78, 0x45260080 },
+	{ 0x4c78, 0x85a60080 },
+	{ 0x4c78, 0x11660080 },
+	{ 0x4c78, 0xe1e60080 },
+	{ 0x4c78, 0x61160080 },
+	{ 0x4c78, 0xa1960080 },
+	{ 0x4c78, 0x21560080 },
+	{ 0x4c78, 0xc1d60080 },
+	{ 0x4c78, 0x41360080 },
+	{ 0x4c78, 0x66b60080 },
+	{ 0x4c78, 0xa6760080 },
+	{ 0x4c78, 0x26f60080 },
+	{ 0x4c78, 0xc60e0080 },
+	{ 0x4c78, 0x468e0080 },
+	{ 0x4c78, 0x864e0080 },
+	{ 0x4c78, 0x12ce0080 },
+	{ 0x4c78, 0xe22e0080 },
+	{ 0x4c78, 0x62ae0080 },
+	{ 0x4c78, 0xa26e0080 },
+	{ 0x4c78, 0x22ee0080 },
+	{ 0x4c78, 0xc21e0080 },
+	{ 0x4c78, 0x429e0080 },
+	{ 0x4c78, 0x825e0080 },
+	{ 0x4c78, 0x02de0080 },
+	{ 0x4c78, 0x023e0080 },
+	{ 0x4c78, 0x02be0080 },
+	{ 0x4c78, 0x027e0080 },
+	{ 0x4c78, 0x02fe0080 },
+	{ 0x4c50, 0x69553422 },
+	{ 0x4c50, 0x69553420 },
+};
+
+const size_t s9082c_rf_init_seq_len = ARRAY_SIZE(s9082c_rf_init_seq);
+const size_t s9082c_mac_init_seq_len = ARRAY_SIZE(s9082c_mac_init_seq);
+const size_t s9082c_phy_init_seq_len = ARRAY_SIZE(s9082c_phy_init_seq);
+const size_t s9082c_agc_init_seq_len = ARRAY_SIZE(s9082c_agc_init_seq);
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
new file mode 100644
index 0000000..ec51c5a
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
+ */
+
+#ifndef __RTW8189E_TABLE_H__
+#define __RTW8189E_TABLE_H__
+
+extern const struct rtw_table rtw8189e_mac_tbl;
+extern const struct rtw_table rtw8189e_agc_tbl;
+extern const struct rtw_table rtw8189e_bb_tbl;
+extern const struct rtw_table rtw8189e_bb_pg_tbl;
+extern const struct rtw_table rtw8189e_rf_a_tbl;
+extern const struct rtw_table rtw8189e_txpwr_lmt_tbl;
+
+enum s9082c_phy_op {
+	S9082C_OP_BB_SET = 0,
+	S9082C_OP_BB_ND  = 1,
+	S9082C_OP_DIRECT = 2,
+};
+
+struct s9082c_rf_step {
+	u32 val;
+	u8 sleep_ms;
+};
+
+struct s9082c_mac_step {
+	u16 reg;
+	u32 val;
+};
+
+struct s9082c_phy_step {
+	u8 op;
+	u16 reg;
+	u32 mask;
+	u32 val;
+};
+
+struct s9082c_agc_step {
+	u16 reg;
+	u32 val;
+};
+
+extern const struct s9082c_rf_step s9082c_rf_init_seq[];
+extern const size_t s9082c_rf_init_seq_len;
+extern const struct s9082c_mac_step s9082c_mac_init_seq[];
+extern const size_t s9082c_mac_init_seq_len;
+extern const struct s9082c_phy_step s9082c_phy_init_seq[];
+extern const size_t s9082c_phy_init_seq_len;
+extern const struct s9082c_agc_step s9082c_agc_init_seq[];
+extern const size_t s9082c_agc_init_seq_len;
+
+#endif
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
  2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
@ 2026-12-01 21:11 ` Alex Novak
  2026-12-02  8:21   ` Luka Gejak
                     ` (2 more replies)
  2026-12-01 21:11 ` [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver Alex Novak
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: Alex Novak @ 2026-12-01 21:11 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless

Add chip definitions, 32-byte TX and 24-byte RX descriptor helpers,
PHY status parsing, power sequences, and S9082C bit-reversed
MAC/BB/RF, IQK/LCK calibration, and SDIO register mapping callbacks for
Realtek RTL8189E and SmartChip S9082C.

Signed-off-by: Alex Novak <neur-alx@agentmail.to>
---
 drivers/net/wireless/realtek/rtw88/Kconfig    |    4 +
 drivers/net/wireless/realtek/rtw88/Makefile   |    3 +
 drivers/net/wireless/realtek/rtw88/rtw8189e.c | 1425 +++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8189e.h |   20 +
 4 files changed, 1452 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.c
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.h

diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
index e1f40d6..58916f6 100644
--- a/drivers/net/wireless/realtek/rtw88/Kconfig
+++ b/drivers/net/wireless/realtek/rtw88/Kconfig
@@ -32,6 +32,10 @@ config RTW88_8822C
 config RTW88_8723X
 	tristate
 
+config RTW88_8189E
+	tristate
+	select RTW88_8723X
+
 config RTW88_8703B
 	tristate
 	select RTW88_8723X
diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
index 6889b37..8a6ef91 100644
--- a/drivers/net/wireless/realtek/rtw88/Makefile
+++ b/drivers/net/wireless/realtek/rtw88/Makefile
@@ -52,6 +52,9 @@ rtw88_8723x-objs		:= rtw8723x.o
 obj-$(CONFIG_RTW88_8703B)	+= rtw88_8703b.o
 rtw88_8703b-objs		:= rtw8703b.o rtw8703b_tables.o
 
+obj-$(CONFIG_RTW88_8189E)	+= rtw88_8189e.o
+rtw88_8189e-objs		:= rtw8189e.o rtw8189e_table.o
+
 obj-$(CONFIG_RTW88_8723CS)	+= rtw88_8723cs.o
 rtw88_8723cs-objs		:= rtw8723cs.o
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e.c b/drivers/net/wireless/realtek/rtw88/rtw8189e.c
new file mode 100644
index 0000000..9032d94
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8189e.c
@@ -0,0 +1,1425 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
+ */
+
+#include <linux/bitrev.h>
+#include <linux/module.h>
+#include "main.h"
+#include "mac.h"
+#include "phy.h"
+#include "reg.h"
+#include "rx.h"
+#include "sdio.h"
+#include "tx.h"
+#include "rtw8723x.h"
+#include "rtw8189e.h"
+#include "rtw8189e_table.h"
+
+struct rtw8189e_tx_desc {
+	__le32 w0;
+	__le32 w1;
+	__le32 w2;
+	__le32 w3;
+	__le32 w4;
+	__le32 w5;
+	__le32 w6;
+	__le32 w7;
+} __packed;
+
+/* 8188E/8189E 32-byte TX descriptor (w0..w7) differences vs 40-byte rtw88 */
+#define RTW8189E_TXD_W0_FS			BIT(27)
+#define RTW8189E_TXD_W0_OWN			BIT(31)
+#define RTW8189E_TXD_W1_MACID			GENMASK(5, 0)
+#define RTW8189E_TXD_W1_RATE_ID			GENMASK(19, 16)
+#define RTW8189E_TXD_W1_NAVUSEHDR		BIT(20)
+#define RTW8189E_TXD_W1_PKT_OFFSET		GENMASK(30, 26)
+#define RTW8189E_TXD_W3_SW_SEQ			GENMASK(27, 16)
+#define RTW8189E_TXD_W3_EN_HWSEQ		BIT(31)
+#define RTW8189E_TXD_W4_RTSRATE			GENMASK(4, 0)
+#define RTW8189E_TXD_W4_HW_SSN_SEL		GENMASK(7, 6)
+#define RTW8189E_TXD_W4_USE_RATE		BIT(8)
+#define RTW8189E_TXD_W4_DISDATAFB		BIT(10)
+#define RTW8189E_TXD_W4_USE_RTS			BIT(12)
+#define RTW8189E_TXD_W4_HW_RTS_EN		BIT(13)
+#define RTW8189E_TXD_W4_DATA_STBC		GENMASK(23, 22)
+#define RTW8189E_TXD_W4_DATA_SHORT		BIT(24)
+#define RTW8189E_TXD_W4_DATA_BW			BIT(25)
+#define RTW8189E_TXD_W4_RTS_SHORT		BIT(26)
+#define RTW8189E_TXD_W5_DATARATE		GENMASK(5, 0)
+#define RTW8189E_TXD_W5_SGI			BIT(6)
+#define RTW8189E_TXD_W5_DATARATE_FB_LIMIT	GENMASK(12, 8)
+#define RTW8189E_TXD_W5_RTS_FB_LIMIT		GENMASK(16, 13)
+#define RTW8189E_TXD_W6_MAX_AGG_NUM		GENMASK(15, 11)
+#define RTW8189E_TXD_W7_SW_DEFINE		GENMASK(27, 16)
+
+/* 8188E/8189E 24-byte RX descriptor (w0..w5) differences */
+#define RTW8189E_RXD_W1_MACID			GENMASK(4, 0)
+#define RTW8189E_RXD_W3_RX_RATE			GENMASK(5, 0)
+#define RTW8189E_RXD_W3_BW			BIT(9)
+#define RTW8189E_RXD_W3_RPT_SEL			GENMASK(15, 14)
+
+#define S9082C_SDIO_LOCAL_BASE			0x2000
+#define S9082C_SDIO_MAC_OFFSET			0x4000
+#define S9082C_HSSI1_PI_EN			BIT(8)
+#define S9082C_HSSI2_ADDR_MSK			GENMASK(30, 23)
+#define S9082C_HSSI2_TRIG			BIT(31)
+#define S9082C_SIPI_ADDR_MSK			GENMASK(27, 20)
+#define S9082C_RFCFGCH_CH_MSK			GENMASK(9, 0)
+#define S9082C_RFCFGCH_BW_MSK			GENMASK(11, 10)
+#define S9082C_RFCFGCH_TX_MSK			GENMASK(14, 12)
+#define S9082C_XTAL_CAP_MSK			GENMASK(5, 0)
+#define S9082C_XTAL_CAP_LO_MSK			GENMASK(5, 0)
+#define S9082C_XTAL_CAP_HI_MSK			GENMASK(11, 6)
+#define S9082C_XTAL_CTRL_MSK			GENMASK(22, 11)
+#define S9082C_CCK_AGC_LNA_MSK			GENMASK(7, 5)
+#define S9082C_CCK_AGC_VGA_MSK			GENMASK(4, 0)
+#define S9082C_OFDM_GAIN_MSK			GENMASK(5, 0)
+#define S9082C_OFDM_PWDB_MSK			GENMASK(7, 1)
+#define S9082C_OFDM_BW40_RES_MSK		GENMASK(11, 10)
+#define S9082C_MAC_BW40_OFFSET_MSK		GENMASK(7, 5)
+#define S9082C_BB_BW40_OFFSET_MSK		GENMASK(1, 0)
+#define S9082C_BB_PWR_SAV5_BW40_MSK		GENMASK(27, 26)
+#define S9082C_IQK_TX0_EXT_A_BIT		BIT(24)
+#define S9082C_IQK_TX0_EXT_C_BIT		BIT(26)
+#define S9082C_IQK_A_PI_MOD_MSK			GENMASK(31, 8)
+#define S9082C_IQK_RX_PATH_MSK			GENMASK(27, 24)
+
+static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8189e[] = {
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_WRITE, BIT(0), 0},
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), 0},
+	{0xFFFF,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 0,
+	 RTW_PWR_CMD_END, 0, 0},
+};
+
+static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8189e[] = {
+	{0x0006,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
+	{0x0002,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(0) | BIT(1), 0},
+	{0x0026,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(7), BIT(7)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(7), 0},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(4) | BIT(3), 0},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_POLLING, BIT(0), 0},
+	{0x0023,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(4), 0},
+	{0xFFFF,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 0,
+	 RTW_PWR_CMD_END, 0, 0},
+};
+
+static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8189e[] = {
+	{0x001F,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0xFF, 0},
+	{0x0023,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(4), BIT(4)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_POLLING, BIT(1), 0},
+	{0xFFFF,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 0,
+	 RTW_PWR_CMD_END, 0, 0},
+};
+
+static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8189e[] = {
+	{0x0026,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(7), BIT(7)},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)},
+	{0x0007,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0xFF, 0},
+	{0x0041,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, BIT(4), 0},
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_POLLING, BIT(1), 0},
+	{0xFFFF,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 0,
+	 RTW_PWR_CMD_END, 0, 0},
+};
+
+static const struct rtw_pwr_seq_cmd * const card_enable_flow_8189e[] = {
+	trans_carddis_to_cardemu_8189e,
+	trans_cardemu_to_act_8189e,
+	NULL
+};
+
+static const struct rtw_pwr_seq_cmd * const card_disable_flow_8189e[] = {
+	trans_act_to_cardemu_8189e,
+	trans_cardemu_to_carddis_8189e,
+	NULL
+};
+
+static const struct rtw_pwr_seq_cmd s9082c_enable_seq[] = {
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_WRITE, 0x08, 0x00},
+	{0x0086,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_SDIO_MSK,
+	 RTW_PWR_ADDR_SDIO,
+	 RTW_PWR_CMD_POLLING, 0x04, 0x04},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x18, 0x00},
+	{0x0006,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_POLLING, 0x40, 0x40},
+	{0x0002,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0xC0, 0x00},
+	{0x0026,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x01, 0x01},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x01, 0x00},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x18, 0x00},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x80, 0x80},
+	{0x0005,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_POLLING, 0x80, 0x00},
+	{0x0023,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 RTW_PWR_ADDR_MAC,
+	 RTW_PWR_CMD_WRITE, 0x08, 0x00},
+	{0xFFFF,
+	 RTW_PWR_CUT_ALL_MSK,
+	 RTW_PWR_INTF_ALL_MSK,
+	 0,
+	 RTW_PWR_CMD_END, 0, 0},
+};
+
+static const struct rtw_pwr_seq_cmd * const s9082c_card_enable_flow[] = {
+	s9082c_enable_seq,
+	NULL
+};
+
+/* S9082C locks up on standard card disable; leave power down empty */
+static const struct rtw_pwr_seq_cmd * const s9082c_card_disable_flow[] = {
+	NULL
+};
+
+static const struct rtw_page_table page_table_8189e[] = {
+	{0, 9, 0, 0, 1},
+	{0, 9, 0, 0, 1},
+	{0, 9, 0, 0, 1},
+	{0, 9, 0, 0, 1},
+	{0, 9, 0, 0, 1},
+};
+
+static const struct rtw_rqpn rqpn_table_8189e[] = {
+	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
+	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
+	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
+	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
+	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
+	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
+	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
+	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
+	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
+	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
+	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
+	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
+	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
+	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
+	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
+};
+
+static const struct rtw_rfe_def rtw8189e_rfe_defs[] = {
+	[0] = { .phy_pg_tbl = &rtw8189e_bb_pg_tbl,
+		.txpwr_lmt_tbl = &rtw8189e_txpwr_lmt_tbl, },
+};
+
+static u32 s9082c_bitrev32(u32 val)
+{
+	return (u32)bitrev8(val) |
+	       ((u32)bitrev8(val >> 8) << 8) |
+	       ((u32)bitrev8(val >> 16) << 16) |
+	       ((u32)bitrev8(val >> 24) << 24);
+}
+
+static bool s9082c_is_nd_bbreg(u32 addr)
+{
+	u32 off = addr & 0x0fff;
+
+	switch (off) {
+	case 0x824:
+	case 0x82c:
+	case 0xa20:
+	case 0xa24:
+	case 0xa28:
+	case 0xc4c:
+	case 0xc50:
+	case 0xc58:
+	case 0xc80:
+	case 0xc88:
+	case 0xc94:
+	case 0xe00:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static u32 s9082c_read_bbreg(struct rtw_dev *rtwdev, u32 addr, u32 mask)
+{
+	u32 orig;
+
+	orig = rtw_read32(rtwdev, addr);
+	if (!s9082c_is_nd_bbreg(addr))
+		orig = s9082c_bitrev32(orig);
+
+	if (mask != MASKDWORD)
+		orig = (orig & mask) >> __ffs(mask);
+
+	return orig;
+}
+
+static void s9082c_write_bbreg(struct rtw_dev *rtwdev, u32 addr, u32 mask,
+			       u32 data)
+{
+	bool is_nd = s9082c_is_nd_bbreg(addr);
+	u32 orig;
+
+	if (mask != MASKDWORD) {
+		orig = rtw_read32(rtwdev, addr);
+		if (!is_nd)
+			orig = s9082c_bitrev32(orig);
+		data = (orig & ~mask) | ((data << __ffs(mask)) & mask);
+	}
+
+	if (!is_nd)
+		data = s9082c_bitrev32(data);
+	rtw_write32(rtwdev, addr, data);
+}
+
+static u32 s9082c_read_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
+			  u32 addr, u32 mask)
+{
+	const struct rtw_rf_sipi_addr *sipi;
+	u32 tmplong, tmplong2, val;
+	u8 pi_en;
+
+	sipi = &rtwdev->chip->rf_sipi_read_addr[rf_path];
+	addr &= 0xff;
+
+	tmplong = rtw_read32(rtwdev, sipi->hssi_2) & ~S9082C_HSSI2_TRIG;
+	tmplong2 = tmplong | S9082C_HSSI2_TRIG;
+	u32p_replace_bits(&tmplong2, addr, S9082C_HSSI2_ADDR_MSK);
+
+	rtw_write32(rtwdev, sipi->hssi_2, tmplong);
+	usleep_range(10, 20);
+	rtw_write32(rtwdev, sipi->hssi_2, tmplong2);
+	usleep_range(110, 150);
+
+	pi_en = s9082c_read_bbreg(rtwdev, sipi->hssi_1, S9082C_HSSI1_PI_EN);
+	if (pi_en)
+		val = s9082c_read_bbreg(rtwdev, sipi->lssi_read_pi, RFREG_MASK);
+	else
+		val = s9082c_read_bbreg(rtwdev, sipi->lssi_read, RFREG_MASK);
+
+	if (mask != RFREG_MASK)
+		val = (val & mask) >> __ffs(mask);
+
+	return val;
+}
+
+static bool s9082c_write_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
+			    u32 addr, u32 mask, u32 data)
+{
+	const struct rtw_chip_info *chip = rtwdev->chip;
+	u32 orig, val;
+
+	addr &= 0xff;
+	if (mask != RFREG_MASK) {
+		orig = s9082c_read_rf(rtwdev, rf_path, addr, RFREG_MASK);
+		data = (orig & ~mask) | ((data << __ffs(mask)) & mask);
+	}
+
+	val = u32_encode_bits(addr, S9082C_SIPI_ADDR_MSK) | (data & RFREG_MASK);
+	s9082c_write_bbreg(rtwdev, chip->rf_sipi_addr[rf_path], MASKDWORD, val);
+
+	return true;
+}
+
+static void rtw8189e_fill_txdesc(struct rtw_dev *rtwdev,
+				 struct rtw_tx_pkt_info *pkt_info,
+				 struct sk_buff *skb)
+{
+	struct rtw8189e_tx_desc *tx_desc = (struct rtw8189e_tx_desc *)skb->data;
+	bool bw40 = pkt_info->bw == RTW_CHANNEL_WIDTH_40;
+
+	tx_desc->w0 = le32_encode_bits(pkt_info->tx_pkt_size, RTW_TX_DESC_W0_TXPKTSIZE) |
+		      le32_encode_bits(pkt_info->offset, RTW_TX_DESC_W0_OFFSET) |
+		      le32_encode_bits(pkt_info->bmc, RTW_TX_DESC_W0_BMC) |
+		      le32_encode_bits(pkt_info->ls, RTW_TX_DESC_W0_LS) |
+		      le32_encode_bits(1, RTW8189E_TXD_W0_FS) |
+		      le32_encode_bits(1, RTW8189E_TXD_W0_OWN);
+
+	tx_desc->w1 = le32_encode_bits(pkt_info->mac_id, RTW8189E_TXD_W1_MACID) |
+		      le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) |
+		      le32_encode_bits(pkt_info->rate_id, RTW8189E_TXD_W1_RATE_ID) |
+		      le32_encode_bits(pkt_info->nav_use_hdr, RTW8189E_TXD_W1_NAVUSEHDR) |
+		      le32_encode_bits(pkt_info->sec_type, RTW_TX_DESC_W1_SEC_TYPE) |
+		      le32_encode_bits(pkt_info->pkt_offset, RTW8189E_TXD_W1_PKT_OFFSET);
+
+	tx_desc->w2 = le32_encode_bits(pkt_info->ampdu_en, RTW_TX_DESC_W2_AGG_EN) |
+		      le32_encode_bits(pkt_info->report, RTW_TX_DESC_W2_SPE_RPT) |
+		      le32_encode_bits(pkt_info->ampdu_density, RTW_TX_DESC_W2_AMPDU_DEN) |
+		      le32_encode_bits(pkt_info->bt_null, RTW_TX_DESC_W2_BT_NULL);
+
+	tx_desc->w3 = le32_encode_bits(pkt_info->seq, RTW8189E_TXD_W3_SW_SEQ) |
+		      le32_encode_bits(pkt_info->en_hwseq, RTW8189E_TXD_W3_EN_HWSEQ);
+
+	tx_desc->w4 = le32_encode_bits(pkt_info->hw_ssn_sel, RTW8189E_TXD_W4_HW_SSN_SEL) |
+		      le32_encode_bits(pkt_info->use_rate, RTW8189E_TXD_W4_USE_RATE) |
+		      le32_encode_bits(pkt_info->dis_rate_fallback, RTW8189E_TXD_W4_DISDATAFB) |
+		      le32_encode_bits(pkt_info->rts, RTW8189E_TXD_W4_USE_RTS) |
+		      le32_encode_bits(pkt_info->rts, RTW8189E_TXD_W4_HW_RTS_EN) |
+		      le32_encode_bits(pkt_info->stbc, RTW8189E_TXD_W4_DATA_STBC) |
+		      le32_encode_bits(pkt_info->short_gi, RTW8189E_TXD_W4_DATA_SHORT) |
+		      le32_encode_bits(bw40, RTW8189E_TXD_W4_DATA_BW);
+
+	tx_desc->w5 = le32_encode_bits(pkt_info->rate, RTW8189E_TXD_W5_DATARATE) |
+		      le32_encode_bits(pkt_info->short_gi && pkt_info->rate >= DESC_RATEMCS0,
+				       RTW8189E_TXD_W5_SGI) |
+		      le32_encode_bits(0xf, RTW8189E_TXD_W5_RTS_FB_LIMIT);
+
+	if (rtwdev->chip->old_datarate_fb_limit)
+		tx_desc->w5 |= le32_encode_bits(0x1f, RTW8189E_TXD_W5_DATARATE_FB_LIMIT);
+
+	tx_desc->w6 = le32_encode_bits(pkt_info->ampdu_factor,
+				       RTW8189E_TXD_W6_MAX_AGG_NUM);
+
+	tx_desc->w7 = le32_encode_bits(pkt_info->sn, RTW8189E_TXD_W7_SW_DEFINE);
+
+	if (pkt_info->rts) {
+		tx_desc->w4 |= le32_encode_bits(DESC_RATE24M, RTW8189E_TXD_W4_RTSRATE) |
+			       le32_encode_bits(1, RTW8189E_TXD_W4_RTS_SHORT);
+	}
+}
+
+static int rtw8189e_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
+				  struct rtw_rx_pkt_stat *pkt_stat,
+				  struct ieee80211_rx_status *rx_status)
+{
+	u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz;
+	struct rtw_rx_desc *rx_desc = rx_desc8;
+	struct ieee80211_hdr *hdr;
+	u32 enc_type, swdec;
+	void *phy_status;
+
+	memset(pkt_stat, 0, sizeof(*pkt_stat));
+
+	pkt_stat->pkt_len = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PKT_LEN);
+	pkt_stat->crc_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_CRC32);
+	pkt_stat->icv_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ICV_ERR);
+	pkt_stat->drv_info_sz = le32_get_bits(rx_desc->w0,
+					      RTW_RX_DESC_W0_DRV_INFO_SIZE);
+	enc_type = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ENC_TYPE);
+	pkt_stat->shift = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SHIFT);
+	pkt_stat->phy_status = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PHYST);
+	swdec = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SWDEC);
+	pkt_stat->decrypted = !swdec && enc_type != RX_DESC_ENC_NONE;
+
+	pkt_stat->cam_id = le32_get_bits(rx_desc->w1, RTW8189E_RXD_W1_MACID);
+
+	pkt_stat->rate = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_RX_RATE);
+	pkt_stat->bw = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_BW) ?
+		       RTW_CHANNEL_WIDTH_40 : RTW_CHANNEL_WIDTH_20;
+	pkt_stat->is_c2h = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_RPT_SEL) != 0;
+
+	pkt_stat->tsf_low = le32_get_bits(rx_desc->w5, RTW_RX_DESC_W5_TSFL);
+
+	if (unlikely(pkt_stat->rate >= DESC_RATE_MAX))
+		return -EINVAL;
+
+	if (unlikely(pkt_stat->drv_info_sz &&
+		     pkt_stat->drv_info_sz != PHY_STATUS_SIZE))
+		return -EINVAL;
+
+	if (unlikely(pkt_stat->phy_status && !pkt_stat->drv_info_sz))
+		return -EINVAL;
+
+	if (unlikely(pkt_stat->pkt_len > IEEE80211_MAX_MPDU_LEN_VHT_11454))
+		return -EINVAL;
+
+	pkt_stat->drv_info_sz *= 8;
+
+	if (pkt_stat->is_c2h)
+		return 0;
+
+	if (unlikely(pkt_stat->pkt_len <= FCS_LEN))
+		return -EINVAL;
+
+	phy_status = rx_desc8 + desc_sz + pkt_stat->shift;
+	hdr = phy_status + pkt_stat->drv_info_sz;
+	pkt_stat->hdr = hdr;
+
+	if (pkt_stat->phy_status)
+		rtwdev->chip->ops->query_phy_status(rtwdev, phy_status, pkt_stat);
+
+	rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status);
+
+	return 0;
+}
+
+static void rtw8189e_query_phy_status_cck(struct rtw_dev *rtwdev, void *phy_raw,
+					  struct rtw_rx_pkt_stat *pkt_stat)
+{
+	struct phy_status_8723x *phy_status = phy_raw;
+	u8 lna_idx = u8_get_bits(phy_status->cck_agc_rpt_ofdm_cfosho_a,
+				 S9082C_CCK_AGC_LNA_MSK);
+	u8 vga_idx = u8_get_bits(phy_status->cck_agc_rpt_ofdm_cfosho_a,
+				 S9082C_CCK_AGC_VGA_MSK);
+	s8 min_rx_power = -120;
+	s8 rx_power;
+
+	rx_power = -96 + (vga_idx * 2) - (lna_idx * 6);
+
+	pkt_stat->bw = RTW_CHANNEL_WIDTH_20;
+	pkt_stat->rx_power[RF_PATH_A] = rx_power;
+	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
+	pkt_stat->signal_power = max(pkt_stat->rx_power[RF_PATH_A], min_rx_power);
+	rtwdev->dm_info.rssi[RF_PATH_A] = pkt_stat->rssi;
+}
+
+static void rtw8189e_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw,
+					   struct rtw_rx_pkt_stat *pkt_stat)
+{
+	struct phy_status_8723x *phy_status = phy_raw;
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	s8 val_s8;
+
+	val_s8 = u8_get_bits(phy_status->path_agc[RF_PATH_A].gain,
+			     S9082C_OFDM_GAIN_MSK);
+	pkt_stat->rx_power[RF_PATH_A] = (val_s8 * 2) - 110;
+	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
+	pkt_stat->rx_snr[RF_PATH_A] = phy_status->path_rxsnr[RF_PATH_A];
+
+	val_s8 = u8_get_bits(phy_status->cck_sig_qual_ofdm_pwdb_all,
+			     S9082C_OFDM_PWDB_MSK);
+	pkt_stat->signal_power = val_s8 - 110;
+
+	pkt_stat->rx_evm[RF_PATH_A] = phy_status->stream_rxevm[RF_PATH_A];
+	pkt_stat->cfo_tail[RF_PATH_A] = phy_status->path_cfotail[RF_PATH_A];
+
+	dm_info->curr_rx_rate = pkt_stat->rate;
+	dm_info->rssi[RF_PATH_A] = pkt_stat->rssi;
+	dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A] >> 1;
+	dm_info->cfo_tail[RF_PATH_A] = (pkt_stat->cfo_tail[RF_PATH_A] * 5) >> 1;
+
+	val_s8 = (s8)pkt_stat->rx_evm[RF_PATH_A];
+	val_s8 = clamp_t(s8, -val_s8 >> 1, 0, 64);
+	val_s8 &= S9082C_OFDM_GAIN_MSK;
+	dm_info->rx_evm_dbm[RF_PATH_A] = val_s8;
+}
+
+static void rtw8189e_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status,
+				      struct rtw_rx_pkt_stat *pkt_stat)
+{
+	if (pkt_stat->rate <= DESC_RATE11M)
+		rtw8189e_query_phy_status_cck(rtwdev, phy_status, pkt_stat);
+	else
+		rtw8189e_query_phy_status_ofdm(rtwdev, phy_status, pkt_stat);
+}
+
+static void rtw8189e_phy_set_param(struct rtw_dev *rtwdev)
+{
+	u8 xtal_cap = u8_get_bits(rtwdev->efuse.crystal_cap,
+				  S9082C_XTAL_CAP_MSK);
+	u32 xtal_val;
+
+	/* power on BB/RF domain */
+	rtw_write16_set(rtwdev, REG_SYS_FUNC_EN,
+			BIT_FEN_EN_25_1 | BIT_FEN_BB_GLB_RST | BIT_FEN_BB_RSTB);
+	rtw_write8_set(rtwdev, REG_RF_CTRL,
+		       BIT_RF_EN | BIT_RF_RSTB | BIT_RF_SDM_RSTB);
+	rtw_write8(rtwdev, REG_AFE_CTRL1 + 1, 0x80);
+
+	rtw_phy_load_tables(rtwdev);
+
+	rtw_write32_clr(rtwdev, REG_RCR, BIT_RCR_ADF);
+	rtw_write8_set(rtwdev, REG_HIQ_NO_LMT_EN, 0xff);
+	xtal_val = u32_encode_bits(xtal_cap, S9082C_XTAL_CAP_LO_MSK) |
+		   u32_encode_bits(xtal_cap, S9082C_XTAL_CAP_HI_MSK);
+	rtw_write32_mask(rtwdev, REG_AFE_XTAL_CTRL, BIT_MASK_XTAL, xtal_val);
+
+	rtw_phy_init(rtwdev);
+}
+
+static void rtw8189e_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
+{
+	u32 rf_cfgch;
+
+	rf_cfgch = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
+	rf_cfgch &= ~(RFCFGCH_CHANNEL_MASK | RFCFGCH_BW_MASK);
+	rf_cfgch |= u32_encode_bits(channel, RFCFGCH_CHANNEL_MASK);
+
+	switch (bw) {
+	case RTW_CHANNEL_WIDTH_20:
+		rf_cfgch |= RFCFGCH_BW_20M;
+		break;
+	case RTW_CHANNEL_WIDTH_40:
+		rf_cfgch |= RFCFGCH_BW_40M;
+		break;
+	default:
+		break;
+	}
+
+	rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, rf_cfgch);
+}
+
+static void rtw8189e_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,
+				    u8 primary_ch_idx)
+{
+	switch (bw) {
+	case RTW_CHANNEL_WIDTH_20:
+		rtw_write32_mask(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x0);
+		rtw_write32_mask(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x0);
+		break;
+	case RTW_CHANNEL_WIDTH_40:
+		rtw_write32_mask(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x1);
+		rtw_write32_mask(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x1);
+		rtw_write32_mask(rtwdev, REG_CCK0_SYS, BIT_CCK_SIDE_BAND,
+				 primary_ch_idx == RTW_SC_20_UPPER ? 1 : 0);
+		rtw_write32_mask(rtwdev, REG_OFDM_FA_RSTD_11N,
+				 S9082C_OFDM_BW40_RES_MSK,
+				 primary_ch_idx == RTW_SC_20_UPPER ? 2 : 1);
+		break;
+	default:
+		break;
+	}
+}
+
+static void rtw8189e_set_channel(struct rtw_dev *rtwdev, u8 channel,
+				 u8 bandwidth, u8 primary_chan_idx)
+{
+	rtw8189e_set_channel_bb(rtwdev, channel, bandwidth, primary_chan_idx);
+	rtw8189e_set_channel_rf(rtwdev, channel, bandwidth);
+}
+
+static void rtw8189e_phy_calibration(struct rtw_dev *rtwdev)
+{
+	rtw8723x_lck(rtwdev);
+}
+
+static int s9082c_mac_init(struct rtw_dev *rtwdev)
+{
+	size_t i;
+
+	for (i = 0; i < s9082c_mac_init_seq_len; i++) {
+		rtw_write32(rtwdev, s9082c_mac_init_seq[i].reg,
+			    s9082c_mac_init_seq[i].val);
+		udelay(1);
+	}
+
+	rtw_write16(rtwdev, 0x04ca, 0xe0e0);
+	rtw_write16_set(rtwdev, REG_APS_FSMCO, 0x0008);
+	rtw_write16_set(rtwdev, REG_CR, 0x60fc);
+
+	return 0;
+}
+
+static void s9082c_set_rf_path_switch(struct rtw_dev *rtwdev, bool is_main)
+{
+	rtw_write8_set(rtwdev, 0x004e, 0x01);
+	s9082c_write_bbreg(rtwdev, 0x0878, 0x2000, 1);
+	s9082c_write_bbreg(rtwdev, 0x0870, 0x300, 0);
+	rtw_write16(rtwdev, 0x0914, 0x4080);
+	s9082c_write_bbreg(rtwdev, 0x0860, 0x7000, is_main ? 1 : 0);
+	s9082c_write_bbreg(rtwdev, 0x0864, 0x38, is_main ? 1 : 0);
+}
+
+static int s9082c_mac_postinit(struct rtw_dev *rtwdev)
+{
+	u32 rcr = BIT_APM | BIT_AM | BIT_AB | BIT_CBSSID_DATA | BIT_CBSSID_BCN |
+		  BIT_AMF | BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | BIT_APP_ICV |
+		  BIT_APP_MIC;
+	u8 val8;
+
+	/* Restore S9082C bit-reversed buffer boundary & RX driver info size */
+	rtw_write8(rtwdev, REG_BCNQ_BDNY, 0x1f);
+	rtw_write8(rtwdev, REG_MGQ_BDNY, 0x1f);
+	rtw_write8(rtwdev, REG_WMAC_LBK_BF_HD, 0x1f);
+	rtw_write8(rtwdev, REG_TRXFF_BNDY, 0x1f);
+	rtw_write8(rtwdev, REG_DWBCN0_CTRL + 1, 0xf8);
+	rtw_write8(rtwdev, REG_RX_DRVINFO_SZ, 0x20);
+
+	/* WMAC RCR, RX filter map & retry/TX-report controls (bit-reversed) */
+	rtw_write32(rtwdev, REG_RCR, s9082c_bitrev32(rcr));
+	rtw_write16(rtwdev, REG_RXFLTMAP1, 0x2000);
+	rtw_write16(rtwdev, REG_RXFLTMAP0, 0xffff);
+	rtw_write16(rtwdev, REG_RXFLTMAP2, 0xffff);
+
+	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 1, 0xf0);
+	rtw_write16(rtwdev, REG_TX_RPT_TIME, 0xbc0f);
+	val8 = rtw_read8(rtwdev, 0x04d3);
+	rtw_write8(rtwdev, 0x04d3, (val8 & ~0x01) | 0x80);
+
+	rtw_write16(rtwdev, REG_TXDMA_OFFSET_CHK,
+		    (rtw_read16(rtwdev, REG_TXDMA_OFFSET_CHK) & ~BIT_DROP_DATA_EN) |
+		    0x4000);
+	rtw_write8_set(rtwdev, REG_CR, 0x03);
+
+	return 0;
+}
+
+static void s9082c_phy_set_param(struct rtw_dev *rtwdev)
+{
+	u32 cap = u8_get_bits(rtwdev->efuse.crystal_cap, S9082C_XTAL_CAP_MSK);
+	size_t i;
+
+	rtw_write16_set(rtwdev, REG_SYS_FUNC_EN, 0x4c0);
+	rtw_write8(rtwdev, REG_RF_CTRL, 0xe0);
+	rtw_write8(rtwdev, REG_SYS_FUNC_EN, 0xc7);
+
+	for (i = 0; i < s9082c_phy_init_seq_len; i++) {
+		const struct s9082c_phy_step *step = &s9082c_phy_init_seq[i];
+
+		if (step->op == S9082C_OP_DIRECT) {
+			rtw_write32(rtwdev, step->reg, step->val);
+		} else if (step->op == S9082C_OP_BB_ND) {
+			u32 orig = rtw_read32(rtwdev, step->reg);
+			u32 shift = __ffs(step->mask);
+			u32 data;
+
+			data = (orig & ~step->mask) |
+			       ((step->val << shift) & step->mask);
+			rtw_write32(rtwdev, step->reg, data);
+		} else {
+			s9082c_write_bbreg(rtwdev, step->reg, step->mask,
+					   step->val);
+		}
+		udelay(1);
+	}
+
+	for (i = 0; i < s9082c_agc_init_seq_len; i++) {
+		rtw_write32(rtwdev, s9082c_agc_init_seq[i].reg,
+			    s9082c_agc_init_seq[i].val);
+		udelay(1);
+	}
+
+	/* Set crystal cap before the XTAL PLL quirk (0x0024 mask overlaps 0x0026) */
+	cap = u32_encode_bits(cap, S9082C_XTAL_CAP_LO_MSK) |
+	      u32_encode_bits(cap, S9082C_XTAL_CAP_HI_MSK);
+	s9082c_write_bbreg(rtwdev, REG_AFE_XTAL_CTRL, S9082C_XTAL_CTRL_MSK, cap);
+	rtw_write16(rtwdev, REG_AFE_XTAL_CTRL + 2, VAL_S9082C_PLL_FIX);
+
+	for (i = 0; i < s9082c_rf_init_seq_len; i++) {
+		rtw_write32(rtwdev, rtwdev->chip->rf_sipi_addr[RF_PATH_A],
+			    s9082c_rf_init_seq[i].val);
+		if (s9082c_rf_init_seq[i].sleep_ms)
+			msleep(s9082c_rf_init_seq[i].sleep_ms);
+		else
+			usleep_range(10, 20);
+	}
+
+	s9082c_set_rf_path_switch(rtwdev, true);
+	rtw_phy_init(rtwdev);
+}
+
+static void s9082c_set_channel(struct rtw_dev *rtwdev, u8 channel,
+			       u8 bw, u8 primary_chan_idx)
+{
+	struct rtw_hal *hal = &rtwdev->hal;
+	u8 bw_opmode, offset40 = 0;
+	u32 val;
+
+	if (!channel)
+		channel = 1;
+
+	/* Mask LCK trigger bit 15 so channel switches do not re-trigger VCO cal */
+	val = hal->ch_param[0];
+	if (!(val & S9082C_RFCFGCH_TX_MSK))
+		val |= 0x07400;
+	val &= ~BIT_LCK;
+	u32p_replace_bits(&val, channel, S9082C_RFCFGCH_CH_MSK);
+	hal->ch_param[0] = val;
+	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, val);
+
+	bw_opmode = rtw_read8(rtwdev, 0x0603);
+	if (bw == RTW_CHANNEL_WIDTH_20) {
+		rtw_write8(rtwdev, 0x0603, bw_opmode | 0x20);
+		s9082c_write_bbreg(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x00);
+		s9082c_write_bbreg(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x00);
+		u32p_replace_bits(&val, 0x3, S9082C_RFCFGCH_BW_MSK);
+	} else {
+		if (primary_chan_idx == RTW_SC_20_LOWER)
+			offset40 = 1;
+		else if (primary_chan_idx == RTW_SC_20_UPPER)
+			offset40 = 2;
+
+		rtw_write8(rtwdev, 0x0603, bw_opmode & ~0x20);
+		rtw_write8(rtwdev, 0x0442,
+			   (rtw_read8(rtwdev, 0x0442) & 0x09) |
+			   bitrev8(u8_encode_bits(offset40,
+						  S9082C_MAC_BW40_OFFSET_MSK)));
+		s9082c_write_bbreg(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x01);
+		s9082c_write_bbreg(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x01);
+		s9082c_write_bbreg(rtwdev, REG_CCK0_SYS, BIT_CCK_SIDE_BAND,
+				   u8_get_bits(offset40, BIT(1)));
+		s9082c_write_bbreg(rtwdev, REG_OFDM_FA_RSTD_11N,
+				   S9082C_OFDM_BW40_RES_MSK,
+				   u8_get_bits(offset40, S9082C_BB_BW40_OFFSET_MSK));
+		s9082c_write_bbreg(rtwdev, REG_BB_PWR_SAV5_11N,
+				   S9082C_BB_PWR_SAV5_BW40_MSK,
+				   offset40 == 1 ? 2 : 1);
+		u32p_replace_bits(&val, 0x1, S9082C_RFCFGCH_BW_MSK);
+	}
+	hal->ch_param[0] = val;
+	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, val);
+
+	/* Spur calibration for channels 13/14 or 40 MHz ch 11 */
+	if (channel == 13 || channel == 14 ||
+	    (bw == RTW_CHANNEL_WIDTH_40 && channel == 11)) {
+		s9082c_write_bbreg(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 1);
+		s9082c_write_bbreg(rtwdev, 0x0d3c, 0x1c0, 2);
+	} else {
+		s9082c_write_bbreg(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 0);
+	}
+}
+
+static void s9082c_lc_calibrate(struct rtw_dev *rtwdev)
+{
+	u32 rf_amode = 0, lc_cal;
+	u8 tmpreg;
+
+	tmpreg = rtw_read8(rtwdev, REG_CTX);
+	if (tmpreg & 0x0e)
+		rtw_write8(rtwdev, REG_CTX, tmpreg & ~0x0e);
+	else
+		rtw_write8(rtwdev, REG_TXPAUSE, 0xff);
+
+	if (tmpreg & 0x0e) {
+		rf_amode = s9082c_read_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK);
+		s9082c_write_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK,
+				(rf_amode & 0x8ffff) | 0x10000);
+	}
+
+	lc_cal = s9082c_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
+	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK,
+			lc_cal | BIT_LCK);
+
+	msleep(100);
+
+	if (tmpreg & 0x0e) {
+		rtw_write8(rtwdev, REG_CTX, tmpreg);
+		s9082c_write_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK, rf_amode);
+	} else {
+		rtw_write8(rtwdev, REG_TXPAUSE, 0x00);
+	}
+
+	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, lc_cal);
+}
+
+static u8 s9082c_path_a_tx_iqk(struct rtw_dev *rtwdev)
+{
+	u32 eac, e94, e9c;
+
+	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x08003138);
+	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x0c003138);
+	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x4128c054);
+	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x14680000);
+	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629488);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
+	mdelay(10);
+
+	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
+	e94 = rtw_read32(rtwdev, REG_IQK_RES_TX);
+	e9c = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY, MASKDWORD);
+
+	if (!(eac & BIT_IQK_TX_FAIL) &&
+	    u32_get_bits(e94, BIT_MASK_RES_TX) != IQK_TX_X_ERR &&
+	    u32_get_bits(e9c, BIT_MASK_RES_TY) != IQK_TX_Y_ERR)
+		return IQK_TX_OK;
+
+	return 0;
+}
+
+static u8 s9082c_path_a_rx_iqk(struct rtw_dev *rtwdev)
+{
+	u32 eac, e94, e9c, ea4, u4tmp;
+
+	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK, 0);
+	rtw_write32(rtwdev, 0x0840, 0x701f0005);
+	rtw_write32(rtwdev, 0x0840, 0xc0c00000);
+	rtw_write32(rtwdev, 0x0840, 0xc00800f0);
+	rtw_write32(rtwdev, 0x0840, 0xc0f488de);
+	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
+			   EN_IQK);
+	rtw_write32(rtwdev, REG_TXIQK_11N, 0x80003e00);
+	rtw_write32(rtwdev, REG_RXIQK_11N, 0x81001200);
+	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x08003138);
+	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x0c003138);
+	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x41681020);
+	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x14680000);
+	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629588);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
+	mdelay(10);
+
+	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
+	e94 = rtw_read32(rtwdev, REG_IQK_RES_TX);
+	e9c = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY, MASKDWORD);
+
+	if ((eac & BIT_IQK_TX_FAIL) ||
+	    u32_get_bits(e94, BIT_MASK_RES_TX) == IQK_TX_X_ERR ||
+	    u32_get_bits(e9c, BIT_MASK_RES_TY) == IQK_TX_Y_ERR)
+		return 0;
+
+	u4tmp = BIT_SET_TXIQK_11N(u32_get_bits(e94, BIT_MASK_RES_TX),
+				  u32_get_bits(e9c, BIT_MASK_RES_TY));
+	s9082c_write_bbreg(rtwdev, REG_TXIQK_11N, MASKDWORD, u4tmp);
+	rtw_write32(rtwdev, REG_FPGA0_IQK_11N, RST_IQK);
+	rtw_write32(rtwdev, 0x0840, 0x701f0005);
+	rtw_write32(rtwdev, 0x0840, 0xc0c00000);
+	rtw_write32(rtwdev, 0x0840, 0xc00800f0);
+	rtw_write32(rtwdev, 0x0840, 0xc0f4fe5f);
+	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
+			   EN_IQK);
+	rtw_write32(rtwdev, REG_RXIQK_11N, 0x80001200);
+	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x0c003138);
+	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x08003138);
+	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x416830a0);
+	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x146830a0);
+	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629588);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
+	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
+	mdelay(10);
+
+	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
+	ea4 = rtw_read32(rtwdev, REG_IQK_RES_RX);
+
+	if (!(eac & BIT_IQK_RX_FAIL) &&
+	    u32_get_bits(ea4, BIT_MASK_RES_RX) != IQK_RX_X_ERR &&
+	    u32_get_bits(eac, BIT_MASK_RES_RY) != IQK_RX_Y_ERR)
+		return IQK_TX_OK | IQK_RX_OK;
+
+	return IQK_TX_OK;
+}
+
+static void s9082c_iqk_single(struct rtw_dev *rtwdev, s32 result[][8], u8 t,
+			      u32 *adda_backup, u32 *iqk_bb_backup,
+			      u8 *raw_522, u8 *raw_550, u8 *raw_551,
+			      u32 *raw_040, u8 *pi_mode)
+{
+	const u32 *adda_regs = rtw8723x_common.iqk_adda_regs;
+	const u32 *iqk_bb_regs = rtw8723x_common.iqk_bb_regs;
+	u8 i, patha_ok;
+
+	if (t == 0) {
+		for (i = 0; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
+			adda_backup[i] = rtw_read32(rtwdev, adda_regs[i]);
+		*raw_522 = rtw_read8(rtwdev, 0x0522);
+		*raw_550 = rtw_read8(rtwdev, 0x0550);
+		*raw_551 = rtw_read8(rtwdev, 0x0551);
+		*raw_040 = rtw_read32(rtwdev, 0x0040);
+		for (i = 0; i < RTW8723X_IQK_BB_REG_NUM; i++)
+			iqk_bb_backup[i] = rtw_read32(rtwdev, iqk_bb_regs[i]);
+	}
+
+	rtw_write32(rtwdev, 0x085c, 0xd0d8a405);
+	for (i = 1; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
+		rtw_write32(rtwdev, adda_regs[i], 0xd0dba405);
+
+	if (t == 0)
+		*pi_mode = s9082c_read_bbreg(rtwdev, 0x0820, S9082C_HSSI1_PI_EN);
+
+	if (!(*pi_mode)) {
+		rtw_write32(rtwdev, 0x0820, 0x80008000);
+		rtw_write32(rtwdev, 0x0828, 0x80008000);
+	}
+
+	rtw_write8(rtwdev, 0x0522, 0xfc);
+	rtw_write8(rtwdev, 0x0550, (*raw_550) & ~0x10);
+	rtw_write8(rtwdev, 0x0551, (*raw_551) & ~0x10);
+	rtw_write8(rtwdev, 0x0040, ((u8)(*raw_040)) & ~0x04);
+
+	s9082c_write_bbreg(rtwdev, REG_CCK_ANT_SEL_11N, S9082C_IQK_RX_PATH_MSK, 0xf);
+	rtw_write32(rtwdev, REG_BB_RX_PATH_11N, 0xc0056a00);
+	rtw_write32(rtwdev, REG_TRMUX_11N, 0x00100027);
+	rtw_write32(rtwdev, REG_BB_PWR_SAV1_11N, 0x44040200);
+	s9082c_write_bbreg(rtwdev, 0x0870, BIT(10), 1);
+	s9082c_write_bbreg(rtwdev, 0x0870, BIT(26), 1);
+	s9082c_write_bbreg(rtwdev, 0x0860, BIT(10), 0);
+	s9082c_write_bbreg(rtwdev, 0x0864, BIT(10), 0);
+	rtw_write32(rtwdev, 0x0b68, 0xf0060000);
+	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
+			   EN_IQK);
+	rtw_write32(rtwdev, REG_TXIQK_11N, 0x80003e00);
+	rtw_write32(rtwdev, REG_RXIQK_11N, 0x81001200);
+
+	for (i = 0; i < PATH_IQK_RETRY; i++) {
+		patha_ok = s9082c_path_a_tx_iqk(rtwdev);
+		if (patha_ok == IQK_TX_OK) {
+			result[t][0] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_TX),
+						    BIT_MASK_RES_TX);
+			result[t][1] = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY,
+							 BIT_MASK_RES_TY);
+			break;
+		}
+	}
+
+	for (i = 0; i < PATH_IQK_RETRY; i++) {
+		patha_ok = s9082c_path_a_rx_iqk(rtwdev);
+		if (patha_ok == (IQK_TX_OK | IQK_RX_OK)) {
+			result[t][2] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_RX),
+						    BIT_MASK_RES_RX);
+			result[t][3] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_RY),
+						    BIT_MASK_RES_RY);
+			break;
+		}
+	}
+
+	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK, 0);
+	s9082c_write_rf(rtwdev, RF_PATH_A, 0xef, RFREG_MASK, 0x000a0);
+
+	if (t != 0) {
+		if (!(*pi_mode)) {
+			rtw_write32(rtwdev, 0x0820, 0x80000000);
+			rtw_write32(rtwdev, 0x0828, 0x80000000);
+		}
+		for (i = 0; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
+			rtw_write32(rtwdev, adda_regs[i], adda_backup[i]);
+		rtw_write8(rtwdev, 0x0522, *raw_522);
+		rtw_write8(rtwdev, 0x0550, *raw_550);
+		rtw_write8(rtwdev, 0x0551, *raw_551);
+		rtw_write32(rtwdev, 0x0040, *raw_040);
+		for (i = 0; i < RTW8723X_IQK_BB_REG_NUM; i++)
+			rtw_write32(rtwdev, iqk_bb_regs[i], iqk_bb_backup[i]);
+		rtw_write32(rtwdev, 0x0840, 0x00c074cb);
+		rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x80003100);
+		rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x80003100);
+	}
+}
+
+static bool s9082c_iqk_similarity(s32 result[][8], u8 c1, u8 c2)
+{
+	u32 i, j, diff, sim_bitmap = 0;
+	u8 final_candidate = 0xff;
+
+	for (i = 0; i < 4; i++) {
+		diff = abs(result[c1][i] - result[c2][i]);
+		if (diff > MAX_TOLERANCE) {
+			if (i == 2 && !sim_bitmap) {
+				if (result[c1][i] + result[c1][i + 1] == 0)
+					final_candidate = c2;
+				else if (result[c2][i] + result[c2][i + 1] == 0)
+					final_candidate = c1;
+				else
+					sim_bitmap |= BIT(i);
+			} else {
+				sim_bitmap |= BIT(i);
+			}
+		}
+	}
+
+	if (sim_bitmap == 0) {
+		if (final_candidate != 0xff) {
+			for (j = 0; j < 2; j++)
+				result[3][j] = result[final_candidate][j];
+			return false;
+		}
+		return true;
+	}
+
+	if (!(sim_bitmap & 0x0f)) {
+		for (i = 0; i < 4; i++)
+			result[3][i] = result[c1][i];
+		return false;
+	}
+
+	return false;
+}
+
+static void s9082c_iq_calibrate(struct rtw_dev *rtwdev)
+{
+	u32 adda_backup[RTW8723X_IQK_ADDA_REG_NUM];
+	u32 iqk_bb_backup[RTW8723X_IQK_BB_REG_NUM];
+	u8 raw_522 = 0, raw_550 = 0, raw_551 = 0, pi_mode = 0;
+	u8 t, idx, final_candidate = 0xff;
+	s32 result[4][8] = {};
+	s32 reg_tmp = 0;
+	u32 raw_040 = 0;
+
+	for (t = 0; t < 3; t++) {
+		s9082c_iqk_single(rtwdev, result, t, adda_backup,
+				  iqk_bb_backup, &raw_522, &raw_550,
+				  &raw_551, &raw_040, &pi_mode);
+		if (t == 1) {
+			if (s9082c_iqk_similarity(result, 0, 1)) {
+				final_candidate = 0;
+				break;
+			}
+		} else if (t == 2) {
+			if (s9082c_iqk_similarity(result, 0, 2)) {
+				final_candidate = 0;
+				break;
+			}
+			if (s9082c_iqk_similarity(result, 1, 2)) {
+				final_candidate = 1;
+				break;
+			}
+			for (idx = 0; idx < 4; idx++)
+				reg_tmp += result[3][idx];
+			final_candidate = reg_tmp ? 3 : 0xff;
+		}
+	}
+
+	if (final_candidate != 0xff && result[final_candidate][0] != 0) {
+		s32 oldval_0 = u32_get_bits(rtw_read32(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE),
+					    BIT_MASK_TXIQ_ELM_D);
+		s32 x = iqkxy_to_s32(result[final_candidate][0]);
+		s32 y = iqkxy_to_s32(result[final_candidate][1]);
+		s32 tx0_a_ext, tx0_c_ext, tx0_a, tx0_c;
+		u32 c4c;
+
+		tx0_a = iqk_mult(x, oldval_0, &tx0_a_ext);
+		tx0_c = iqk_mult(y, oldval_0, &tx0_c_ext);
+
+		s9082c_write_bbreg(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE,
+				   BIT_MASK_TXIQ_ELM_A,
+				   tx0_a & BIT_MASK_TXIQ_ELM_A);
+
+		c4c = rtw_read32(rtwdev, REG_OFDM_0_ECCA_THRESHOLD);
+		u32p_replace_bits(&c4c, tx0_a_ext, S9082C_IQK_TX0_EXT_A_BIT);
+		u32p_replace_bits(&c4c, tx0_c_ext, S9082C_IQK_TX0_EXT_C_BIT);
+
+		s9082c_write_bbreg(rtwdev, REG_TXIQK_MATRIXA_LSB2_11N,
+				   GENMASK(31, 28), BIT_SET_TXIQ_ELM_C1(tx0_c));
+		s9082c_write_bbreg(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE,
+				   BIT_MASK_TXIQ_ELM_C,
+				   BIT_SET_TXIQ_ELM_C2(tx0_c));
+
+		rtw_write32(rtwdev, REG_OFDM_0_ECCA_THRESHOLD, c4c);
+
+		if (result[final_candidate][2] != 0) {
+			u32 rx_x = result[final_candidate][2];
+			u32 rx_y = result[final_candidate][3];
+
+			s9082c_write_bbreg(rtwdev, REG_A_RXIQI,
+					   BIT_MASK_RXIQ_S1_X, rx_x);
+			s9082c_write_bbreg(rtwdev, REG_A_RXIQI,
+					   BIT_MASK_RXIQ_S1_Y1,
+					   BIT_SET_RXIQ_S1_Y1(rx_y));
+			s9082c_write_bbreg(rtwdev, REG_RXIQK_MATRIX_LSB_11N,
+					   BIT_MASK_RXIQ_S1_Y2,
+					   BIT_SET_RXIQ_S1_Y2(rx_y));
+		}
+	}
+}
+
+static void s9082c_phy_calibration(struct rtw_dev *rtwdev)
+{
+	s9082c_iq_calibrate(rtwdev);
+	s9082c_lc_calibrate(rtwdev);
+	s9082c_set_rf_path_switch(rtwdev, true);
+}
+
+static void s9082c_set_tx_power_index(struct rtw_dev *rtwdev)
+{
+	static const struct rtw_hw_reg s9082c_txagc[] = {
+		[DESC_RATE1M]	= { .addr = 0x0e08, .mask = 0x0000ff00 },
+		[DESC_RATE2M]	= { .addr = 0x086c, .mask = 0x0000ff00 },
+		[DESC_RATE5_5M]	= { .addr = 0x086c, .mask = 0x00ff0000 },
+		[DESC_RATE11M]	= { .addr = 0x086c, .mask = 0xff000000 },
+		[DESC_RATE6M]	= { .addr = 0x0e00, .mask = 0x000000ff },
+		[DESC_RATE9M]	= { .addr = 0x0e00, .mask = 0x0000ff00 },
+		[DESC_RATE12M]	= { .addr = 0x0e00, .mask = 0x00ff0000 },
+		[DESC_RATE18M]	= { .addr = 0x0e00, .mask = 0xff000000 },
+		[DESC_RATE24M]	= { .addr = 0x0e04, .mask = 0x000000ff },
+		[DESC_RATE36M]	= { .addr = 0x0e04, .mask = 0x0000ff00 },
+		[DESC_RATE48M]	= { .addr = 0x0e04, .mask = 0x00ff0000 },
+		[DESC_RATE54M]	= { .addr = 0x0e04, .mask = 0xff000000 },
+		[DESC_RATEMCS0]	= { .addr = 0x0e10, .mask = 0x000000ff },
+		[DESC_RATEMCS1]	= { .addr = 0x0e10, .mask = 0x0000ff00 },
+		[DESC_RATEMCS2]	= { .addr = 0x0e10, .mask = 0x00ff0000 },
+		[DESC_RATEMCS3]	= { .addr = 0x0e10, .mask = 0xff000000 },
+		[DESC_RATEMCS4]	= { .addr = 0x0e14, .mask = 0x000000ff },
+		[DESC_RATEMCS5]	= { .addr = 0x0e14, .mask = 0x0000ff00 },
+		[DESC_RATEMCS6]	= { .addr = 0x0e14, .mask = 0x00ff0000 },
+		[DESC_RATEMCS7]	= { .addr = 0x0e14, .mask = 0xff000000 },
+	};
+	struct rtw_hal *hal = &rtwdev->hal;
+	u8 rate;
+
+	for (rate = DESC_RATE1M; rate <= DESC_RATEMCS7; rate++) {
+		if (!s9082c_txagc[rate].addr)
+			continue;
+		s9082c_write_bbreg(rtwdev, s9082c_txagc[rate].addr,
+				   s9082c_txagc[rate].mask,
+				   hal->tx_pwr_tbl[RF_PATH_A][rate]);
+	}
+}
+
+static void s9082c_false_alarm_statistics(struct rtw_dev *rtwdev)
+{
+	/* S9082C uses bit-reversed BB FA counters; avoid raw 8723x reads */
+}
+
+static u32 s9082c_sdio_to_bus_offset(struct rtw_dev *rtwdev, u32 addr)
+{
+	switch (addr & RTW_SDIO_BUS_MSK) {
+	case WLAN_IOREG_OFFSET:
+		addr &= WLAN_IOREG_REG_MSK;
+		if (addr < S9082C_SDIO_MAC_OFFSET)
+			addr += S9082C_SDIO_MAC_OFFSET;
+		addr |= FIELD_PREP(REG_SDIO_CMD_ADDR_MSK,
+				   REG_SDIO_CMD_ADDR_MAC_REG);
+		break;
+	case SDIO_LOCAL_OFFSET:
+		addr &= SDIO_LOCAL_REG_MSK;
+		addr |= S9082C_SDIO_LOCAL_BASE;
+		break;
+	default:
+		rtw_warn(rtwdev, "Cannot convert addr 0x%08x to bus offset",
+			 addr);
+	}
+
+	return addr;
+}
+
+static u32 s9082c_sdio_fixup_val(u32 val)
+{
+	u32 w = ((val & 0x55555555) << 1) | ((val & 0xaaaaaaaa) >> 1);
+
+	return ((w & 0x33333333) << 2) | ((w & 0xcccccccc) >> 2);
+}
+
+static void s9082c_sdio_enable_rx_agg(struct rtw_dev *rtwdev)
+{
+	rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, 0x6024);
+	rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, 0x20);
+	rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);
+}
+
+static const struct rtw_chip_ops rtw8189e_ops = {
+	.power_on		= rtw_power_on,
+	.power_off		= rtw_power_off,
+	.mac_init		= rtw8723x_mac_init,
+	.mac_postinit		= rtw8723x_mac_postinit,
+	.read_efuse		= rtw8723x_read_efuse,
+	.phy_set_param		= rtw8189e_phy_set_param,
+	.set_channel		= rtw8189e_set_channel,
+	.query_phy_status	= rtw8189e_query_phy_status,
+	.read_rf		= rtw_phy_read_rf_sipi,
+	.write_rf		= rtw_phy_write_rf_reg_sipi,
+	.set_tx_power_index	= rtw8723x_set_tx_power_index,
+	.cfg_ldo25		= rtw8723x_cfg_ldo25,
+	.efuse_grant		= rtw8723x_efuse_grant,
+	.false_alarm_statistics	= rtw8723x_false_alarm_statistics,
+	.phy_calibration	= rtw8189e_phy_calibration,
+	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,
+	.fill_txdesc		= rtw8189e_fill_txdesc,
+	.query_rx_desc		= rtw8189e_query_rx_desc,
+};
+
+static const struct rtw_chip_ops s9082c_ops = {
+	.power_on		= rtw_power_on,
+	.power_off		= rtw_power_off,
+	.mac_init		= s9082c_mac_init,
+	.mac_postinit		= s9082c_mac_postinit,
+	.read_efuse		= rtw8723x_read_efuse,
+	.phy_set_param		= s9082c_phy_set_param,
+	.set_channel		= s9082c_set_channel,
+	.query_phy_status	= rtw8189e_query_phy_status,
+	.read_rf		= s9082c_read_rf,
+	.write_rf		= s9082c_write_rf,
+	.set_tx_power_index	= s9082c_set_tx_power_index,
+	.cfg_ldo25		= rtw8723x_cfg_ldo25,
+	.efuse_grant		= rtw8723x_efuse_grant,
+	.false_alarm_statistics	= s9082c_false_alarm_statistics,
+	.phy_calibration	= s9082c_phy_calibration,
+	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,
+	.fill_txdesc		= rtw8189e_fill_txdesc,
+	.query_rx_desc		= rtw8189e_query_rx_desc,
+	.sdio_to_bus_offset	= s9082c_sdio_to_bus_offset,
+	.sdio_fixup_val		= s9082c_sdio_fixup_val,
+	.sdio_enable_rx_agg	= s9082c_sdio_enable_rx_agg,
+};
+
+#define RTW8189E_HW_SPEC_BASE						\
+	.id = RTW_CHIP_TYPE_8189E,					\
+	.wlan_cpu = RTW_WCPU_8051,					\
+	.tx_pkt_desc_sz = 32,						\
+	.tx_buf_desc_sz = 16,						\
+	.rx_pkt_desc_sz = 24,						\
+	.rx_buf_desc_sz = 8,						\
+	.phy_efuse_size = 512,						\
+	.log_efuse_size = 512,						\
+	.ptct_efuse_size = 0,						\
+	.txff_size = 22528,						\
+	.rxff_size = 10240,						\
+	.rsvd_drv_pg_num = 9,						\
+	.band = RTW_BAND_2G,						\
+	.page_size = TX_PAGE_SIZE,					\
+	.csi_buf_pg_num = 0,						\
+	.dig_min = 0x20,						\
+	.txgi_factor = 1,						\
+	.is_pwr_by_rate_dec = true,					\
+	.rx_ldpc = false,						\
+	.tx_stbc = false,						\
+	.max_power_index = 0x3f,					\
+	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,			\
+	.hw_feature_report = false,					\
+	.c2h_ra_report_size = 7,					\
+	.old_datarate_fb_limit = true,					\
+	.path_div_supported = false,					\
+	.ht_supported = true,						\
+	.vht_supported = false,						\
+	.lps_deep_mode_supported = 0,					\
+	.sys_func_en = 0xFD,						\
+	.rqpn_table = rqpn_table_8189e,					\
+	.prioq_addrs = &rtw8723x_common.prioq_addrs,			\
+	.page_table = page_table_8189e,					\
+	.intf_table = NULL,						\
+	.dig = rtw8723x_common.dig,					\
+	.dig_cck = rtw8723x_common.dig_cck,				\
+	.rf_sipi_addr = {0x840, 0x844},					\
+	.rf_sipi_read_addr = rtw8723x_common.rf_sipi_addr,		\
+	.fix_rf_phy_num = 2,						\
+	.mac_tbl = &rtw8189e_mac_tbl,					\
+	.agc_tbl = &rtw8189e_agc_tbl,					\
+	.bb_tbl = &rtw8189e_bb_tbl,					\
+	.rf_tbl = {&rtw8189e_rf_a_tbl},					\
+	.rfe_defs = rtw8189e_rfe_defs,					\
+	.rfe_defs_size = ARRAY_SIZE(rtw8189e_rfe_defs),			\
+	.iqk_threshold = 8,						\
+	.max_scan_ie_len = IEEE80211_MAX_DATA_LEN
+
+const struct rtw_chip_info rtw8189e_hw_spec = {
+	RTW8189E_HW_SPEC_BASE,
+	.ops = &rtw8189e_ops,
+	.fw_name = "rtw88/rtw8189e_fw.bin",
+	.pwr_on_seq = card_enable_flow_8189e,
+	.pwr_off_seq = card_disable_flow_8189e,
+	.efuse_inverted = false,
+	.fw_no_hdr = false,
+};
+EXPORT_SYMBOL(rtw8189e_hw_spec);
+
+const struct rtw_chip_info s9082c_hw_spec = {
+	RTW8189E_HW_SPEC_BASE,
+	.ops = &s9082c_ops,
+	.fw_name = "rtw88/s9082c_fw.bin",
+	.pwr_on_seq = s9082c_card_enable_flow,
+	.pwr_off_seq = s9082c_card_disable_flow,
+	.efuse_inverted = true,
+	.fw_no_hdr = true,
+};
+EXPORT_SYMBOL(s9082c_hw_spec);
+
+MODULE_AUTHOR("Alex Novak <neur-alx@agentmail.to>");
+MODULE_DESCRIPTION("Realtek 8189E / SmartChip S9082C chip core");
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_FIRMWARE("rtw88/rtw8189e_fw.bin");
+MODULE_FIRMWARE("rtw88/s9082c_fw.bin");
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e.h b/drivers/net/wireless/realtek/rtw88/rtw8189e.h
new file mode 100644
index 0000000..52a9ffa
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8189e.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
+ */
+
+#ifndef __RTW8189E_H__
+#define __RTW8189E_H__
+
+#include "main.h"
+#include "rtw8723x.h"
+
+extern const struct rtw_chip_info rtw8189e_hw_spec;
+extern const struct rtw_chip_info s9082c_hw_spec;
+
+#define VAL_S9082C_PLL_FIX		0xac82
+
+#define SDIO_VENDOR_ID_SMARTCHIP	0x02e7
+#define SDIO_DEVICE_ID_S9082C		0x9082
+#define SDIO_DEVICE_ID_REALTEK_8189ES	0x8179
+
+#endif /* __RTW8189E_H__ */
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
                   ` (2 preceding siblings ...)
  2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
@ 2026-12-01 21:11 ` Alex Novak
  2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
  2026-12-02  8:21 ` [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Luka Gejak
  2026-12-02 19:14 ` Bitterblue Smith
  5 siblings, 2 replies; 18+ messages in thread
From: Alex Novak @ 2026-12-01 21:11 UTC (permalink / raw)
  To: pkshih; +Cc: linux-wireless

Add the SDIO driver glue for Realtek RTL8189ES (024c:8179) and the
SmartChip S9082C clone (02e7:9082), along with the RTW88_8189ES Kconfig
option and Makefile entry.

Signed-off-by: Alex Novak <neur-alx@agentmail.to>
---
 drivers/net/wireless/realtek/rtw88/Kconfig    | 12 ++++++
 drivers/net/wireless/realtek/rtw88/Makefile   |  3 ++
 .../net/wireless/realtek/rtw88/rtw8189es.c    | 43 +++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189es.c

diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
index 58916f6..ab71e52 100644
--- a/drivers/net/wireless/realtek/rtw88/Kconfig
+++ b/drivers/net/wireless/realtek/rtw88/Kconfig
@@ -167,6 +167,18 @@ config RTW88_8723CS
 
 	  If you choose to build a module, it'll be called rtw88_8723cs.
 
+config RTW88_8189ES
+	tristate "Realtek 8189ES and SmartChip S9082C SDIO wireless network adapter"
+	depends on MMC
+	select RTW88_CORE
+	select RTW88_SDIO
+	select RTW88_8189E
+	help
+	  Select this option to enable support for Realtek RTL8189ES and
+	  SmartChip S9082C / S9082xs 802.11n SDIO wireless network adapters.
+
+	  If you choose to build a module, it'll be called rtw88_8189es.
+
 config RTW88_8723BS
 	tristate "Realtek 8723BS SDIO wireless network adapter"
 	depends on MMC
diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
index 8a6ef91..048db8a 100644
--- a/drivers/net/wireless/realtek/rtw88/Makefile
+++ b/drivers/net/wireless/realtek/rtw88/Makefile
@@ -55,6 +55,9 @@ rtw88_8703b-objs		:= rtw8703b.o rtw8703b_tables.o
 obj-$(CONFIG_RTW88_8189E)	+= rtw88_8189e.o
 rtw88_8189e-objs		:= rtw8189e.o rtw8189e_table.o
 
+obj-$(CONFIG_RTW88_8189ES)	+= rtw88_8189es.o
+rtw88_8189es-objs		:= rtw8189es.o
+
 obj-$(CONFIG_RTW88_8723CS)	+= rtw88_8723cs.o
 rtw88_8723cs-objs		:= rtw8723cs.o
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189es.c b/drivers/net/wireless/realtek/rtw88/rtw8189es.c
new file mode 100644
index 0000000..19d50c5
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8189es.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
+ */
+
+#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/sdio_ids.h>
+#include <linux/module.h>
+#include "main.h"
+#include "rtw8189e.h"
+#include "sdio.h"
+
+static const struct sdio_device_id rtw_8189es_id_table[] = {
+	{
+		/* Standard Realtek RTL8189ES */
+		SDIO_DEVICE(SDIO_VENDOR_ID_REALTEK,
+			    SDIO_DEVICE_ID_REALTEK_8189ES),
+		.driver_data = (kernel_ulong_t)&rtw8189e_hw_spec,
+	},
+	{
+		/* SmartChip S9082C / S9082xs clone */
+		SDIO_DEVICE(SDIO_VENDOR_ID_SMARTCHIP,
+			    SDIO_DEVICE_ID_S9082C),
+		.driver_data = (kernel_ulong_t)&s9082c_hw_spec,
+	},
+	{}
+};
+MODULE_DEVICE_TABLE(sdio, rtw_8189es_id_table);
+
+static struct sdio_driver rtw_8189es_driver = {
+	.name = KBUILD_MODNAME,
+	.probe = rtw_sdio_probe,
+	.remove = rtw_sdio_remove,
+	.shutdown = rtw_sdio_shutdown,
+	.id_table = rtw_8189es_id_table,
+	.drv = {
+		.pm = &rtw_sdio_pm_ops,
+	}
+};
+module_sdio_driver(rtw_8189es_driver);
+
+MODULE_AUTHOR("Alex Novak <neur-alx@agentmail.to>");
+MODULE_DESCRIPTION("Realtek 8189ES and SmartChip S9082C SDIO wireless driver");
+MODULE_LICENSE("Dual BSD/GPL");
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
                   ` (3 preceding siblings ...)
  2026-12-01 21:11 ` [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver Alex Novak
@ 2026-12-02  8:21 ` Luka Gejak
  2026-12-02 19:14 ` Bitterblue Smith
  5 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:21 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Thanks for putting this together. Three comments on the series below.

On December 1, 2026 9:10:41 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> - Patch 2 adds the RTL8189E register tables and S9082C init sequences.

Where did the register tables come from, and what license applies
to the imported data? A source link and revision in patch 2 would
help here.

[ ... ]

> Testing status:
> Compile- and static-tested only (no runtime test on hardware yet).

I think both chips need hardware testing before this moves past RFC.
Can you share results for probe, association, traffic in both
directions and an interface down and up cycle on each? For AP
support, please check beaconing too.

[ ... ]

> 1. Is this split and encapsulation of the S9082C SDIO quirks via
>    sdio_to_bus_offset, sdio_fixup_val, and sdio_enable_rx_agg in
>    chip_ops acceptable for rtw88, or would a different abstraction be
>    preferred?
> 2. Is the fw_no_hdr flag in chip_info together with the path
>    "rtw88/s9082c_fw.bin" the preferred approach for handling headerless
>    8051 firmware images in rtw88?

The SDIO hooks look like a reasonable start. As far as I can see,
S9082C also needs its own efuse and firmware download transactions.
fw_no_hdr only handles the header. Would you send RTL8189ES
separately so it can be tested on its own?

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
@ 2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:15   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:21 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Thanks for working on these chips. Five comments below.

On December 1, 2026 9:11:00 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

> @@ -166,6 +166,13 @@ int rtw_parse_efuse_map(struct rtw_dev *rtwdev)

[ ... ]

> +		for (i = 0; i < phy_size; i++)
> +			phy_map[i] = ~phy_map[i];

I think S9082C needs its own efuse read and grant. The reference
uses 0x96 and reverses the address and ready bits. It passes the
data through as read.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/core/efuse/rtw_efuse.c#L2161-L2177

[ ... ]

> +	if (!rtwdev->chip->fw_no_hdr) {
> +		data += sizeof(struct rtw_fw_hdr_legacy);
> +		size -= sizeof(struct rtw_fw_hdr_legacy);
> +	}

How will this handle the S9082C download registers? The reference
uses different enable and checksum bits and puts the page index in
bits 7 through 5 of the page byte.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_hal_init.c#L546-L590

[ ... ]

> +	if (rtwdev->chip->ops->sdio_to_bus_offset)
> +		return rtwdev->chip->ops->sdio_to_bus_offset(rtwdev, addr);

As far as I can see, rtw_sdio_get_tx_addr() bypasses this hook and sends
management frames to port 7. Should these chips use port 4 here?

https://github.com/lwfinger/rtw88/blob/475584a581cb449a8616e0339ecb85bcb88c67aa/sdio.c#L938-L946

[ ... ]

>  		free_txpg = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG);
> +		free_txpg = rtw_sdio_fixup_val(rtwdev, free_txpg);

What checks the output queue credits? The reference checks them
separately from free pages and decodes the S9082C counter.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/sdio/rtl8189es_xmit.c#L458-L484

[ ... ]

>  	switch (rtwdev->chip->id) {
> +	case RTW_CHIP_TYPE_8189E:

The RX parser still advances on 8 byte boundaries. I think it needs
the reference's 128 byte alignment to find the next descriptor.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/sdio/rtl8189es_recv.c#L443-L451

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables
  2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
@ 2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:17   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:21 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

One comment on the register tables below.

On December 1, 2026 9:11:07 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +static const u32 rtw8189e_mac[] = {
> +0x026, 0x00000041,
> +		0x027, 0x00000035,
> +	0x80000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x040, 0x0000000C,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,

These MAC, BB, AGC and RF A arrays match the S9082C variants. I think
RTL8189ES needs the Realtek tables here. The parser reads the board
flags as RFE IDs, so branches 1 and 2 never match RFE 0.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/phydm/rtl8188e/halhwimg8188e_mac.c#L227-L273

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core
  2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
@ 2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:18   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:21 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

I have twelve comments on the chip core.

On December 1, 2026 9:11:13 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +/* S9082C locks up on standard card disable; leave power down empty */
> +static const struct rtw_pwr_seq_cmd * const s9082c_card_disable_flow[] = {
> +	NULL
> +};

What happens when probe leaves the MAC on? With this empty sequence,
rtw_mac_power_on() retries and still gets -EALREADY.

[ ... ]

> +static const struct rtw_page_table page_table_8189e[] = {

The reference writes 0x01779000 to RQPN and programs the LLT through
0x41e0. Should S9082C have its own queue setup?

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/sdio/sdio_halinit.c#L1175-L1200
https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_hal_init.c#L2855-L2878

[ ... ]

> +	if (pkt_stat->is_c2h)
> +		return 0;

The RX parser marks CCX ACK status and T firmware retry records as
C2H. Where are their formats handled?

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_rxdesc.c#L72-L84

[ ... ]

> +	rx_power = -96 + (vga_idx * 2) - (lna_idx * 6);

The RTL8189ES reference subtracts twice the VGA index from the LNA
gain. Is the sign here intentional?

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/phydm/rtl8188e/phydm_rtl8188e.c#L26-L58

[ ... ]

> +	rtw_phy_load_tables(rtwdev);

Where do we enable CCK and OFDM? The tables seem to leave these bits
clear on RTL8189ES and S9082C.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/sdio/sdio_halinit.c#L953-L962

[ ... ]

> +	rtw_write32_mask(rtwdev, REG_AFE_XTAL_CTRL, BIT_MASK_XTAL, xtal_val);

I'd use bits 22 through 11 here. BIT_MASK_XTAL seems to shift the
RTL8189ES crystal cap one bit too high.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/phydm/phydm_cfotracking.c#L225-L235

[ ... ]

> +	rtw_write8(rtwdev, REG_DWBCN0_CTRL + 1, 0xf8);

Should the shared 8051 path poll bit 7 for beacon valid on S9082C?
It currently polls bit 0 of REG_DWBCN0_CTRL + 2.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_hal_init.c#L4359-L4367

[ ... ]

> +	rtw_write32(rtwdev, REG_RCR, s9082c_bitrev32(rcr));

Start and filter changes seem to overwrite REG_RCR with raw hal.rcr.
Should those writes use this encoding too?

[ ... ]

> +	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,

Is the complement needed here? The reference uses plain XOR over
the 16 words on both chips.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_xmit.c#L286-L301

[ ... ]

> +static const struct rtw_chip_ops s9082c_ops = {

How does the common mailbox path handle the S9082C encoding? The
reference polls bits 7 through 4 of REG_HMETFR and reverses each byte.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/rtl8188e/rtl8188e_cmd.c#L29-L47

[ ... ]

> +	.mac_postinit		= s9082c_mac_postinit,

Does S9082C need the same encoding for runtime MAC writes? Key
installation still writes raw CAM words, and EDCA does the same.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/hal_com.c#L2520-L2541

[ ... ]

> +const struct rtw_chip_info rtw8189e_hw_spec = {
> +	RTW8189E_HW_SPEC_BASE,

With the feature report disabled, nss and bw stay zero. That leaves
out MCS 0 through 7 and 40 MHz. I'd set both in the efuse callbacks.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver
  2026-12-01 21:11 ` [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver Alex Novak
@ 2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
  1 sibling, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:21 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Just one question about firmware.

On December 1, 2026 9:11:19 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +config RTW88_8189ES

Where should users get rtw88/s9082c_fw.bin? Both names are missing
from linux-firmware. A WHENCE alias may work for RTL8189ES if
rtlwifi/rtl8188eufw.bin is the same image.

https://lore.kernel.org/linux-wireless/d34cd45d652f4b88a02c4795b0e1aaf2@realtek.com/

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
  2026-12-02  8:21   ` Luka Gejak
@ 2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:15   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:56 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Two more comments on the common code.

On December 1, 2026 9:11:00 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

>  	/* for USB/SDIO only */
>  	void (*fill_txdesc_checksum)(struct rtw_dev *rtwdev,
>  				     struct rtw_tx_pkt_info *pkt_info,
>  				     u8 *txdesc);
> +	u32 (*sdio_to_bus_offset)(struct rtw_dev *rtwdev, u32 addr);
> +	u32 (*sdio_fixup_val)(u32 val);
> +	void (*sdio_enable_rx_agg)(struct rtw_dev *rtwdev);

These three new callbacks are SDIO only. A separate comment above
them would distinguish their scope from the checksum callback.

[ ... ]

> +	if (rtwdev->chip->ops->query_rx_desc)
> +		return rtwdev->chip->ops->query_rx_desc(rtwdev, rx_desc8,
> +							pkt_stat, rx_status);

The 8189E callback repeats the checks, header lookup and status setup
from rx.c. I think the callback could just decode the descriptor and
let the common path handle the rest.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables
  2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
  2026-12-02  8:21   ` Luka Gejak
@ 2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:17   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:56 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Two small formatting comments on the new files.

On December 1, 2026 9:11:07 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
> + */

This fits on one line with the closing marker. I'd use the same
format across the new files.

[ ... ]

> +static const u32 rtw8189e_mac[] = {
> +0x026, 0x00000041,
> +		0x027, 0x00000035,

The first row starts in column one in each of the MAC, AGC, BB and
RF A tables. Please indent each row to match the others at the same
level.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core
  2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
  2026-12-02  8:21   ` Luka Gejak
@ 2026-12-02  8:56   ` Luka Gejak
  2026-12-02 19:18   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:56 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

Six more comments on the chip setup.

On December 1, 2026 9:11:13 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +	u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz;
> +	struct rtw_rx_desc *rx_desc = rx_desc8;
> +	struct ieee80211_hdr *hdr;
> +	u32 enc_type, swdec;
> +	void *phy_status;

If this stays as a separate function, I'd put the struct pointers
together first, then order the remaining declarations by decreasing
line length.

[ ... ]

> +	rtw_write16(rtwdev, 0x04ca, 0xe0e0);

There are names in reg.h for these registers. Use REG_MAX_AGGR_NUM
for 0x04ca and REG_LEDCFG2 for 0x004e. The IQK sequence can use
REG_TXPAUSE, REG_BCN_CTRL and REG_BCN_CTRL_CLINT0 too.

[ ... ]

> +	rtw_write32(rtwdev, REG_RCR, s9082c_bitrev32(rcr));
> +	rtw_write16(rtwdev, REG_RXFLTMAP1, 0x2000);

Clearing FIF_CONTROL restores hal.rxfltmap1, so this default needs to
be cached too. Please also keep BIT_APP_FCS when fixing the RCR write.
rtw88 advertises RX_INCLUDES_FCS.

[ ... ]

> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
> +	mdelay(10);

The association and AP paths can sleep here. Would fsleep() work
for the three IQK waits? Each one currently spins for 10 ms.

[ ... ]

> +	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,
> +	.fill_txdesc		= rtw8189e_fill_txdesc,
> +	.query_rx_desc		= rtw8189e_query_rx_desc,

For the checksum fix, I think fill_txdesc_checksum_common(txdesc, 16)
already fits. It uses the plain XOR and writes the low half of word 7,
as on RTL8723B.

I'd also put the descriptor callbacks before the checksum callback
to match struct rtw_chip_ops.

[ ... ]

> +const struct rtw_chip_info rtw8189e_hw_spec = {
> +	RTW8189E_HW_SPEC_BASE,

Does RTL8189ES need dig_cck? It enables a write to 0xa0c that the
reference limits to newer PHY layouts. For CCK packet detection at
0xa0a, rtw_phy_cck_pd_set() already uses the reference thresholds.

https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/phydm/phydm_dig.c#L596-L601
https://github.com/Neur-alx/s9082c-linux-driver/blob/117ecc26c8c6b470cdeddfa9239c176dcadc83db/hal/phydm/phydm_cck_pd.c#L36-L80

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver
  2026-12-01 21:11 ` [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver Alex Novak
  2026-12-02  8:21   ` Luka Gejak
@ 2026-12-02  8:56   ` Luka Gejak
  1 sibling, 0 replies; 18+ messages in thread
From: Luka Gejak @ 2026-12-02  8:56 UTC (permalink / raw)
  To: Alex Novak; +Cc: pkshih, linux-wireless

Hi Alex,

One small comment on the device table.

On December 1, 2026 9:11:19 PM GMT+00:00, Alex Novak
<neur-alx@agentmail.to> wrote:

[ ... ]

> +		/* Standard Realtek RTL8189ES */
> +		SDIO_DEVICE(SDIO_VENDOR_ID_REALTEK,
> +			    SDIO_DEVICE_ID_REALTEK_8189ES),

[ ... ]

> +		/* SmartChip S9082C / S9082xs clone */
> +		SDIO_DEVICE(SDIO_VENDOR_ID_SMARTCHIP,
> +			    SDIO_DEVICE_ID_S9082C),

The Realtek comment repeats the named match. The S9082xs alias is
useful information and would fit in the commit message.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support
  2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
                   ` (4 preceding siblings ...)
  2026-12-02  8:21 ` [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Luka Gejak
@ 2026-12-02 19:14 ` Bitterblue Smith
  5 siblings, 0 replies; 18+ messages in thread
From: Bitterblue Smith @ 2026-12-02 19:14 UTC (permalink / raw)
  To: Alex Novak, pkshih; +Cc: linux-wireless

On 01/12/2026 23:10, Alex Novak wrote:
> Following up on my earlier thread "[RFC/INFO] Hardware quirks of
> SmartChip S9082C (02e7:9082 RTL8189ES clone)" on linux-wireless, this
> RFC series adds support for Realtek RTL8189ES (024c:8179) and the
> SmartChip S9082C clone (02e7:9082) to rtw88.
> 
> To keep shared code changes minimal, all chip-specific behavior is
> hidden behind chip_ops hooks and chip_info flags instead of inline chip
> checks in the common paths:
> 
> - Patch 1 adds minimal core hooks and flags (RTW_CHIP_TYPE_8189E,

The PCI version is called RTL8188EE and the USB version is called
RTL8188EU(S). I'm afraid SDIO is outvoted. :) It should be 8188E/8188e
when there is no S/s at the end.

>   efuse_inverted, fw_no_hdr, fill_txdesc, query_rx_desc,
>   rtw_coex_supported(), and three SDIO callbacks: sdio_to_bus_offset,
>   sdio_fixup_val, and sdio_enable_rx_agg).
> - Patch 2 adds the RTL8189E register tables and S9082C init sequences.
> - Patch 3 adds the RTL8189E/S9082C chip core, 32-byte TX / 24-byte RX
>   descriptor helpers, and S9082C bit-reversed MAC/BB/RF, IQK/LCK
>   calibration, and SDIO register callbacks.
> - Patch 4 adds the rtw88_8189es SDIO driver glue, Kconfig, and Makefile
>   wiring.
> 

I see you have a lot of registers that need special handling. What if
you made lists of them and handled all the bit negation/reversing in the
rtw_sdio_read{8,16,32} and rtw_sdio_write{8,16,32} functions? Wouldn't
that simplify a lot of code?

> Testing status:
> Compile- and static-tested only (no runtime test on hardware yet).
> Each patch in the series is bisectable and verified via GitHub Actions
> on x86_64 and arm64 with W=1, C=1 sparse (CF=-D__CHECK_ENDIAN__),
> KCFLAGS="-Werror", checkpatch.pl --strict --codespell, and a config
> matrix covering CONFIG_RTW88_8189ES=m, CONFIG_RTW88_8189ES=y,
> CONFIG_RTW88_DEBUGFS=n, and CONFIG_PM=n (0 compiler errors, 0 sparse
> warnings). Runtime probe and register-sequencing validation on an
> Amlogic S905X board will be completed before any non-RFC [PATCH rtw-next
> v1] submission.
> 
> I would appreciate feedback on two specific questions before testing on
> hardware:
> 
> 1. Is this split and encapsulation of the S9082C SDIO quirks via
>    sdio_to_bus_offset, sdio_fixup_val, and sdio_enable_rx_agg in
>    chip_ops acceptable for rtw88, or would a different abstraction be
>    preferred?
> 2. Is the fw_no_hdr flag in chip_info together with the path
>    "rtw88/s9082c_fw.bin" the preferred approach for handling headerless
>    8051 firmware images in rtw88?
> 
> Alex Novak (4):
>   wifi: rtw88: extend core hooks for 8189E and S9082C
>   wifi: rtw88: add RTL8189E and S9082C register tables
>   wifi: rtw88: add RTL8189E and S9082C chip core
>   wifi: rtw88: add RTL8189ES and S9082C SDIO driver
> 
>  drivers/net/wireless/realtek/rtw88/Kconfig    |   16 +
>  drivers/net/wireless/realtek/rtw88/Makefile   |    6 +
>  drivers/net/wireless/realtek/rtw88/coex.c     |   34 +-
>  drivers/net/wireless/realtek/rtw88/coex.h     |    5 +
>  drivers/net/wireless/realtek/rtw88/efuse.c    |    7 +
>  drivers/net/wireless/realtek/rtw88/mac.c      |    6 +-
>  drivers/net/wireless/realtek/rtw88/main.c     |    3 +
>  drivers/net/wireless/realtek/rtw88/main.h     |   15 +
>  drivers/net/wireless/realtek/rtw88/phy.c      |    3 +-
>  drivers/net/wireless/realtek/rtw88/rtw8189e.c | 1425 +++++++++++
>  drivers/net/wireless/realtek/rtw88/rtw8189e.h |   20 +
>  .../wireless/realtek/rtw88/rtw8189e_table.c   | 2238 +++++++++++++++++
>  .../wireless/realtek/rtw88/rtw8189e_table.h   |   52 +
>  .../net/wireless/realtek/rtw88/rtw8189es.c    |   43 +
>  drivers/net/wireless/realtek/rtw88/rx.c       |   13 +-
>  drivers/net/wireless/realtek/rtw88/rx.h       |    4 +
>  drivers/net/wireless/realtek/rtw88/sdio.c     |   29 +-
>  drivers/net/wireless/realtek/rtw88/tx.c       |    5 +
>  18 files changed, 3909 insertions(+), 15 deletions(-)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.h
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189es.c
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C
  2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
  2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
@ 2026-12-02 19:15   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Bitterblue Smith @ 2026-12-02 19:15 UTC (permalink / raw)
  To: Alex Novak, pkshih; +Cc: linux-wireless

On 01/12/2026 23:11, Alex Novak wrote:
> Add minimal chip_ops hooks and chip_info flags needed by RTL8189ES and
> SmartChip S9082C without adding per-chip quirks to shared paths:
> 
> - Add RTW_CHIP_TYPE_8189E, efuse_inverted, and fw_no_hdr in chip_info.

Are you sure the S9082C firmware has no header? Have you checked the
vendor blob?

> - Add fill_txdesc, query_rx_desc, sdio_to_bus_offset, sdio_fixup_val,
>   and sdio_enable_rx_agg hooks in chip_ops, plus NULL guards in
>   rtw_load_table() and rtw_phy_pwr_track().

What are the NULL guards for? rtw_phy_load_tables() shouldn't hit any NULL
pointers. For rtw_phy_pwr_track() just add an empty function in rtw8188e.c.

> - Add rtw_coex_supported() so chips without BT coexistence skip coex

I'm not sure you need to do that. Other chips without Bluetooth already
work. Did it cause a problem for you?

>   initialization, C2H handling, and periodic polling while keeping
>   coex->stop_dm set.
> - Export rtw_rx_fill_rx_status() for chip RX descriptor parsers.
> 
> Signed-off-by: Alex Novak <neur-alx@agentmail.to>
> ---
>  drivers/net/wireless/realtek/rtw88/coex.c  | 34 +++++++++++++++++++---
>  drivers/net/wireless/realtek/rtw88/coex.h  |  5 ++++
>  drivers/net/wireless/realtek/rtw88/efuse.c |  7 +++++
>  drivers/net/wireless/realtek/rtw88/mac.c   |  6 ++--
>  drivers/net/wireless/realtek/rtw88/main.c  |  3 ++
>  drivers/net/wireless/realtek/rtw88/main.h  | 15 ++++++++++
>  drivers/net/wireless/realtek/rtw88/phy.c   |  3 +-
>  drivers/net/wireless/realtek/rtw88/rx.c    | 13 ++++++---
>  drivers/net/wireless/realtek/rtw88/rx.h    |  4 +++
>  drivers/net/wireless/realtek/rtw88/sdio.c  | 29 +++++++++++++++---
>  drivers/net/wireless/realtek/rtw88/tx.c    |  5 ++++
>  11 files changed, 109 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c
> index 37c336d..6cc533a 100644
> --- a/drivers/net/wireless/realtek/rtw88/coex.c
> +++ b/drivers/net/wireless/realtek/rtw88/coex.c
> @@ -643,7 +643,8 @@ void rtw_coex_info_response(struct rtw_dev *rtwdev, struct sk_buff *skb)
>  	struct rtw_coex *coex = &rtwdev->coex;
>  	u8 *payload = get_payload_from_coex_resp(skb);
>  
> -	if (payload[0] != COEX_RESP_ACK_BY_WL_FW) {
> +	if (!rtw_coex_supported(rtwdev) ||
> +	    payload[0] != COEX_RESP_ACK_BY_WL_FW) {
>  		dev_kfree_skb_any(skb);
>  		return;
>  	}
> @@ -2555,7 +2556,7 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason)
>  
>  	lockdep_assert_held(&rtwdev->mutex);
>  
> -	if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
> +	if (!rtw_coex_supported(rtwdev) || !test_bit(RTW_FLAG_RUNNING, rtwdev->flags))
>  		return;
>  
>  	coex_dm->reason = reason;
> @@ -2710,6 +2711,9 @@ static void __rtw_coex_init_hw_config(struct rtw_dev *rtwdev, bool wifi_only)
>  	struct rtw_coex *coex = &rtwdev->coex;
>  	struct rtw_coex_stat *coex_stat = &coex->stat;
>  
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
>  
>  	rtw_coex_init_coex_var(rtwdev);
> @@ -2765,6 +2769,9 @@ void rtw_coex_power_on_setting(struct rtw_dev *rtwdev)
>  	struct rtw_coex *coex = &rtwdev->coex;
>  	u8 table_case = 1;
>  
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__);
>  
>  	coex->stop_dm = true;
> @@ -2789,6 +2796,9 @@ EXPORT_SYMBOL(rtw_coex_power_on_setting);
>  
>  void rtw_coex_power_off_setting(struct rtw_dev *rtwdev)
>  {
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	rtw_write16(rtwdev, REG_WIFI_BT_INFO, BIT_BT_INT_EN);
>  }
>  EXPORT_SYMBOL(rtw_coex_power_off_setting);
> @@ -3032,6 +3042,9 @@ void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
>  	u8 i, rsp_source = 0, type;
>  	bool inq_page = false;
>  
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	rsp_source = buf[0] & 0xf;
>  	if (rsp_source >= COEX_BTINFO_SRC_MAX)
>  		return;
> @@ -3304,6 +3317,9 @@ void rtw_coex_bt_hid_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
>  	u8 sub_id = buf[2], gamehid_cnt = 0, handle, i;
>  	bool cur_game_hid_exist, complete;
>  
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	if (!chip->wl_mimo_ps_support &&
>  	    (sub_id == COEX_BT_HIDINFO_LIST || sub_id == COEX_BT_HIDINFO_A))
>  		return;
> @@ -3392,7 +3408,8 @@ void rtw_coex_query_bt_hid_list(struct rtw_dev *rtwdev)
>  	u8 i, handle;
>  	bool complete;
>  
> -	if (!chip->wl_mimo_ps_support || coex_stat->wl_under_ips ||
> +	if (!rtw_coex_supported(rtwdev) || !chip->wl_mimo_ps_support ||
> +	    coex_stat->wl_under_ips ||
>  	    (coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl))
>  		return;
>  
> @@ -3425,6 +3442,9 @@ void rtw_coex_wl_fwdbginfo_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length)
>  	u8 val;
>  	int i;
>  
> +	if (!rtw_coex_supported(rtwdev))
> +		return;
> +
>  	rtw_dbg(rtwdev, RTW_DBG_COEX,
>  		"[BTCoex], WiFi Fw Dbg info = %8ph (len = %d)\n",
>  		buf, length);
> @@ -3458,7 +3478,8 @@ void rtw_coex_wl_status_check(struct rtw_dev *rtwdev)
>  {
>  	struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat;
>  
> -	if ((coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl) ||
> +	if (!rtw_coex_supported(rtwdev) ||
> +	    (coex_stat->wl_under_lps && !coex_stat->wl_force_lps_ctrl) ||
>  	    coex_stat->wl_under_ips)
>  		return;
>  
> @@ -3951,6 +3972,11 @@ void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m)
>  	u32 lte_coex = 0, bt_coex = 0;
>  	int i;
>  
> +	if (!rtw_coex_supported(rtwdev)) {
> +		seq_puts(m, "BT coex not supported\n");
> +		return;
> +	}
> +
>  	score_board_BW = rtw_coex_read_scbd(rtwdev);
>  	score_board_WB = coex_stat->score_board;
>  	wl_reg_6c0 = rtw_read32(rtwdev, REG_BT_COEX_TABLE0);
> diff --git a/drivers/net/wireless/realtek/rtw88/coex.h b/drivers/net/wireless/realtek/rtw88/coex.h
> index c398be8..431933c 100644
> --- a/drivers/net/wireless/realtek/rtw88/coex.h
> +++ b/drivers/net/wireless/realtek/rtw88/coex.h
> @@ -325,6 +325,11 @@ struct coex_rf_para {
>  	u8 bt_lna_lvl;
>  };
>  
> +static inline bool rtw_coex_supported(struct rtw_dev *rtwdev)
> +{
> +	return !!rtwdev->chip->ops->coex_set_init;
> +}
> +
>  static inline void rtw_coex_set_init(struct rtw_dev *rtwdev)
>  {
>  	const struct rtw_chip_info *chip = rtwdev->chip;
> diff --git a/drivers/net/wireless/realtek/rtw88/efuse.c b/drivers/net/wireless/realtek/rtw88/efuse.c
> index 15c5720..90a010e 100644
> --- a/drivers/net/wireless/realtek/rtw88/efuse.c
> +++ b/drivers/net/wireless/realtek/rtw88/efuse.c
> @@ -166,6 +166,13 @@ int rtw_parse_efuse_map(struct rtw_dev *rtwdev)
>  		goto out_free;
>  	}
>  
> +	if (chip->efuse_inverted) {
> +		u32 i;
> +
> +		for (i = 0; i < phy_size; i++)
> +			phy_map[i] = ~phy_map[i];
> +	}
> +
>  	memset(log_map, 0xff, log_size);
>  	ret = rtw_dump_logical_efuse_map(rtwdev, phy_map, log_map);
>  	if (ret) {
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index eaa928b..511e0b5 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -896,8 +896,10 @@ download_firmware_legacy(struct rtw_dev *rtwdev, const u8 *data, u32 size)
>  	u32 total_page;
>  	u32 last_page_size;
>  
> -	data += sizeof(struct rtw_fw_hdr_legacy);
> -	size -= sizeof(struct rtw_fw_hdr_legacy);
> +	if (!rtwdev->chip->fw_no_hdr) {
> +		data += sizeof(struct rtw_fw_hdr_legacy);
> +		size -= sizeof(struct rtw_fw_hdr_legacy);
> +	}
>  
>  	total_page = size >> DLFW_PAGE_SIZE_SHIFT_LEGACY;
>  	last_page_size = size & (DLFW_PAGE_SIZE_LEGACY - 1);
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index 19b5c6f..5726f98 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -1793,6 +1793,8 @@ static void __update_firmware_info_legacy(struct rtw_dev *rtwdev,
>  				(struct rtw_fw_hdr_legacy *)fw->firmware->data;
>  
>  	fw->h2c_version = 0;
> +	if (rtwdev->chip->fw_no_hdr)
> +		return;
>  	fw->version = le16_to_cpu(legacy->version);
>  	fw->sub_version = legacy->subversion1;
>  	fw->sub_index = legacy->subversion2;
> @@ -2191,6 +2193,7 @@ int rtw_core_init(struct rtw_dev *rtwdev)
>  	mutex_init(&rtwdev->hal.tx_power_mutex);
>  
>  	init_waitqueue_head(&rtwdev->coex.wait);
> +	coex->stop_dm = !rtw_coex_supported(rtwdev);
>  	init_completion(&rtwdev->lps_leave_check);
>  	init_completion(&rtwdev->fw_scan_density);
>  
> diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
> index 1401eff..5adeea6 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.h
> +++ b/drivers/net/wireless/realtek/rtw88/main.h
> @@ -198,6 +198,7 @@ enum rtw_chip_type {
>  	RTW_CHIP_TYPE_8821A,
>  	RTW_CHIP_TYPE_8812A,
>  	RTW_CHIP_TYPE_8814A,
> +	RTW_CHIP_TYPE_8189E,
>  };
>  
>  enum rtw_tx_queue_type {
> @@ -912,10 +913,19 @@ struct rtw_chip_ops {
>  	void (*config_txrx_mode)(struct rtw_dev *rtwdev, u8 tx_path,
>  				 u8 rx_path, bool is_tx2_path);
>  	void (*led_set)(struct led_classdev *led, enum led_brightness brightness);
> +	void (*fill_txdesc)(struct rtw_dev *rtwdev,
> +			    struct rtw_tx_pkt_info *pkt_info,
> +			    struct sk_buff *skb);
> +	int (*query_rx_desc)(struct rtw_dev *rtwdev, void *rx_desc8,
> +			     struct rtw_rx_pkt_stat *pkt_stat,
> +			     struct ieee80211_rx_status *rx_status);
>  	/* for USB/SDIO only */
>  	void (*fill_txdesc_checksum)(struct rtw_dev *rtwdev,
>  				     struct rtw_tx_pkt_info *pkt_info,
>  				     u8 *txdesc);
> +	u32 (*sdio_to_bus_offset)(struct rtw_dev *rtwdev, u32 addr);
> +	u32 (*sdio_fixup_val)(u32 val);
> +	void (*sdio_enable_rx_agg)(struct rtw_dev *rtwdev);
>  
>  	/* for coex */
>  	void (*coex_set_init)(struct rtw_dev *rtwdev);
> @@ -1110,6 +1120,9 @@ struct rtw_table {
>  static inline void rtw_load_table(struct rtw_dev *rtwdev,
>  				  const struct rtw_table *tbl)
>  {
> +	if (!tbl)
> +		return;
> +
>  	(*tbl->parse)(rtwdev, tbl);
>  }
>  
> @@ -1251,6 +1264,8 @@ struct rtw_chip_info {
>  	bool path_div_supported;
>  	bool ht_supported;
>  	bool vht_supported;
> +	bool efuse_inverted;
> +	bool fw_no_hdr;
>  	u8 lps_deep_mode_supported;
>  
>  	/* init values */
> diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
> index e2515a6..8588061 100644
> --- a/drivers/net/wireless/realtek/rtw88/phy.c
> +++ b/drivers/net/wireless/realtek/rtw88/phy.c
> @@ -852,7 +852,8 @@ EXPORT_SYMBOL(rtw_phy_cck_pd_set);
>  
>  static void rtw_phy_pwr_track(struct rtw_dev *rtwdev)
>  {
> -	rtwdev->chip->ops->pwr_track(rtwdev);
> +	if (rtwdev->chip->ops->pwr_track)
> +		rtwdev->chip->ops->pwr_track(rtwdev);
>  }
>  
>  static void rtw_phy_ra_track(struct rtw_dev *rtwdev)
> diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c
> index fde21c8..75c8503 100644
> --- a/drivers/net/wireless/realtek/rtw88/rx.c
> +++ b/drivers/net/wireless/realtek/rtw88/rx.c
> @@ -194,10 +194,10 @@ void rtw_update_rx_freq_from_ie(struct rtw_dev *rtwdev, struct sk_buff *skb,
>  }
>  EXPORT_SYMBOL(rtw_update_rx_freq_from_ie);
>  
> -static void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
> -				  struct rtw_rx_pkt_stat *pkt_stat,
> -				  struct ieee80211_hdr *hdr,
> -				  struct ieee80211_rx_status *rx_status)
> +void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
> +			   struct rtw_rx_pkt_stat *pkt_stat,
> +			   struct ieee80211_hdr *hdr,
> +			   struct ieee80211_rx_status *rx_status)
>  {
>  	struct ieee80211_hw *hw = rtwdev->hw;
>  	u8 path;
> @@ -263,6 +263,7 @@ static void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
>  		rtw_dbg(rtwdev, RTW_DBG_RX, "zero length packet");
>  	}
>  }
> +EXPORT_SYMBOL(rtw_rx_fill_rx_status);
>  
>  int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
>  			 struct rtw_rx_pkt_stat *pkt_stat,
> @@ -274,6 +275,10 @@ int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
>  	u32 enc_type, swdec;
>  	void *phy_status;
>  
> +	if (rtwdev->chip->ops->query_rx_desc)
> +		return rtwdev->chip->ops->query_rx_desc(rtwdev, rx_desc8,
> +							pkt_stat, rx_status);
> +

Just initialise rtwdev->chip->ops->query_rx_desc for all the chips
instead of adding this if.

You have the same pattern in some other places too.

>  	memset(pkt_stat, 0, sizeof(*pkt_stat));
>  
>  	pkt_stat->pkt_len = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PKT_LEN);
> diff --git a/drivers/net/wireless/realtek/rtw88/rx.h b/drivers/net/wireless/realtek/rtw88/rx.h
> index 74359f6..6633f04 100644
> --- a/drivers/net/wireless/realtek/rtw88/rx.h
> +++ b/drivers/net/wireless/realtek/rtw88/rx.h
> @@ -45,6 +45,10 @@ struct rtw_rx_desc {
>  
>  void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
>  		  struct sk_buff *skb);
> +void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
> +			   struct rtw_rx_pkt_stat *pkt_stat,
> +			   struct ieee80211_hdr *hdr,
> +			   struct ieee80211_rx_status *rx_status);
>  int rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
>  			 struct rtw_rx_pkt_stat *pkt_stat,
>  			 struct ieee80211_rx_status *rx_status);
> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
> index 82d7de4..1324226 100644
> --- a/drivers/net/wireless/realtek/rtw88/sdio.c
> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c
> @@ -38,8 +38,19 @@ static bool rtw_sdio_bus_claim_needed(struct rtw_sdio *rtwsdio)
>  	       rtwsdio->irq_thread != current;
>  }
>  
> +static u32 rtw_sdio_fixup_val(struct rtw_dev *rtwdev, u32 val)
> +{
> +	if (rtwdev->chip->ops->sdio_fixup_val)
> +		return rtwdev->chip->ops->sdio_fixup_val(val);
> +
> +	return val;
> +}
> +
>  static u32 rtw_sdio_to_bus_offset(struct rtw_dev *rtwdev, u32 addr)
>  {
> +	if (rtwdev->chip->ops->sdio_to_bus_offset)
> +		return rtwdev->chip->ops->sdio_to_bus_offset(rtwdev, addr);
> +
>  	switch (addr & RTW_SDIO_BUS_MSK) {
>  	case WLAN_IOREG_OFFSET:
>  		addr &= WLAN_IOREG_REG_MSK;
> @@ -700,6 +711,7 @@ static int rtw_sdio_check_free_txpg(struct rtw_dev *rtwdev, u8 queue,
>  		u32 free_txpg;
>  
>  		free_txpg = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG);
> +		free_txpg = rtw_sdio_fixup_val(rtwdev, free_txpg);
>  
>  		switch (queue) {
>  		case RTW_TX_QUEUE_BCN:
> @@ -954,7 +966,13 @@ static void rtw_sdio_enable_rx_aggregation(struct rtw_dev *rtwdev)
>  {
>  	u8 size, timeout;
>  
> +	if (rtwdev->chip->ops->sdio_enable_rx_agg) {
> +		rtwdev->chip->ops->sdio_enable_rx_agg(rtwdev);
> +		return;
> +	}
> +
>  	switch (rtwdev->chip->id) {
> +	case RTW_CHIP_TYPE_8189E:
>  	case RTW_CHIP_TYPE_8723B:
>  	case RTW_CHIP_TYPE_8703B:
>  	case RTW_CHIP_TYPE_8821A:
> @@ -991,7 +1009,8 @@ static void rtw_sdio_enable_interrupt(struct rtw_dev *rtwdev)
>  {
>  	struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
>  
> -	rtw_write32(rtwdev, REG_SDIO_HIMR, rtwsdio->irq_mask);
> +	rtw_write32(rtwdev, REG_SDIO_HIMR,
> +		    rtw_sdio_fixup_val(rtwdev, rtwsdio->irq_mask));
>  }
>  
>  static void rtw_sdio_disable_interrupt(struct rtw_dev *rtwdev)
> @@ -1489,6 +1508,7 @@ static void rtw_sdio_rx_isr_8051(struct rtw_dev *rtwdev)
>  
>  	do {
>  		rx_len = rtw_read16(rtwdev, REG_SDIO_RX0_REQ_LEN);
> +		rx_len = rtw_sdio_fixup_val(rtwdev, rx_len);
>  		if (!rx_len)
>  			break;
>  
> @@ -1508,7 +1528,8 @@ static void rtw_sdio_rx_isr_8051(struct rtw_dev *rtwdev)
>  		 * rtw_rx_pkt_stat.pkt_len is zero or points beyond the
>  		 * end of the buffer.
>  		 */
> -		hisr = rtw_read32(rtwdev, REG_SDIO_HISR);
> +		hisr = rtw_sdio_fixup_val(rtwdev,
> +					  rtw_read32(rtwdev, REG_SDIO_HISR));
>  	} while (total_rx_bytes < SZ_64K && hisr & REG_SDIO_HISR_RX_REQUEST);
>  }
>  
> @@ -1547,7 +1568,7 @@ static void rtw_sdio_handle_interrupt_8051(struct rtw_dev *rtwdev, u32 hisr)
>  	if (rtw_is_8723bs(rtwdev))
>  		hisr &= RTW_SDIO_HISR_CLEAR_MASK;
>  
> -	rtw_write32(rtwdev, REG_SDIO_HISR, hisr);
> +	rtw_write32(rtwdev, REG_SDIO_HISR, rtw_sdio_fixup_val(rtwdev, hisr));
>  }
>  
>  static void rtw_sdio_handle_interrupt_3081(struct rtw_dev *rtwdev, u32 hisr)
> @@ -1599,7 +1620,7 @@ static void rtw_sdio_handle_interrupt(struct sdio_func *sdio_func)
>  
>  	rtwsdio->irq_thread = current;
>  
> -	hisr = rtw_read32(rtwdev, REG_SDIO_HISR);
> +	hisr = rtw_sdio_fixup_val(rtwdev, rtw_read32(rtwdev, REG_SDIO_HISR));
>  	if (hisr) {
>  		if (rtw_chip_wcpu_8051(rtwdev))
>  			rtw_sdio_handle_interrupt_8051(rtwdev, hisr);
> diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
> index b2d8005..32fa8d5 100644
> --- a/drivers/net/wireless/realtek/rtw88/tx.c
> +++ b/drivers/net/wireless/realtek/rtw88/tx.c
> @@ -40,6 +40,11 @@ void rtw_tx_fill_tx_desc(struct rtw_dev *rtwdev,
>  	struct rtw_tx_desc *tx_desc = (struct rtw_tx_desc *)skb->data;
>  	bool more_data = false;
>  
> +	if (rtwdev->chip->ops->fill_txdesc) {
> +		rtwdev->chip->ops->fill_txdesc(rtwdev, pkt_info, skb);
> +		return;
> +	}
> +
>  	if (pkt_info->qsel == TX_DESC_QSEL_HIGH)
>  		more_data = true;
>  


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables
  2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
  2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
@ 2026-12-02 19:17   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Bitterblue Smith @ 2026-12-02 19:17 UTC (permalink / raw)
  To: Alex Novak, pkshih; +Cc: linux-wireless

On 01/12/2026 23:11, Alex Novak wrote:
> Add the MAC, BB, AGC, RF path A, power-by-rate, and TX power limit
> register tables for Realtek RTL8189E, along with the S9082C hardware
> initialization sequences.

Please mention from what driver version you got the tables. You can
find it in include/rtw_version.h.

> 
> Signed-off-by: Alex Novak <neur-alx@agentmail.to>
> ---
>  .../wireless/realtek/rtw88/rtw8189e_table.c   | 2238 +++++++++++++++++
>  .../wireless/realtek/rtw88/rtw8189e_table.h   |   52 +
>  2 files changed, 2290 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
> new file mode 100644
> index 0000000..28d9848
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.c
> @@ -0,0 +1,2238 @@
> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> +/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
> + */
> +
> +#include "main.h"
> +#include "phy.h"
> +#include "rtw8189e_table.h"
> +
> +static const u32 rtw8189e_mac[] = {
> +0x026, 0x00000041,
> +		0x027, 0x00000035,
> +	0x80000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x040, 0x0000000C,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x040, 0x0000000C,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x040, 0x0000000C,
> +	0xA0000000,	0x00000000,
> +		0x040, 0x00000000,
> +	0xB0000000,	0x00000000,
> +		0x421, 0x0000000F,
> +		0x428, 0x0000000A,
> +		0x429, 0x00000010,
> +		0x430, 0x00000000,
> +		0x431, 0x00000001,
> +		0x432, 0x00000002,
> +		0x433, 0x00000004,
> +		0x434, 0x00000005,
> +		0x435, 0x00000006,
> +		0x436, 0x00000007,
> +		0x437, 0x00000008,
> +		0x438, 0x00000000,
> +		0x439, 0x00000000,
> +		0x43A, 0x00000001,
> +		0x43B, 0x00000002,
> +		0x43C, 0x00000004,
> +		0x43D, 0x00000005,
> +		0x43E, 0x00000006,
> +		0x43F, 0x00000007,
> +		0x440, 0x0000005D,
> +		0x441, 0x00000001,
> +		0x442, 0x00000000,
> +		0x444, 0x00000015,
> +		0x445, 0x000000F0,
> +		0x446, 0x0000000F,
> +		0x447, 0x00000000,
> +		0x458, 0x00000041,
> +		0x459, 0x000000A8,
> +		0x45A, 0x00000072,
> +		0x45B, 0x000000B9,
> +		0x460, 0x00000066,
> +		0x461, 0x00000066,
> +		0x480, 0x00000008,
> +		0x4C8, 0x000000FF,
> +		0x4C9, 0x00000008,
> +		0x4CC, 0x000000FF,
> +		0x4CD, 0x000000FF,
> +		0x4CE, 0x00000001,
> +		0x4D3, 0x00000001,
> +		0x500, 0x00000026,
> +		0x501, 0x000000A2,
> +		0x502, 0x0000002F,
> +		0x503, 0x00000000,
> +		0x504, 0x00000028,
> +		0x505, 0x000000A3,
> +		0x506, 0x0000005E,
> +		0x507, 0x00000000,
> +		0x508, 0x0000002B,
> +		0x509, 0x000000A4,
> +		0x50A, 0x0000005E,
> +		0x50B, 0x00000000,
> +		0x50C, 0x0000004F,
> +		0x50D, 0x000000A4,
> +		0x50E, 0x00000000,
> +		0x50F, 0x00000000,
> +		0x512, 0x0000001C,
> +		0x514, 0x0000000A,
> +		0x516, 0x0000000A,
> +		0x525, 0x0000004F,
> +		0x550, 0x00000010,
> +		0x551, 0x00000010,
> +		0x559, 0x00000002,
> +		0x55D, 0x000000FF,
> +		0x605, 0x00000030,
> +		0x608, 0x0000000E,
> +		0x609, 0x0000002A,
> +		0x620, 0x000000FF,
> +		0x621, 0x000000FF,
> +		0x622, 0x000000FF,
> +		0x623, 0x000000FF,
> +		0x624, 0x000000FF,
> +		0x625, 0x000000FF,
> +		0x626, 0x000000FF,
> +		0x627, 0x000000FF,
> +		0x63C, 0x00000008,
> +		0x63D, 0x00000008,
> +		0x63E, 0x0000000C,
> +		0x63F, 0x0000000C,
> +		0x640, 0x00000040,
> +		0x652, 0x00000020,
> +		0x66E, 0x00000005,
> +		0x700, 0x00000021,
> +		0x701, 0x00000043,
> +		0x702, 0x00000065,
> +		0x703, 0x00000087,
> +		0x708, 0x00000021,
> +		0x709, 0x00000043,
> +		0x70A, 0x00000065,
> +		0x70B, 0x00000087,
> +};
> +
> +RTW_DECL_TABLE_PHY_COND(rtw8189e_mac, rtw_phy_cfg_mac);
> +
> +static const u32 rtw8189e_agc[] = {
> +0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xF6000001,
> +		0xC78, 0xF5010001,
> +		0xC78, 0xF4020001,
> +		0xC78, 0xF3030001,
> +		0xC78, 0xF2040001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xF7000001,
> +		0xC78, 0xF6010001,
> +		0xC78, 0xF5020001,
> +		0xC78, 0xF4030001,
> +		0xC78, 0xF3040001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0xFB000001,
> +		0xC78, 0xFA010001,
> +		0xC78, 0xF9020001,
> +		0xC78, 0xF8030001,
> +		0xC78, 0xF7040001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0xFB000001,
> +		0xC78, 0xFB010001,
> +		0xC78, 0xFB020001,
> +		0xC78, 0xFB030001,
> +		0xC78, 0xFB040001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xF1050001,
> +		0xC78, 0xF0060001,
> +		0xC78, 0xEF070001,
> +		0xC78, 0xEE080001,
> +		0xC78, 0xED090001,
> +		0xC78, 0xEC0A0001,
> +		0xC78, 0xEB0B0001,
> +		0xC78, 0xEA0C0001,
> +		0xC78, 0xE90D0001,
> +		0xC78, 0xE80E0001,
> +		0xC78, 0xE70F0001,
> +		0xC78, 0xE6100001,
> +		0xC78, 0xE5110001,
> +		0xC78, 0xE4120001,
> +		0xC78, 0xE3130001,
> +		0xC78, 0xE2140001,
> +		0xC78, 0xC5150001,
> +		0xC78, 0xC4160001,
> +		0xC78, 0xC3170001,
> +		0xC78, 0xC2180001,
> +		0xC78, 0x88190001,
> +		0xC78, 0x871A0001,
> +		0xC78, 0x861B0001,
> +		0xC78, 0x851C0001,
> +		0xC78, 0x841D0001,
> +		0xC78, 0x831E0001,
> +		0xC78, 0x821F0001,
> +		0xC78, 0x81200001,
> +		0xC78, 0x80210001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xF2050001,
> +		0xC78, 0xF1060001,
> +		0xC78, 0xF0070001,
> +		0xC78, 0xEF080001,
> +		0xC78, 0xEE090001,
> +		0xC78, 0xED0A0001,
> +		0xC78, 0xEC0B0001,
> +		0xC78, 0xEB0C0001,
> +		0xC78, 0xEA0D0001,
> +		0xC78, 0xE90E0001,
> +		0xC78, 0xE80F0001,
> +		0xC78, 0xE7100001,
> +		0xC78, 0xE6110001,
> +		0xC78, 0xE5120001,
> +		0xC78, 0xE4130001,
> +		0xC78, 0xE3140001,
> +		0xC78, 0xE2150001,
> +		0xC78, 0xE1160001,
> +		0xC78, 0x89170001,
> +		0xC78, 0x88180001,
> +		0xC78, 0x87190001,
> +		0xC78, 0x861A0001,
> +		0xC78, 0x851B0001,
> +		0xC78, 0x841C0001,
> +		0xC78, 0x831D0001,
> +		0xC78, 0x821E0001,
> +		0xC78, 0x811F0001,
> +		0xC78, 0x6B200001,
> +		0xC78, 0x6A210001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0xF6050001,
> +		0xC78, 0xF5060001,
> +		0xC78, 0xF4070001,
> +		0xC78, 0xF3080001,
> +		0xC78, 0xF2090001,
> +		0xC78, 0xF10A0001,
> +		0xC78, 0xF00B0001,
> +		0xC78, 0xEF0C0001,
> +		0xC78, 0xEE0D0001,
> +		0xC78, 0xED0E0001,
> +		0xC78, 0xEC0F0001,
> +		0xC78, 0xEB100001,
> +		0xC78, 0xEA110001,
> +		0xC78, 0xE9120001,
> +		0xC78, 0xE8130001,
> +		0xC78, 0xE7140001,
> +		0xC78, 0xE6150001,
> +		0xC78, 0xE5160001,
> +		0xC78, 0xE4170001,
> +		0xC78, 0xE3180001,
> +		0xC78, 0xE2190001,
> +		0xC78, 0xE11A0001,
> +		0xC78, 0x8A1B0001,
> +		0xC78, 0x891C0001,
> +		0xC78, 0x881D0001,
> +		0xC78, 0x871E0001,
> +		0xC78, 0x861F0001,
> +		0xC78, 0x85200001,
> +		0xC78, 0x84210001,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xFA050001,
> +		0xC78, 0xF9060001,
> +		0xC78, 0xF8070001,
> +		0xC78, 0xF7080001,
> +		0xC78, 0xF6090001,
> +		0xC78, 0xF50A0001,
> +		0xC78, 0xF40B0001,
> +		0xC78, 0xF30C0001,
> +		0xC78, 0xF20D0001,
> +		0xC78, 0xF10E0001,
> +		0xC78, 0xF00F0001,
> +		0xC78, 0xEF100001,
> +		0xC78, 0xEE110001,
> +		0xC78, 0xED120001,
> +		0xC78, 0xEC130001,
> +		0xC78, 0xEB140001,
> +		0xC78, 0xEA150001,
> +		0xC78, 0xE9160001,
> +		0xC78, 0xE8170001,
> +		0xC78, 0xE7180001,
> +		0xC78, 0xE6190001,
> +		0xC78, 0xE51A0001,
> +		0xC78, 0xE41B0001,
> +		0xC78, 0xC71C0001,
> +		0xC78, 0xC61D0001,
> +		0xC78, 0xC51E0001,
> +		0xC78, 0xC41F0001,
> +		0xC78, 0xC3200001,
> +		0xC78, 0xC2210001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0xFB050001,
> +		0xC78, 0xFA060001,
> +		0xC78, 0xF9070001,
> +		0xC78, 0xF8080001,
> +		0xC78, 0xF7090001,
> +		0xC78, 0xF60A0001,
> +		0xC78, 0xF50B0001,
> +		0xC78, 0xF40C0001,
> +		0xC78, 0xF30D0001,
> +		0xC78, 0xF20E0001,
> +		0xC78, 0xF10F0001,
> +		0xC78, 0xF0100001,
> +		0xC78, 0xEF110001,
> +		0xC78, 0xEE120001,
> +		0xC78, 0xED130001,
> +		0xC78, 0xEC140001,
> +		0xC78, 0xEB150001,
> +		0xC78, 0xEA160001,
> +		0xC78, 0xE9170001,
> +		0xC78, 0xE8180001,
> +		0xC78, 0xE7190001,
> +		0xC78, 0xE61A0001,
> +		0xC78, 0xE51B0001,
> +		0xC78, 0xE41C0001,
> +		0xC78, 0xE31D0001,
> +		0xC78, 0xE21E0001,
> +		0xC78, 0xE11F0001,
> +		0xC78, 0x8A200001,
> +		0xC78, 0x89210001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x66220001,
> +		0xC78, 0x65230001,
> +		0xC78, 0x64240001,
> +		0xC78, 0x63250001,
> +		0xC78, 0x62260001,
> +		0xC78, 0x61270001,
> +		0xC78, 0x60280001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x69220001,
> +		0xC78, 0x68230001,
> +		0xC78, 0x67240001,
> +		0xC78, 0x66250001,
> +		0xC78, 0x65260001,
> +		0xC78, 0x64270001,
> +		0xC78, 0x63280001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x83220001,
> +		0xC78, 0x82230001,
> +		0xC78, 0x6B240001,
> +		0xC78, 0x6A250001,
> +		0xC78, 0x69260001,
> +		0xC78, 0x68270001,
> +		0xC78, 0x67280001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x88220001,
> +		0xC78, 0x87230001,
> +		0xC78, 0x86240001,
> +		0xC78, 0x85250001,
> +		0xC78, 0x84260001,
> +		0xC78, 0x83270001,
> +		0xC78, 0x82280001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x4A290001,
> +		0xC78, 0x492A0001,
> +		0xC78, 0x482B0001,
> +		0xC78, 0x472C0001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x62290001,
> +		0xC78, 0x612A0001,
> +		0xC78, 0x462B0001,
> +		0xC78, 0x452C0001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x66290001,
> +		0xC78, 0x652A0001,
> +		0xC78, 0x642B0001,
> +		0xC78, 0x632C0001,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x81290001,
> +		0xC78, 0x242A0001,
> +		0xC78, 0x232B0001,
> +		0xC78, 0x222C0001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x6B290001,
> +		0xC78, 0x6A2A0001,
> +		0xC78, 0x692B0001,
> +		0xC78, 0x682C0001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x462D0001,
> +		0xC78, 0x452E0001,
> +		0xC78, 0x442F0001,
> +		0xC78, 0x43300001,
> +		0xC78, 0x42310001,
> +		0xC78, 0x41320001,
> +		0xC78, 0x40330001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x442D0001,
> +		0xC78, 0x432E0001,
> +		0xC78, 0x422F0001,
> +		0xC78, 0x41300001,
> +		0xC78, 0x40310001,
> +		0xC78, 0x40320001,
> +		0xC78, 0x40330001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x622D0001,
> +		0xC78, 0x612E0001,
> +		0xC78, 0x462F0001,
> +		0xC78, 0x45300001,
> +		0xC78, 0x44310001,
> +		0xC78, 0x43320001,
> +		0xC78, 0x42330001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x672D0001,
> +		0xC78, 0x662E0001,
> +		0xC78, 0x652F0001,
> +		0xC78, 0x64300001,
> +		0xC78, 0x63310001,
> +		0xC78, 0x62320001,
> +		0xC78, 0x61330001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x40340001,
> +		0xC78, 0x40350001,
> +		0xC78, 0x40360001,
> +		0xC78, 0x40370001,
> +		0xC78, 0x40380001,
> +		0xC78, 0x40390001,
> +		0xC78, 0x403A0001,
> +		0xC78, 0x403B0001,
> +		0xC78, 0x403C0001,
> +		0xC78, 0x403D0001,
> +		0xC78, 0x403E0001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x40340001,
> +		0xC78, 0x40350001,
> +		0xC78, 0x40360001,
> +		0xC78, 0x40370001,
> +		0xC78, 0x40380001,
> +		0xC78, 0x40390001,
> +		0xC78, 0x403A0001,
> +		0xC78, 0x403B0001,
> +		0xC78, 0x403C0001,
> +		0xC78, 0x403D0001,
> +		0xC78, 0x403E0001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x41340001,
> +		0xC78, 0x40350001,
> +		0xC78, 0x40360001,
> +		0xC78, 0x40370001,
> +		0xC78, 0x40380001,
> +		0xC78, 0x40390001,
> +		0xC78, 0x403A0001,
> +		0xC78, 0x403B0001,
> +		0xC78, 0x403C0001,
> +		0xC78, 0x403D0001,
> +		0xC78, 0x403E0001,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0x60340001,
> +		0xC78, 0x4A350001,
> +		0xC78, 0x49360001,
> +		0xC78, 0x48370001,
> +		0xC78, 0x47380001,
> +		0xC78, 0x46390001,
> +		0xC78, 0x453A0001,
> +		0xC78, 0x443B0001,
> +		0xC78, 0x433C0001,
> +		0xC78, 0x423D0001,
> +		0xC78, 0x413E0001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x46340001,
> +		0xC78, 0x45350001,
> +		0xC78, 0x44360001,
> +		0xC78, 0x43370001,
> +		0xC78, 0x42380001,
> +		0xC78, 0x41390001,
> +		0xC78, 0x403A0001,
> +		0xC78, 0x403B0001,
> +		0xC78, 0x403C0001,
> +		0xC78, 0x403D0001,
> +		0xC78, 0x403E0001,
> +	0xB0000000,	0x00000000,
> +	0x80000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x403F0001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x403F0001,
> +	0xB0000000,	0x00000000,
> +	0x88000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xFB400001,
> +		0xC78, 0xFA410001,
> +		0xC78, 0xF9420001,
> +		0xC78, 0xF8430001,
> +		0xC78, 0xF7440001,
> +		0xC78, 0xF6450001,
> +		0xC78, 0xF5460001,
> +		0xC78, 0xF4470001,
> +		0xC78, 0xF3480001,
> +		0xC78, 0xF2490001,
> +		0xC78, 0xF14A0001,
> +		0xC78, 0xF04B0001,
> +		0xC78, 0xEF4C0001,
> +		0xC78, 0xEE4D0001,
> +		0xC78, 0xED4E0001,
> +		0xC78, 0xEC4F0001,
> +		0xC78, 0xEB500001,
> +		0xC78, 0xEA510001,
> +		0xC78, 0xE9520001,
> +		0xC78, 0xE8530001,
> +		0xC78, 0xE7540001,
> +		0xC78, 0xE6550001,
> +		0xC78, 0xE5560001,
> +		0xC78, 0xC6570001,
> +		0xC78, 0xC5580001,
> +		0xC78, 0xC4590001,
> +		0xC78, 0xC35A0001,
> +		0xC78, 0xC25B0001,
> +		0xC78, 0xC15C0001,
> +		0xC78, 0xC05D0001,
> +		0xC78, 0xA35E0001,
> +		0xC78, 0xA25F0001,
> +		0xC78, 0xA1600001,
> +		0xC78, 0x88610001,
> +		0xC78, 0x87620001,
> +		0xC78, 0x86630001,
> +		0xC78, 0x85640001,
> +		0xC78, 0x84650001,
> +		0xC78, 0x83660001,
> +		0xC78, 0x82670001,
> +		0xC78, 0x66680001,
> +		0xC78, 0x65690001,
> +		0xC78, 0x646A0001,
> +		0xC78, 0x636B0001,
> +		0xC78, 0x626C0001,
> +		0xC78, 0x616D0001,
> +		0xC78, 0x486E0001,
> +		0xC78, 0x476F0001,
> +		0xC78, 0x46700001,
> +		0xC78, 0x45710001,
> +		0xC78, 0x44720001,
> +		0xC78, 0x43730001,
> +		0xC78, 0x42740001,
> +		0xC78, 0x41750001,
> +		0xC78, 0x40760001,
> +		0xC78, 0x40770001,
> +		0xC78, 0x40780001,
> +		0xC78, 0x40790001,
> +		0xC78, 0x407A0001,
> +		0xC78, 0x407B0001,
> +		0xC78, 0x407C0001,
> +	0x90000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xFB400001,
> +		0xC78, 0xFA410001,
> +		0xC78, 0xF9420001,
> +		0xC78, 0xF8430001,
> +		0xC78, 0xF7440001,
> +		0xC78, 0xF6450001,
> +		0xC78, 0xF5460001,
> +		0xC78, 0xF4470001,
> +		0xC78, 0xF3480001,
> +		0xC78, 0xF2490001,
> +		0xC78, 0xF14A0001,
> +		0xC78, 0xF04B0001,
> +		0xC78, 0xEF4C0001,
> +		0xC78, 0xEE4D0001,
> +		0xC78, 0xED4E0001,
> +		0xC78, 0xEC4F0001,
> +		0xC78, 0xEB500001,
> +		0xC78, 0xEA510001,
> +		0xC78, 0xE9520001,
> +		0xC78, 0xE8530001,
> +		0xC78, 0xE7540001,
> +		0xC78, 0xE6550001,
> +		0xC78, 0xE5560001,
> +		0xC78, 0xE4570001,
> +		0xC78, 0xE3580001,
> +		0xC78, 0xE2590001,
> +		0xC78, 0xC35A0001,
> +		0xC78, 0xC25B0001,
> +		0xC78, 0xC15C0001,
> +		0xC78, 0x8B5D0001,
> +		0xC78, 0x8A5E0001,
> +		0xC78, 0x895F0001,
> +		0xC78, 0x88600001,
> +		0xC78, 0x87610001,
> +		0xC78, 0x86620001,
> +		0xC78, 0x85630001,
> +		0xC78, 0x84640001,
> +		0xC78, 0x67650001,
> +		0xC78, 0x66660001,
> +		0xC78, 0x65670001,
> +		0xC78, 0x64680001,
> +		0xC78, 0x63690001,
> +		0xC78, 0x626A0001,
> +		0xC78, 0x616B0001,
> +		0xC78, 0x606C0001,
> +		0xC78, 0x466D0001,
> +		0xC78, 0x456E0001,
> +		0xC78, 0x446F0001,
> +		0xC78, 0x43700001,
> +		0xC78, 0x42710001,
> +		0xC78, 0x41720001,
> +		0xC78, 0x40730001,
> +		0xC78, 0x40740001,
> +		0xC78, 0x40750001,
> +		0xC78, 0x40760001,
> +		0xC78, 0x40770001,
> +		0xC78, 0x40780001,
> +		0xC78, 0x40790001,
> +		0xC78, 0x407A0001,
> +		0xC78, 0x407B0001,
> +		0xC78, 0x407C0001,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0xFB400001,
> +		0xC78, 0xFB410001,
> +		0xC78, 0xFB420001,
> +		0xC78, 0xFB430001,
> +		0xC78, 0xFB440001,
> +		0xC78, 0xFB450001,
> +		0xC78, 0xFA460001,
> +		0xC78, 0xF9470001,
> +		0xC78, 0xF8480001,
> +		0xC78, 0xF7490001,
> +		0xC78, 0xF64A0001,
> +		0xC78, 0xF54B0001,
> +		0xC78, 0xF44C0001,
> +		0xC78, 0xF34D0001,
> +		0xC78, 0xF24E0001,
> +		0xC78, 0xF14F0001,
> +		0xC78, 0xF0500001,
> +		0xC78, 0xEF510001,
> +		0xC78, 0xEE520001,
> +		0xC78, 0xED530001,
> +		0xC78, 0xEC540001,
> +		0xC78, 0xEB550001,
> +		0xC78, 0xEA560001,
> +		0xC78, 0xE9570001,
> +		0xC78, 0xE8580001,
> +		0xC78, 0xE7590001,
> +		0xC78, 0xE65A0001,
> +		0xC78, 0xE55B0001,
> +		0xC78, 0xC65C0001,
> +		0xC78, 0xC55D0001,
> +		0xC78, 0xC45E0001,
> +		0xC78, 0xC35F0001,
> +		0xC78, 0xC2600001,
> +		0xC78, 0xC1610001,
> +		0xC78, 0xC0620001,
> +		0xC78, 0xA3630001,
> +		0xC78, 0xA2640001,
> +		0xC78, 0xA1650001,
> +		0xC78, 0x88660001,
> +		0xC78, 0x87670001,
> +		0xC78, 0x86680001,
> +		0xC78, 0x85690001,
> +		0xC78, 0x846A0001,
> +		0xC78, 0x836B0001,
> +		0xC78, 0x826C0001,
> +		0xC78, 0x666D0001,
> +		0xC78, 0x656E0001,
> +		0xC78, 0x646F0001,
> +		0xC78, 0x63700001,
> +		0xC78, 0x62710001,
> +		0xC78, 0x61720001,
> +		0xC78, 0x48730001,
> +		0xC78, 0x47740001,
> +		0xC78, 0x46750001,
> +		0xC78, 0x45760001,
> +		0xC78, 0x44770001,
> +		0xC78, 0x43780001,
> +		0xC78, 0x42790001,
> +		0xC78, 0x417A0001,
> +		0xC78, 0x407B0001,
> +		0xC78, 0x407C0001,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC78, 0xFF400001,
> +		0xC78, 0xFF410001,
> +		0xC78, 0xFE420001,
> +		0xC78, 0xFD430001,
> +		0xC78, 0xFC440001,
> +		0xC78, 0xFB450001,
> +		0xC78, 0xFA460001,
> +		0xC78, 0xF9470001,
> +		0xC78, 0xF8480001,
> +		0xC78, 0xF7490001,
> +		0xC78, 0xF64A0001,
> +		0xC78, 0xF54B0001,
> +		0xC78, 0xF44C0001,
> +		0xC78, 0xF34D0001,
> +		0xC78, 0xF24E0001,
> +		0xC78, 0xF14F0001,
> +		0xC78, 0xF0500001,
> +		0xC78, 0xEF510001,
> +		0xC78, 0xEE520001,
> +		0xC78, 0xED530001,
> +		0xC78, 0xEC540001,
> +		0xC78, 0xEB550001,
> +		0xC78, 0xEA560001,
> +		0xC78, 0xE9570001,
> +		0xC78, 0xE8580001,
> +		0xC78, 0xE7590001,
> +		0xC78, 0xE65A0001,
> +		0xC78, 0xE55B0001,
> +		0xC78, 0xE45C0001,
> +		0xC78, 0xA85D0001,
> +		0xC78, 0xA75E0001,
> +		0xC78, 0xA65F0001,
> +		0xC78, 0xA5600001,
> +		0xC78, 0xA4610001,
> +		0xC78, 0xA3620001,
> +		0xC78, 0xA2630001,
> +		0xC78, 0xA1640001,
> +		0xC78, 0x28650001,
> +		0xC78, 0x27660001,
> +		0xC78, 0x26670001,
> +		0xC78, 0x07680001,
> +		0xC78, 0x06690001,
> +		0xC78, 0x056A0001,
> +		0xC78, 0x046B0001,
> +		0xC78, 0x036C0001,
> +		0xC78, 0x026D0001,
> +		0xC78, 0x016E0001,
> +		0xC78, 0x646F0001,
> +		0xC78, 0x63700001,
> +		0xC78, 0x62710001,
> +		0xC78, 0x61720001,
> +		0xC78, 0x47730001,
> +		0xC78, 0x46740001,
> +		0xC78, 0x45750001,
> +		0xC78, 0x44760001,
> +		0xC78, 0x43770001,
> +		0xC78, 0x42780001,
> +		0xC78, 0x41790001,
> +		0xC78, 0x407A0001,
> +		0xC78, 0x407B0001,
> +		0xC78, 0x407C0001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0xFB400001,
> +		0xC78, 0xFB410001,
> +		0xC78, 0xFB420001,
> +		0xC78, 0xFB430001,
> +		0xC78, 0xFB440001,
> +		0xC78, 0xFB450001,
> +		0xC78, 0xFB460001,
> +		0xC78, 0xFB470001,
> +		0xC78, 0xFB480001,
> +		0xC78, 0xFA490001,
> +		0xC78, 0xF94A0001,
> +		0xC78, 0xF84B0001,
> +		0xC78, 0xF74C0001,
> +		0xC78, 0xF64D0001,
> +		0xC78, 0xF54E0001,
> +		0xC78, 0xF44F0001,
> +		0xC78, 0xF3500001,
> +		0xC78, 0xF2510001,
> +		0xC78, 0xF1520001,
> +		0xC78, 0xF0530001,
> +		0xC78, 0xEF540001,
> +		0xC78, 0xEE550001,
> +		0xC78, 0xED560001,
> +		0xC78, 0xEC570001,
> +		0xC78, 0xEB580001,
> +		0xC78, 0xEA590001,
> +		0xC78, 0xE95A0001,
> +		0xC78, 0xE85B0001,
> +		0xC78, 0xE75C0001,
> +		0xC78, 0xE65D0001,
> +		0xC78, 0xE55E0001,
> +		0xC78, 0xE45F0001,
> +		0xC78, 0xE3600001,
> +		0xC78, 0xE2610001,
> +		0xC78, 0xC3620001,
> +		0xC78, 0xC2630001,
> +		0xC78, 0xC1640001,
> +		0xC78, 0x8B650001,
> +		0xC78, 0x8A660001,
> +		0xC78, 0x89670001,
> +		0xC78, 0x88680001,
> +		0xC78, 0x87690001,
> +		0xC78, 0x866A0001,
> +		0xC78, 0x856B0001,
> +		0xC78, 0x846C0001,
> +		0xC78, 0x676D0001,
> +		0xC78, 0x666E0001,
> +		0xC78, 0x656F0001,
> +		0xC78, 0x64700001,
> +		0xC78, 0x63710001,
> +		0xC78, 0x62720001,
> +		0xC78, 0x61730001,
> +		0xC78, 0x60740001,
> +		0xC78, 0x46750001,
> +		0xC78, 0x45760001,
> +		0xC78, 0x44770001,
> +		0xC78, 0x43780001,
> +		0xC78, 0x42790001,
> +		0xC78, 0x417A0001,
> +		0xC78, 0x407B0001,
> +		0xC78, 0x407C0001,
> +	0xB0000000,	0x00000000,
> +	0x80000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC78, 0x407D0001,
> +		0xC78, 0x407E0001,
> +		0xC78, 0x407F0001,
> +	0xA0000000,	0x00000000,
> +		0xC78, 0x407D0001,
> +		0xC78, 0x407E0001,
> +		0xC78, 0x407F0001,
> +	0xB0000000,	0x00000000,
> +		0xC50, 0x69553422,
> +		0xC50, 0x69553420,
> +};
> +
> +RTW_DECL_TABLE_PHY_COND(rtw8189e_agc, rtw_phy_cfg_agc);
> +
> +static const u32 rtw8189e_bb[] = {
> +0x800, 0x80040000,
> +		0x804, 0x00000003,
> +		0x808, 0x0000FC00,
> +		0x80C, 0x0000000A,
> +		0x810, 0x10001331,
> +		0x814, 0x020C3D10,
> +		0x818, 0x02200385,
> +		0x81C, 0x00000000,
> +		0x820, 0x01000100,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x824, 0x00390004,
> +	0xA0000000,	0x00000000,
> +		0x824, 0x00390204,
> +	0xB0000000,	0x00000000,
> +		0x828, 0x00000000,
> +		0x82C, 0x00000000,
> +		0x830, 0x00000000,
> +		0x834, 0x00000000,
> +		0x838, 0x00000000,
> +		0x83C, 0x00000000,
> +		0x840, 0x00010000,
> +		0x844, 0x00000000,
> +		0x848, 0x00000000,
> +		0x84C, 0x00000000,
> +		0x850, 0x00000000,
> +		0x854, 0x00000000,
> +		0x858, 0x569A11A9,
> +		0x85C, 0x01000014,
> +		0x860, 0x66F60110,
> +		0x864, 0x061F0649,
> +		0x868, 0x00000000,
> +		0x86C, 0x27272700,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x870, 0x07000300,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x870, 0x07000760,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x870, 0x07000760,
> +	0xA0000000,	0x00000000,
> +		0x870, 0x07000760,
> +	0xB0000000,	0x00000000,
> +		0x874, 0x25004000,
> +		0x878, 0x00000808,
> +		0x87C, 0x00000000,
> +		0x880, 0xB0000C1C,
> +		0x884, 0x00000001,
> +		0x888, 0x00000000,
> +		0x88C, 0xCCC000C0,
> +		0x890, 0x00000800,
> +		0x894, 0xFFFFFFFE,
> +		0x898, 0x40302010,
> +		0x89C, 0x00706050,
> +		0x900, 0x00000000,
> +		0x904, 0x00000023,
> +		0x908, 0x00000000,
> +		0x90C, 0x81121111,
> +		0x910, 0x00000002,
> +		0x914, 0x00000201,
> +		0xA00, 0x00D047C8,
> +		0xA04, 0x80FF800C,
> +		0xA08, 0x8C838300,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xA0C, 0x2E34120F,
> +	0xA0000000,	0x00000000,
> +		0xA0C, 0x2E7F120F,
> +	0xB0000000,	0x00000000,
> +		0xA10, 0x9500BB7E,
> +		0xA14, 0x1114D028,
> +		0xA18, 0x00881117,
> +		0xA1C, 0x89140F00,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xA20, 0x13130000,
> +		0xA24, 0x060A0D10,
> +		0xA28, 0x00000103,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xA20, 0x13130000,
> +		0xA24, 0x060A0D10,
> +		0xA28, 0x00000103,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xA20, 0x13130000,
> +		0xA24, 0x060A0D10,
> +		0xA28, 0x00000103,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0xA0000000,	0x00000000,
> +		0xA20, 0x1A1B0000,
> +		0xA24, 0x090E1317,
> +		0xA28, 0x00000204,
> +	0xB0000000,	0x00000000,
> +		0xA2C, 0x00D30000,
> +		0xA70, 0x101FBF00,
> +		0xA74, 0x00000007,
> +		0xA78, 0x00000900,
> +		0xA7C, 0x225B0606,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xA80, 0x21807531,
> +	0xA0000000,	0x00000000,
> +		0xA80, 0x218075B1,
> +	0xB0000000,	0x00000000,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xB2C, 0x00000000,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xB2C, 0x80000000,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xB2C, 0x80000000,
> +	0xA0000000,	0x00000000,
> +		0xB2C, 0x80000000,
> +	0xB0000000,	0x00000000,
> +		0xC00, 0x48071D40,
> +		0xC04, 0x03A05611,
> +		0xC08, 0x000000E4,
> +		0xC0C, 0x6C6C6C6C,
> +		0xC10, 0x08800000,
> +		0xC14, 0x40000100,
> +		0xC18, 0x08800000,
> +		0xC1C, 0x40000100,
> +		0xC20, 0x00000000,
> +		0xC24, 0x00000000,
> +		0xC28, 0x00000000,
> +		0xC2C, 0x00000000,
> +		0xC30, 0x69E9AC47,
> +		0xC34, 0x469652AF,
> +		0xC38, 0x49795994,
> +		0xC3C, 0x0A97971C,
> +		0xC40, 0x1F7C403F,
> +		0xC44, 0x000100B7,
> +		0xC48, 0xEC020107,
> +		0xC4C, 0x007F037F,
> +		0xC50, 0x69553420,
> +		0xC54, 0x43BC0094,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xC58, 0x00013169,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC58, 0x00013169,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC58, 0x00013159,
> +	0xA0000000,	0x00000000,
> +		0xC58, 0x00013169,
> +	0xB0000000,	0x00000000,
> +		0xC5C, 0x00250492,
> +		0xC60, 0x00000000,
> +		0xC64, 0x7112848B,
> +		0xC68, 0x47C00BFF,
> +		0xC6C, 0x00000036,
> +		0xC70, 0x2C7F000D,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xC74, 0x020610DB,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC74, 0x020610DB,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC74, 0x028610DB,
> +	0xA0000000,	0x00000000,
> +		0xC74, 0x020610DB,
> +	0xB0000000,	0x00000000,
> +		0xC78, 0x0000001F,
> +		0xC7C, 0x00B91612,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xC80, 0x2D4000B5,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xC80, 0x2D4000B5,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xC80, 0x2D4000B5,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0xA0000000,	0x00000000,
> +		0xC80, 0x390000E4,
> +	0xB0000000,	0x00000000,
> +		0xC84, 0x21F60000,
> +		0xC88, 0x40000100,
> +		0xC8C, 0x20200000,
> +		0xC90, 0x00091521,
> +		0xC94, 0x00000000,
> +		0xC98, 0x00121820,
> +		0xC9C, 0x00007F7F,
> +		0xCA0, 0x00000000,
> +		0xCA4, 0x000300A0,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xCA8, 0x00000000,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xCA8, 0x00000000,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xCA8, 0xFFFF0000,
> +	0xA0000000,	0x00000000,
> +		0xCA8, 0x00000000,
> +	0xB0000000,	0x00000000,
> +		0xCAC, 0x00000000,
> +		0xCB0, 0x00000000,
> +		0xCB4, 0x00000000,
> +		0xCB8, 0x00000000,
> +		0xCBC, 0x28000000,
> +		0xCC0, 0x00000000,
> +		0xCC4, 0x00000000,
> +		0xCC8, 0x00000000,
> +		0xCCC, 0x00000000,
> +		0xCD0, 0x00000000,
> +		0xCD4, 0x00000000,
> +		0xCD8, 0x64B22427,
> +		0xCDC, 0x00766932,
> +		0xCE0, 0x00222222,
> +		0xCE4, 0x00000000,
> +		0xCE8, 0x37644302,
> +		0xCEC, 0x2F97D40C,
> +		0xD00, 0x00000740,
> +		0xD04, 0x00020401,
> +		0xD08, 0x0000907F,
> +		0xD0C, 0x20010201,
> +		0xD10, 0xA0633333,
> +		0xD14, 0x3333BC43,
> +		0xD18, 0x7A8F5B6F,
> +		0xD2C, 0xCC979975,
> +		0xD30, 0x00000000,
> +		0xD34, 0x80608000,
> +		0xD38, 0x00000000,
> +		0xD3C, 0x00127353,
> +		0xD40, 0x00000000,
> +		0xD44, 0x00000000,
> +		0xD48, 0x00000000,
> +		0xD4C, 0x00000000,
> +		0xD50, 0x6437140A,
> +		0xD54, 0x00000000,
> +		0xD58, 0x00000282,
> +		0xD5C, 0x30032064,
> +		0xD60, 0x4653DE68,
> +		0xD64, 0x04518A3C,
> +		0xD68, 0x00002101,
> +		0xD6C, 0x2A201C16,
> +		0xD70, 0x1812362E,
> +		0xD74, 0x322C2220,
> +		0xD78, 0x000E3C24,
> +		0xE00, 0x2D2D2D2D,
> +		0xE04, 0x2D2D2D2D,
> +		0xE08, 0x0390272D,
> +		0xE10, 0x2D2D2D2D,
> +		0xE14, 0x2D2D2D2D,
> +		0xE18, 0x2D2D2D2D,
> +		0xE1C, 0x2D2D2D2D,
> +		0xE28, 0x00000000,
> +		0xE30, 0x1000DC1F,
> +		0xE34, 0x10008C1F,
> +		0xE38, 0x02140102,
> +		0xE3C, 0x681604C2,
> +		0xE40, 0x01007C00,
> +		0xE44, 0x01004800,
> +		0xE48, 0xFB000000,
> +		0xE4C, 0x000028D1,
> +		0xE50, 0x1000DC1F,
> +		0xE54, 0x10008C1F,
> +		0xE58, 0x02140102,
> +		0xE5C, 0x28160D05,
> +		0xE60, 0x00000048,
> +		0xE68, 0x001B25A4,
> +		0xE6C, 0x00C00014,
> +		0xE70, 0x00C00014,
> +		0xE74, 0x01000014,
> +		0xE78, 0x01000014,
> +		0xE7C, 0x01000014,
> +		0xE80, 0x01000014,
> +		0xE84, 0x00C00014,
> +		0xE88, 0x01000014,
> +		0xE8C, 0x00C00014,
> +		0xED0, 0x00C00014,
> +		0xED4, 0x00C00014,
> +		0xED8, 0x00C00014,
> +		0xEDC, 0x00000014,
> +		0xEE0, 0x00000014,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x98000003,	0x00000001,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x98000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0xEE8, 0x32555448,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0xEE8, 0x21555448,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0xEE8, 0x21555448,
> +	0xA0000000,	0x00000000,
> +		0xEE8, 0x21555448,
> +	0xB0000000,	0x00000000,
> +		0xEEC, 0x01C00014,
> +		0xF14, 0x00000003,
> +		0xF4C, 0x00000000,
> +		0xF00, 0x00000300,
> +};
> +
> +RTW_DECL_TABLE_PHY_COND(rtw8189e_bb, rtw_phy_cfg_bb);
> +
> +static const u32 rtw8189e_rf_a[] = {
> +0x000, 0x00030000,
> +		0x008, 0x00084000,
> +		0x018, 0x00000407,
> +		0x019, 0x00000012,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x01B, 0x00000084,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x01B, 0x00000084,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x01B, 0x00000084,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x01B, 0x00000084,
> +	0x90000400,	0x00000000,	0x40000000,	0x00000000,
> +	0xA0000000,	0x00000000,
> +	0xB0000000,	0x00000000,
> +		0x01E, 0x00080009,
> +		0x01F, 0x00000880,
> +		0x02F, 0x0001A060,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x000C0000,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x000C0000,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x000C0000,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x00000000,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x03F, 0x00000000,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x000C0000,
> +	0x90000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x03F, 0x00000000,
> +	0xA0000000,	0x00000000,
> +		0x03F, 0x00000000,
> +	0xB0000000,	0x00000000,
> +		0x042, 0x000060C0,
> +		0x057, 0x000D0000,
> +		0x058, 0x000BE180,
> +		0x067, 0x00001552,
> +		0x083, 0x00000000,
> +		0x0B0, 0x000FF8FC,
> +		0x0B1, 0x00054400,
> +		0x0B2, 0x000CCC19,
> +		0x0B4, 0x00043003,
> +		0x0B6, 0x0004953E,
> +		0x0B7, 0x0001C718,
> +		0x0B8, 0x000060FF,
> +		0x0B9, 0x00080001,
> +		0x0BA, 0x00040000,
> +		0x0BB, 0x00000400,
> +		0x0BF, 0x000C0000,
> +		0x0C2, 0x00002400,
> +		0x0C3, 0x00000009,
> +		0x0C4, 0x00040C91,
> +		0x0C5, 0x00099999,
> +		0x0C6, 0x000000A3,
> +		0x0C7, 0x00088820,
> +		0x0C8, 0x00076C06,
> +		0x0C9, 0x00000000,
> +		0x0CA, 0x00080000,
> +		0x0DF, 0x00000180,
> +		0x0EF, 0x000001A0,
> +		0x051, 0x0006B27D,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E4DD,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0x90000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x052, 0x0007E4DD,
> +	0xA0000000,	0x00000000,
> +		0x052, 0x0007E49D,
> +	0xB0000000,	0x00000000,
> +		0x053, 0x00000073,
> +		0x056, 0x00051FF3,
> +		0x035, 0x00000086,
> +		0x035, 0x00000186,
> +		0x035, 0x00000286,
> +		0x036, 0x00001C25,
> +		0x036, 0x00009C25,
> +		0x036, 0x00011C25,
> +		0x036, 0x00019C25,
> +		0x0B6, 0x00048538,
> +		0x018, 0x00000C07,
> +		0x05A, 0x0004BD00,
> +		0x019, 0x000739D0,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x034, 0x0000A095,
> +		0x034, 0x00009092,
> +		0x034, 0x0000808E,
> +		0x034, 0x0000704F,
> +		0x034, 0x0000604C,
> +		0x034, 0x00005049,
> +		0x034, 0x0000400C,
> +		0x034, 0x00003009,
> +		0x034, 0x00002006,
> +		0x034, 0x00001003,
> +		0x034, 0x00000000,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x034, 0x0000A095,
> +		0x034, 0x00009092,
> +		0x034, 0x0000808E,
> +		0x034, 0x0000704F,
> +		0x034, 0x0000604C,
> +		0x034, 0x00005049,
> +		0x034, 0x0000400C,
> +		0x034, 0x00003009,
> +		0x034, 0x00002006,
> +		0x034, 0x00001003,
> +		0x034, 0x00000000,
> +	0xA0000000,	0x00000000,
> +		0x034, 0x0000ADF3,
> +		0x034, 0x00009DF0,
> +		0x034, 0x00008DED,
> +		0x034, 0x00007DEA,
> +		0x034, 0x00006DE7,
> +		0x034, 0x000054EE,
> +		0x034, 0x000044EB,
> +		0x034, 0x000034E8,
> +		0x034, 0x0000246B,
> +		0x034, 0x00001468,
> +		0x034, 0x0000006D,
> +	0xB0000000,	0x00000000,
> +		0x000, 0x00030159,
> +		0x084, 0x00068200,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x0008014E,
> +		0x087, 0x0004DF80,
> +	0x90000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0xA0000000,	0x00000000,
> +		0x086, 0x000000CE,
> +		0x087, 0x00048A00,
> +	0xB0000000,	0x00000000,
> +		0x08E, 0x00065540,
> +		0x08F, 0x00088000,
> +		0x0EF, 0x000020A0,
> +	0x88000003,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0x98000001,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0x98000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0x90000002,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0x90000001,	0x00000001,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0x98000000,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F6030,
> +		0x03B, 0x000E6030,
> +		0x03B, 0x000D6030,
> +		0x03B, 0x000C6030,
> +		0x03B, 0x000BF030,
> +		0x03B, 0x000A0020,
> +		0x03B, 0x00090090,
> +		0x03B, 0x0008F080,
> +		0x03B, 0x0007A730,
> +		0x03B, 0x000607B0,
> +		0x03B, 0x0005F770,
> +		0x03B, 0x00040060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020780,
> +		0x03B, 0x000107A0,
> +		0x03B, 0x0000F760,
> +		0x0EF, 0x000000A0,
> +	0x90000400,	0x00000000,	0x40000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0xA0000000,	0x00000000,
> +		0x03B, 0x000F02B0,
> +		0x03B, 0x000EF7B0,
> +		0x03B, 0x000D4FB0,
> +		0x03B, 0x000CF060,
> +		0x03B, 0x000B0090,
> +		0x03B, 0x000A0080,
> +		0x03B, 0x00090080,
> +		0x03B, 0x0008F780,
> +		0x03B, 0x000722B0,
> +		0x03B, 0x0006F7B0,
> +		0x03B, 0x00054FB0,
> +		0x03B, 0x0004F060,
> +		0x03B, 0x00030090,
> +		0x03B, 0x00020080,
> +		0x03B, 0x00010080,
> +		0x03B, 0x0000F780,
> +		0x0EF, 0x000000A0,
> +	0xB0000000,	0x00000000,
> +		0x000, 0x00010159,
> +		0x018, 0x0000F407,
> +		0xFFE, 0x00000000,
> +		0xFFE, 0x00000000,
> +		0x01F, 0x00080003,
> +		0xFFE, 0x00000000,
> +		0xFFE, 0x00000000,
> +		0x01E, 0x00000001,
> +		0x01F, 0x00080000,
> +		0x000, 0x00033E60,
> +};
> +
> +RTW_DECL_TABLE_RF_RADIO(rtw8189e_rf_a, A);
> +
> +static const struct rtw_phy_pg_cfg_pair rtw8189e_bb_pg[] = {
> +	{ 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00003800, },
> +	{ 0, 0, 0, 0x0000086c, 0xffffff00, 0x32343600, },
> +	{ 0, 0, 0, 0x00000e00, 0xffffffff, 0x40424446, },
> +	{ 0, 0, 0, 0x00000e04, 0xffffffff, 0x28323638, },
> +	{ 0, 0, 0, 0x00000e10, 0xffffffff, 0x38404244, },
> +	{ 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436, },
> +};
> +
> +RTW_DECL_TABLE_BB_PG(rtw8189e_bb_pg);
> +
> +static const struct rtw_txpwr_lmt_cfg_pair rtw8189e_txpwr_lmt[] = {
> +	{0, 0, 0, 0, 1, 32},
> +	{2, 0, 0, 0, 1, 26},
> +	{1, 0, 0, 0, 1, 32},
> +	{0, 0, 0, 0, 2, 32},
> +	{2, 0, 0, 0, 2, 26},
> +	{1, 0, 0, 0, 2, 32},
> +	{0, 0, 0, 0, 3, 32},
> +	{2, 0, 0, 0, 3, 26},
> +	{1, 0, 0, 0, 3, 32},
> +	{0, 0, 0, 0, 4, 32},
> +	{2, 0, 0, 0, 4, 26},
> +	{1, 0, 0, 0, 4, 32},
> +	{0, 0, 0, 0, 5, 32},
> +	{2, 0, 0, 0, 5, 26},
> +	{1, 0, 0, 0, 5, 32},
> +	{0, 0, 0, 0, 6, 32},
> +	{2, 0, 0, 0, 6, 26},
> +	{1, 0, 0, 0, 6, 32},
> +	{0, 0, 0, 0, 7, 32},
> +	{2, 0, 0, 0, 7, 26},
> +	{1, 0, 0, 0, 7, 32},
> +	{0, 0, 0, 0, 8, 32},
> +	{2, 0, 0, 0, 8, 26},
> +	{1, 0, 0, 0, 8, 32},
> +	{0, 0, 0, 0, 9, 32},
> +	{2, 0, 0, 0, 9, 26},
> +	{1, 0, 0, 0, 9, 32},
> +	{0, 0, 0, 0, 10, 32},
> +	{2, 0, 0, 0, 10, 26},
> +	{1, 0, 0, 0, 10, 32},
> +	{0, 0, 0, 0, 11, 32},
> +	{2, 0, 0, 0, 11, 26},
> +	{1, 0, 0, 0, 11, 32},
> +	{0, 0, 0, 0, 12, 63},
> +	{2, 0, 0, 0, 12, 26},
> +	{1, 0, 0, 0, 12, 32},
> +	{0, 0, 0, 0, 13, 63},
> +	{2, 0, 0, 0, 13, 26},
> +	{1, 0, 0, 0, 13, 32},
> +	{0, 0, 0, 0, 14, 63},
> +	{2, 0, 0, 0, 14, 63},
> +	{1, 0, 0, 0, 14, 32},
> +	{0, 0, 0, 1, 1, 28},
> +	{2, 0, 0, 1, 1, 30},
> +	{1, 0, 0, 1, 1, 30},
> +	{0, 0, 0, 1, 2, 28},
> +	{2, 0, 0, 1, 2, 30},
> +	{1, 0, 0, 1, 2, 30},
> +	{0, 0, 0, 1, 3, 30},
> +	{2, 0, 0, 1, 3, 30},
> +	{1, 0, 0, 1, 3, 30},
> +	{0, 0, 0, 1, 4, 30},
> +	{2, 0, 0, 1, 4, 30},
> +	{1, 0, 0, 1, 4, 30},
> +	{0, 0, 0, 1, 5, 30},
> +	{2, 0, 0, 1, 5, 30},
> +	{1, 0, 0, 1, 5, 30},
> +	{0, 0, 0, 1, 6, 30},
> +	{2, 0, 0, 1, 6, 30},
> +	{1, 0, 0, 1, 6, 30},
> +	{0, 0, 0, 1, 7, 30},
> +	{2, 0, 0, 1, 7, 30},
> +	{1, 0, 0, 1, 7, 30},
> +	{0, 0, 0, 1, 8, 30},
> +	{2, 0, 0, 1, 8, 30},
> +	{1, 0, 0, 1, 8, 30},
> +	{0, 0, 0, 1, 9, 28},
> +	{2, 0, 0, 1, 9, 30},
> +	{1, 0, 0, 1, 9, 30},
> +	{0, 0, 0, 1, 10, 28},
> +	{2, 0, 0, 1, 10, 30},
> +	{1, 0, 0, 1, 10, 30},
> +	{0, 0, 0, 1, 11, 28},
> +	{2, 0, 0, 1, 11, 30},
> +	{1, 0, 0, 1, 11, 30},
> +	{0, 0, 0, 1, 12, 63},
> +	{2, 0, 0, 1, 12, 30},
> +	{1, 0, 0, 1, 12, 30},
> +	{0, 0, 0, 1, 13, 63},
> +	{2, 0, 0, 1, 13, 30},
> +	{1, 0, 0, 1, 13, 30},
> +	{0, 0, 0, 1, 14, 63},
> +	{2, 0, 0, 1, 14, 63},
> +	{1, 0, 0, 1, 14, 63},
> +	{0, 0, 0, 2, 1, 28},
> +	{2, 0, 0, 2, 1, 30},
> +	{1, 0, 0, 2, 1, 30},
> +	{0, 0, 0, 2, 2, 28},
> +	{2, 0, 0, 2, 2, 30},
> +	{1, 0, 0, 2, 2, 30},
> +	{0, 0, 0, 2, 3, 30},
> +	{2, 0, 0, 2, 3, 30},
> +	{1, 0, 0, 2, 3, 30},
> +	{0, 0, 0, 2, 4, 30},
> +	{2, 0, 0, 2, 4, 30},
> +	{1, 0, 0, 2, 4, 30},
> +	{0, 0, 0, 2, 5, 30},
> +	{2, 0, 0, 2, 5, 30},
> +	{1, 0, 0, 2, 5, 30},
> +	{0, 0, 0, 2, 6, 30},
> +	{2, 0, 0, 2, 6, 30},
> +	{1, 0, 0, 2, 6, 30},
> +	{0, 0, 0, 2, 7, 30},
> +	{2, 0, 0, 2, 7, 30},
> +	{1, 0, 0, 2, 7, 30},
> +	{0, 0, 0, 2, 8, 30},
> +	{2, 0, 0, 2, 8, 30},
> +	{1, 0, 0, 2, 8, 30},
> +	{0, 0, 0, 2, 9, 28},
> +	{2, 0, 0, 2, 9, 30},
> +	{1, 0, 0, 2, 9, 30},
> +	{0, 0, 0, 2, 10, 28},
> +	{2, 0, 0, 2, 10, 30},
> +	{1, 0, 0, 2, 10, 30},
> +	{0, 0, 0, 2, 11, 28},
> +	{2, 0, 0, 2, 11, 30},
> +	{1, 0, 0, 2, 11, 30},
> +	{0, 0, 0, 2, 12, 63},
> +	{2, 0, 0, 2, 12, 30},
> +	{1, 0, 0, 2, 12, 30},
> +	{0, 0, 0, 2, 13, 63},
> +	{2, 0, 0, 2, 13, 30},
> +	{1, 0, 0, 2, 13, 30},
> +	{0, 0, 0, 2, 14, 63},
> +	{2, 0, 0, 2, 14, 63},
> +	{1, 0, 0, 2, 14, 63},
> +	{0, 0, 1, 2, 1, 63},
> +	{2, 0, 1, 2, 1, 63},
> +	{1, 0, 1, 2, 1, 63},
> +	{0, 0, 1, 2, 2, 63},
> +	{2, 0, 1, 2, 2, 63},
> +	{1, 0, 1, 2, 2, 63},
> +	{0, 0, 1, 2, 3, 26},
> +	{2, 0, 1, 2, 3, 26},
> +	{1, 0, 1, 2, 3, 26},
> +	{0, 0, 1, 2, 4, 26},
> +	{2, 0, 1, 2, 4, 26},
> +	{1, 0, 1, 2, 4, 26},
> +	{0, 0, 1, 2, 5, 26},
> +	{2, 0, 1, 2, 5, 26},
> +	{1, 0, 1, 2, 5, 26},
> +	{0, 0, 1, 2, 6, 26},
> +	{2, 0, 1, 2, 6, 26},
> +	{1, 0, 1, 2, 6, 26},
> +	{0, 0, 1, 2, 7, 26},
> +	{2, 0, 1, 2, 7, 26},
> +	{1, 0, 1, 2, 7, 26},
> +	{0, 0, 1, 2, 8, 26},
> +	{2, 0, 1, 2, 8, 26},
> +	{1, 0, 1, 2, 8, 26},
> +	{0, 0, 1, 2, 9, 26},
> +	{2, 0, 1, 2, 9, 26},
> +	{1, 0, 1, 2, 9, 26},
> +	{0, 0, 1, 2, 10, 26},
> +	{2, 0, 1, 2, 10, 26},
> +	{1, 0, 1, 2, 10, 26},
> +	{0, 0, 1, 2, 11, 26},
> +	{2, 0, 1, 2, 11, 26},
> +	{1, 0, 1, 2, 11, 26},
> +	{0, 0, 1, 2, 12, 63},
> +	{2, 0, 1, 2, 12, 26},
> +	{1, 0, 1, 2, 12, 26},
> +	{0, 0, 1, 2, 13, 63},
> +	{2, 0, 1, 2, 13, 26},
> +	{1, 0, 1, 2, 13, 26},
> +	{0, 0, 1, 2, 14, 63},
> +	{2, 0, 1, 2, 14, 63},
> +	{1, 0, 1, 2, 14, 63},
> +};
> +
> +RTW_DECL_TABLE_TXPWR_LMT(rtw8189e_txpwr_lmt);
> +
> +const struct s9082c_rf_step s9082c_rf_init_seq[] = {
> +	{ 0x00c00000, 0 },
> +	{ 0x00110200, 0 },
> +	{ 0x800120e0, 0 },
> +	{ 0x80090048, 0 },
> +	{ 0x800d0021, 0 },
> +	{ 0x80170090, 0 },
> +	{ 0x800f1001, 0 },
> +	{ 0x408f0506, 0 },
> +	{ 0xc03f0000, 0 },
> +	{ 0x20040603, 0 },
> +	{ 0xa0be0000, 0 },
> +	{ 0xa0d18701, 0 },
> +	{ 0x600ea84a, 0 },
> +	{ 0x100c0000, 0 },
> +	{ 0xd0f01f3f, 0 },
> +	{ 0xd0a82200, 0 },
> +	{ 0xd0343398, 0 },
> +	{ 0xd0220cc0, 0 },
> +	{ 0xd026a97c, 0 },
> +	{ 0xd08ee318, 0 },
> +	{ 0xd00106ff, 0 },
> +	{ 0xd0190080, 0 },
> +	{ 0xd0250000, 0 },
> +	{ 0xd00d2000, 0 },
> +	{ 0xd03f0000, 0 },
> +	{ 0x30042400, 0 },
> +	{ 0x300c0090, 0 },
> +	{ 0x30223089, 0 },
> +	{ 0x309a9999, 0 },
> +	{ 0x300600c5, 0 },
> +	{ 0x301e1104, 0 },
> +	{ 0x30e13660, 0 },
> +	{ 0x30090000, 0 },
> +	{ 0x30150000, 0 },
> +	{ 0xb00f8001, 0 },
> +	{ 0x700f8005, 0 },
> +	{ 0xa0684dbe, 0 },
> +	{ 0xa0e427bb, 0 },
> +	{ 0xa00c00ce, 0 },
> +	{ 0xa0a6f8cf, 0 },
> +	{ 0xc00a0061, 0 },
> +	{ 0xc00a8061, 0 },
> +	{ 0xc00a4061, 0 },
> +	{ 0xc00638a4, 0 },
> +	{ 0xc00639a4, 0 },
> +	{ 0xc08638a4, 0 },
> +	{ 0xc08639a4, 0 },
> +	{ 0xd026a11c, 0 },
> +	{ 0x800130e0, 0 },
> +	{ 0xa025bd00, 0 },
> +	{ 0x80e99c0b, 0 },
> +	{ 0xc002b5cf, 0 },
> +	{ 0xc002b90f, 0 },
> +	{ 0xc002b1b7, 0 },
> +	{ 0xc002be57, 0 },
> +	{ 0xc002b6e7, 0 },
> +	{ 0xc0022a77, 0 },
> +	{ 0xc00222d7, 0 },
> +	{ 0xc0022c17, 0 },
> +	{ 0xc00224d6, 0 },
> +	{ 0xc0022816, 0 },
> +	{ 0xc00200b6, 0 },
> +	{ 0x00c0809a, 0 },
> +	{ 0x10624100, 0 },
> +	{ 0x10060073, 0 },
> +	{ 0x102e5100, 0 },
> +	{ 0x1067aa02, 0 },
> +	{ 0x101f0100, 0 },
> +	{ 0x700f0405, 0 },
> +	{ 0xc0fd400d, 0 },
> +	{ 0xc07def0d, 0 },
> +	{ 0xc0bdf20d, 0 },
> +	{ 0xc03d0f06, 0 },
> +	{ 0xc0dd0009, 0 },
> +	{ 0xc05d0001, 0 },
> +	{ 0xc09d0001, 0 },
> +	{ 0xc01def01, 0 },
> +	{ 0xc0ed440d, 0 },
> +	{ 0xc06def0d, 0 },
> +	{ 0xc0adf20d, 0 },
> +	{ 0xc02d0f06, 0 },
> +	{ 0xc0cd0009, 0 },
> +	{ 0xc04d0001, 0 },
> +	{ 0xc08d0001, 0 },
> +	{ 0xc00def01, 0 },
> +	{ 0x700f0005, 0 },
> +	{ 0x0080809a, 0 },
> +	{ 0x80012fe0, 100 },
> +	{ 0x801f00c0, 100 },
> +	{ 0x80070080, 0 },
> +	{ 0x801f0000, 0 },
> +	{ 0x00c07c06, 0 },
> +};
> +
> +const struct s9082c_mac_step s9082c_mac_init_seq[] = {
> +	{ 0x4380, 0x0000e500 },
> +	{ 0x4384, 0x0f200100 },
> +	{ 0x43e0, 0x103c0107 },

Any idea what these three registers do? In the real Realtek chips
page 0x300 is for PCI stuff.

> +	{ 0x4430, 0x20408000 },
> +	{ 0x4434, 0x10e060a0 },
> +	{ 0x4438, 0x40800000 },
> +	{ 0x443c, 0xe060a020 },
> +	{ 0x4444, 0x00f00fa8 },
> +	{ 0x4458, 0x9d4e1541 },
> +	{ 0x4468, 0x20106666 },
> +	{ 0x446c, 0x2018cccc },
> +	{ 0x4470, 0x0070ac52 },
> +	{ 0x4478, 0x00000020 },
> +	{ 0x4500, 0x00f44564 },
> +	{ 0x4504, 0x007ac514 },
> +	{ 0x4508, 0x007a25d4 },
> +	{ 0x450c, 0x000025f2 },
> +	{ 0x4620, 0xffffffff },
> +	{ 0x4624, 0xffffffff },
> +	{ 0x463c, 0x30301010 },
> +	{ 0x4700, 0xe1a6c284 },
> +	{ 0x4708, 0xe1a6c284 },
> +	{ 0x47bc, 0x00203030 },
> +	{ 0x47c0, 0x00008240 },
> +	{ 0x47c8, 0xe01200f0 },
> +};
> +
> +const struct s9082c_phy_step s9082c_phy_init_seq[] = {
> +	{ S9082C_OP_BB_SET, 0x4800, 0xffff0000, 0x5b2e8004 },
> +	{ S9082C_OP_BB_SET, 0x4800, 0x0000ffff, 0x26680000 },
> +	{ S9082C_OP_BB_SET, 0x4804, 0xffff0000, 0x8a520000 },
> +	{ S9082C_OP_BB_SET, 0x4804, 0x0000ffff, 0xed1a0003 },
> +	{ S9082C_OP_BB_SET, 0x4808, 0xffff0000, 0xfc180000 },
> +	{ S9082C_OP_BB_SET, 0x4808, 0x0000ffff, 0x3200fc00 },
> +	{ S9082C_OP_BB_SET, 0x480c, 0xffff0000, 0x0b0a0000 },
> +	{ S9082C_OP_BB_SET, 0x480c, 0x0000ffff, 0x3b01000a },
> +	{ S9082C_OP_BB_SET, 0x4810, 0xffff0000, 0x12121000 },
> +	{ S9082C_OP_BB_SET, 0x4810, 0x0000ffff, 0x12131331 },
> +	{ S9082C_OP_BB_SET, 0x4814, 0xffff0000, 0x3f10020c },
> +	{ S9082C_OP_BB_SET, 0x4814, 0x0000ffff, 0x022d3d10 },
> +	{ S9082C_OP_BB_SET, 0x4818, 0xffff0000, 0x02210220 },
> +	{ S9082C_OP_BB_SET, 0x4818, 0x0000ffff, 0x02230385 },
> +	{ S9082C_OP_BB_SET, 0x481c, 0xffff0000, 0x22020000 },
> +	{ S9082C_OP_BB_SET, 0x481c, 0x0000ffff, 0x22030000 },
> +	{ S9082C_OP_BB_SET, 0x4820, 0xffff0000, 0x22100100 },
> +	{ S9082C_OP_BB_SET, 0x4820, 0x0000ffff, 0x21000100 },
> +	{ S9082C_OP_BB_ND, 0x4824, 0xffff0000, 0x00250039 },
> +	{ S9082C_OP_BB_ND, 0x4824, 0x0000ffff, 0x00280204 },
> +	{ S9082C_OP_BB_SET, 0x4828, 0xffff0000, 0x3ff00000 },
> +	{ S9082C_OP_BB_SET, 0x4828, 0x0000ffff, 0x3ffe0000 },
> +	{ S9082C_OP_BB_ND, 0x482c, 0xffff0000, 0x3ff30000 },
> +	{ S9082C_OP_BB_ND, 0x482c, 0x0000ffff, 0x3ffa0000 },
> +	{ S9082C_OP_BB_SET, 0x4830, 0xffff0000, 0x2af00000 },
> +	{ S9082C_OP_BB_SET, 0x4830, 0x0000ffff, 0x2ef00000 },
> +	{ S9082C_OP_BB_SET, 0x4834, 0xffff0000, 0x3d250000 },
> +	{ S9082C_OP_BB_SET, 0x4834, 0x0000ffff, 0x3da50000 },
> +	{ S9082C_OP_BB_SET, 0x4838, 0xffff0000, 0x02e00000 },
> +	{ S9082C_OP_BB_SET, 0x4838, 0x0000ffff, 0x02f10000 },
> +	{ S9082C_OP_BB_SET, 0x483c, 0xffff0000, 0x00200000 },
> +	{ S9082C_OP_BB_SET, 0x483c, 0x0000ffff, 0x01200000 },
> +	{ S9082C_OP_BB_SET, 0x4840, 0xffff0000, 0x50500001 },
> +	{ S9082C_OP_BB_SET, 0x4840, 0x0000ffff, 0x50510000 },
> +	{ S9082C_OP_BB_SET, 0x4844, 0xffff0000, 0x7e100000 },
> +	{ S9082C_OP_BB_SET, 0x4844, 0x0000ffff, 0x7e010000 },
> +	{ S9082C_OP_BB_SET, 0x4848, 0xffff0000, 0x10200000 },
> +	{ S9082C_OP_BB_SET, 0x4848, 0x0000ffff, 0x10210000 },
> +	{ S9082C_OP_BB_SET, 0x484c, 0xffff0000, 0xe0400000 },
> +	{ S9082C_OP_BB_SET, 0x484c, 0x0000ffff, 0xe0800000 },
> +	{ S9082C_OP_BB_SET, 0x4850, 0xffff0000, 0x49100000 },
> +	{ S9082C_OP_BB_SET, 0x4850, 0x0000ffff, 0x4e100000 },
> +	{ S9082C_OP_BB_SET, 0x4854, 0xffff0000, 0xa11a0000 },
> +	{ S9082C_OP_BB_SET, 0x4854, 0x0000ffff, 0xa24a0000 },
> +	{ S9082C_OP_BB_SET, 0x4858, 0xffff0000, 0xaee0569a },
> +	{ S9082C_OP_BB_SET, 0x4858, 0x0000ffff, 0xa2e011a9 },
> +	{ S9082C_OP_BB_SET, 0x485c, 0xffff0000, 0x11040100 },
> +	{ S9082C_OP_BB_SET, 0x485c, 0x0000ffff, 0x11000014 },
> +	{ S9082C_OP_BB_SET, 0x4860, 0xffff0000, 0x66e066f6 },
> +	{ S9082C_OP_BB_SET, 0x4860, 0x0000ffff, 0x66f00110 },
> +	{ S9082C_OP_BB_SET, 0x4864, 0xffff0000, 0x060f061f },
> +	{ S9082C_OP_BB_SET, 0x4864, 0x0000ffff, 0x060f0649 },
> +	{ S9082C_OP_DIRECT, 0x4868, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x486c, 0xffffffff, 0xe4e4e400 },
> +	{ S9082C_OP_BB_SET, 0x4870, 0xffff0000, 0x07e00700 },
> +	{ S9082C_OP_BB_SET, 0x4870, 0x0000ffff, 0x07100760 },
> +	{ S9082C_OP_BB_SET, 0x4874, 0xffff0000, 0x25102500 },
> +	{ S9082C_OP_BB_SET, 0x4874, 0x0000ffff, 0x25804000 },
> +	{ S9082C_OP_BB_SET, 0x4878, 0xffff0000, 0x07210000 },
> +	{ S9082C_OP_BB_SET, 0x4878, 0x0000ffff, 0x07210808 },
> +	{ S9082C_OP_BB_SET, 0x487c, 0xffff0000, 0x10100000 },
> +	{ S9082C_OP_BB_SET, 0x487c, 0x0000ffff, 0x11100000 },
> +	{ S9082C_OP_DIRECT, 0x4880, 0xffffffff, 0x0d003038 },
> +	{ S9082C_OP_DIRECT, 0x4884, 0xffffffff, 0x00000080 },
> +	{ S9082C_OP_DIRECT, 0x4888, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x488c, 0xffff0000, 0xccc0ccc0 },
> +	{ S9082C_OP_BB_SET, 0x488c, 0x0000ffff, 0xccc100c0 },
> +	{ S9082C_OP_BB_SET, 0x4890, 0xffff0000, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4890, 0x0000ffff, 0x00000800 },
> +	{ S9082C_OP_BB_SET, 0x4894, 0xffff0000, 0xeffeffff },
> +	{ S9082C_OP_BB_SET, 0x4894, 0x0000ffff, 0xfffefffe },
> +	{ S9082C_OP_BB_SET, 0x4898, 0xffff0000, 0x4a314030 },
> +	{ S9082C_OP_BB_SET, 0x4898, 0x0000ffff, 0x4a302010 },
> +	{ S9082C_OP_DIRECT, 0x489c, 0xffffffff, 0x000e060a },
> +	{ S9082C_OP_DIRECT, 0x48a4, 0xffffffff, 0x0e0e050a },
> +	{ S9082C_OP_BB_SET, 0x4900, 0xffff0000, 0x72890000 },
> +	{ S9082C_OP_BB_SET, 0x4900, 0x0000ffff, 0x71090000 },
> +	{ S9082C_OP_BB_SET, 0x4904, 0xffff0000, 0x02020000 },
> +	{ S9082C_OP_BB_SET, 0x4904, 0x0000ffff, 0x02040023 },
> +	{ S9082C_OP_BB_SET, 0x4908, 0xffff0000, 0x40710000 },
> +	{ S9082C_OP_BB_SET, 0x4908, 0x0000ffff, 0x44710000 },
> +	{ S9082C_OP_DIRECT, 0x490c, 0xffffffff, 0x81488888 },
> +	{ S9082C_OP_DIRECT, 0x4910, 0xffffffff, 0x00000040 },
> +	{ S9082C_OP_DIRECT, 0x4914, 0xffffffff, 0x00004080 },
> +	{ S9082C_OP_BB_SET, 0x4a00, 0xffff0000, 0x00de00d0 },
> +	{ S9082C_OP_BB_SET, 0x4a00, 0x0000ffff, 0x00de47c8 },
> +	{ S9082C_OP_BB_SET, 0x4a04, 0xffff0000, 0x800880ff },
> +	{ S9082C_OP_BB_SET, 0x4a04, 0x0000ffff, 0x8002800c },
> +	{ S9082C_OP_DIRECT, 0x4a08, 0xffffffff, 0x31c1c100 },
> +	{ S9082C_OP_DIRECT, 0x4a0c, 0xffffffff, 0x74fe48f0 },
> +	{ S9082C_OP_DIRECT, 0x4a10, 0xffffffff, 0xa900dd1e },
> +	{ S9082C_OP_DIRECT, 0x4a14, 0xffffffff, 0x88280b14 },
> +	{ S9082C_OP_DIRECT, 0x4a18, 0xffffffff, 0x001188e8 },
> +	{ S9082C_OP_BB_SET, 0x4a1c, 0xffff0000, 0x00e08914 },
> +	{ S9082C_OP_BB_SET, 0x4a1c, 0x0000ffff, 0x00e10f00 },
> +	{ S9082C_OP_DIRECT, 0x4a20, 0xffffffff, 0x1a1b0000 },
> +	{ S9082C_OP_DIRECT, 0x4a24, 0xffffffff, 0x090e1317 },
> +	{ S9082C_OP_DIRECT, 0x4a28, 0xffffffff, 0x00000204 },
> +	{ S9082C_OP_BB_SET, 0x4a2c, 0xffff0000, 0x003000d3 },
> +	{ S9082C_OP_BB_SET, 0x4a2c, 0x0000ffff, 0x003e0000 },
> +	{ S9082C_OP_BB_SET, 0x4a70, 0xffff0000, 0x1010101f },
> +	{ S9082C_OP_BB_SET, 0x4a70, 0x0000ffff, 0x1012bf00 },
> +	{ S9082C_OP_BB_SET, 0x4a74, 0xffff0000, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4a74, 0x0000ffff, 0x00000007 },
> +	{ S9082C_OP_DIRECT, 0x4a78, 0xffffffff, 0x00009000 },
> +	{ S9082C_OP_DIRECT, 0x4a7c, 0xffffffff, 0x44da6060 },
> +	{ S9082C_OP_BB_SET, 0x4a80, 0xffff0000, 0x11202180 },
> +	{ S9082C_OP_BB_SET, 0x4a80, 0x0000ffff, 0x110075b1 },
> +	{ S9082C_OP_BB_SET, 0x4b2c, 0xffff0000, 0x02f58000 },
> +	{ S9082C_OP_BB_SET, 0x4b2c, 0x0000ffff, 0x82f50000 },
> +	{ S9082C_OP_BB_SET, 0x4c00, 0xffff0000, 0x11054807 },
> +	{ S9082C_OP_BB_SET, 0x4c00, 0x0000ffff, 0x18051d40 },
> +	{ S9082C_OP_DIRECT, 0x4c04, 0xffffffff, 0xc0056a88 },
> +	{ S9082C_OP_DIRECT, 0x4c08, 0xffffffff, 0x00000027 },
> +	{ S9082C_OP_DIRECT, 0x4c0c, 0xffffffff, 0x36363636 },
> +	{ S9082C_OP_BB_SET, 0x4c10, 0xffff0000, 0x00200880 },
> +	{ S9082C_OP_BB_SET, 0x4c10, 0x0000ffff, 0x08200000 },
> +	{ S9082C_OP_BB_SET, 0x4c14, 0xffff0000, 0x01004000 },
> +	{ S9082C_OP_BB_SET, 0x4c14, 0x0000ffff, 0x41000100 },
> +	{ S9082C_OP_BB_SET, 0x4c18, 0xffff0000, 0x00280880 },
> +	{ S9082C_OP_BB_SET, 0x4c18, 0x0000ffff, 0x08280000 },
> +	{ S9082C_OP_DIRECT, 0x4c1c, 0xffffffff, 0x02008000 },
> +	{ S9082C_OP_DIRECT, 0x4c20, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4c24, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4c28, 0xffff0000, 0x09a00000 },
> +	{ S9082C_OP_BB_SET, 0x4c28, 0x0000ffff, 0x09e00000 },
> +	{ S9082C_OP_BB_SET, 0x4c2c, 0xffff0000, 0x25100000 },
> +	{ S9082C_OP_BB_SET, 0x4c2c, 0x0000ffff, 0x25500000 },
> +	{ S9082C_OP_BB_SET, 0x4c30, 0xffff0000, 0x19a069e9 },
> +	{ S9082C_OP_BB_SET, 0x4c30, 0x0000ffff, 0x19a0ac47 },
> +	{ S9082C_OP_DIRECT, 0x4c34, 0xffffffff, 0x62694af5 },
> +	{ S9082C_OP_DIRECT, 0x4c38, 0xffffffff, 0x929e9a29 },
> +	{ S9082C_OP_DIRECT, 0x4c3c, 0xffffffff, 0x50e9e938 },
> +	{ S9082C_OP_BB_SET, 0x4c40, 0xffff0000, 0x407c1f7c },
> +	{ S9082C_OP_BB_SET, 0x4c40, 0x0000ffff, 0x407c403f },
> +	{ S9082C_OP_BB_SET, 0x4c44, 0xffff0000, 0x00800001 },
> +	{ S9082C_OP_BB_SET, 0x4c44, 0x0000ffff, 0x009000b7 },
> +	{ S9082C_OP_BB_SET, 0x4c48, 0xffff0000, 0x00e0ec02 },
> +	{ S9082C_OP_BB_SET, 0x4c48, 0x0000ffff, 0x00e00107 },
> +	{ S9082C_OP_DIRECT, 0x4c4c, 0xffffffff, 0x007f037f },
> +	{ S9082C_OP_DIRECT, 0x4c50, 0xffffffff, 0x69553420 },
> +	{ S9082C_OP_DIRECT, 0x4c54, 0xffffffff, 0xc23d0029 },
> +	{ S9082C_OP_DIRECT, 0x4c58, 0xffffffff, 0x00013159 },
> +	{ S9082C_OP_DIRECT, 0x4c5c, 0xffffffff, 0x00a42049 },
> +	{ S9082C_OP_DIRECT, 0x4c60, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4c64, 0xffffffff, 0x8e4821d1 },
> +	{ S9082C_OP_DIRECT, 0x4c68, 0xffffffff, 0xe203d0ff },
> +	{ S9082C_OP_BB_SET, 0x4c6c, 0xffff0000, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4c6c, 0x0000ffff, 0x00000036 },
> +	{ S9082C_OP_BB_SET, 0x4c70, 0xffff0000, 0x80112c7f },
> +	{ S9082C_OP_BB_SET, 0x4c70, 0x0000ffff, 0x8001000d },
> +	{ S9082C_OP_BB_SET, 0x4c74, 0xffff0000, 0x10470286 },
> +	{ S9082C_OP_BB_SET, 0x4c74, 0x0000ffff, 0x108710db },
> +	{ S9082C_OP_DIRECT, 0x4c78, 0xffffffff, 0x000000f8 },
> +	{ S9082C_OP_DIRECT, 0x4c7c, 0xffffffff, 0x009d6848 },
> +	{ S9082C_OP_DIRECT, 0x4c80, 0xffffffff, 0x390000e4 },
> +	{ S9082C_OP_BB_SET, 0x4c84, 0xffff0000, 0x2e1121f6 },
> +	{ S9082C_OP_BB_SET, 0x4c84, 0x0000ffff, 0x2e100000 },
> +	{ S9082C_OP_BB_ND, 0x4c88, 0xffff0000, 0x00104000 },
> +	{ S9082C_OP_BB_ND, 0x4c88, 0x0000ffff, 0x00100100 },
> +	{ S9082C_OP_DIRECT, 0x4c8c, 0xffffffff, 0x04040000 },
> +	{ S9082C_OP_DIRECT, 0x4c90, 0xffffffff, 0x0090a884 },
> +	{ S9082C_OP_DIRECT, 0x4c94, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4c98, 0xffffffff, 0x00481804 },
> +	{ S9082C_OP_DIRECT, 0x4c9c, 0xffffffff, 0x0000fefe },
> +	{ S9082C_OP_BB_SET, 0x4ca0, 0xffff0000, 0x105d0000 },
> +	{ S9082C_OP_BB_SET, 0x4ca0, 0x0000ffff, 0x115d0000 },
> +	{ S9082C_OP_BB_SET, 0x4ca4, 0xffff0000, 0x00120003 },
> +	{ S9082C_OP_BB_SET, 0x4ca4, 0x0000ffff, 0x004200a0 },
> +	{ S9082C_OP_DIRECT, 0x4ca8, 0xffffffff, 0xffff0000 },
> +	{ S9082C_OP_DIRECT, 0x4cac, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4cb0, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4cb4, 0xffff0000, 0x19e00000 },
> +	{ S9082C_OP_BB_SET, 0x4cb4, 0x0000ffff, 0x11e00000 },
> +	{ S9082C_OP_BB_SET, 0x4cb8, 0xffff0000, 0xef000000 },
> +	{ S9082C_OP_BB_SET, 0x4cb8, 0x0000ffff, 0xef080000 },
> +	{ S9082C_OP_DIRECT, 0x4cbc, 0xffffffff, 0x14000000 },
> +	{ S9082C_OP_DIRECT, 0x4cc0, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4cc4, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4cc8, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4ccc, 0xffff0000, 0x6b050000 },
> +	{ S9082C_OP_BB_SET, 0x4ccc, 0x0000ffff, 0x6e050000 },
> +	{ S9082C_OP_BB_SET, 0x4cd0, 0xffff0000, 0x28000000 },
> +	{ S9082C_OP_BB_SET, 0x4cd0, 0x0000ffff, 0x88100000 },
> +	{ S9082C_OP_BB_SET, 0x4cd4, 0xffff0000, 0xc4800000 },
> +	{ S9082C_OP_BB_SET, 0x4cd4, 0x0000ffff, 0xc4100000 },
> +	{ S9082C_OP_DIRECT, 0x4cd8, 0xffffffff, 0x264d24e4 },
> +	{ S9082C_OP_DIRECT, 0x4cdc, 0xffffffff, 0x006e964c },
> +	{ S9082C_OP_DIRECT, 0x4ce0, 0xffffffff, 0x00444444 },
> +	{ S9082C_OP_DIRECT, 0x4ce4, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4ce8, 0xffffffff, 0xec26c240 },
> +	{ S9082C_OP_DIRECT, 0x4cec, 0xffffffff, 0xf4e92b30 },
> +	{ S9082C_OP_BB_SET, 0x4d00, 0xffff0000, 0x09180000 },
> +	{ S9082C_OP_BB_SET, 0x4d00, 0x0000ffff, 0x09180740 },
> +	{ S9082C_OP_BB_SET, 0x4d04, 0xffff0000, 0x00100002 },
> +	{ S9082C_OP_BB_SET, 0x4d04, 0x0000ffff, 0x13100401 },
> +	{ S9082C_OP_BB_SET, 0x4d08, 0xffff0000, 0x10020000 },
> +	{ S9082C_OP_BB_SET, 0x4d08, 0x0000ffff, 0x1002907f },
> +	{ S9082C_OP_DIRECT, 0x4d0c, 0xffffffff, 0x04804080 },
> +	{ S9082C_OP_DIRECT, 0x4d10, 0xffffffff, 0x05c6cccc },
> +	{ S9082C_OP_DIRECT, 0x4d14, 0xffffffff, 0xcccc3dc2 },
> +	{ S9082C_OP_DIRECT, 0x4d18, 0xffffffff, 0x5ef1daf6 },
> +	{ S9082C_OP_DIRECT, 0x4d2c, 0xffffffff, 0x33e999ae },
> +	{ S9082C_OP_BB_SET, 0x4d30, 0xffff0000, 0x3e100000 },
> +	{ S9082C_OP_BB_SET, 0x4d30, 0x0000ffff, 0x3f3f0000 },
> +	{ S9082C_OP_BB_SET, 0x4d34, 0xffff0000, 0x90618060 },
> +	{ S9082C_OP_BB_SET, 0x4d34, 0x0000ffff, 0x90648000 },
> +	{ S9082C_OP_BB_SET, 0x4d38, 0xffff0000, 0x80010000 },
> +	{ S9082C_OP_BB_SET, 0x4d38, 0x0000ffff, 0x80910000 },
> +	{ S9082C_OP_DIRECT, 0x4d3c, 0xffffffff, 0x0048ceca },
> +	{ S9082C_OP_DIRECT, 0x4d40, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4d44, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4d48, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4d4c, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4d50, 0xffffffff, 0x26ec2850 },
> +	{ S9082C_OP_DIRECT, 0x4d54, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_DIRECT, 0x4d58, 0xffffffff, 0x00004041 },
> +	{ S9082C_OP_DIRECT, 0x4d5c, 0xffffffff, 0x0cc00426 },
> +	{ S9082C_OP_BB_SET, 0x4d60, 0xffff0000, 0x00204653 },
> +	{ S9082C_OP_BB_SET, 0x4d60, 0x0000ffff, 0x0200de68 },
> +	{ S9082C_OP_BB_SET, 0x4d64, 0xffff0000, 0x00900451 },
> +	{ S9082C_OP_BB_SET, 0x4d64, 0x0000ffff, 0x09908a3c },
> +	{ S9082C_OP_BB_SET, 0x4d68, 0xffff0000, 0x21000000 },
> +	{ S9082C_OP_BB_SET, 0x4d68, 0x0000ffff, 0x00002101 },
> +	{ S9082C_OP_DIRECT, 0x4d6c, 0xffffffff, 0x54043868 },
> +	{ S9082C_OP_DIRECT, 0x4d70, 0xffffffff, 0x18486c74 },
> +	{ S9082C_OP_DIRECT, 0x4d74, 0xffffffff, 0x4c344404 },
> +	{ S9082C_OP_DIRECT, 0x4d78, 0xffffffff, 0x00703c24 },
> +	{ S9082C_OP_DIRECT, 0x4e00, 0xffffffff, 0x2d2d2d2d },
> +	{ S9082C_OP_BB_SET, 0x4e04, 0xffff0000, 0x2e2e2d2d },
> +	{ S9082C_OP_BB_SET, 0x4e04, 0x0000ffff, 0x3f3f2d2d },
> +	{ S9082C_OP_BB_SET, 0x4e08, 0xffff0000, 0x09390390 },
> +	{ S9082C_OP_BB_SET, 0x4e08, 0x0000ffff, 0x3939272d },
> +	{ S9082C_OP_BB_SET, 0x4e10, 0xffff0000, 0x2e2e2d2d },
> +	{ S9082C_OP_BB_SET, 0x4e10, 0x0000ffff, 0x3e3e2d2d },
> +	{ S9082C_OP_DIRECT, 0x4e14, 0xffffffff, 0xb4b4b4b4 },
> +	{ S9082C_OP_DIRECT, 0x4e18, 0xffffffff, 0xb4b4b4b4 },
> +	{ S9082C_OP_DIRECT, 0x4e1c, 0xffffffff, 0xb4b4b4b4 },
> +	{ S9082C_OP_DIRECT, 0x4e28, 0xffffffff, 0x00000000 },
> +	{ S9082C_OP_BB_SET, 0x4e30, 0xffff0000, 0x10001000 },
> +	{ S9082C_OP_BB_SET, 0x4e30, 0x0000ffff, 0x1000dc1f },
> +	{ S9082C_OP_BB_SET, 0x4e34, 0xffff0000, 0x10001000 },
> +	{ S9082C_OP_BB_SET, 0x4e34, 0x0000ffff, 0x10108c1f },
> +	{ S9082C_OP_BB_SET, 0x4e38, 0xffff0000, 0x20120214 },
> +	{ S9082C_OP_BB_SET, 0x4e38, 0x0000ffff, 0x20100102 },
> +	{ S9082C_OP_DIRECT, 0x4e3c, 0xffffffff, 0x16682043 },
> +	{ S9082C_OP_DIRECT, 0x4e40, 0xffffffff, 0x80003e00 },
> +	{ S9082C_OP_DIRECT, 0x4e44, 0xffffffff, 0x80001200 },
> +	{ S9082C_OP_DIRECT, 0x4e48, 0xffffffff, 0xdf000000 },
> +	{ S9082C_OP_DIRECT, 0x4e4c, 0xffffffff, 0x0000148b },
> +	{ S9082C_OP_BB_SET, 0x4e50, 0xffff0000, 0x10101000 },
> +	{ S9082C_OP_BB_SET, 0x4e50, 0x0000ffff, 0x1010dc1f },
> +	{ S9082C_OP_BB_SET, 0x4e54, 0xffff0000, 0x10011000 },
> +	{ S9082C_OP_BB_SET, 0x4e54, 0x0000ffff, 0x10018c1f },
> +	{ S9082C_OP_DIRECT, 0x4e58, 0xffffffff, 0x40288040 },
> +	{ S9082C_OP_DIRECT, 0x4e5c, 0xffffffff, 0x1468b0a0 },
> +	{ S9082C_OP_DIRECT, 0x4e60, 0xffffffff, 0x00000012 },
> +	{ S9082C_OP_DIRECT, 0x4e68, 0xffffffff, 0x00d8a425 },
> +	{ S9082C_OP_DIRECT, 0x4e6c, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4e70, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4e74, 0xffffffff, 0x80000028 },
> +	{ S9082C_OP_DIRECT, 0x4e78, 0xffffffff, 0x80000028 },
> +	{ S9082C_OP_DIRECT, 0x4e7c, 0xffffffff, 0x80000028 },
> +	{ S9082C_OP_DIRECT, 0x4e80, 0xffffffff, 0x80000028 },
> +	{ S9082C_OP_DIRECT, 0x4e84, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4e88, 0xffffffff, 0x80000028 },
> +	{ S9082C_OP_DIRECT, 0x4e8c, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4ed0, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4ed4, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_DIRECT, 0x4ed8, 0xffffffff, 0x00030028 },
> +	{ S9082C_OP_BB_SET, 0x4edc, 0xffff0000, 0x2ee00000 },
> +	{ S9082C_OP_BB_SET, 0x4edc, 0x0000ffff, 0x2ee00014 },
> +	{ S9082C_OP_BB_SET, 0x4ee0, 0xffff0000, 0x2ee00000 },
> +	{ S9082C_OP_BB_SET, 0x4ee0, 0x0000ffff, 0x2ee00014 },
> +	{ S9082C_OP_BB_SET, 0x4ee8, 0xffff0000, 0x20102155 },
> +	{ S9082C_OP_BB_SET, 0x4ee8, 0x0000ffff, 0x20105448 },
> +	{ S9082C_OP_BB_SET, 0x4eec, 0xffff0000, 0x01c001c0 },
> +	{ S9082C_OP_BB_SET, 0x4eec, 0x0000ffff, 0x01c00014 },
> +	{ S9082C_OP_BB_SET, 0x4f14, 0xffff0000, 0x00300000 },
> +	{ S9082C_OP_BB_SET, 0x4f14, 0x0000ffff, 0x003f0003 },
> +	{ S9082C_OP_BB_SET, 0x4f4c, 0xffff0000, 0xe0100000 },
> +	{ S9082C_OP_BB_SET, 0x4f4c, 0x0000ffff, 0x90100000 },
> +	{ S9082C_OP_BB_SET, 0x4f00, 0xffff0000, 0x10e00000 },
> +	{ S9082C_OP_BB_SET, 0x4f00, 0x0000ffff, 0x10e00300 },
> +};
> +
> +const struct s9082c_agc_step s9082c_agc_init_seq[] = {
> +	{ 0x4c78, 0xdf000080 },
> +	{ 0x4c78, 0xdf800080 },
> +	{ 0x4c78, 0xdf400080 },
> +	{ 0x4c78, 0xdfc00080 },
> +	{ 0x4c78, 0xdf200080 },
> +	{ 0x4c78, 0x5fa00080 },
> +	{ 0x4c78, 0x9f600080 },
> +	{ 0x4c78, 0x1fe00080 },
> +	{ 0x4c78, 0xef100080 },
> +	{ 0x4c78, 0x6f900080 },
> +	{ 0x4c78, 0xaf500080 },
> +	{ 0x4c78, 0x2fd00080 },
> +	{ 0x4c78, 0xcf300080 },
> +	{ 0x4c78, 0x4fb00080 },
> +	{ 0x4c78, 0x8f700080 },
> +	{ 0x4c78, 0x0ff00080 },
> +	{ 0x4c78, 0xf7080080 },
> +	{ 0x4c78, 0x77880080 },
> +	{ 0x4c78, 0xb7480080 },
> +	{ 0x4c78, 0x37c80080 },
> +	{ 0x4c78, 0xd7280080 },
> +	{ 0x4c78, 0x57a80080 },
> +	{ 0x4c78, 0x97680080 },
> +	{ 0x4c78, 0x17e80080 },
> +	{ 0x4c78, 0xe7180080 },
> +	{ 0x4c78, 0x67980080 },
> +	{ 0x4c78, 0xa7580080 },
> +	{ 0x4c78, 0x27d80080 },
> +	{ 0x4c78, 0xe3380080 },
> +	{ 0x4c78, 0x63b80080 },
> +	{ 0x4c78, 0xa3780080 },
> +	{ 0x4c78, 0x23f80080 },
> +	{ 0x4c78, 0xc3040080 },
> +	{ 0x4c78, 0x43840080 },
> +	{ 0x4c78, 0x11440080 },
> +	{ 0x4c78, 0xe1c40080 },
> +	{ 0x4c78, 0x61240080 },
> +	{ 0x4c78, 0xa1a40080 },
> +	{ 0x4c78, 0x21640080 },
> +	{ 0x4c78, 0xc1e40080 },
> +	{ 0x4c78, 0x41140080 },
> +	{ 0x4c78, 0x81940080 },
> +	{ 0x4c78, 0x24540080 },
> +	{ 0x4c78, 0xc4d40080 },
> +	{ 0x4c78, 0x44340080 },
> +	{ 0x4c78, 0xe6b40080 },
> +	{ 0x4c78, 0x66740080 },
> +	{ 0x4c78, 0xa6f40080 },
> +	{ 0x4c78, 0x260c0080 },
> +	{ 0x4c78, 0xc68c0080 },
> +	{ 0x4c78, 0x464c0080 },
> +	{ 0x4c78, 0x86cc0080 },
> +	{ 0x4c78, 0x062c0080 },
> +	{ 0x4c78, 0x52ac0080 },
> +	{ 0x4c78, 0x926c0080 },
> +	{ 0x4c78, 0x12ec0080 },
> +	{ 0x4c78, 0xe21c0080 },
> +	{ 0x4c78, 0x629c0080 },
> +	{ 0x4c78, 0xa25c0080 },
> +	{ 0x4c78, 0x22dc0080 },
> +	{ 0x4c78, 0xc23c0080 },
> +	{ 0x4c78, 0x42bc0080 },
> +	{ 0x4c78, 0x827c0080 },
> +	{ 0x4c78, 0x02fc0080 },
> +	{ 0x4c78, 0xdf020080 },
> +	{ 0x4c78, 0xdf820080 },
> +	{ 0x4c78, 0xdf420080 },
> +	{ 0x4c78, 0xdfc20080 },
> +	{ 0x4c78, 0xdf220080 },
> +	{ 0x4c78, 0xdfa20080 },
> +	{ 0x4c78, 0x5f620080 },
> +	{ 0x4c78, 0x9fe20080 },
> +	{ 0x4c78, 0x1f120080 },
> +	{ 0x4c78, 0xef920080 },
> +	{ 0x4c78, 0x6f520080 },
> +	{ 0x4c78, 0xafd20080 },
> +	{ 0x4c78, 0x2f320080 },
> +	{ 0x4c78, 0xcfb20080 },
> +	{ 0x4c78, 0x4f720080 },
> +	{ 0x4c78, 0x8ff20080 },
> +	{ 0x4c78, 0x0f0a0080 },
> +	{ 0x4c78, 0xf78a0080 },
> +	{ 0x4c78, 0x774a0080 },
> +	{ 0x4c78, 0xb7ca0080 },
> +	{ 0x4c78, 0x372a0080 },
> +	{ 0x4c78, 0xd7aa0080 },
> +	{ 0x4c78, 0x576a0080 },
> +	{ 0x4c78, 0x97ea0080 },
> +	{ 0x4c78, 0x171a0080 },
> +	{ 0x4c78, 0xe79a0080 },
> +	{ 0x4c78, 0x675a0080 },
> +	{ 0x4c78, 0xa7da0080 },
> +	{ 0x4c78, 0x633a0080 },
> +	{ 0x4c78, 0xa3ba0080 },
> +	{ 0x4c78, 0x237a0080 },
> +	{ 0x4c78, 0xc3fa0080 },
> +	{ 0x4c78, 0x43060080 },
> +	{ 0x4c78, 0x83860080 },
> +	{ 0x4c78, 0x03460080 },
> +	{ 0x4c78, 0xc5c60080 },
> +	{ 0x4c78, 0x45260080 },
> +	{ 0x4c78, 0x85a60080 },
> +	{ 0x4c78, 0x11660080 },
> +	{ 0x4c78, 0xe1e60080 },
> +	{ 0x4c78, 0x61160080 },
> +	{ 0x4c78, 0xa1960080 },
> +	{ 0x4c78, 0x21560080 },
> +	{ 0x4c78, 0xc1d60080 },
> +	{ 0x4c78, 0x41360080 },
> +	{ 0x4c78, 0x66b60080 },
> +	{ 0x4c78, 0xa6760080 },
> +	{ 0x4c78, 0x26f60080 },
> +	{ 0x4c78, 0xc60e0080 },
> +	{ 0x4c78, 0x468e0080 },
> +	{ 0x4c78, 0x864e0080 },
> +	{ 0x4c78, 0x12ce0080 },
> +	{ 0x4c78, 0xe22e0080 },
> +	{ 0x4c78, 0x62ae0080 },
> +	{ 0x4c78, 0xa26e0080 },
> +	{ 0x4c78, 0x22ee0080 },
> +	{ 0x4c78, 0xc21e0080 },
> +	{ 0x4c78, 0x429e0080 },
> +	{ 0x4c78, 0x825e0080 },
> +	{ 0x4c78, 0x02de0080 },
> +	{ 0x4c78, 0x023e0080 },
> +	{ 0x4c78, 0x02be0080 },
> +	{ 0x4c78, 0x027e0080 },
> +	{ 0x4c78, 0x02fe0080 },
> +	{ 0x4c50, 0x69553422 },
> +	{ 0x4c50, 0x69553420 },
> +};
> +
> +const size_t s9082c_rf_init_seq_len = ARRAY_SIZE(s9082c_rf_init_seq);
> +const size_t s9082c_mac_init_seq_len = ARRAY_SIZE(s9082c_mac_init_seq);
> +const size_t s9082c_phy_init_seq_len = ARRAY_SIZE(s9082c_phy_init_seq);
> +const size_t s9082c_agc_init_seq_len = ARRAY_SIZE(s9082c_agc_init_seq);
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
> new file mode 100644
> index 0000000..ec51c5a
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8189e_table.h
> @@ -0,0 +1,52 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
> +/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
> + */
> +
> +#ifndef __RTW8189E_TABLE_H__
> +#define __RTW8189E_TABLE_H__
> +
> +extern const struct rtw_table rtw8189e_mac_tbl;
> +extern const struct rtw_table rtw8189e_agc_tbl;
> +extern const struct rtw_table rtw8189e_bb_tbl;
> +extern const struct rtw_table rtw8189e_bb_pg_tbl;
> +extern const struct rtw_table rtw8189e_rf_a_tbl;
> +extern const struct rtw_table rtw8189e_txpwr_lmt_tbl;
> +
> +enum s9082c_phy_op {
> +	S9082C_OP_BB_SET = 0,
> +	S9082C_OP_BB_ND  = 1,
> +	S9082C_OP_DIRECT = 2,
> +};
> +
> +struct s9082c_rf_step {
> +	u32 val;
> +	u8 sleep_ms;
> +};
> +
> +struct s9082c_mac_step {
> +	u16 reg;
> +	u32 val;
> +};
> +
> +struct s9082c_phy_step {
> +	u8 op;
> +	u16 reg;
> +	u32 mask;
> +	u32 val;
> +};
> +
> +struct s9082c_agc_step {
> +	u16 reg;
> +	u32 val;
> +};
> +
> +extern const struct s9082c_rf_step s9082c_rf_init_seq[];
> +extern const size_t s9082c_rf_init_seq_len;
> +extern const struct s9082c_mac_step s9082c_mac_init_seq[];
> +extern const size_t s9082c_mac_init_seq_len;
> +extern const struct s9082c_phy_step s9082c_phy_init_seq[];
> +extern const size_t s9082c_phy_init_seq_len;
> +extern const struct s9082c_agc_step s9082c_agc_init_seq[];
> +extern const size_t s9082c_agc_init_seq_len;
> +
> +#endif


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core
  2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
  2026-12-02  8:21   ` Luka Gejak
  2026-12-02  8:56   ` Luka Gejak
@ 2026-12-02 19:18   ` Bitterblue Smith
  2 siblings, 0 replies; 18+ messages in thread
From: Bitterblue Smith @ 2026-12-02 19:18 UTC (permalink / raw)
  To: Alex Novak, pkshih; +Cc: linux-wireless

On 01/12/2026 23:11, Alex Novak wrote:
> Add chip definitions, 32-byte TX and 24-byte RX descriptor helpers,
> PHY status parsing, power sequences, and S9082C bit-reversed
> MAC/BB/RF, IQK/LCK calibration, and SDIO register mapping callbacks for
> Realtek RTL8189E and SmartChip S9082C.
> 
> Signed-off-by: Alex Novak <neur-alx@agentmail.to>
> ---
>  drivers/net/wireless/realtek/rtw88/Kconfig    |    4 +
>  drivers/net/wireless/realtek/rtw88/Makefile   |    3 +
>  drivers/net/wireless/realtek/rtw88/rtw8189e.c | 1425 +++++++++++++++++
>  drivers/net/wireless/realtek/rtw88/rtw8189e.h |   20 +
>  4 files changed, 1452 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8189e.h
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
> index e1f40d6..58916f6 100644
> --- a/drivers/net/wireless/realtek/rtw88/Kconfig
> +++ b/drivers/net/wireless/realtek/rtw88/Kconfig
> @@ -32,6 +32,10 @@ config RTW88_8822C
>  config RTW88_8723X
>  	tristate
>  
> +config RTW88_8189E
> +	tristate
> +	select RTW88_8723X
> +
>  config RTW88_8703B
>  	tristate
>  	select RTW88_8723X
> diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
> index 6889b37..8a6ef91 100644
> --- a/drivers/net/wireless/realtek/rtw88/Makefile
> +++ b/drivers/net/wireless/realtek/rtw88/Makefile
> @@ -52,6 +52,9 @@ rtw88_8723x-objs		:= rtw8723x.o
>  obj-$(CONFIG_RTW88_8703B)	+= rtw88_8703b.o
>  rtw88_8703b-objs		:= rtw8703b.o rtw8703b_tables.o
>  
> +obj-$(CONFIG_RTW88_8189E)	+= rtw88_8189e.o
> +rtw88_8189e-objs		:= rtw8189e.o rtw8189e_table.o
> +
>  obj-$(CONFIG_RTW88_8723CS)	+= rtw88_8723cs.o
>  rtw88_8723cs-objs		:= rtw8723cs.o
>  
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e.c b/drivers/net/wireless/realtek/rtw88/rtw8189e.c
> new file mode 100644
> index 0000000..9032d94
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8189e.c
> @@ -0,0 +1,1425 @@
> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> +/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
> + */
> +
> +#include <linux/bitrev.h>
> +#include <linux/module.h>
> +#include "main.h"
> +#include "mac.h"
> +#include "phy.h"
> +#include "reg.h"
> +#include "rx.h"
> +#include "sdio.h"
> +#include "tx.h"
> +#include "rtw8723x.h"
> +#include "rtw8189e.h"
> +#include "rtw8189e_table.h"
> +
> +struct rtw8189e_tx_desc {
> +	__le32 w0;
> +	__le32 w1;
> +	__le32 w2;
> +	__le32 w3;
> +	__le32 w4;
> +	__le32 w5;
> +	__le32 w6;
> +	__le32 w7;
> +} __packed;
> +
> +/* 8188E/8189E 32-byte TX descriptor (w0..w7) differences vs 40-byte rtw88 */
> +#define RTW8189E_TXD_W0_FS			BIT(27)
> +#define RTW8189E_TXD_W0_OWN			BIT(31)
> +#define RTW8189E_TXD_W1_MACID			GENMASK(5, 0)
> +#define RTW8189E_TXD_W1_RATE_ID			GENMASK(19, 16)
> +#define RTW8189E_TXD_W1_NAVUSEHDR		BIT(20)
> +#define RTW8189E_TXD_W1_PKT_OFFSET		GENMASK(30, 26)
> +#define RTW8189E_TXD_W3_SW_SEQ			GENMASK(27, 16)
> +#define RTW8189E_TXD_W3_EN_HWSEQ		BIT(31)
> +#define RTW8189E_TXD_W4_RTSRATE			GENMASK(4, 0)
> +#define RTW8189E_TXD_W4_HW_SSN_SEL		GENMASK(7, 6)
> +#define RTW8189E_TXD_W4_USE_RATE		BIT(8)
> +#define RTW8189E_TXD_W4_DISDATAFB		BIT(10)
> +#define RTW8189E_TXD_W4_USE_RTS			BIT(12)
> +#define RTW8189E_TXD_W4_HW_RTS_EN		BIT(13)
> +#define RTW8189E_TXD_W4_DATA_STBC		GENMASK(23, 22)
> +#define RTW8189E_TXD_W4_DATA_SHORT		BIT(24)
> +#define RTW8189E_TXD_W4_DATA_BW			BIT(25)
> +#define RTW8189E_TXD_W4_RTS_SHORT		BIT(26)
> +#define RTW8189E_TXD_W5_DATARATE		GENMASK(5, 0)
> +#define RTW8189E_TXD_W5_SGI			BIT(6)
> +#define RTW8189E_TXD_W5_DATARATE_FB_LIMIT	GENMASK(12, 8)
> +#define RTW8189E_TXD_W5_RTS_FB_LIMIT		GENMASK(16, 13)
> +#define RTW8189E_TXD_W6_MAX_AGG_NUM		GENMASK(15, 11)
> +#define RTW8189E_TXD_W7_SW_DEFINE		GENMASK(27, 16)
> +
> +/* 8188E/8189E 24-byte RX descriptor (w0..w5) differences */
> +#define RTW8189E_RXD_W1_MACID			GENMASK(4, 0)
> +#define RTW8189E_RXD_W3_RX_RATE			GENMASK(5, 0)
> +#define RTW8189E_RXD_W3_BW			BIT(9)
> +#define RTW8189E_RXD_W3_RPT_SEL			GENMASK(15, 14)
> +
> +#define S9082C_SDIO_LOCAL_BASE			0x2000
> +#define S9082C_SDIO_MAC_OFFSET			0x4000
> +#define S9082C_HSSI1_PI_EN			BIT(8)
> +#define S9082C_HSSI2_ADDR_MSK			GENMASK(30, 23)
> +#define S9082C_HSSI2_TRIG			BIT(31)
> +#define S9082C_SIPI_ADDR_MSK			GENMASK(27, 20)
> +#define S9082C_RFCFGCH_CH_MSK			GENMASK(9, 0)
> +#define S9082C_RFCFGCH_BW_MSK			GENMASK(11, 10)
> +#define S9082C_RFCFGCH_TX_MSK			GENMASK(14, 12)
> +#define S9082C_XTAL_CAP_MSK			GENMASK(5, 0)
> +#define S9082C_XTAL_CAP_LO_MSK			GENMASK(5, 0)
> +#define S9082C_XTAL_CAP_HI_MSK			GENMASK(11, 6)
> +#define S9082C_XTAL_CTRL_MSK			GENMASK(22, 11)
> +#define S9082C_CCK_AGC_LNA_MSK			GENMASK(7, 5)
> +#define S9082C_CCK_AGC_VGA_MSK			GENMASK(4, 0)
> +#define S9082C_OFDM_GAIN_MSK			GENMASK(5, 0)
> +#define S9082C_OFDM_PWDB_MSK			GENMASK(7, 1)
> +#define S9082C_OFDM_BW40_RES_MSK		GENMASK(11, 10)
> +#define S9082C_MAC_BW40_OFFSET_MSK		GENMASK(7, 5)
> +#define S9082C_BB_BW40_OFFSET_MSK		GENMASK(1, 0)
> +#define S9082C_BB_PWR_SAV5_BW40_MSK		GENMASK(27, 26)
> +#define S9082C_IQK_TX0_EXT_A_BIT		BIT(24)
> +#define S9082C_IQK_TX0_EXT_C_BIT		BIT(26)
> +#define S9082C_IQK_A_PI_MOD_MSK			GENMASK(31, 8)
> +#define S9082C_IQK_RX_PATH_MSK			GENMASK(27, 24)
> +
> +static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8189e[] = {
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_WRITE, BIT(0), 0},
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), 0},
> +	{0xFFFF,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 0,
> +	 RTW_PWR_CMD_END, 0, 0},
> +};
> +
> +static const struct rtw_pwr_seq_cmd trans_cardemu_to_act_8189e[] = {
> +	{0x0006,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_POLLING, BIT(1), BIT(1)},
> +	{0x0002,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(0) | BIT(1), 0},
> +	{0x0026,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(7), BIT(7)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(7), 0},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(4) | BIT(3), 0},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_POLLING, BIT(0), 0},
> +	{0x0023,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(4), 0},
> +	{0xFFFF,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 0,
> +	 RTW_PWR_CMD_END, 0, 0},
> +};
> +
> +static const struct rtw_pwr_seq_cmd trans_act_to_cardemu_8189e[] = {
> +	{0x001F,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0xFF, 0},
> +	{0x0023,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(4), BIT(4)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(1), BIT(1)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_POLLING, BIT(1), 0},
> +	{0xFFFF,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 0,
> +	 RTW_PWR_CMD_END, 0, 0},
> +};
> +
> +static const struct rtw_pwr_seq_cmd trans_cardemu_to_carddis_8189e[] = {
> +	{0x0026,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(7), BIT(7)},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)},
> +	{0x0007,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0xFF, 0},
> +	{0x0041,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_USB_MSK | RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, BIT(4), 0},
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_WRITE, BIT(0), BIT(0)},
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_POLLING, BIT(1), 0},
> +	{0xFFFF,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 0,
> +	 RTW_PWR_CMD_END, 0, 0},
> +};
> +
> +static const struct rtw_pwr_seq_cmd * const card_enable_flow_8189e[] = {
> +	trans_carddis_to_cardemu_8189e,
> +	trans_cardemu_to_act_8189e,
> +	NULL
> +};
> +
> +static const struct rtw_pwr_seq_cmd * const card_disable_flow_8189e[] = {
> +	trans_act_to_cardemu_8189e,
> +	trans_cardemu_to_carddis_8189e,
> +	NULL
> +};
> +
> +static const struct rtw_pwr_seq_cmd s9082c_enable_seq[] = {
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_WRITE, 0x08, 0x00},
> +	{0x0086,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_SDIO_MSK,
> +	 RTW_PWR_ADDR_SDIO,
> +	 RTW_PWR_CMD_POLLING, 0x04, 0x04},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x18, 0x00},
> +	{0x0006,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_POLLING, 0x40, 0x40},
> +	{0x0002,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0xC0, 0x00},
> +	{0x0026,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x01, 0x01},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x01, 0x00},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x18, 0x00},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x80, 0x80},
> +	{0x0005,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_POLLING, 0x80, 0x00},
> +	{0x0023,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 RTW_PWR_ADDR_MAC,
> +	 RTW_PWR_CMD_WRITE, 0x08, 0x00},
> +	{0xFFFF,
> +	 RTW_PWR_CUT_ALL_MSK,
> +	 RTW_PWR_INTF_ALL_MSK,
> +	 0,
> +	 RTW_PWR_CMD_END, 0, 0},
> +};
> +
> +static const struct rtw_pwr_seq_cmd * const s9082c_card_enable_flow[] = {
> +	s9082c_enable_seq,
> +	NULL
> +};
> +
> +/* S9082C locks up on standard card disable; leave power down empty */
> +static const struct rtw_pwr_seq_cmd * const s9082c_card_disable_flow[] = {
> +	NULL
> +};
> +
> +static const struct rtw_page_table page_table_8189e[] = {
> +	{0, 9, 0, 0, 1},
> +	{0, 9, 0, 0, 1},
> +	{0, 9, 0, 0, 1},
> +	{0, 9, 0, 0, 1},
> +	{0, 9, 0, 0, 1},
> +};
> +
> +static const struct rtw_rqpn rqpn_table_8189e[] = {
> +	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
> +	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
> +	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
> +	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
> +	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
> +	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
> +	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
> +	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
> +	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
> +	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
> +	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
> +	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
> +	{RTW_DMA_MAPPING_NORMAL, RTW_DMA_MAPPING_NORMAL,
> +	 RTW_DMA_MAPPING_LOW, RTW_DMA_MAPPING_LOW,
> +	 RTW_DMA_MAPPING_HIGH, RTW_DMA_MAPPING_HIGH},
> +};
> +
> +static const struct rtw_rfe_def rtw8189e_rfe_defs[] = {
> +	[0] = { .phy_pg_tbl = &rtw8189e_bb_pg_tbl,
> +		.txpwr_lmt_tbl = &rtw8189e_txpwr_lmt_tbl, },
> +};
> +
> +static u32 s9082c_bitrev32(u32 val)
> +{
> +	return (u32)bitrev8(val) |
> +	       ((u32)bitrev8(val >> 8) << 8) |
> +	       ((u32)bitrev8(val >> 16) << 16) |
> +	       ((u32)bitrev8(val >> 24) << 24);
> +}

This looks like bitrev8x4, doesn't it?

> +
> +static bool s9082c_is_nd_bbreg(u32 addr)

What does "nd" mean?

> +{
> +	u32 off = addr & 0x0fff;
> +
> +	switch (off) {
> +	case 0x824:
> +	case 0x82c:
> +	case 0xa20:
> +	case 0xa24:
> +	case 0xa28:
> +	case 0xc4c:
> +	case 0xc50:
> +	case 0xc58:
> +	case 0xc80:
> +	case 0xc88:
> +	case 0xc94:
> +	case 0xe00:
> +		return true;
> +	default:
> +		return false;
> +	}
> +}
> +
> +static u32 s9082c_read_bbreg(struct rtw_dev *rtwdev, u32 addr, u32 mask)
> +{
> +	u32 orig;
> +
> +	orig = rtw_read32(rtwdev, addr);
> +	if (!s9082c_is_nd_bbreg(addr))
> +		orig = s9082c_bitrev32(orig);
> +
> +	if (mask != MASKDWORD)
> +		orig = (orig & mask) >> __ffs(mask);
> +
> +	return orig;
> +}
> +
> +static void s9082c_write_bbreg(struct rtw_dev *rtwdev, u32 addr, u32 mask,
> +			       u32 data)
> +{
> +	bool is_nd = s9082c_is_nd_bbreg(addr);
> +	u32 orig;
> +
> +	if (mask != MASKDWORD) {
> +		orig = rtw_read32(rtwdev, addr);
> +		if (!is_nd)
> +			orig = s9082c_bitrev32(orig);
> +		data = (orig & ~mask) | ((data << __ffs(mask)) & mask);
> +	}
> +
> +	if (!is_nd)
> +		data = s9082c_bitrev32(data);
> +	rtw_write32(rtwdev, addr, data);
> +}
> +
> +static u32 s9082c_read_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
> +			  u32 addr, u32 mask)
> +{
> +	const struct rtw_rf_sipi_addr *sipi;
> +	u32 tmplong, tmplong2, val;
> +	u8 pi_en;
> +
> +	sipi = &rtwdev->chip->rf_sipi_read_addr[rf_path];
> +	addr &= 0xff;
> +
> +	tmplong = rtw_read32(rtwdev, sipi->hssi_2) & ~S9082C_HSSI2_TRIG;
> +	tmplong2 = tmplong | S9082C_HSSI2_TRIG;
> +	u32p_replace_bits(&tmplong2, addr, S9082C_HSSI2_ADDR_MSK);
> +
> +	rtw_write32(rtwdev, sipi->hssi_2, tmplong);
> +	usleep_range(10, 20);
> +	rtw_write32(rtwdev, sipi->hssi_2, tmplong2);
> +	usleep_range(110, 150);
> +
> +	pi_en = s9082c_read_bbreg(rtwdev, sipi->hssi_1, S9082C_HSSI1_PI_EN);
> +	if (pi_en)
> +		val = s9082c_read_bbreg(rtwdev, sipi->lssi_read_pi, RFREG_MASK);
> +	else
> +		val = s9082c_read_bbreg(rtwdev, sipi->lssi_read, RFREG_MASK);
> +
> +	if (mask != RFREG_MASK)
> +		val = (val & mask) >> __ffs(mask);
> +
> +	return val;
> +}
> +
> +static bool s9082c_write_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
> +			    u32 addr, u32 mask, u32 data)
> +{
> +	const struct rtw_chip_info *chip = rtwdev->chip;
> +	u32 orig, val;
> +
> +	addr &= 0xff;
> +	if (mask != RFREG_MASK) {
> +		orig = s9082c_read_rf(rtwdev, rf_path, addr, RFREG_MASK);
> +		data = (orig & ~mask) | ((data << __ffs(mask)) & mask);
> +	}
> +
> +	val = u32_encode_bits(addr, S9082C_SIPI_ADDR_MSK) | (data & RFREG_MASK);
> +	s9082c_write_bbreg(rtwdev, chip->rf_sipi_addr[rf_path], MASKDWORD, val);
> +
> +	return true;
> +}
> +
> +static void rtw8189e_fill_txdesc(struct rtw_dev *rtwdev,
> +				 struct rtw_tx_pkt_info *pkt_info,
> +				 struct sk_buff *skb)
> +{
> +	struct rtw8189e_tx_desc *tx_desc = (struct rtw8189e_tx_desc *)skb->data;
> +	bool bw40 = pkt_info->bw == RTW_CHANNEL_WIDTH_40;
> +
> +	tx_desc->w0 = le32_encode_bits(pkt_info->tx_pkt_size, RTW_TX_DESC_W0_TXPKTSIZE) |
> +		      le32_encode_bits(pkt_info->offset, RTW_TX_DESC_W0_OFFSET) |
> +		      le32_encode_bits(pkt_info->bmc, RTW_TX_DESC_W0_BMC) |
> +		      le32_encode_bits(pkt_info->ls, RTW_TX_DESC_W0_LS) |
> +		      le32_encode_bits(1, RTW8189E_TXD_W0_FS) |
> +		      le32_encode_bits(1, RTW8189E_TXD_W0_OWN);
> +
> +	tx_desc->w1 = le32_encode_bits(pkt_info->mac_id, RTW8189E_TXD_W1_MACID) |
> +		      le32_encode_bits(pkt_info->qsel, RTW_TX_DESC_W1_QSEL) |
> +		      le32_encode_bits(pkt_info->rate_id, RTW8189E_TXD_W1_RATE_ID) |
> +		      le32_encode_bits(pkt_info->nav_use_hdr, RTW8189E_TXD_W1_NAVUSEHDR) |
> +		      le32_encode_bits(pkt_info->sec_type, RTW_TX_DESC_W1_SEC_TYPE) |
> +		      le32_encode_bits(pkt_info->pkt_offset, RTW8189E_TXD_W1_PKT_OFFSET);
> +
> +	tx_desc->w2 = le32_encode_bits(pkt_info->ampdu_en, RTW_TX_DESC_W2_AGG_EN) |
> +		      le32_encode_bits(pkt_info->report, RTW_TX_DESC_W2_SPE_RPT) |
> +		      le32_encode_bits(pkt_info->ampdu_density, RTW_TX_DESC_W2_AMPDU_DEN) |
> +		      le32_encode_bits(pkt_info->bt_null, RTW_TX_DESC_W2_BT_NULL);
> +
> +	tx_desc->w3 = le32_encode_bits(pkt_info->seq, RTW8189E_TXD_W3_SW_SEQ) |
> +		      le32_encode_bits(pkt_info->en_hwseq, RTW8189E_TXD_W3_EN_HWSEQ);
> +
> +	tx_desc->w4 = le32_encode_bits(pkt_info->hw_ssn_sel, RTW8189E_TXD_W4_HW_SSN_SEL) |
> +		      le32_encode_bits(pkt_info->use_rate, RTW8189E_TXD_W4_USE_RATE) |
> +		      le32_encode_bits(pkt_info->dis_rate_fallback, RTW8189E_TXD_W4_DISDATAFB) |
> +		      le32_encode_bits(pkt_info->rts, RTW8189E_TXD_W4_USE_RTS) |
> +		      le32_encode_bits(pkt_info->rts, RTW8189E_TXD_W4_HW_RTS_EN) |
> +		      le32_encode_bits(pkt_info->stbc, RTW8189E_TXD_W4_DATA_STBC) |
> +		      le32_encode_bits(pkt_info->short_gi, RTW8189E_TXD_W4_DATA_SHORT) |
> +		      le32_encode_bits(bw40, RTW8189E_TXD_W4_DATA_BW);
> +
> +	tx_desc->w5 = le32_encode_bits(pkt_info->rate, RTW8189E_TXD_W5_DATARATE) |
> +		      le32_encode_bits(pkt_info->short_gi && pkt_info->rate >= DESC_RATEMCS0,
> +				       RTW8189E_TXD_W5_SGI) |
> +		      le32_encode_bits(0xf, RTW8189E_TXD_W5_RTS_FB_LIMIT);
> +
> +	if (rtwdev->chip->old_datarate_fb_limit)
> +		tx_desc->w5 |= le32_encode_bits(0x1f, RTW8189E_TXD_W5_DATARATE_FB_LIMIT);
> +
> +	tx_desc->w6 = le32_encode_bits(pkt_info->ampdu_factor,
> +				       RTW8189E_TXD_W6_MAX_AGG_NUM);
> +
> +	tx_desc->w7 = le32_encode_bits(pkt_info->sn, RTW8189E_TXD_W7_SW_DEFINE);
> +
> +	if (pkt_info->rts) {
> +		tx_desc->w4 |= le32_encode_bits(DESC_RATE24M, RTW8189E_TXD_W4_RTSRATE) |
> +			       le32_encode_bits(1, RTW8189E_TXD_W4_RTS_SHORT);
> +	}
> +}
> +
> +static int rtw8189e_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
> +				  struct rtw_rx_pkt_stat *pkt_stat,
> +				  struct ieee80211_rx_status *rx_status)
> +{
> +	u32 desc_sz = rtwdev->chip->rx_pkt_desc_sz;
> +	struct rtw_rx_desc *rx_desc = rx_desc8;
> +	struct ieee80211_hdr *hdr;
> +	u32 enc_type, swdec;
> +	void *phy_status;
> +
> +	memset(pkt_stat, 0, sizeof(*pkt_stat));
> +
> +	pkt_stat->pkt_len = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PKT_LEN);
> +	pkt_stat->crc_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_CRC32);
> +	pkt_stat->icv_err = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ICV_ERR);
> +	pkt_stat->drv_info_sz = le32_get_bits(rx_desc->w0,
> +					      RTW_RX_DESC_W0_DRV_INFO_SIZE);
> +	enc_type = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_ENC_TYPE);
> +	pkt_stat->shift = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SHIFT);
> +	pkt_stat->phy_status = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_PHYST);
> +	swdec = le32_get_bits(rx_desc->w0, RTW_RX_DESC_W0_SWDEC);
> +	pkt_stat->decrypted = !swdec && enc_type != RX_DESC_ENC_NONE;
> +
> +	pkt_stat->cam_id = le32_get_bits(rx_desc->w1, RTW8189E_RXD_W1_MACID);
> +
> +	pkt_stat->rate = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_RX_RATE);
> +	pkt_stat->bw = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_BW) ?
> +		       RTW_CHANNEL_WIDTH_40 : RTW_CHANNEL_WIDTH_20;
> +	pkt_stat->is_c2h = le32_get_bits(rx_desc->w3, RTW8189E_RXD_W3_RPT_SEL) != 0;
> +
> +	pkt_stat->tsf_low = le32_get_bits(rx_desc->w5, RTW_RX_DESC_W5_TSFL);
> +
> +	if (unlikely(pkt_stat->rate >= DESC_RATE_MAX))
> +		return -EINVAL;
> +
> +	if (unlikely(pkt_stat->drv_info_sz &&
> +		     pkt_stat->drv_info_sz != PHY_STATUS_SIZE))
> +		return -EINVAL;
> +
> +	if (unlikely(pkt_stat->phy_status && !pkt_stat->drv_info_sz))
> +		return -EINVAL;
> +
> +	if (unlikely(pkt_stat->pkt_len > IEEE80211_MAX_MPDU_LEN_VHT_11454))
> +		return -EINVAL;
> +
> +	pkt_stat->drv_info_sz *= 8;
> +
> +	if (pkt_stat->is_c2h)
> +		return 0;
> +
> +	if (unlikely(pkt_stat->pkt_len <= FCS_LEN))
> +		return -EINVAL;
> +
> +	phy_status = rx_desc8 + desc_sz + pkt_stat->shift;
> +	hdr = phy_status + pkt_stat->drv_info_sz;
> +	pkt_stat->hdr = hdr;
> +
> +	if (pkt_stat->phy_status)
> +		rtwdev->chip->ops->query_phy_status(rtwdev, phy_status, pkt_stat);
> +
> +	rtw_rx_fill_rx_status(rtwdev, pkt_stat, hdr, rx_status);
> +
> +	return 0;
> +}
> +
> +static void rtw8189e_query_phy_status_cck(struct rtw_dev *rtwdev, void *phy_raw,
> +					  struct rtw_rx_pkt_stat *pkt_stat)
> +{
> +	struct phy_status_8723x *phy_status = phy_raw;
> +	u8 lna_idx = u8_get_bits(phy_status->cck_agc_rpt_ofdm_cfosho_a,
> +				 S9082C_CCK_AGC_LNA_MSK);
> +	u8 vga_idx = u8_get_bits(phy_status->cck_agc_rpt_ofdm_cfosho_a,
> +				 S9082C_CCK_AGC_VGA_MSK);
> +	s8 min_rx_power = -120;
> +	s8 rx_power;
> +
> +	rx_power = -96 + (vga_idx * 2) - (lna_idx * 6);
> +
> +	pkt_stat->bw = RTW_CHANNEL_WIDTH_20;
> +	pkt_stat->rx_power[RF_PATH_A] = rx_power;
> +	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
> +	pkt_stat->signal_power = max(pkt_stat->rx_power[RF_PATH_A], min_rx_power);
> +	rtwdev->dm_info.rssi[RF_PATH_A] = pkt_stat->rssi;
> +}
> +
> +static void rtw8189e_query_phy_status_ofdm(struct rtw_dev *rtwdev, void *phy_raw,
> +					   struct rtw_rx_pkt_stat *pkt_stat)
> +{
> +	struct phy_status_8723x *phy_status = phy_raw;
> +	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
> +	s8 val_s8;
> +
> +	val_s8 = u8_get_bits(phy_status->path_agc[RF_PATH_A].gain,
> +			     S9082C_OFDM_GAIN_MSK);
> +	pkt_stat->rx_power[RF_PATH_A] = (val_s8 * 2) - 110;
> +	pkt_stat->rssi = rtw_phy_rf_power_2_rssi(pkt_stat->rx_power, 1);
> +	pkt_stat->rx_snr[RF_PATH_A] = phy_status->path_rxsnr[RF_PATH_A];
> +
> +	val_s8 = u8_get_bits(phy_status->cck_sig_qual_ofdm_pwdb_all,
> +			     S9082C_OFDM_PWDB_MSK);
> +	pkt_stat->signal_power = val_s8 - 110;
> +
> +	pkt_stat->rx_evm[RF_PATH_A] = phy_status->stream_rxevm[RF_PATH_A];
> +	pkt_stat->cfo_tail[RF_PATH_A] = phy_status->path_cfotail[RF_PATH_A];
> +
> +	dm_info->curr_rx_rate = pkt_stat->rate;
> +	dm_info->rssi[RF_PATH_A] = pkt_stat->rssi;
> +	dm_info->rx_snr[RF_PATH_A] = pkt_stat->rx_snr[RF_PATH_A] >> 1;
> +	dm_info->cfo_tail[RF_PATH_A] = (pkt_stat->cfo_tail[RF_PATH_A] * 5) >> 1;
> +
> +	val_s8 = (s8)pkt_stat->rx_evm[RF_PATH_A];
> +	val_s8 = clamp_t(s8, -val_s8 >> 1, 0, 64);
> +	val_s8 &= S9082C_OFDM_GAIN_MSK;
> +	dm_info->rx_evm_dbm[RF_PATH_A] = val_s8;
> +}
> +
> +static void rtw8189e_query_phy_status(struct rtw_dev *rtwdev, u8 *phy_status,
> +				      struct rtw_rx_pkt_stat *pkt_stat)
> +{
> +	if (pkt_stat->rate <= DESC_RATE11M)
> +		rtw8189e_query_phy_status_cck(rtwdev, phy_status, pkt_stat);
> +	else
> +		rtw8189e_query_phy_status_ofdm(rtwdev, phy_status, pkt_stat);
> +}
> +
> +static void rtw8189e_phy_set_param(struct rtw_dev *rtwdev)
> +{
> +	u8 xtal_cap = u8_get_bits(rtwdev->efuse.crystal_cap,
> +				  S9082C_XTAL_CAP_MSK);
> +	u32 xtal_val;
> +
> +	/* power on BB/RF domain */
> +	rtw_write16_set(rtwdev, REG_SYS_FUNC_EN,
> +			BIT_FEN_EN_25_1 | BIT_FEN_BB_GLB_RST | BIT_FEN_BB_RSTB);
> +	rtw_write8_set(rtwdev, REG_RF_CTRL,
> +		       BIT_RF_EN | BIT_RF_RSTB | BIT_RF_SDM_RSTB);
> +	rtw_write8(rtwdev, REG_AFE_CTRL1 + 1, 0x80);
> +
> +	rtw_phy_load_tables(rtwdev);
> +
> +	rtw_write32_clr(rtwdev, REG_RCR, BIT_RCR_ADF);
> +	rtw_write8_set(rtwdev, REG_HIQ_NO_LMT_EN, 0xff);
> +	xtal_val = u32_encode_bits(xtal_cap, S9082C_XTAL_CAP_LO_MSK) |
> +		   u32_encode_bits(xtal_cap, S9082C_XTAL_CAP_HI_MSK);
> +	rtw_write32_mask(rtwdev, REG_AFE_XTAL_CTRL, BIT_MASK_XTAL, xtal_val);
> +
> +	rtw_phy_init(rtwdev);
> +}
> +
> +static void rtw8189e_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
> +{
> +	u32 rf_cfgch;
> +
> +	rf_cfgch = rtw_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
> +	rf_cfgch &= ~(RFCFGCH_CHANNEL_MASK | RFCFGCH_BW_MASK);
> +	rf_cfgch |= u32_encode_bits(channel, RFCFGCH_CHANNEL_MASK);
> +
> +	switch (bw) {
> +	case RTW_CHANNEL_WIDTH_20:
> +		rf_cfgch |= RFCFGCH_BW_20M;
> +		break;
> +	case RTW_CHANNEL_WIDTH_40:
> +		rf_cfgch |= RFCFGCH_BW_40M;
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, rf_cfgch);
> +}
> +
> +static void rtw8189e_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,
> +				    u8 primary_ch_idx)
> +{
> +	switch (bw) {
> +	case RTW_CHANNEL_WIDTH_20:
> +		rtw_write32_mask(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x0);
> +		rtw_write32_mask(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x0);
> +		break;
> +	case RTW_CHANNEL_WIDTH_40:
> +		rtw_write32_mask(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x1);
> +		rtw_write32_mask(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x1);
> +		rtw_write32_mask(rtwdev, REG_CCK0_SYS, BIT_CCK_SIDE_BAND,
> +				 primary_ch_idx == RTW_SC_20_UPPER ? 1 : 0);
> +		rtw_write32_mask(rtwdev, REG_OFDM_FA_RSTD_11N,
> +				 S9082C_OFDM_BW40_RES_MSK,
> +				 primary_ch_idx == RTW_SC_20_UPPER ? 2 : 1);
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
> +static void rtw8189e_set_channel(struct rtw_dev *rtwdev, u8 channel,
> +				 u8 bandwidth, u8 primary_chan_idx)
> +{
> +	rtw8189e_set_channel_bb(rtwdev, channel, bandwidth, primary_chan_idx);
> +	rtw8189e_set_channel_rf(rtwdev, channel, bandwidth);
> +}
> +
> +static void rtw8189e_phy_calibration(struct rtw_dev *rtwdev)
> +{
> +	rtw8723x_lck(rtwdev);
> +}
> +
> +static int s9082c_mac_init(struct rtw_dev *rtwdev)
> +{
> +	size_t i;
> +
> +	for (i = 0; i < s9082c_mac_init_seq_len; i++) {
> +		rtw_write32(rtwdev, s9082c_mac_init_seq[i].reg,
> +			    s9082c_mac_init_seq[i].val);
> +		udelay(1);
> +	}
> +
> +	rtw_write16(rtwdev, 0x04ca, 0xe0e0);
> +	rtw_write16_set(rtwdev, REG_APS_FSMCO, 0x0008);
> +	rtw_write16_set(rtwdev, REG_CR, 0x60fc);
> +
> +	return 0;
> +}
> +
> +static void s9082c_set_rf_path_switch(struct rtw_dev *rtwdev, bool is_main)
> +{
> +	rtw_write8_set(rtwdev, 0x004e, 0x01);
> +	s9082c_write_bbreg(rtwdev, 0x0878, 0x2000, 1);
> +	s9082c_write_bbreg(rtwdev, 0x0870, 0x300, 0);
> +	rtw_write16(rtwdev, 0x0914, 0x4080);
> +	s9082c_write_bbreg(rtwdev, 0x0860, 0x7000, is_main ? 1 : 0);
> +	s9082c_write_bbreg(rtwdev, 0x0864, 0x38, is_main ? 1 : 0);
> +}
> +
> +static int s9082c_mac_postinit(struct rtw_dev *rtwdev)
> +{
> +	u32 rcr = BIT_APM | BIT_AM | BIT_AB | BIT_CBSSID_DATA | BIT_CBSSID_BCN |
> +		  BIT_AMF | BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | BIT_APP_ICV |
> +		  BIT_APP_MIC;
> +	u8 val8;
> +
> +	/* Restore S9082C bit-reversed buffer boundary & RX driver info size */
> +	rtw_write8(rtwdev, REG_BCNQ_BDNY, 0x1f);
> +	rtw_write8(rtwdev, REG_MGQ_BDNY, 0x1f);
> +	rtw_write8(rtwdev, REG_WMAC_LBK_BF_HD, 0x1f);
> +	rtw_write8(rtwdev, REG_TRXFF_BNDY, 0x1f);
> +	rtw_write8(rtwdev, REG_DWBCN0_CTRL + 1, 0xf8);
> +	rtw_write8(rtwdev, REG_RX_DRVINFO_SZ, 0x20);
> +
> +	/* WMAC RCR, RX filter map & retry/TX-report controls (bit-reversed) */
> +	rtw_write32(rtwdev, REG_RCR, s9082c_bitrev32(rcr));
> +	rtw_write16(rtwdev, REG_RXFLTMAP1, 0x2000);
> +	rtw_write16(rtwdev, REG_RXFLTMAP0, 0xffff);
> +	rtw_write16(rtwdev, REG_RXFLTMAP2, 0xffff);
> +
> +	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 1, 0xf0);
> +	rtw_write16(rtwdev, REG_TX_RPT_TIME, 0xbc0f);
> +	val8 = rtw_read8(rtwdev, 0x04d3);
> +	rtw_write8(rtwdev, 0x04d3, (val8 & ~0x01) | 0x80);
> +
> +	rtw_write16(rtwdev, REG_TXDMA_OFFSET_CHK,
> +		    (rtw_read16(rtwdev, REG_TXDMA_OFFSET_CHK) & ~BIT_DROP_DATA_EN) |
> +		    0x4000);
> +	rtw_write8_set(rtwdev, REG_CR, 0x03);
> +
> +	return 0;
> +}
> +
> +static void s9082c_phy_set_param(struct rtw_dev *rtwdev)
> +{
> +	u32 cap = u8_get_bits(rtwdev->efuse.crystal_cap, S9082C_XTAL_CAP_MSK);
> +	size_t i;
> +
> +	rtw_write16_set(rtwdev, REG_SYS_FUNC_EN, 0x4c0);
> +	rtw_write8(rtwdev, REG_RF_CTRL, 0xe0);
> +	rtw_write8(rtwdev, REG_SYS_FUNC_EN, 0xc7);
> +
> +	for (i = 0; i < s9082c_phy_init_seq_len; i++) {
> +		const struct s9082c_phy_step *step = &s9082c_phy_init_seq[i];
> +
> +		if (step->op == S9082C_OP_DIRECT) {
> +			rtw_write32(rtwdev, step->reg, step->val);
> +		} else if (step->op == S9082C_OP_BB_ND) {
> +			u32 orig = rtw_read32(rtwdev, step->reg);
> +			u32 shift = __ffs(step->mask);
> +			u32 data;
> +
> +			data = (orig & ~step->mask) |
> +			       ((step->val << shift) & step->mask);
> +			rtw_write32(rtwdev, step->reg, data);
> +		} else {
> +			s9082c_write_bbreg(rtwdev, step->reg, step->mask,
> +					   step->val);
> +		}
> +		udelay(1);
> +	}
> +
> +	for (i = 0; i < s9082c_agc_init_seq_len; i++) {
> +		rtw_write32(rtwdev, s9082c_agc_init_seq[i].reg,
> +			    s9082c_agc_init_seq[i].val);
> +		udelay(1);
> +	}
> +
> +	/* Set crystal cap before the XTAL PLL quirk (0x0024 mask overlaps 0x0026) */
> +	cap = u32_encode_bits(cap, S9082C_XTAL_CAP_LO_MSK) |
> +	      u32_encode_bits(cap, S9082C_XTAL_CAP_HI_MSK);
> +	s9082c_write_bbreg(rtwdev, REG_AFE_XTAL_CTRL, S9082C_XTAL_CTRL_MSK, cap);
> +	rtw_write16(rtwdev, REG_AFE_XTAL_CTRL + 2, VAL_S9082C_PLL_FIX);
> +
> +	for (i = 0; i < s9082c_rf_init_seq_len; i++) {
> +		rtw_write32(rtwdev, rtwdev->chip->rf_sipi_addr[RF_PATH_A],
> +			    s9082c_rf_init_seq[i].val);
> +		if (s9082c_rf_init_seq[i].sleep_ms)
> +			msleep(s9082c_rf_init_seq[i].sleep_ms);
> +		else
> +			usleep_range(10, 20);
> +	}
> +
> +	s9082c_set_rf_path_switch(rtwdev, true);
> +	rtw_phy_init(rtwdev);
> +}
> +
> +static void s9082c_set_channel(struct rtw_dev *rtwdev, u8 channel,
> +			       u8 bw, u8 primary_chan_idx)
> +{
> +	struct rtw_hal *hal = &rtwdev->hal;
> +	u8 bw_opmode, offset40 = 0;
> +	u32 val;
> +
> +	if (!channel)
> +		channel = 1;
> +
> +	/* Mask LCK trigger bit 15 so channel switches do not re-trigger VCO cal */
> +	val = hal->ch_param[0];
> +	if (!(val & S9082C_RFCFGCH_TX_MSK))
> +		val |= 0x07400;
> +	val &= ~BIT_LCK;
> +	u32p_replace_bits(&val, channel, S9082C_RFCFGCH_CH_MSK);
> +	hal->ch_param[0] = val;
> +	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, val);
> +
> +	bw_opmode = rtw_read8(rtwdev, 0x0603);
> +	if (bw == RTW_CHANNEL_WIDTH_20) {
> +		rtw_write8(rtwdev, 0x0603, bw_opmode | 0x20);
> +		s9082c_write_bbreg(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x00);
> +		s9082c_write_bbreg(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x00);
> +		u32p_replace_bits(&val, 0x3, S9082C_RFCFGCH_BW_MSK);
> +	} else {
> +		if (primary_chan_idx == RTW_SC_20_LOWER)
> +			offset40 = 1;
> +		else if (primary_chan_idx == RTW_SC_20_UPPER)
> +			offset40 = 2;
> +
> +		rtw_write8(rtwdev, 0x0603, bw_opmode & ~0x20);
> +		rtw_write8(rtwdev, 0x0442,
> +			   (rtw_read8(rtwdev, 0x0442) & 0x09) |
> +			   bitrev8(u8_encode_bits(offset40,
> +						  S9082C_MAC_BW40_OFFSET_MSK)));
> +		s9082c_write_bbreg(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x01);
> +		s9082c_write_bbreg(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x01);
> +		s9082c_write_bbreg(rtwdev, REG_CCK0_SYS, BIT_CCK_SIDE_BAND,
> +				   u8_get_bits(offset40, BIT(1)));
> +		s9082c_write_bbreg(rtwdev, REG_OFDM_FA_RSTD_11N,
> +				   S9082C_OFDM_BW40_RES_MSK,
> +				   u8_get_bits(offset40, S9082C_BB_BW40_OFFSET_MSK));
> +		s9082c_write_bbreg(rtwdev, REG_BB_PWR_SAV5_11N,
> +				   S9082C_BB_PWR_SAV5_BW40_MSK,
> +				   offset40 == 1 ? 2 : 1);
> +		u32p_replace_bits(&val, 0x1, S9082C_RFCFGCH_BW_MSK);
> +	}
> +	hal->ch_param[0] = val;
> +	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, val);
> +
> +	/* Spur calibration for channels 13/14 or 40 MHz ch 11 */
> +	if (channel == 13 || channel == 14 ||
> +	    (bw == RTW_CHANNEL_WIDTH_40 && channel == 11)) {
> +		s9082c_write_bbreg(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 1);
> +		s9082c_write_bbreg(rtwdev, 0x0d3c, 0x1c0, 2);
> +	} else {
> +		s9082c_write_bbreg(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 0);
> +	}
> +}
> +
> +static void s9082c_lc_calibrate(struct rtw_dev *rtwdev)
> +{
> +	u32 rf_amode = 0, lc_cal;
> +	u8 tmpreg;
> +
> +	tmpreg = rtw_read8(rtwdev, REG_CTX);
> +	if (tmpreg & 0x0e)
> +		rtw_write8(rtwdev, REG_CTX, tmpreg & ~0x0e);
> +	else
> +		rtw_write8(rtwdev, REG_TXPAUSE, 0xff);
> +
> +	if (tmpreg & 0x0e) {
> +		rf_amode = s9082c_read_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK);
> +		s9082c_write_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK,
> +				(rf_amode & 0x8ffff) | 0x10000);
> +	}
> +
> +	lc_cal = s9082c_read_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK);
> +	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK,
> +			lc_cal | BIT_LCK);
> +
> +	msleep(100);
> +
> +	if (tmpreg & 0x0e) {
> +		rtw_write8(rtwdev, REG_CTX, tmpreg);
> +		s9082c_write_rf(rtwdev, RF_PATH_A, 0x00, RFREG_MASK, rf_amode);
> +	} else {
> +		rtw_write8(rtwdev, REG_TXPAUSE, 0x00);
> +	}
> +
> +	s9082c_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, lc_cal);
> +}
> +
> +static u8 s9082c_path_a_tx_iqk(struct rtw_dev *rtwdev)
> +{
> +	u32 eac, e94, e9c;
> +
> +	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x08003138);
> +	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x0c003138);
> +	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x4128c054);
> +	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x14680000);
> +	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629488);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
> +	mdelay(10);
> +
> +	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
> +	e94 = rtw_read32(rtwdev, REG_IQK_RES_TX);
> +	e9c = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY, MASKDWORD);
> +
> +	if (!(eac & BIT_IQK_TX_FAIL) &&
> +	    u32_get_bits(e94, BIT_MASK_RES_TX) != IQK_TX_X_ERR &&
> +	    u32_get_bits(e9c, BIT_MASK_RES_TY) != IQK_TX_Y_ERR)
> +		return IQK_TX_OK;
> +
> +	return 0;
> +}
> +
> +static u8 s9082c_path_a_rx_iqk(struct rtw_dev *rtwdev)
> +{
> +	u32 eac, e94, e9c, ea4, u4tmp;
> +
> +	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK, 0);
> +	rtw_write32(rtwdev, 0x0840, 0x701f0005);
> +	rtw_write32(rtwdev, 0x0840, 0xc0c00000);
> +	rtw_write32(rtwdev, 0x0840, 0xc00800f0);
> +	rtw_write32(rtwdev, 0x0840, 0xc0f488de);
> +	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
> +			   EN_IQK);
> +	rtw_write32(rtwdev, REG_TXIQK_11N, 0x80003e00);
> +	rtw_write32(rtwdev, REG_RXIQK_11N, 0x81001200);
> +	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x08003138);
> +	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x0c003138);
> +	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x41681020);
> +	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x14680000);
> +	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629588);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
> +	mdelay(10);
> +
> +	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
> +	e94 = rtw_read32(rtwdev, REG_IQK_RES_TX);
> +	e9c = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY, MASKDWORD);
> +
> +	if ((eac & BIT_IQK_TX_FAIL) ||
> +	    u32_get_bits(e94, BIT_MASK_RES_TX) == IQK_TX_X_ERR ||
> +	    u32_get_bits(e9c, BIT_MASK_RES_TY) == IQK_TX_Y_ERR)
> +		return 0;
> +
> +	u4tmp = BIT_SET_TXIQK_11N(u32_get_bits(e94, BIT_MASK_RES_TX),
> +				  u32_get_bits(e9c, BIT_MASK_RES_TY));
> +	s9082c_write_bbreg(rtwdev, REG_TXIQK_11N, MASKDWORD, u4tmp);
> +	rtw_write32(rtwdev, REG_FPGA0_IQK_11N, RST_IQK);
> +	rtw_write32(rtwdev, 0x0840, 0x701f0005);
> +	rtw_write32(rtwdev, 0x0840, 0xc0c00000);
> +	rtw_write32(rtwdev, 0x0840, 0xc00800f0);
> +	rtw_write32(rtwdev, 0x0840, 0xc0f4fe5f);
> +	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
> +			   EN_IQK);
> +	rtw_write32(rtwdev, REG_RXIQK_11N, 0x80001200);
> +	rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x0c003138);
> +	rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x08003138);
> +	rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x416830a0);
> +	rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x146830a0);
> +	rtw_write32(rtwdev, REG_IQK_AGC_RSP_11N, 0x00629588);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x9f000000);
> +	rtw_write32(rtwdev, REG_IQK_AGC_PTS_11N, 0x1f000000);
> +	mdelay(10);
> +
> +	eac = rtw_read32(rtwdev, REG_IQK_RES_RY);
> +	ea4 = rtw_read32(rtwdev, REG_IQK_RES_RX);
> +
> +	if (!(eac & BIT_IQK_RX_FAIL) &&
> +	    u32_get_bits(ea4, BIT_MASK_RES_RX) != IQK_RX_X_ERR &&
> +	    u32_get_bits(eac, BIT_MASK_RES_RY) != IQK_RX_Y_ERR)
> +		return IQK_TX_OK | IQK_RX_OK;
> +
> +	return IQK_TX_OK;
> +}
> +
> +static void s9082c_iqk_single(struct rtw_dev *rtwdev, s32 result[][8], u8 t,
> +			      u32 *adda_backup, u32 *iqk_bb_backup,
> +			      u8 *raw_522, u8 *raw_550, u8 *raw_551,
> +			      u32 *raw_040, u8 *pi_mode)
> +{
> +	const u32 *adda_regs = rtw8723x_common.iqk_adda_regs;
> +	const u32 *iqk_bb_regs = rtw8723x_common.iqk_bb_regs;
> +	u8 i, patha_ok;
> +
> +	if (t == 0) {
> +		for (i = 0; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
> +			adda_backup[i] = rtw_read32(rtwdev, adda_regs[i]);
> +		*raw_522 = rtw_read8(rtwdev, 0x0522);
> +		*raw_550 = rtw_read8(rtwdev, 0x0550);
> +		*raw_551 = rtw_read8(rtwdev, 0x0551);
> +		*raw_040 = rtw_read32(rtwdev, 0x0040);
> +		for (i = 0; i < RTW8723X_IQK_BB_REG_NUM; i++)
> +			iqk_bb_backup[i] = rtw_read32(rtwdev, iqk_bb_regs[i]);
> +	}
> +
> +	rtw_write32(rtwdev, 0x085c, 0xd0d8a405);
> +	for (i = 1; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
> +		rtw_write32(rtwdev, adda_regs[i], 0xd0dba405);
> +
> +	if (t == 0)
> +		*pi_mode = s9082c_read_bbreg(rtwdev, 0x0820, S9082C_HSSI1_PI_EN);
> +
> +	if (!(*pi_mode)) {
> +		rtw_write32(rtwdev, 0x0820, 0x80008000);
> +		rtw_write32(rtwdev, 0x0828, 0x80008000);
> +	}
> +
> +	rtw_write8(rtwdev, 0x0522, 0xfc);
> +	rtw_write8(rtwdev, 0x0550, (*raw_550) & ~0x10);
> +	rtw_write8(rtwdev, 0x0551, (*raw_551) & ~0x10);
> +	rtw_write8(rtwdev, 0x0040, ((u8)(*raw_040)) & ~0x04);
> +
> +	s9082c_write_bbreg(rtwdev, REG_CCK_ANT_SEL_11N, S9082C_IQK_RX_PATH_MSK, 0xf);
> +	rtw_write32(rtwdev, REG_BB_RX_PATH_11N, 0xc0056a00);
> +	rtw_write32(rtwdev, REG_TRMUX_11N, 0x00100027);
> +	rtw_write32(rtwdev, REG_BB_PWR_SAV1_11N, 0x44040200);
> +	s9082c_write_bbreg(rtwdev, 0x0870, BIT(10), 1);
> +	s9082c_write_bbreg(rtwdev, 0x0870, BIT(26), 1);
> +	s9082c_write_bbreg(rtwdev, 0x0860, BIT(10), 0);
> +	s9082c_write_bbreg(rtwdev, 0x0864, BIT(10), 0);
> +	rtw_write32(rtwdev, 0x0b68, 0xf0060000);
> +	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK,
> +			   EN_IQK);
> +	rtw_write32(rtwdev, REG_TXIQK_11N, 0x80003e00);
> +	rtw_write32(rtwdev, REG_RXIQK_11N, 0x81001200);
> +
> +	for (i = 0; i < PATH_IQK_RETRY; i++) {
> +		patha_ok = s9082c_path_a_tx_iqk(rtwdev);
> +		if (patha_ok == IQK_TX_OK) {
> +			result[t][0] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_TX),
> +						    BIT_MASK_RES_TX);
> +			result[t][1] = s9082c_read_bbreg(rtwdev, REG_IQK_RES_TY,
> +							 BIT_MASK_RES_TY);
> +			break;
> +		}
> +	}
> +
> +	for (i = 0; i < PATH_IQK_RETRY; i++) {
> +		patha_ok = s9082c_path_a_rx_iqk(rtwdev);
> +		if (patha_ok == (IQK_TX_OK | IQK_RX_OK)) {
> +			result[t][2] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_RX),
> +						    BIT_MASK_RES_RX);
> +			result[t][3] = u32_get_bits(rtw_read32(rtwdev, REG_IQK_RES_RY),
> +						    BIT_MASK_RES_RY);
> +			break;
> +		}
> +	}
> +
> +	s9082c_write_bbreg(rtwdev, REG_FPGA0_IQK_11N, S9082C_IQK_A_PI_MOD_MSK, 0);
> +	s9082c_write_rf(rtwdev, RF_PATH_A, 0xef, RFREG_MASK, 0x000a0);
> +
> +	if (t != 0) {
> +		if (!(*pi_mode)) {
> +			rtw_write32(rtwdev, 0x0820, 0x80000000);
> +			rtw_write32(rtwdev, 0x0828, 0x80000000);
> +		}
> +		for (i = 0; i < RTW8723X_IQK_ADDA_REG_NUM; i++)
> +			rtw_write32(rtwdev, adda_regs[i], adda_backup[i]);
> +		rtw_write8(rtwdev, 0x0522, *raw_522);
> +		rtw_write8(rtwdev, 0x0550, *raw_550);
> +		rtw_write8(rtwdev, 0x0551, *raw_551);
> +		rtw_write32(rtwdev, 0x0040, *raw_040);
> +		for (i = 0; i < RTW8723X_IQK_BB_REG_NUM; i++)
> +			rtw_write32(rtwdev, iqk_bb_regs[i], iqk_bb_backup[i]);
> +		rtw_write32(rtwdev, 0x0840, 0x00c074cb);
> +		rtw_write32(rtwdev, REG_TXIQK_TONE_A_11N, 0x80003100);
> +		rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x80003100);
> +	}
> +}
> +
> +static bool s9082c_iqk_similarity(s32 result[][8], u8 c1, u8 c2)
> +{
> +	u32 i, j, diff, sim_bitmap = 0;
> +	u8 final_candidate = 0xff;
> +
> +	for (i = 0; i < 4; i++) {
> +		diff = abs(result[c1][i] - result[c2][i]);
> +		if (diff > MAX_TOLERANCE) {
> +			if (i == 2 && !sim_bitmap) {
> +				if (result[c1][i] + result[c1][i + 1] == 0)
> +					final_candidate = c2;
> +				else if (result[c2][i] + result[c2][i + 1] == 0)
> +					final_candidate = c1;
> +				else
> +					sim_bitmap |= BIT(i);
> +			} else {
> +				sim_bitmap |= BIT(i);
> +			}
> +		}
> +	}
> +
> +	if (sim_bitmap == 0) {
> +		if (final_candidate != 0xff) {
> +			for (j = 0; j < 2; j++)
> +				result[3][j] = result[final_candidate][j];
> +			return false;
> +		}
> +		return true;
> +	}
> +
> +	if (!(sim_bitmap & 0x0f)) {
> +		for (i = 0; i < 4; i++)
> +			result[3][i] = result[c1][i];
> +		return false;
> +	}
> +
> +	return false;
> +}
> +
> +static void s9082c_iq_calibrate(struct rtw_dev *rtwdev)
> +{
> +	u32 adda_backup[RTW8723X_IQK_ADDA_REG_NUM];
> +	u32 iqk_bb_backup[RTW8723X_IQK_BB_REG_NUM];
> +	u8 raw_522 = 0, raw_550 = 0, raw_551 = 0, pi_mode = 0;
> +	u8 t, idx, final_candidate = 0xff;
> +	s32 result[4][8] = {};
> +	s32 reg_tmp = 0;
> +	u32 raw_040 = 0;
> +
> +	for (t = 0; t < 3; t++) {
> +		s9082c_iqk_single(rtwdev, result, t, adda_backup,
> +				  iqk_bb_backup, &raw_522, &raw_550,
> +				  &raw_551, &raw_040, &pi_mode);
> +		if (t == 1) {
> +			if (s9082c_iqk_similarity(result, 0, 1)) {
> +				final_candidate = 0;
> +				break;
> +			}
> +		} else if (t == 2) {
> +			if (s9082c_iqk_similarity(result, 0, 2)) {
> +				final_candidate = 0;
> +				break;
> +			}
> +			if (s9082c_iqk_similarity(result, 1, 2)) {
> +				final_candidate = 1;
> +				break;
> +			}
> +			for (idx = 0; idx < 4; idx++)
> +				reg_tmp += result[3][idx];
> +			final_candidate = reg_tmp ? 3 : 0xff;
> +		}
> +	}
> +
> +	if (final_candidate != 0xff && result[final_candidate][0] != 0) {
> +		s32 oldval_0 = u32_get_bits(rtw_read32(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE),
> +					    BIT_MASK_TXIQ_ELM_D);
> +		s32 x = iqkxy_to_s32(result[final_candidate][0]);
> +		s32 y = iqkxy_to_s32(result[final_candidate][1]);
> +		s32 tx0_a_ext, tx0_c_ext, tx0_a, tx0_c;
> +		u32 c4c;
> +
> +		tx0_a = iqk_mult(x, oldval_0, &tx0_a_ext);
> +		tx0_c = iqk_mult(y, oldval_0, &tx0_c_ext);
> +
> +		s9082c_write_bbreg(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE,
> +				   BIT_MASK_TXIQ_ELM_A,
> +				   tx0_a & BIT_MASK_TXIQ_ELM_A);
> +
> +		c4c = rtw_read32(rtwdev, REG_OFDM_0_ECCA_THRESHOLD);
> +		u32p_replace_bits(&c4c, tx0_a_ext, S9082C_IQK_TX0_EXT_A_BIT);
> +		u32p_replace_bits(&c4c, tx0_c_ext, S9082C_IQK_TX0_EXT_C_BIT);
> +
> +		s9082c_write_bbreg(rtwdev, REG_TXIQK_MATRIXA_LSB2_11N,
> +				   GENMASK(31, 28), BIT_SET_TXIQ_ELM_C1(tx0_c));
> +		s9082c_write_bbreg(rtwdev, REG_OFDM_0_XA_TX_IQ_IMBALANCE,
> +				   BIT_MASK_TXIQ_ELM_C,
> +				   BIT_SET_TXIQ_ELM_C2(tx0_c));
> +
> +		rtw_write32(rtwdev, REG_OFDM_0_ECCA_THRESHOLD, c4c);
> +
> +		if (result[final_candidate][2] != 0) {
> +			u32 rx_x = result[final_candidate][2];
> +			u32 rx_y = result[final_candidate][3];
> +
> +			s9082c_write_bbreg(rtwdev, REG_A_RXIQI,
> +					   BIT_MASK_RXIQ_S1_X, rx_x);
> +			s9082c_write_bbreg(rtwdev, REG_A_RXIQI,
> +					   BIT_MASK_RXIQ_S1_Y1,
> +					   BIT_SET_RXIQ_S1_Y1(rx_y));
> +			s9082c_write_bbreg(rtwdev, REG_RXIQK_MATRIX_LSB_11N,
> +					   BIT_MASK_RXIQ_S1_Y2,
> +					   BIT_SET_RXIQ_S1_Y2(rx_y));
> +		}
> +	}
> +}
> +
> +static void s9082c_phy_calibration(struct rtw_dev *rtwdev)
> +{
> +	s9082c_iq_calibrate(rtwdev);
> +	s9082c_lc_calibrate(rtwdev);
> +	s9082c_set_rf_path_switch(rtwdev, true);
> +}
> +
> +static void s9082c_set_tx_power_index(struct rtw_dev *rtwdev)
> +{
> +	static const struct rtw_hw_reg s9082c_txagc[] = {
> +		[DESC_RATE1M]	= { .addr = 0x0e08, .mask = 0x0000ff00 },
> +		[DESC_RATE2M]	= { .addr = 0x086c, .mask = 0x0000ff00 },
> +		[DESC_RATE5_5M]	= { .addr = 0x086c, .mask = 0x00ff0000 },
> +		[DESC_RATE11M]	= { .addr = 0x086c, .mask = 0xff000000 },
> +		[DESC_RATE6M]	= { .addr = 0x0e00, .mask = 0x000000ff },
> +		[DESC_RATE9M]	= { .addr = 0x0e00, .mask = 0x0000ff00 },
> +		[DESC_RATE12M]	= { .addr = 0x0e00, .mask = 0x00ff0000 },
> +		[DESC_RATE18M]	= { .addr = 0x0e00, .mask = 0xff000000 },
> +		[DESC_RATE24M]	= { .addr = 0x0e04, .mask = 0x000000ff },
> +		[DESC_RATE36M]	= { .addr = 0x0e04, .mask = 0x0000ff00 },
> +		[DESC_RATE48M]	= { .addr = 0x0e04, .mask = 0x00ff0000 },
> +		[DESC_RATE54M]	= { .addr = 0x0e04, .mask = 0xff000000 },
> +		[DESC_RATEMCS0]	= { .addr = 0x0e10, .mask = 0x000000ff },
> +		[DESC_RATEMCS1]	= { .addr = 0x0e10, .mask = 0x0000ff00 },
> +		[DESC_RATEMCS2]	= { .addr = 0x0e10, .mask = 0x00ff0000 },
> +		[DESC_RATEMCS3]	= { .addr = 0x0e10, .mask = 0xff000000 },
> +		[DESC_RATEMCS4]	= { .addr = 0x0e14, .mask = 0x000000ff },
> +		[DESC_RATEMCS5]	= { .addr = 0x0e14, .mask = 0x0000ff00 },
> +		[DESC_RATEMCS6]	= { .addr = 0x0e14, .mask = 0x00ff0000 },
> +		[DESC_RATEMCS7]	= { .addr = 0x0e14, .mask = 0xff000000 },
> +	};
> +	struct rtw_hal *hal = &rtwdev->hal;
> +	u8 rate;
> +
> +	for (rate = DESC_RATE1M; rate <= DESC_RATEMCS7; rate++) {
> +		if (!s9082c_txagc[rate].addr)
> +			continue;
> +		s9082c_write_bbreg(rtwdev, s9082c_txagc[rate].addr,
> +				   s9082c_txagc[rate].mask,
> +				   hal->tx_pwr_tbl[RF_PATH_A][rate]);
> +	}
> +}
> +
> +static void s9082c_false_alarm_statistics(struct rtw_dev *rtwdev)
> +{
> +	/* S9082C uses bit-reversed BB FA counters; avoid raw 8723x reads */
> +}
> +
> +static u32 s9082c_sdio_to_bus_offset(struct rtw_dev *rtwdev, u32 addr)
> +{
> +	switch (addr & RTW_SDIO_BUS_MSK) {
> +	case WLAN_IOREG_OFFSET:
> +		addr &= WLAN_IOREG_REG_MSK;
> +		if (addr < S9082C_SDIO_MAC_OFFSET)
> +			addr += S9082C_SDIO_MAC_OFFSET;
> +		addr |= FIELD_PREP(REG_SDIO_CMD_ADDR_MSK,
> +				   REG_SDIO_CMD_ADDR_MAC_REG);
> +		break;
> +	case SDIO_LOCAL_OFFSET:
> +		addr &= SDIO_LOCAL_REG_MSK;
> +		addr |= S9082C_SDIO_LOCAL_BASE;
> +		break;
> +	default:
> +		rtw_warn(rtwdev, "Cannot convert addr 0x%08x to bus offset",
> +			 addr);
> +	}
> +
> +	return addr;
> +}
> +
> +static u32 s9082c_sdio_fixup_val(u32 val)
> +{
> +	u32 w = ((val & 0x55555555) << 1) | ((val & 0xaaaaaaaa) >> 1);
> +
> +	return ((w & 0x33333333) << 2) | ((w & 0xcccccccc) >> 2);
> +}

So some registers only need a partial bitrev?

> +
> +static void s9082c_sdio_enable_rx_agg(struct rtw_dev *rtwdev)
> +{
> +	rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH, 0x6024);
> +	rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, 0x20);
> +	rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);
> +}
> +
> +static const struct rtw_chip_ops rtw8189e_ops = {
> +	.power_on		= rtw_power_on,
> +	.power_off		= rtw_power_off,
> +	.mac_init		= rtw8723x_mac_init,
> +	.mac_postinit		= rtw8723x_mac_postinit,
> +	.read_efuse		= rtw8723x_read_efuse,
> +	.phy_set_param		= rtw8189e_phy_set_param,
> +	.set_channel		= rtw8189e_set_channel,
> +	.query_phy_status	= rtw8189e_query_phy_status,
> +	.read_rf		= rtw_phy_read_rf_sipi,
> +	.write_rf		= rtw_phy_write_rf_reg_sipi,
> +	.set_tx_power_index	= rtw8723x_set_tx_power_index,
> +	.cfg_ldo25		= rtw8723x_cfg_ldo25,
> +	.efuse_grant		= rtw8723x_efuse_grant,
> +	.false_alarm_statistics	= rtw8723x_false_alarm_statistics,
> +	.phy_calibration	= rtw8189e_phy_calibration,
> +	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,
> +	.fill_txdesc		= rtw8189e_fill_txdesc,
> +	.query_rx_desc		= rtw8189e_query_rx_desc,
> +};
> +
> +static const struct rtw_chip_ops s9082c_ops = {
> +	.power_on		= rtw_power_on,
> +	.power_off		= rtw_power_off,
> +	.mac_init		= s9082c_mac_init,
> +	.mac_postinit		= s9082c_mac_postinit,
> +	.read_efuse		= rtw8723x_read_efuse,
> +	.phy_set_param		= s9082c_phy_set_param,
> +	.set_channel		= s9082c_set_channel,
> +	.query_phy_status	= rtw8189e_query_phy_status,
> +	.read_rf		= s9082c_read_rf,
> +	.write_rf		= s9082c_write_rf,
> +	.set_tx_power_index	= s9082c_set_tx_power_index,
> +	.cfg_ldo25		= rtw8723x_cfg_ldo25,
> +	.efuse_grant		= rtw8723x_efuse_grant,
> +	.false_alarm_statistics	= s9082c_false_alarm_statistics,
> +	.phy_calibration	= s9082c_phy_calibration,
> +	.fill_txdesc_checksum	= rtw8723x_fill_txdesc_checksum,
> +	.fill_txdesc		= rtw8189e_fill_txdesc,
> +	.query_rx_desc		= rtw8189e_query_rx_desc,
> +	.sdio_to_bus_offset	= s9082c_sdio_to_bus_offset,
> +	.sdio_fixup_val		= s9082c_sdio_fixup_val,
> +	.sdio_enable_rx_agg	= s9082c_sdio_enable_rx_agg,
> +};
> +
> +#define RTW8189E_HW_SPEC_BASE						\
> +	.id = RTW_CHIP_TYPE_8189E,					\
> +	.wlan_cpu = RTW_WCPU_8051,					\
> +	.tx_pkt_desc_sz = 32,						\
> +	.tx_buf_desc_sz = 16,						\
> +	.rx_pkt_desc_sz = 24,						\
> +	.rx_buf_desc_sz = 8,						\
> +	.phy_efuse_size = 512,						\
> +	.log_efuse_size = 512,						\
> +	.ptct_efuse_size = 0,						\
> +	.txff_size = 22528,						\
> +	.rxff_size = 10240,						\
> +	.rsvd_drv_pg_num = 9,						\
> +	.band = RTW_BAND_2G,						\
> +	.page_size = TX_PAGE_SIZE,					\
> +	.csi_buf_pg_num = 0,						\
> +	.dig_min = 0x20,						\
> +	.txgi_factor = 1,						\
> +	.is_pwr_by_rate_dec = true,					\
> +	.rx_ldpc = false,						\
> +	.tx_stbc = false,						\
> +	.max_power_index = 0x3f,					\
> +	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,			\
> +	.hw_feature_report = false,					\
> +	.c2h_ra_report_size = 7,					\
> +	.old_datarate_fb_limit = true,					\
> +	.path_div_supported = false,					\
> +	.ht_supported = true,						\
> +	.vht_supported = false,						\
> +	.lps_deep_mode_supported = 0,					\
> +	.sys_func_en = 0xFD,						\
> +	.rqpn_table = rqpn_table_8189e,					\
> +	.prioq_addrs = &rtw8723x_common.prioq_addrs,			\
> +	.page_table = page_table_8189e,					\
> +	.intf_table = NULL,						\
> +	.dig = rtw8723x_common.dig,					\
> +	.dig_cck = rtw8723x_common.dig_cck,				\
> +	.rf_sipi_addr = {0x840, 0x844},					\
> +	.rf_sipi_read_addr = rtw8723x_common.rf_sipi_addr,		\

> +	.fix_rf_phy_num = 2,						\

I don't think this chip needs that.

> +	.mac_tbl = &rtw8189e_mac_tbl,					\
> +	.agc_tbl = &rtw8189e_agc_tbl,					\
> +	.bb_tbl = &rtw8189e_bb_tbl,					\
> +	.rf_tbl = {&rtw8189e_rf_a_tbl},					\
> +	.rfe_defs = rtw8189e_rfe_defs,					\
> +	.rfe_defs_size = ARRAY_SIZE(rtw8189e_rfe_defs),			\
> +	.iqk_threshold = 8,						\
> +	.max_scan_ie_len = IEEE80211_MAX_DATA_LEN
> +
> +const struct rtw_chip_info rtw8189e_hw_spec = {
> +	RTW8189E_HW_SPEC_BASE,
> +	.ops = &rtw8189e_ops,
> +	.fw_name = "rtw88/rtw8189e_fw.bin",
> +	.pwr_on_seq = card_enable_flow_8189e,
> +	.pwr_off_seq = card_disable_flow_8189e,
> +	.efuse_inverted = false,
> +	.fw_no_hdr = false,
> +};
> +EXPORT_SYMBOL(rtw8189e_hw_spec);
> +
> +const struct rtw_chip_info s9082c_hw_spec = {
> +	RTW8189E_HW_SPEC_BASE,
> +	.ops = &s9082c_ops,
> +	.fw_name = "rtw88/s9082c_fw.bin",
> +	.pwr_on_seq = s9082c_card_enable_flow,
> +	.pwr_off_seq = s9082c_card_disable_flow,
> +	.efuse_inverted = true,
> +	.fw_no_hdr = true,
> +};
> +EXPORT_SYMBOL(s9082c_hw_spec);
> +
> +MODULE_AUTHOR("Alex Novak <neur-alx@agentmail.to>");
> +MODULE_DESCRIPTION("Realtek 8189E / SmartChip S9082C chip core");
> +MODULE_LICENSE("Dual BSD/GPL");
> +MODULE_FIRMWARE("rtw88/rtw8189e_fw.bin");
> +MODULE_FIRMWARE("rtw88/s9082c_fw.bin");
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8189e.h b/drivers/net/wireless/realtek/rtw88/rtw8189e.h
> new file mode 100644
> index 0000000..52a9ffa
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8189e.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
> +/* Copyright(c) 2026 Alex Novak <neur-alx@agentmail.to>
> + */
> +
> +#ifndef __RTW8189E_H__
> +#define __RTW8189E_H__
> +
> +#include "main.h"
> +#include "rtw8723x.h"
> +
> +extern const struct rtw_chip_info rtw8189e_hw_spec;
> +extern const struct rtw_chip_info s9082c_hw_spec;
> +
> +#define VAL_S9082C_PLL_FIX		0xac82
> +
> +#define SDIO_VENDOR_ID_SMARTCHIP	0x02e7
> +#define SDIO_DEVICE_ID_S9082C		0x9082
> +#define SDIO_DEVICE_ID_REALTEK_8189ES	0x8179
> +
> +#endif /* __RTW8189E_H__ */


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-12-02 19:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 21:10 [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Alex Novak
2026-12-01 21:11 ` [RFC PATCH rtw-next 1/4] wifi: rtw88: extend core hooks for 8189E and S9082C Alex Novak
2026-12-02  8:21   ` Luka Gejak
2026-12-02  8:56   ` Luka Gejak
2026-12-02 19:15   ` Bitterblue Smith
2026-12-01 21:11 ` [RFC PATCH rtw-next 2/4] wifi: rtw88: add RTL8189E and S9082C register tables Alex Novak
2026-12-02  8:21   ` Luka Gejak
2026-12-02  8:56   ` Luka Gejak
2026-12-02 19:17   ` Bitterblue Smith
2026-12-01 21:11 ` [RFC PATCH rtw-next 3/4] wifi: rtw88: add RTL8189E and S9082C chip core Alex Novak
2026-12-02  8:21   ` Luka Gejak
2026-12-02  8:56   ` Luka Gejak
2026-12-02 19:18   ` Bitterblue Smith
2026-12-01 21:11 ` [RFC PATCH rtw-next 4/4] wifi: rtw88: add RTL8189ES and S9082C SDIO driver Alex Novak
2026-12-02  8:21   ` Luka Gejak
2026-12-02  8:56   ` Luka Gejak
2026-12-02  8:21 ` [RFC PATCH rtw-next 0/4] wifi: rtw88: add RTL8189ES and SmartChip S9082C SDIO support Luka Gejak
2026-12-02 19:14 ` Bitterblue Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox