wifi: rtw88: Pass the physical map to the read_efuse chip op
PATCH v2 1/3 wifi: rtw88: Pass the physical map to the read_efuse chip op
rtw8723b_read_efuse() will need to read a byte from the physical efuse map, so pass the map to the read_efuse chip op.
---
v2:
- Patch is new in v2.
--- drivers/net/wireless/realtek/rtw88/efuse.c | 2 +- drivers/net/wireless/realtek/rtw88/main.h | 2 +- drivers/net/wireless/realtek/rtw88/rtw8703b.c | 4 ++-- drivers/net/wireless/realtek/rtw88/rtw8723b.c | 4 ++-- drivers/net/wireless/realtek/rtw88/rtw8723x.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8723x.h | 7 ++++--- drivers/net/wireless/realtek/rtw88/rtw8814a.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw88xxa.h | 2 +- 12 files changed, 17 insertions(+), 16 deletions(-)
drivers/net/wireless/realtek/rtw88/efuse.c +1 -1
@@ -173,7 +173,7 @@ int rtw_parse_efuse_map(struct rtw_dev *rtwdev) goto out_free; } - ret = chip->ops->read_efuse (rtwdev, log_map); + ret = chip->ops->read_efuse (rtwdev, log_map, phy_map);if (ret) {rtw_err (rtwdev,"failed to read efuse map\n" ); goto out_free;
drivers/net/wireless/realtek/rtw88/main.h +1 -1
@@ -868,7 +868,7 @@ struct rtw_chip_ops {int (*mac_postinit)(struct rtw_dev *rtwdev);int (*dump_fw_crash)(struct rtw_dev *rtwdev);void (*shutdown)(struct rtw_dev *rtwdev); -int (*read_efuse)(struct rtw_dev *rtwdev,u8 *map); +int (*read_efuse)(struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map);void (*phy_set_param)(struct rtw_dev *rtwdev);void (*set_channel)(struct rtw_dev *rtwdev,u8 channel,u8 bandwidth,u8 primary_chan_idx);
drivers/net/wireless/realtek/rtw88/rtw8703b.c +2 -2
@@ -563,12 +563,12 @@ static void try_mac_from_devicetree(struct rtw_dev *rtwdev) } } -static int rtw8703b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8703b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;int ret; - ret =rtw8723x_read_efuse (rtwdev, log_map); + ret =rtw8723x_read_efuse (rtwdev, log_map, phy_map);if (ret !=0 )return ret;
drivers/net/wireless/realtek/rtw88/rtw8723b.c +2 -2
@@ -2349,12 +2349,12 @@ static void rtw8723b_fill_txdesc_checksum(struct rtw_dev *rtwdev,fill_txdesc_checksum_common (txdesc,16 ); } -static int rtw8723b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8723b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;int ret; - ret =rtw8723x_read_efuse (rtwdev, log_map); + ret =rtw8723x_read_efuse (rtwdev, log_map, phy_map);if (ret)return ret;
drivers/net/wireless/realtek/rtw88/rtw8723x.c +1 -1
@@ -250,7 +250,7 @@ static const u8 rtw8723x_txpwr_idx_table[] = { 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x02 }; -static int __rtw8723x_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int __rtw8723x_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;u8 *pwr = (u8 *)efuse->txpwr_idx_table;
drivers/net/wireless/realtek/rtw88/rtw8723x.h +4 -3
@@ -135,7 +135,7 @@ struct rtw8723x_common {/* common functions */ void (*lck)(struct rtw_dev *rtwdev); -int (*read_efuse)(struct rtw_dev *rtwdev,u8 *log_map); +int (*read_efuse)(struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map);int (*mac_init)(struct rtw_dev *rtwdev);int (*mac_postinit)(struct rtw_dev *rtwdev);void (*cfg_ldo25)(struct rtw_dev *rtwdev,bool enable);
@@ -434,9 +434,10 @@ static inline void rtw8723x_lck(struct rtw_dev *rtwdev) rtw8723x_common.lck (rtwdev); } -static inline int rtw8723x_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static inline +int rtw8723x_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) { -return rtw8723x_common.read_efuse (rtwdev, log_map); +return rtw8723x_common.read_efuse (rtwdev, log_map, phy_map); }static inline int rtw8723x_mac_init (struct rtw_dev *rtwdev)
drivers/net/wireless/realtek/rtw88/rtw8814a.c +1 -1
@@ -126,7 +126,7 @@ static void rtw8814a_init_hwcap(struct rtw_dev *rtwdev) efuse->hw_cap.ant_num, efuse->hw_cap.nss); } -static int rtw8814a_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8814a_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;struct rtw8814a_efuse *map;
drivers/net/wireless/realtek/rtw88/rtw8821c.c +1 -1
@@ -45,7 +45,7 @@ enum rtw8821ce_rf_set { SWITCH_TO_BT, }; -static int rtw8821c_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8821c_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_hal *hal = &rtwdev->hal;struct rtw_efuse *efuse = &rtwdev->efuse;
drivers/net/wireless/realtek/rtw88/rtw8822b.c +1 -1
@@ -38,7 +38,7 @@ static void rtw8822bs_efuse_parsing(struct rtw_efuse *efuse,ether_addr_copy (efuse->addr, map->s.mac_addr); } -static int rtw8822b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8822b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;struct rtw8822b_efuse *map;
drivers/net/wireless/realtek/rtw88/rtw8822c.c +1 -1
@@ -41,7 +41,7 @@ static void rtw8822cs_efuse_parsing(struct rtw_efuse *efuse,ether_addr_copy (efuse->addr, map->s.mac_addr); } -static int rtw8822c_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +static int rtw8822c_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;struct rtw8822c_efuse *map;
drivers/net/wireless/realtek/rtw88/rtw88xxa.c +1 -1
@@ -197,7 +197,7 @@ static void rtw88xxa_read_usb_type(struct rtw_dev *rtwdev) efuse->hw_cap.ant_num, efuse->hw_cap.nss); } -int rtw88xxa_read_efuse (struct rtw_dev *rtwdev,u8 *log_map) +int rtw88xxa_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {const struct rtw_chip_info *chip = rtwdev->chip;struct rtw_efuse *efuse = &rtwdev->efuse;
drivers/net/wireless/realtek/rtw88/rtw88xxa.h +1 -1
@@ -140,7 +140,7 @@ struct rtw_jaguar_phy_status_rpt {#define RF18_BW_MASK (BIT(11) | BIT(10))void rtw88xxa_efuse_grant (struct rtw_dev *rtwdev,bool on); -int rtw88xxa_read_efuse (struct rtw_dev *rtwdev,u8 *log_map); +int rtw88xxa_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map);void rtw88xxa_power_off (struct rtw_dev *rtwdev,const struct rtw_pwr_seq_cmd *const *enter_lps_flow);int rtw88xxa_power_on (struct rtw_dev *rtwdev);
Signature · 1 line
2.55.0
PATCH v2 2/3 wifi: rtw88: 8723b: Read the package type from efuse
Some chip package types need different parts of the RF initialisation table, so read the package type from efuse.
---
v2:
- Get the byte from the efuse physical map stored in RAM instead of reading it again from the chip.
- Use macros for the address and the mask.
- Read only the package type. The chip variant is now in patch 3.
--- drivers/net/wireless/realtek/rtw88/rtw8723b.c | 29 +++++++++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8723b.h | 11 +++++++ 2 files changed, 40 insertions(+)
drivers/net/wireless/realtek/rtw88/rtw8723b.c +29 -0
@@ -2349,6 +2349,33 @@ 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,u8 *phy_map) +{ +struct rtw_hal *hal = &rtwdev->hal; +u8 val_1fb, package; + + val_1fb = phy_map[RTW8723B_EFUSE_PACKAGE_TYPE ]; + package =u8_get_bits (val_1fb,RTW8723B_PACKAGE_TYPE_MASK ); + +switch (package) { +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 ; + } +} +static int rtw8723b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -2374,6 +2401,8 @@ static int rtw8723b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map, u8 *phy_map) efuse->hw_cap.bw =BIT (RTW_CHANNEL_WIDTH_20 ) |BIT (RTW_CHANNEL_WIDTH_40 ); +rtw8723b_read_package_type (rtwdev, phy_map); +return 0 ; }
drivers/net/wireless/realtek/rtw88/rtw8723b.h +11 -0
@@ -9,6 +9,17 @@#include "rtw8723x.h" +enum rtw8723b_package_type { +RTW8723B_PACKAGE_DEFAULT , +RTW8723B_PACKAGE_QFN68 , +RTW8723B_PACKAGE_TFBGA90 , +RTW8723B_PACKAGE_TFBGA80 , +RTW8723B_PACKAGE_TFBGA79 , +}; + +#define RTW8723B_EFUSE_PACKAGE_TYPE 0x1fb +#define RTW8723B_PACKAGE_TYPE_MASK GENMASK(2, 0) +extern const struct rtw_chip_info rtw8723b_hw_spec;#endif
Signature · 1 line
2.55.0
PATCH v2 3/3 wifi: rtw88: 8723b: Read the chip variant from efuse
In reply to Bitterblue SmithThe RTL8703AS appears to be a variant of RTL8723BS which doesn't support 40 MHz channel width, so read the chip variant from efuse and disable support for 40 MHz.
---
v2:
- Split into a separate patch.
- Get the byte from the efuse physical map stored in RAM instead of reading it again from the chip.
- Use macros for the address, mask, and chip variants.
--- drivers/net/wireless/realtek/rtw88/rtw8723b.c | 13 +++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8723b.h | 3 +++ 2 files changed, 16 insertions(+)
drivers/net/wireless/realtek/rtw88/rtw8723b.c +13 -0
@@ -2376,6 +2376,18 @@ static void rtw8723b_read_package_type(struct rtw_dev *rtwdev, u8 *phy_map) } } +static void rtw8723b_read_chip_variant (struct rtw_dev *rtwdev,u8 *phy_map) +{ +u8 val_1fb, variant; + + val_1fb = phy_map[RTW8723B_EFUSE_PACKAGE_TYPE ]; + variant =u8_get_bits (val_1fb,RTW8723B_VARIANT_MASK ); + +if (rtw_hci_type (rtwdev) ==RTW_HCI_TYPE_SDIO && + variant ==RTW8723B_VARIANT_8703AS ) + rtwdev->efuse.hw_cap.bw &= ~BIT (RTW_CHANNEL_WIDTH_40 ); +} +static int rtw8723b_read_efuse (struct rtw_dev *rtwdev,u8 *log_map,u8 *phy_map) {struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -2402,6 +2414,7 @@ static int rtw8723b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map, u8 *phy_map)BIT (RTW_CHANNEL_WIDTH_40 );rtw8723b_read_package_type (rtwdev, phy_map); +rtw8723b_read_chip_variant (rtwdev, phy_map);return 0 ; }
drivers/net/wireless/realtek/rtw88/rtw8723b.h +3 -0
@@ -19,6 +19,9 @@ enum rtw8723b_package_type {#define RTW8723B_EFUSE_PACKAGE_TYPE 0x1fb#define RTW8723B_PACKAGE_TYPE_MASK GENMASK(2, 0) +#define RTW8723B_VARIANT_MASK GENMASK(5, 4) +#define RTW8723B_VARIANT_8723BS 0x3 +#define RTW8723B_VARIANT_8703AS 0x2extern const struct rtw_chip_info rtw8723b_hw_spec;
Signature · 1 line
2.55.0
Quoted 4 lines · Bitterblue Smith
rtw8723b_read_efuse()will need to read a byte from the physical efuse map, so pass the map to theread_efusechip op.Signed-off-by Bitterblue Smith <[email protected]>
RE: [PATCH rtw-next v2 2/3] wifi: rtw88: 8723b: Read the package type from efuse
In reply to Bitterblue SmithQuoted 4 lines · Bitterblue Smith
Some chip package types need different parts of the RF initialisation table, so read the package type from efuse.
Signed-off-by Bitterblue Smith <[email protected]>
RE: [PATCH rtw-next v2 3/3] wifi: rtw88: 8723b: Read the chip variant from efuse
In reply to Bitterblue SmithQuoted 5 lines · Bitterblue Smith
The RTL8703AS appears to be a variant of RTL8723BS which doesn't support 40 MHz channel width, so read the chip variant from efuse and disable support for 40 MHz.
Signed-off-by Bitterblue Smith <[email protected]>
Quoted 9 lines · Bitterblue Smith
rtw8723b_read_efuse()will need to read a byte from the physical efuse map, so pass the map to theread_efusechip op.Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Patch is new in v2.
---
Best regards,
Luka Gejak
Re: [PATCH rtw-next v2 2/3] wifi: rtw88: 8723b: Read the package type from efuse
In reply to Bitterblue SmithQuoted 4 lines · Bitterblue Smith
Some chip package types need different parts of the RF initialisation table, so read the package type from efuse.
Quoted 8 lines
Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Get the byte from the efuse physical map stored in RAM instead of reading it again from the chip.
- Use macros for the address and the mask.
- Read only the package type. The chip variant is now in patch 3.
---
Best regards,
Luka Gejak
Re: [PATCH rtw-next v2 3/3] wifi: rtw88: 8723b: Read the chip variant from efuse
In reply to Bitterblue SmithQuoted 5 lines · Bitterblue Smith
The RTL8703AS appears to be a variant of RTL8723BS which doesn't support 40 MHz channel width, so read the chip variant from efuse and disable support for 40 MHz.
Quoted 8 lines
Signed-off-by Bitterblue Smith <[email protected]>---
v2:
- Split into a separate patch.
- Get the byte from the efuse physical map stored in RAM instead of reading it again from the chip.
- Use macros for the address, mask, and chip variants.
---
Best regards,
Luka Gejak
Ping-Ke Shih
maintainerQuoted 7 lines · Bitterblue Smith
rtw8723b_read_efuse()will need to read a byte from the physical efuse map, so pass the map to theread_efusechip op.Signed-off-by Bitterblue Smith <[email protected]>Acked-by Ping-Ke Shih <[email protected]>Reviewed-by Luka Gejak <[email protected]>Tested-by Luka Gejak <[email protected]>
3 patch(es) applied to rtw-next branch of rtw.git, thanks.
ec2baa4c9317 wifi: rtw88: Pass the physical map to the read_efuse chip op 51abe866522f wifi: rtw88: 8723b: Read the package type from efuse 10d1312f2f19 wifi: rtw88: 8723b: Read the chip variant from efuse