Search Linux Wireless

[PATCH v2 2/5] rtw88: check efuse for BT FT S1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx>

Some modules might not have full programed efuse.
Driver should check the BT FT S1 type to know that
if BT has been programed. If BT is not programed,
throw a warning to notify that this module is not
capable of working with WiFi + BT concurrently.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx>
---
v1 -> v2
    no change

 drivers/net/wireless/realtek/rtw88/efuse.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/efuse.c b/drivers/net/wireless/realtek/rtw88/efuse.c
index 66e56f3..82aa26a 100644
--- a/drivers/net/wireless/realtek/rtw88/efuse.c
+++ b/drivers/net/wireless/realtek/rtw88/efuse.c
@@ -8,6 +8,11 @@
 #include "debug.h"
 
 #define RTW_EFUSE_BANK_WIFI		0x0
+#define RTW_EFUSE_BANK_BT		0x1
+
+#define EFUSE_BT_S1_ADDR		0x4a
+#define EFUSE_BT_S1_TYPE1		0xff
+#define EFUSE_BT_S1_TYPE2		0x00
 
 static void switch_efuse_bank(struct rtw_dev *rtwdev, u8 efuse_bank)
 {
@@ -89,6 +94,7 @@ static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map)
 	u32 efuse_ctl;
 	u32 addr;
 	u32 cnt;
+	u8 ft_ver;
 
 	switch_efuse_bank(rtwdev, RTW_EFUSE_BANK_WIFI);
 
@@ -113,6 +119,24 @@ static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map)
 		*(map + addr) = (u8)(efuse_ctl & BIT_MASK_EF_DATA);
 	}
 
+	/* verify BT FT S1 efuse type */
+	switch_efuse_bank(rtwdev, RTW_EFUSE_BANK_BT);
+
+	efuse_ctl = rtw_read32(rtwdev, REG_EFUSE_CTRL);
+	efuse_ctl &= ~(BIT_MASK_EF_DATA | BITS_EF_ADDR);
+	efuse_ctl |= (EFUSE_BT_S1_ADDR & BIT_MASK_EF_ADDR) << BIT_SHIFT_EF_ADDR;
+	rtw_write32(rtwdev, REG_EFUSE_CTRL, efuse_ctl & (~BIT_EF_FLAG));
+
+	if (!check_hw_ready(rtwdev, REG_EFUSE_CTRL, BIT_EF_FLAG, 0x1)) {
+		rtw_err(rtwdev, "failed to read BT efuse\n");
+		return -EBUSY;
+	}
+
+	efuse_ctl = rtw_read32(rtwdev, REG_EFUSE_CTRL);
+	ft_ver = (u8)(efuse_ctl & BIT_MASK_EF_DATA);
+	if (ft_ver == EFUSE_BT_S1_TYPE1 || ft_ver == EFUSE_BT_S1_TYPE2)
+		rtw_warn(rtwdev, "BT S1 not calibrated, not recommended to verify BT for this module\n");
+
 	return 0;
 }
 
-- 
2.7.4




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux