Skip to content

Commit 2daafe9

Browse files
Ping-Ke ShihKalle Valo
authored andcommitted
wifi: rtw89: pci: implement PCI mac_pre_init for WiFi 7 chips
Call this function when doing MAC initialization at probe stage. It does partial initial registers only, because we only need basic ability to download firmware. The function to clear index is the sub-function, so set its pointer as well. Signed-off-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bfdcfee commit 2daafe9

File tree

4 files changed

+624
-1
lines changed

4 files changed

+624
-1
lines changed

drivers/net/wireless/realtek/rtw89/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ static void rtw89_pci_release_tx_ring(struct rtw89_dev *rtwdev,
15371537
rtw89_pci_release_pending_txwd_skb(rtwdev, tx_ring);
15381538
}
15391539

1540-
static void rtw89_pci_ops_reset(struct rtw89_dev *rtwdev)
1540+
void rtw89_pci_ops_reset(struct rtw89_dev *rtwdev)
15411541
{
15421542
struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
15431543
const struct rtw89_pci_info *info = rtwdev->pci_info;

drivers/net/wireless/realtek/rtw89/pci.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,51 @@
245245
#define B_AX_HS1ISR_IND_INT BIT(25)
246246
#define B_AX_PCIE_DBG_STE_INT BIT(13)
247247

248+
#define R_BE_PCIE_FRZ_CLK 0x3004
249+
#define B_BE_PCIE_FRZ_MAC_HW_RST BIT(31)
250+
#define B_BE_PCIE_FRZ_CFG_SPC_RST BIT(30)
251+
#define B_BE_PCIE_FRZ_ELBI_RST BIT(29)
252+
#define B_BE_PCIE_MAC_IS_ACTIVE BIT(28)
253+
#define B_BE_PCIE_FRZ_RTK_HW_RST BIT(27)
254+
#define B_BE_PCIE_FRZ_REG_RST BIT(26)
255+
#define B_BE_PCIE_FRZ_ANA_RST BIT(25)
256+
#define B_BE_PCIE_FRZ_WLAN_RST BIT(24)
257+
#define B_BE_PCIE_FRZ_FLR_RST BIT(23)
258+
#define B_BE_PCIE_FRZ_RET_NON_STKY_RST BIT(22)
259+
#define B_BE_PCIE_FRZ_RET_STKY_RST BIT(21)
260+
#define B_BE_PCIE_FRZ_NON_STKY_RST BIT(20)
261+
#define B_BE_PCIE_FRZ_STKY_RST BIT(19)
262+
#define B_BE_PCIE_FRZ_RET_CORE_RST BIT(18)
263+
#define B_BE_PCIE_FRZ_PWR_RST BIT(17)
264+
#define B_BE_PCIE_FRZ_PERST_RST BIT(16)
265+
#define B_BE_PCIE_FRZ_PHY_ALOAD BIT(15)
266+
#define B_BE_PCIE_FRZ_PHY_HW_RST BIT(14)
267+
#define B_BE_PCIE_DBG_CLK BIT(4)
268+
#define B_BE_PCIE_EN_CLK BIT(3)
269+
#define B_BE_PCIE_DBI_ACLK_ACT BIT(2)
270+
#define B_BE_PCIE_S1_ACLK_ACT BIT(1)
271+
#define B_BE_PCIE_EN_AUX_CLK BIT(0)
272+
273+
#define R_BE_PCIE_PS_CTRL 0x3008
274+
#define B_BE_RSM_L0S_EN BIT(8)
275+
#define B_BE_CMAC_EXIT_L1_EN BIT(7)
276+
#define B_BE_DMAC0_EXIT_L1_EN BIT(6)
277+
#define B_BE_FORCE_L0 BIT(5)
278+
#define B_BE_DBI_RO_WR_DISABLE BIT(4)
279+
#define B_BE_SEL_XFER_PENDING BIT(3)
280+
#define B_BE_SEL_REQ_ENTR_L1 BIT(2)
281+
#define B_BE_PCIE_EN_SWENT_L23 BIT(1)
282+
#define B_BE_SEL_REQ_EXIT_L1 BIT(0)
283+
284+
#define R_BE_PCIE_LAT_CTRL 0x3044
285+
#define B_BE_ELBI_PHY_REMAP_MASK GENMASK(29, 24)
286+
#define B_BE_SYS_SUS_L12_EN BIT(17)
287+
#define B_BE_MDIO_S_EN BIT(16)
288+
#define B_BE_SYM_AUX_CLK_SEL BIT(15)
289+
#define B_BE_RTK_LDO_POWER_LATENCY_MASK GENMASK(11, 10)
290+
#define B_BE_RTK_LDO_BIAS_LATENCY_MASK GENMASK(9, 8)
291+
#define B_BE_CLK_REQ_LAT_MASK GENMASK(7, 4)
292+
248293
/* TX/RX */
249294
#define R_AX_DRV_FW_HSK_0 0x01B0
250295
#define R_AX_DRV_FW_HSK_1 0x01B4
@@ -656,6 +701,31 @@
656701
#define R_BE_PCIE_HRPWM 0x30C0
657702
#define R_BE_PCIE_CRPWM 0x30C4
658703

704+
#define R_BE_L1_2_CTRL_HCILDO 0x3110
705+
#define B_BE_PCIE_DIS_L1_2_CTRL_HCILDO BIT(0)
706+
707+
#define R_BE_PL1_DBG_INFO 0x3120
708+
#define B_BE_END_PL1_CNT_MASK GENMASK(23, 16)
709+
#define B_BE_START_PL1_CNT_MASK GENMASK(7, 0)
710+
711+
#define R_BE_SER_PL1_CTRL 0x34A8
712+
#define B_BE_PL1_SER_PL1_EN BIT(31)
713+
#define B_BE_PL1_IGNORE_HOT_RST BIT(30)
714+
#define B_BE_PL1_TIMER_UNIT_MASK GENMASK(19, 17)
715+
#define B_BE_PL1_TIMER_CLEAR BIT(0)
716+
717+
#define R_BE_REG_PL1_MASK 0x34B0
718+
#define B_BE_SER_PCLKREQ_ACK_MASK BIT(5)
719+
#define B_BE_SER_PM_CLK_MASK BIT(4)
720+
#define B_BE_SER_LTSSM_IMR BIT(3)
721+
#define B_BE_SER_PM_MASTER_IMR BIT(2)
722+
#define B_BE_SER_L1SUB_IMR BIT(1)
723+
#define B_BE_SER_PMU_IMR BIT(0)
724+
725+
#define R_BE_RX_APPEND_MODE 0x8920
726+
#define B_BE_APPEND_OFFSET_MASK GENMASK(23, 16)
727+
#define B_BE_APPEND_LEN_MASK GENMASK(15, 0)
728+
659729
#define R_BE_TXBD_RWPTR_CLR1 0xB014
660730
#define B_BE_CLR_CH14_IDX BIT(14)
661731
#define B_BE_CLR_CH13_IDX BIT(13)
@@ -1244,6 +1314,7 @@ struct pci_device_id;
12441314

12451315
int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id);
12461316
void rtw89_pci_remove(struct pci_dev *pdev);
1317+
void rtw89_pci_ops_reset(struct rtw89_dev *rtwdev);
12471318
int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en);
12481319
int rtw89_pci_ltr_set_v1(struct rtw89_dev *rtwdev, bool en);
12491320
u32 rtw89_pci_fill_txaddr_info(struct rtw89_dev *rtwdev,

0 commit comments

Comments
 (0)