All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rtw-next] wifi: rtw88: 8723b: Read the package type from efuse
@ 2026-10-17 15:42 Bitterblue Smith
  2026-10-18 10:49 ` Luka Gejak
  2026-10-19  2:39 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Bitterblue Smith @ 2026-10-17 15:42 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih, Luka Gejak

Some chip package types need different parts of the RF initialisation
table, so read the package type from efuse.

Also disable support for 40 MHz channel width based on some other bits
of the same efuse byte. This is not exactly the package type, but the
vendor driver puts it in the same function.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8723b.c | 35 +++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8723b.h |  8 +++++
 2 files changed, 43 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723b.c b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
index 8bb9c03d769c..fa57900b22fa 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.c
@@ -6,6 +6,7 @@
 
 #include "main.h"
 #include "coex.h"
+#include "efuse.h"
 #include "fw.h"
 #include "mac.h"
 #include "phy.h"
@@ -2349,6 +2350,38 @@ static void rtw8723b_fill_txdesc_checksum(struct rtw_dev *rtwdev,
 	fill_txdesc_checksum_common(txdesc, 16);
 }
 
+static void rtw8723b_read_package_type(struct rtw_dev *rtwdev)
+{
+	struct rtw_hal *hal = &rtwdev->hal;
+	u8 val_1fb;
+
+	rtw8723b_efuse_grant(rtwdev, true);
+	rtw_read8_physical_efuse(rtwdev, 0x1fb, &val_1fb);
+	rtw8723b_efuse_grant(rtwdev, false);
+
+	switch (u8_get_bits(val_1fb, GENMASK(2, 0))) {
+	case 0x4:
+		hal->pkg_type = RTW8723B_PACKAGE_TFBGA79;
+		break;
+	case 0x5:
+		hal->pkg_type = RTW8723B_PACKAGE_TFBGA90;
+		break;
+	case 0x6:
+		hal->pkg_type = RTW8723B_PACKAGE_QFN68;
+		break;
+	case 0x7:
+		hal->pkg_type = RTW8723B_PACKAGE_TFBGA80;
+		break;
+	default:
+		hal->pkg_type = RTW8723B_PACKAGE_DEFAULT;
+		break;
+	}
+
+	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_SDIO &&
+	    u8_get_bits(val_1fb, GENMASK(5, 4)) == 0x2)
+		rtwdev->efuse.hw_cap.bw &= ~BIT(RTW_CHANNEL_WIDTH_40);
+}
+
 static int rtw8723b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 {
 	struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -2374,6 +2407,8 @@ static int rtw8723b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 	efuse->hw_cap.bw = BIT(RTW_CHANNEL_WIDTH_20) |
 			   BIT(RTW_CHANNEL_WIDTH_40);
 
+	rtw8723b_read_package_type(rtwdev);
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723b.h b/drivers/net/wireless/realtek/rtw88/rtw8723b.h
index cf93b93ede81..8201109c18f2 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723b.h
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723b.h
@@ -9,6 +9,14 @@
 
 #include "rtw8723x.h"
 
+enum rtw8723b_package_type {
+	RTW8723B_PACKAGE_DEFAULT,
+	RTW8723B_PACKAGE_QFN68,
+	RTW8723B_PACKAGE_TFBGA90,
+	RTW8723B_PACKAGE_TFBGA80,
+	RTW8723B_PACKAGE_TFBGA79,
+};
+
 extern const struct rtw_chip_info rtw8723b_hw_spec;
 
 #endif
-- 
2.55.0


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

end of thread, other threads:[~2026-10-19  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 15:42 [PATCH rtw-next] wifi: rtw88: 8723b: Read the package type from efuse Bitterblue Smith
2026-10-18 10:49 ` Luka Gejak
2026-10-19  2:39 ` Ping-Ke Shih

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.