mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
wifi: rtl8xxxu: Use u32_get_bits in *_identify_chip
It simplifies the code a bit. Suggested-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/68f94284-3728-7b75-2b7b-64fae8af6bc5@gmail.com
This commit is contained in:
committed by
Kalle Valo
parent
9b00565abf
commit
60d18ddb53
@@ -335,8 +335,7 @@ static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
priv->has_wifi = 1;
|
||||
|
||||
sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
|
||||
priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
|
||||
SYS_CFG_CHIP_VERSION_SHIFT;
|
||||
priv->chip_cut = u32_get_bits(sys_cfg, SYS_CFG_CHIP_VERSION_MASK);
|
||||
if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
|
||||
dev_info(dev, "Unsupported test chip\n");
|
||||
ret = -ENOTSUPP;
|
||||
|
||||
@@ -333,8 +333,7 @@ static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
int ret = 0;
|
||||
|
||||
sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
|
||||
priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
|
||||
SYS_CFG_CHIP_VERSION_SHIFT;
|
||||
priv->chip_cut = u32_get_bits(sys_cfg, SYS_CFG_CHIP_VERSION_MASK);
|
||||
if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
|
||||
dev_info(dev, "Unsupported test chip\n");
|
||||
ret = -ENOTSUPP;
|
||||
@@ -371,7 +370,7 @@ static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
rtl8xxxu_identify_vendor_1bit(priv, vendor);
|
||||
|
||||
val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
|
||||
priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
|
||||
priv->rom_rev = u32_get_bits(val32, GPIO_RF_RL_ID);
|
||||
|
||||
rtl8xxxu_config_endpoints_sie(priv);
|
||||
|
||||
|
||||
@@ -485,8 +485,7 @@ static int rtl8192eu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
int ret = 0;
|
||||
|
||||
sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
|
||||
priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
|
||||
SYS_CFG_CHIP_VERSION_SHIFT;
|
||||
priv->chip_cut = u32_get_bits(sys_cfg, SYS_CFG_CHIP_VERSION_MASK);
|
||||
if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
|
||||
dev_info(dev, "Unsupported test chip\n");
|
||||
ret = -ENOTSUPP;
|
||||
@@ -512,7 +511,7 @@ static int rtl8192eu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
rtl8xxxu_identify_vendor_2bits(priv, vendor);
|
||||
|
||||
val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
|
||||
priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
|
||||
priv->rom_rev = u32_get_bits(val32, GPIO_RF_RL_ID);
|
||||
|
||||
rtl8xxxu_config_endpoints_sie(priv);
|
||||
|
||||
|
||||
@@ -136,8 +136,7 @@ static int rtl8723au_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
int ret = 0;
|
||||
|
||||
sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
|
||||
priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
|
||||
SYS_CFG_CHIP_VERSION_SHIFT;
|
||||
priv->chip_cut = u32_get_bits(sys_cfg, SYS_CFG_CHIP_VERSION_MASK);
|
||||
if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
|
||||
dev_info(dev, "Unsupported test chip\n");
|
||||
ret = -ENOTSUPP;
|
||||
@@ -165,7 +164,7 @@ static int rtl8723au_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
rtl8xxxu_identify_vendor_1bit(priv, vendor);
|
||||
|
||||
val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
|
||||
priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
|
||||
priv->rom_rev = u32_get_bits(val32, GPIO_RF_RL_ID);
|
||||
|
||||
rtl8xxxu_config_endpoints_sie(priv);
|
||||
|
||||
|
||||
@@ -311,8 +311,7 @@ static int rtl8723bu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
int ret = 0;
|
||||
|
||||
sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
|
||||
priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
|
||||
SYS_CFG_CHIP_VERSION_SHIFT;
|
||||
priv->chip_cut = u32_get_bits(sys_cfg, SYS_CFG_CHIP_VERSION_MASK);
|
||||
if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
|
||||
dev_info(dev, "Unsupported test chip\n");
|
||||
ret = -ENOTSUPP;
|
||||
@@ -338,7 +337,7 @@ static int rtl8723bu_identify_chip(struct rtl8xxxu_priv *priv)
|
||||
rtl8xxxu_identify_vendor_2bits(priv, vendor);
|
||||
|
||||
val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
|
||||
priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
|
||||
priv->rom_rev = u32_get_bits(val32, GPIO_RF_RL_ID);
|
||||
|
||||
rtl8xxxu_config_endpoints_sie(priv);
|
||||
|
||||
|
||||
@@ -315,7 +315,6 @@
|
||||
#define SYS_CFG_SPS_SEL BIT(24) /* 1:LDO regulator mode;
|
||||
0:Switching regulator mode*/
|
||||
#define SYS_CFG_CHIP_VERSION_MASK 0xf000 /* Bit 12 - 15 */
|
||||
#define SYS_CFG_CHIP_VERSION_SHIFT 12
|
||||
|
||||
#define REG_GPIO_OUTSTS 0x00f4 /* For RTL8723 only. */
|
||||
#define GPIO_EFS_HCI_SEL (BIT(0) | BIT(1))
|
||||
|
||||
Reference in New Issue
Block a user