From patchwork Wed Sep 18 08:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ping-Ke Shih X-Patchwork-Id: 829555 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6C6B180A6A for ; Wed, 18 Sep 2024 08:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726649794; cv=none; b=dqGft+iSctVtpUTWoGWpU1G+NyKPuzFTSZMPBMFFL4wYkwC/fczWbM6R5ibyEyznHZUBZWDViWjVBW7lpITDsrQWJSmFdx3ML15FEv9PJdY3JFgUpgjkzDpyT9MAfVBbO+FaHKCC/07wTAU4bY2F3pCDrkfdwTMT/IM2TKanYRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726649794; c=relaxed/simple; bh=17ERSlRppoc382F8PgDa0/gUcfR+x2UiP6ZzLbSNjMc=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=X0oF7wwjr+0Dw8T4A0uMDGa6TdZtgJuzuxxGaZTYKIlt4uVvj2v4cAFCg6GcwZBtoneVbit38D9hO+Es/yNM4qJe3Bpx5Qe1T1yZ8uDHzlLFV2fUDHegw9RIHGQlFnBbHm0DLO4NOFD7af8aofPCFZE15vLIOVZ+cUJugbhL70A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=MXrJIHO6; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="MXrJIHO6" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 48I8uMq551865612, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1726649782; bh=17ERSlRppoc382F8PgDa0/gUcfR+x2UiP6ZzLbSNjMc=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version: Content-Transfer-Encoding; b=MXrJIHO66HJkvB6rzCpFMD+yB4KdyuG7dvWN/p7ifoDpRtEvo63axd1z2LvSqGICR KqXoVgjhdcuND7zz7mwRPwxW8u9UbM+U8IZhMSwdJqiF4ybGo8xXLyiL6iukzOqGwA bc+sdLWVyRkm+GrXrHnpFHNWAVGB/I+z350bwFOiMCCGfLhn2U/Ghy9dCZ5KH9o8Dk WAqkBp91CXCMitS5/uz3aocQm/TVRkV8WZ9vv0J5cCRy+QjiZM+3QgTzS4uawTlo9E u7QlFYzEABgjWY9W1cqRaV6ci722A1PkGJhTQIMFLrFmbLKWnMCv7ckYYHCouwE3jY 0d3RO7/xSh6cw== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.05/5.92) with ESMTPS id 48I8uMq551865612 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2024 16:56:22 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 18 Sep 2024 16:56:22 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 18 Sep 2024 16:56:22 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH] wifi: rtw89: 8852be: add quirk to avoid PCI 36bit DMA for certain platforms Date: Wed, 18 Sep 2024 16:55:51 +0800 Message-ID: <20240918085551.54611-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) 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 Closes: https://lore.kernel.org/linux-wireless/20240918073237.Horde.VLueh0_KaiDw-9asEEcdM84@ignaz.org/T/#m07c5694df1acb173a42e1a0bab7ac22bd231a2b8 Signed-off-by: Ping-Ke Shih --- 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 --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, },