diff mbox series

wifi: rtw89: 8852be: add quirk to avoid PCI 36bit DMA for certain platforms

Message ID 20240918085551.54611-1-pkshih@realtek.com (mailing list archive)
State Rejected
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtw89: 8852be: add quirk to avoid PCI 36bit DMA for certain platforms | expand

Commit Message

Ping-Ke Shih Sept. 18, 2024, 8:55 a.m. UTC
RTL8852BE has PCI 36-bit DMA interoperability problem on certain
platforms, so add quirks to exclude this kind of platforms.

Otherwise, failed to download firmware, and WiFi becomes unusable.

Reported-by: Marcel Weißenbach <mweissenbach@ignaz.org>
Closes: https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5694df1acb173a42e1a0bab7ac22bd231a2b8
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.h      |  1 +
 drivers/net/wireless/realtek/rtw89/pci.c       |  4 ++++
 drivers/net/wireless/realtek/rtw89/rtw8852be.c | 14 +++++++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 4ed9034fdb46..d3b140ac0aae 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -4710,6 +4710,7 @@  enum rtw89_flags {
 
 enum rtw89_quirks {
 	RTW89_QUIRK_PCI_BER,
+	RTW89_QUIRK_PCI_NO_36BIT_DMA,
 
 	NUM_OF_RTW89_QUIRKS,
 };
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index 02afeb3acce4..03e3e17c8a67 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -3061,6 +3061,9 @@  static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
 		goto err;
 	}
 
+	if (test_bit(RTW89_QUIRK_PCI_NO_36BIT_DMA, rtwdev->quirks))
+		goto no_36bit_dma;
+
 	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
 	if (!ret) {
 		rtwpci->enable_dac = true;
@@ -3074,6 +3077,7 @@  static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
 		}
 	}
 
+no_36bit_dma:
 	resource_len = pci_resource_len(pdev, bar_id);
 	rtwpci->mmap = pci_iomap(pdev, bar_id, resource_len);
 	if (!rtwpci->mmap) {
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852be.c b/drivers/net/wireless/realtek/rtw89/rtw8852be.c
index d8f9d92ca0fb..33a6aaca5a4b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852be.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852be.c
@@ -62,9 +62,21 @@  static const struct rtw89_pci_info rtw8852b_pci_info = {
 	.recognize_intrs	= rtw89_pci_recognize_intrs,
 };
 
+static const struct dmi_system_id rtw8852b_pci_quirks[] = {
+	{
+		.ident = "ASUSTeK COMPUTER INC. TUF GAMING B550M-PLUS",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_BOARD_NAME, "TUF GAMING B550M-PLUS"),
+		},
+		.driver_data = (void *)RTW89_QUIRK_PCI_NO_36BIT_DMA,
+	},
+	{},
+};
+
 static const struct rtw89_driver_info rtw89_8852be_info = {
 	.chip = &rtw8852b_chip_info,
-	.quirks = NULL,
+	.quirks = rtw8852b_pci_quirks,
 	.bus = {
 		.pci = &rtw8852b_pci_info,
 	},