Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtw88: add interface config for 8822c

Some devices need to configure interface/HCI related reigsters
in power on flow. Add interface_cfg for HCI for the settings.

The driver only supports RTL8822BE/RTL8822CE now, and since
RTL8822BE does not need to configure PCIE, the configuration
is only added for RTL8822CE. Without it, some of the RTL8822CE
device can crash and disconnected to host in suspend/wowlan mode.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Yan-Hsuan Chuang and committed by
Kalle Valo
78622104 fd30e891

+27
+6
drivers/net/wireless/realtek/rtw88/hci.h
··· 15 15 void (*stop)(struct rtw_dev *rtwdev); 16 16 void (*deep_ps)(struct rtw_dev *rtwdev, bool enter); 17 17 void (*link_ps)(struct rtw_dev *rtwdev, bool enter); 18 + void (*interface_cfg)(struct rtw_dev *rtwdev); 18 19 19 20 int (*write_data_rsvd_page)(struct rtw_dev *rtwdev, u8 *buf, u32 size); 20 21 int (*write_data_h2c)(struct rtw_dev *rtwdev, u8 *buf, u32 size); ··· 58 57 static inline void rtw_hci_link_ps(struct rtw_dev *rtwdev, bool enter) 59 58 { 60 59 rtwdev->hci.ops->link_ps(rtwdev, enter); 60 + } 61 + 62 + static inline void rtw_hci_interface_cfg(struct rtw_dev *rtwdev) 63 + { 64 + rtwdev->hci.ops->interface_cfg(rtwdev); 61 65 } 62 66 63 67 static inline int
+2
drivers/net/wireless/realtek/rtw88/mac.c
··· 1034 1034 if (ret) 1035 1035 return ret; 1036 1036 1037 + rtw_hci_interface_cfg(rtwdev); 1038 + 1037 1039 return 0; 1038 1040 }
+17
drivers/net/wireless/realtek/rtw88/pci.c
··· 6 6 #include <linux/pci.h> 7 7 #include "main.h" 8 8 #include "pci.h" 9 + #include "reg.h" 9 10 #include "tx.h" 10 11 #include "rx.h" 11 12 #include "fw.h" ··· 1225 1224 rtwpci->link_ctrl = link_ctrl; 1226 1225 } 1227 1226 1227 + static void rtw_pci_interface_cfg(struct rtw_dev *rtwdev) 1228 + { 1229 + struct rtw_chip_info *chip = rtwdev->chip; 1230 + 1231 + switch (chip->id) { 1232 + case RTW_CHIP_TYPE_8822C: 1233 + if (rtwdev->hal.cut_version >= RTW_CHIP_VER_CUT_D) 1234 + rtw_write32_mask(rtwdev, REG_HCI_MIX_CFG, 1235 + BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK, 1); 1236 + break; 1237 + default: 1238 + break; 1239 + } 1240 + } 1241 + 1228 1242 static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev) 1229 1243 { 1230 1244 struct rtw_chip_info *chip = rtwdev->chip; ··· 1348 1332 .stop = rtw_pci_stop, 1349 1333 .deep_ps = rtw_pci_deep_ps, 1350 1334 .link_ps = rtw_pci_link_ps, 1335 + .interface_cfg = rtw_pci_interface_cfg, 1351 1336 1352 1337 .read8 = rtw_pci_read8, 1353 1338 .read16 = rtw_pci_read16,
+2
drivers/net/wireless/realtek/rtw88/reg.h
··· 194 194 #define REG_H2C_INFO 0x0254 195 195 196 196 #define REG_INT_MIG 0x0304 197 + #define REG_HCI_MIX_CFG 0x03FC 198 + #define BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK BIT(26) 197 199 198 200 #define REG_FWHW_TXQ_CTRL 0x0420 199 201 #define BIT_EN_BCNQ_DL BIT(22)