2023-05-12 06:17:27

by Ping-Ke Shih

[permalink] [raw]
Subject: [PATCH 1/6] wifi: rtw89: 8851b: add to read efuse version to recognize hardware version B

8851B hardware version A and B use different firmware, but register version
code of these two are the same, so add this helper to read efuse version to
determine which version is installed.

Signed-off-by: Ping-Ke Shih <[email protected]>
---
drivers/net/wireless/realtek/rtw89/efuse.c | 21 +++++++++++++++++++++
drivers/net/wireless/realtek/rtw89/efuse.h | 1 +
2 files changed, 22 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/efuse.c b/drivers/net/wireless/realtek/rtw89/efuse.c
index 7bd4f8558e03b..2aaf4d013e464 100644
--- a/drivers/net/wireless/realtek/rtw89/efuse.c
+++ b/drivers/net/wireless/realtek/rtw89/efuse.c
@@ -7,6 +7,10 @@
#include "mac.h"
#include "reg.h"

+#define EF_FV_OFSET 0x5ea
+#define EF_CV_MASK GENMASK(7, 4)
+#define EF_CV_INV 15
+
enum rtw89_efuse_bank {
RTW89_EFUSE_BANK_WIFI,
RTW89_EFUSE_BANK_BT,
@@ -328,3 +332,20 @@ int rtw89_parse_phycap_map(struct rtw89_dev *rtwdev)

return ret;
}
+
+int rtw89_read_efuse_ver(struct rtw89_dev *rtwdev, u8 *ecv)
+{
+ int ret;
+ u8 val;
+
+ ret = rtw89_dump_physical_efuse_map(rtwdev, &val, EF_FV_OFSET, 1, false);
+ if (ret)
+ return ret;
+
+ *ecv = u8_get_bits(val, EF_CV_MASK);
+ if (*ecv == EF_CV_INV)
+ return -ENOENT;
+
+ return 0;
+}
+EXPORT_SYMBOL(rtw89_read_efuse_ver);
diff --git a/drivers/net/wireless/realtek/rtw89/efuse.h b/drivers/net/wireless/realtek/rtw89/efuse.h
index 622ff95e74763..79071aff28de3 100644
--- a/drivers/net/wireless/realtek/rtw89/efuse.h
+++ b/drivers/net/wireless/realtek/rtw89/efuse.h
@@ -9,5 +9,6 @@

int rtw89_parse_efuse_map(struct rtw89_dev *rtwdev);
int rtw89_parse_phycap_map(struct rtw89_dev *rtwdev);
+int rtw89_read_efuse_ver(struct rtw89_dev *rtwdev, u8 *efv);

#endif
--
2.25.1



2023-05-17 08:17:25

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/6] wifi: rtw89: 8851b: add to read efuse version to recognize hardware version B

Ping-Ke Shih <[email protected]> wrote:

> 8851B hardware version A and B use different firmware, but register version
> code of these two are the same, so add this helper to read efuse version to
> determine which version is installed.
>
> Signed-off-by: Ping-Ke Shih <[email protected]>

6 patches applied to wireless-next.git, thanks.

40bb2ab49c36 wifi: rtw89: 8851b: add to read efuse version to recognize hardware version B
f03bd0429f9b wifi: rtw89: 8851b: configure GPIO according to RFE type
4885b17ebb92 wifi: rtw89: 8851b: add BT coexistence support function
31df6df89f93 wifi: rtw89: 8851b: add basic power on function
e948213fb856 wifi: rtw89: 8851b: add set channel function
f4244d7fbc91 wifi: rtw89: 8851b: add to parse efuse content

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches