No changes to functionality, just moving code to make
rtl8xxxu_init_device look nicer.
Signed-off-by: Bitterblue Smith <[email protected]>
---
v2:
- No change.
---
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +
.../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
.../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 +
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 89 ++++++++++---------
4 files changed, 52 insertions(+), 41 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 6ff554ba0250..9f8b23160ed0 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1485,6 +1485,7 @@ struct rtl8xxxu_fileops {
int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb);
void (*init_aggregation) (struct rtl8xxxu_priv *priv);
void (*init_statistics) (struct rtl8xxxu_priv *priv);
+ void (*init_burst) (struct rtl8xxxu_priv *priv);
void (*enable_rf) (struct rtl8xxxu_priv *priv);
void (*disable_rf) (struct rtl8xxxu_priv *priv);
void (*usb_quirks) (struct rtl8xxxu_priv *priv);
@@ -1592,6 +1593,7 @@ void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv);
void rtl8xxxu_gen1_enable_rf(struct rtl8xxxu_priv *priv);
void rtl8xxxu_gen1_disable_rf(struct rtl8xxxu_priv *priv);
void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv);
+void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv);
int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
int rtl8xxxu_gen2_channel_to_group(int channel);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
index 5a5b7fa4283c..5eadeb02a762 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
@@ -1705,6 +1705,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = {
.parse_rx_desc = rtl8xxxu_parse_rxdesc24,
.init_aggregation = rtl8188fu_init_aggregation,
.init_statistics = rtl8188fu_init_statistics,
+ .init_burst = rtl8xxxu_init_burst,
.enable_rf = rtl8188f_enable_rf,
.disable_rf = rtl8188f_disable_rf,
.usb_quirks = rtl8188f_usb_quirks,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
index 9214c1d3b644..27df8805cb18 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
@@ -1683,6 +1683,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = {
.parse_rx_desc = rtl8xxxu_parse_rxdesc24,
.init_aggregation = rtl8723bu_init_aggregation,
.init_statistics = rtl8723bu_init_statistics,
+ .init_burst = rtl8xxxu_init_burst,
.enable_rf = rtl8723b_enable_rf,
.disable_rf = rtl8xxxu_gen2_disable_rf,
.usb_quirks = rtl8xxxu_gen2_usb_quirks,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 019f8ddd418b..282ad8a9b73d 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -3886,6 +3886,52 @@ static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
rtl8xxxu_write32(priv, REG_RQPN, val32);
}
+void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv)
+{
+ u8 val8;
+
+ /*
+ * For USB high speed set 512B packets
+ */
+ val8 = rtl8xxxu_read8(priv, REG_RXDMA_PRO_8723B);
+ val8 &= ~(BIT(4) | BIT(5));
+ val8 |= BIT(4);
+ val8 |= BIT(1) | BIT(2) | BIT(3);
+ rtl8xxxu_write8(priv, REG_RXDMA_PRO_8723B, val8);
+
+ /*
+ * Enable single packet AMPDU
+ */
+ val8 = rtl8xxxu_read8(priv, REG_HT_SINGLE_AMPDU_8723B);
+ val8 |= BIT(7);
+ rtl8xxxu_write8(priv, REG_HT_SINGLE_AMPDU_8723B, val8);
+
+ rtl8xxxu_write16(priv, REG_MAX_AGGR_NUM, 0x0c14);
+ if (priv->rtl_chip == RTL8723B)
+ val8 = 0x5e;
+ else if (priv->rtl_chip == RTL8188F)
+ val8 = 0x70; /* 0x5e would make it very slow */
+ rtl8xxxu_write8(priv, REG_AMPDU_MAX_TIME_8723B, val8);
+ rtl8xxxu_write32(priv, REG_AGGLEN_LMT, 0xffffffff);
+ rtl8xxxu_write8(priv, REG_RX_PKT_LIMIT, 0x18);
+ rtl8xxxu_write8(priv, REG_PIFS, 0x00);
+ if (priv->rtl_chip == RTL8188F) {
+ rtl8xxxu_write8(priv, REG_FWHW_TXQ_CTRL, FWHW_TXQ_CTRL_AMPDU_RETRY);
+ rtl8xxxu_write32(priv, REG_FAST_EDCA_CTRL, 0x03086666);
+ }
+ if (priv->rtl_chip == RTL8723B)
+ val8 = 0x50;
+ else if (priv->rtl_chip == RTL8188F)
+ val8 = 0x28; /* 0x50 would make the upload slow */
+ rtl8xxxu_write8(priv, REG_USTIME_TSF_8723B, val8);
+ rtl8xxxu_write8(priv, REG_USTIME_EDCA, val8);
+
+ /* to prevent mac is reseted by bus. */
+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL);
+ val8 |= BIT(5) | BIT(6);
+ rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
+}
+
static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
{
struct rtl8xxxu_priv *priv = hw->priv;
@@ -4139,48 +4185,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
/*
* Initialize burst parameters
*/
- if (priv->rtl_chip == RTL8723B || priv->rtl_chip == RTL8188F) {
- /*
- * For USB high speed set 512B packets
- */
- val8 = rtl8xxxu_read8(priv, REG_RXDMA_PRO_8723B);
- val8 &= ~(BIT(4) | BIT(5));
- val8 |= BIT(4);
- val8 |= BIT(1) | BIT(2) | BIT(3);
- rtl8xxxu_write8(priv, REG_RXDMA_PRO_8723B, val8);
- /*
- * For USB high speed set 512B packets
- */
- val8 = rtl8xxxu_read8(priv, REG_HT_SINGLE_AMPDU_8723B);
- val8 |= BIT(7);
- rtl8xxxu_write8(priv, REG_HT_SINGLE_AMPDU_8723B, val8);
-
- rtl8xxxu_write16(priv, REG_MAX_AGGR_NUM, 0x0c14);
- if (priv->rtl_chip == RTL8723B)
- val8 = 0x5e;
- else if (priv->rtl_chip == RTL8188F)
- val8 = 0x70; /* 0x5e would make it very slow */
- rtl8xxxu_write8(priv, REG_AMPDU_MAX_TIME_8723B, val8);
- rtl8xxxu_write32(priv, REG_AGGLEN_LMT, 0xffffffff);
- rtl8xxxu_write8(priv, REG_RX_PKT_LIMIT, 0x18);
- rtl8xxxu_write8(priv, REG_PIFS, 0x00);
- if (priv->rtl_chip == RTL8188F) {
- rtl8xxxu_write8(priv, REG_FWHW_TXQ_CTRL, FWHW_TXQ_CTRL_AMPDU_RETRY);
- rtl8xxxu_write32(priv, REG_FAST_EDCA_CTRL, 0x03086666);
- }
- if (priv->rtl_chip == RTL8723B)
- val8 = 0x50;
- else if (priv->rtl_chip == RTL8188F)
- val8 = 0x28; /* 0x50 would make the upload slow */
- rtl8xxxu_write8(priv, REG_USTIME_TSF_8723B, val8);
- rtl8xxxu_write8(priv, REG_USTIME_EDCA, val8);
-
- /* to prevent mac is reseted by bus. */
- val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL);
- val8 |= BIT(5) | BIT(6);
- rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
- }
+ if (priv->fops->init_burst)
+ priv->fops->init_burst(priv);
if (fops->init_aggregation)
fops->init_aggregation(priv);
--
2.38.0
This name is an anomaly. Change it to rtl8188f_channel_to_group to
follow the same pattern as the other functions.
Signed-off-by: Bitterblue Smith <[email protected]>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
index 4d044a8baa30..0f77312dd0ca 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
@@ -352,7 +352,7 @@ static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
return ret;
}
-static void rtl8xxxu_8188f_channel_to_group(int channel, int *group, int *cck_group)
+static void rtl8188f_channel_to_group(int channel, int *group, int *cck_group)
{
if (channel < 3)
*group = 0;
@@ -378,7 +378,7 @@ rtl8188f_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
u8 cck, ofdmbase, mcsbase;
int group, cck_group;
- rtl8xxxu_8188f_channel_to_group(channel, &group, &cck_group);
+ rtl8188f_channel_to_group(channel, &group, &cck_group);
cck = priv->cck_tx_power_index_A[cck_group];
--
2.38.0
Move the reusable parts into separate functions and create one
identify_chip function for each chip type.
This is preparation for supporting the RTL8710BU chip, which would
need too many ugly changes to this function. Another reason to do this
is to get rid of the long and scary if..else if..else block in the
middle of the function.
Everything should still work the same as before.
Signed-off-by: Bitterblue Smith <[email protected]>
---
v2:
- Make rtl8192cu_identify_chip and rtl8192eu_identify_chip static.
Reported-by: kernel test robot <[email protected]>
---
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 5 +
.../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 32 +++
.../realtek/rtl8xxxu/rtl8xxxu_8192c.c | 60 +++++
.../realtek/rtl8xxxu/rtl8xxxu_8192e.c | 49 +++++
.../realtek/rtl8xxxu/rtl8xxxu_8723a.c | 51 +++++
.../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 49 +++++
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 207 +++++-------------
7 files changed, 297 insertions(+), 156 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 9f8b23160ed0..136992f0200c 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1470,6 +1470,7 @@ struct rtl8xxxu_tx_urb {
};
struct rtl8xxxu_fileops {
+ int (*identify_chip) (struct rtl8xxxu_priv *priv);
int (*parse_efuse) (struct rtl8xxxu_priv *priv);
int (*load_firmware) (struct rtl8xxxu_priv *priv);
int (*power_on) (struct rtl8xxxu_priv *priv);
@@ -1562,6 +1563,10 @@ int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name);
void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv);
void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv);
+void rtl8xxxu_identify_vendor_1bit(struct rtl8xxxu_priv *priv, u32 vendor);
+void rtl8xxxu_identify_vendor_2bits(struct rtl8xxxu_priv *priv, u32 vendor);
+void rtl8xxxu_config_endpoints_sie(struct rtl8xxxu_priv *priv);
+int rtl8xxxu_config_endpoints_no_sie(struct rtl8xxxu_priv *priv);
int rtl8xxxu_read_efuse8(struct rtl8xxxu_priv *priv, u16 offset, u8 *data);
void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv);
int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
index 5eadeb02a762..4d044a8baa30 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
@@ -321,6 +321,37 @@ static const struct rtl8xxxu_rfregval rtl8188fu_cut_b_radioa_init_table[] = {
{0xff, 0xffffffff}
};
+static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+ u32 sys_cfg, vendor;
+ int ret = 0;
+
+ sprintf(priv->chip_name, "8188FU");
+ priv->rtl_chip = RTL8188F;
+ priv->rf_paths = 1;
+ priv->rx_paths = 1;
+ priv->tx_paths = 1;
+ 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;
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
+ dev_info(dev, "Unsupported test chip\n");
+ ret = -ENOTSUPP;
+ goto out;
+ }
+
+ vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
+ rtl8xxxu_identify_vendor_2bits(priv, vendor);
+
+ ret = rtl8xxxu_config_endpoints_no_sie(priv);
+
+out:
+ return ret;
+}
+
static void rtl8xxxu_8188f_channel_to_group(int channel, int *group, int *cck_group)
{
if (channel < 3)
@@ -1690,6 +1721,7 @@ static s8 rtl8188f_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
}
struct rtl8xxxu_fileops rtl8188fu_fops = {
+ .identify_chip = rtl8188fu_identify_chip,
.parse_efuse = rtl8188fu_parse_efuse,
.load_firmware = rtl8188fu_load_firmware,
.power_on = rtl8188fu_power_on,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
index 9dfeeaa74927..815c1e278e4e 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
@@ -326,6 +326,65 @@ static const struct rtl8xxxu_rfregval rtl8188ru_radioa_1t_highpa_table[] = {
{0xff, 0xffffffff}
};
+static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+ u32 val32, bonding, sys_cfg, vendor;
+ 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;
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
+ dev_info(dev, "Unsupported test chip\n");
+ ret = -ENOTSUPP;
+ goto out;
+ }
+
+ if (sys_cfg & SYS_CFG_TYPE_ID) {
+ bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
+ bonding &= HPON_FSM_BONDING_MASK;
+ if (bonding == HPON_FSM_BONDING_1T2R) {
+ sprintf(priv->chip_name, "8191CU");
+ priv->tx_paths = 1;
+ priv->usb_interrupts = 1;
+ priv->rtl_chip = RTL8191C;
+ } else {
+ sprintf(priv->chip_name, "8192CU");
+ priv->tx_paths = 2;
+ priv->usb_interrupts = 0;
+ priv->rtl_chip = RTL8192C;
+ }
+ priv->rf_paths = 2;
+ priv->rx_paths = 2;
+ } else {
+ sprintf(priv->chip_name, "8188CU");
+ priv->rf_paths = 1;
+ priv->rx_paths = 1;
+ priv->tx_paths = 1;
+ priv->rtl_chip = RTL8188C;
+ priv->usb_interrupts = 0;
+ }
+ priv->has_wifi = 1;
+
+ vendor = sys_cfg & SYS_CFG_VENDOR_ID;
+ rtl8xxxu_identify_vendor_1bit(priv, vendor);
+
+ val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
+ priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
+
+ rtl8xxxu_config_endpoints_sie(priv);
+
+ /*
+ * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
+ */
+ if (!priv->ep_tx_count)
+ ret = rtl8xxxu_config_endpoints_no_sie(priv);
+
+out:
+ return ret;
+}
+
static int rtl8192cu_load_firmware(struct rtl8xxxu_priv *priv)
{
char *fw_name;
@@ -541,6 +600,7 @@ static int rtl8192cu_power_on(struct rtl8xxxu_priv *priv)
}
struct rtl8xxxu_fileops rtl8192cu_fops = {
+ .identify_chip = rtl8192cu_identify_chip,
.parse_efuse = rtl8192cu_parse_efuse,
.load_firmware = rtl8192cu_load_firmware,
.power_on = rtl8192cu_power_on,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
index 973a02afc82b..7a182073832b 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
@@ -478,6 +478,54 @@ static const struct rtl8xxxu_rfregval rtl8192eu_radiob_init_table[] = {
{0xff, 0xffffffff}
};
+static int rtl8192eu_identify_chip(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+ u32 val32, bonding, sys_cfg, vendor;
+ 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;
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
+ dev_info(dev, "Unsupported test chip\n");
+ ret = -ENOTSUPP;
+ goto out;
+ }
+
+ bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
+ bonding &= HPON_FSM_BONDING_MASK;
+ if (bonding == HPON_FSM_BONDING_1T2R) {
+ sprintf(priv->chip_name, "8191EU");
+ priv->tx_paths = 1;
+ priv->rtl_chip = RTL8191E;
+ } else {
+ sprintf(priv->chip_name, "8192EU");
+ priv->tx_paths = 2;
+ priv->rtl_chip = RTL8192E;
+ }
+ priv->rf_paths = 2;
+ priv->rx_paths = 2;
+ priv->has_wifi = 1;
+
+ vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
+ rtl8xxxu_identify_vendor_2bits(priv, vendor);
+
+ val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
+ priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
+
+ rtl8xxxu_config_endpoints_sie(priv);
+
+ /*
+ * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
+ */
+ if (!priv->ep_tx_count)
+ ret = rtl8xxxu_config_endpoints_no_sie(priv);
+
+out:
+ return ret;
+}
+
static void
rtl8192e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
{
@@ -1693,6 +1741,7 @@ static s8 rtl8192e_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
}
struct rtl8xxxu_fileops rtl8192eu_fops = {
+ .identify_chip = rtl8192eu_identify_chip,
.parse_efuse = rtl8192eu_parse_efuse,
.load_firmware = rtl8192eu_load_firmware,
.power_on = rtl8192eu_power_on,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
index 8d8eb16a0970..33a1114a5853 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
@@ -129,6 +129,56 @@ static const struct rtl8xxxu_rfregval rtl8723au_radioa_1t_init_table[] = {
{0xff, 0xffffffff}
};
+static int rtl8723au_identify_chip(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+ u32 val32, sys_cfg, vendor;
+ 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;
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
+ dev_info(dev, "Unsupported test chip\n");
+ ret = -ENOTSUPP;
+ goto out;
+ }
+
+ sprintf(priv->chip_name, "8723AU");
+ priv->usb_interrupts = 1;
+ priv->rtl_chip = RTL8723A;
+
+ priv->rf_paths = 1;
+ priv->rx_paths = 1;
+ priv->tx_paths = 1;
+
+ val32 = rtl8xxxu_read32(priv, REG_MULTI_FUNC_CTRL);
+ if (val32 & MULTI_WIFI_FUNC_EN)
+ priv->has_wifi = 1;
+ if (val32 & MULTI_BT_FUNC_EN)
+ priv->has_bluetooth = 1;
+ if (val32 & MULTI_GPS_FUNC_EN)
+ priv->has_gps = 1;
+ priv->is_multi_func = 1;
+
+ vendor = sys_cfg & SYS_CFG_VENDOR_ID;
+ rtl8xxxu_identify_vendor_1bit(priv, vendor);
+
+ val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
+ priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
+
+ rtl8xxxu_config_endpoints_sie(priv);
+
+ /*
+ * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
+ */
+ if (!priv->ep_tx_count)
+ ret = rtl8xxxu_config_endpoints_no_sie(priv);
+
+out:
+ return ret;
+}
+
static int rtl8723au_parse_efuse(struct rtl8xxxu_priv *priv)
{
struct rtl8723au_efuse *efuse = &priv->efuse_wifi.efuse8723;
@@ -409,6 +459,7 @@ s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
}
struct rtl8xxxu_fileops rtl8723au_fops = {
+ .identify_chip = rtl8723au_identify_chip,
.parse_efuse = rtl8723au_parse_efuse,
.load_firmware = rtl8723au_load_firmware,
.power_on = rtl8723au_power_on,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
index 27df8805cb18..558572bdd2c8 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
@@ -304,6 +304,54 @@ static const struct rtl8xxxu_rfregval rtl8723bu_radioa_1t_init_table[] = {
{0xff, 0xffffffff}
};
+static int rtl8723bu_identify_chip(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+ u32 val32, sys_cfg, vendor;
+ 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;
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
+ dev_info(dev, "Unsupported test chip\n");
+ ret = -ENOTSUPP;
+ goto out;
+ }
+
+ sprintf(priv->chip_name, "8723BU");
+ priv->rtl_chip = RTL8723B;
+ priv->rf_paths = 1;
+ priv->rx_paths = 1;
+ priv->tx_paths = 1;
+
+ val32 = rtl8xxxu_read32(priv, REG_MULTI_FUNC_CTRL);
+ if (val32 & MULTI_WIFI_FUNC_EN)
+ priv->has_wifi = 1;
+ if (val32 & MULTI_BT_FUNC_EN)
+ priv->has_bluetooth = 1;
+ if (val32 & MULTI_GPS_FUNC_EN)
+ priv->has_gps = 1;
+ priv->is_multi_func = 1;
+
+ vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
+ rtl8xxxu_identify_vendor_2bits(priv, vendor);
+
+ val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
+ priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
+
+ rtl8xxxu_config_endpoints_sie(priv);
+
+ /*
+ * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
+ */
+ if (!priv->ep_tx_count)
+ ret = rtl8xxxu_config_endpoints_no_sie(priv);
+
+out:
+ return ret;
+}
+
static void rtl8723bu_write_btreg(struct rtl8xxxu_priv *priv, u8 reg, u8 data)
{
struct h2c_cmd h2c;
@@ -1668,6 +1716,7 @@ static s8 rtl8723b_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
}
struct rtl8xxxu_fileops rtl8723bu_fops = {
+ .identify_chip = rtl8723bu_identify_chip,
.parse_efuse = rtl8723bu_parse_efuse,
.load_firmware = rtl8723bu_load_firmware,
.power_on = rtl8723bu_power_on,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 282ad8a9b73d..839e0546f5ec 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1589,148 +1589,40 @@ static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
dev_info(dev, "RTL%s MAC: %pM\n", priv->chip_name, priv->mac_addr);
}
-static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
+void rtl8xxxu_identify_vendor_1bit(struct rtl8xxxu_priv *priv, u32 vendor)
{
- const struct usb_device_descriptor *descriptor = &priv->udev->descriptor;
- struct device *dev = &priv->udev->dev;
- struct ieee80211_hw *hw = priv->hw;
- u32 val32, bonding, sys_cfg;
- u16 val16;
-
- sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
- priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
- SYS_CFG_CHIP_VERSION_SHIFT;
- if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
- dev_info(dev, "Unsupported test chip\n");
- return -ENOTSUPP;
- }
-
- if (descriptor->idVendor == USB_VENDOR_ID_REALTEK &&
- descriptor->idProduct == 0xf179) {
- sprintf(priv->chip_name, "8188FU");
- priv->rtl_chip = RTL8188F;
- priv->rf_paths = 1;
- priv->rx_paths = 1;
- priv->tx_paths = 1;
- priv->has_wifi = 1;
- goto skip_complicated_chip_detection;
- }
-
- if (sys_cfg & SYS_CFG_BT_FUNC) {
- if (priv->chip_cut >= 3) {
- sprintf(priv->chip_name, "8723BU");
- priv->rtl_chip = RTL8723B;
- } else {
- sprintf(priv->chip_name, "8723AU");
- priv->usb_interrupts = 1;
- priv->rtl_chip = RTL8723A;
- }
-
- priv->rf_paths = 1;
- priv->rx_paths = 1;
- priv->tx_paths = 1;
-
- val32 = rtl8xxxu_read32(priv, REG_MULTI_FUNC_CTRL);
- if (val32 & MULTI_WIFI_FUNC_EN)
- priv->has_wifi = 1;
- if (val32 & MULTI_BT_FUNC_EN)
- priv->has_bluetooth = 1;
- if (val32 & MULTI_GPS_FUNC_EN)
- priv->has_gps = 1;
- priv->is_multi_func = 1;
- } else if (sys_cfg & SYS_CFG_TYPE_ID) {
- bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
- bonding &= HPON_FSM_BONDING_MASK;
- if (priv->fops->tx_desc_size ==
- sizeof(struct rtl8xxxu_txdesc40)) {
- if (bonding == HPON_FSM_BONDING_1T2R) {
- sprintf(priv->chip_name, "8191EU");
- priv->rf_paths = 2;
- priv->rx_paths = 2;
- priv->tx_paths = 1;
- priv->rtl_chip = RTL8191E;
- } else {
- sprintf(priv->chip_name, "8192EU");
- priv->rf_paths = 2;
- priv->rx_paths = 2;
- priv->tx_paths = 2;
- priv->rtl_chip = RTL8192E;
- }
- } else if (bonding == HPON_FSM_BONDING_1T2R) {
- sprintf(priv->chip_name, "8191CU");
- priv->rf_paths = 2;
- priv->rx_paths = 2;
- priv->tx_paths = 1;
- priv->usb_interrupts = 1;
- priv->rtl_chip = RTL8191C;
- } else {
- sprintf(priv->chip_name, "8192CU");
- priv->rf_paths = 2;
- priv->rx_paths = 2;
- priv->tx_paths = 2;
- priv->usb_interrupts = 0;
- priv->rtl_chip = RTL8192C;
- }
- priv->has_wifi = 1;
+ if (vendor) {
+ sprintf(priv->chip_vendor, "UMC");
+ priv->vendor_umc = 1;
} else {
- sprintf(priv->chip_name, "8188CU");
- priv->rf_paths = 1;
- priv->rx_paths = 1;
- priv->tx_paths = 1;
- priv->rtl_chip = RTL8188C;
- priv->usb_interrupts = 0;
- priv->has_wifi = 1;
+ sprintf(priv->chip_vendor, "TSMC");
}
+}
-skip_complicated_chip_detection:
-
- hw->wiphy->available_antennas_tx = BIT(priv->tx_paths) - 1;
- hw->wiphy->available_antennas_rx = BIT(priv->rx_paths) - 1;
-
- switch (priv->rtl_chip) {
- case RTL8188E:
- case RTL8188F:
- case RTL8192E:
- case RTL8723B:
- switch (sys_cfg & SYS_CFG_VENDOR_EXT_MASK) {
- case SYS_CFG_VENDOR_ID_TSMC:
- sprintf(priv->chip_vendor, "TSMC");
- break;
- case SYS_CFG_VENDOR_ID_SMIC:
- sprintf(priv->chip_vendor, "SMIC");
- priv->vendor_smic = 1;
- break;
- case SYS_CFG_VENDOR_ID_UMC:
- sprintf(priv->chip_vendor, "UMC");
- priv->vendor_umc = 1;
- break;
- default:
- sprintf(priv->chip_vendor, "unknown");
- }
+void rtl8xxxu_identify_vendor_2bits(struct rtl8xxxu_priv *priv, u32 vendor)
+{
+ switch (vendor) {
+ case SYS_CFG_VENDOR_ID_TSMC:
+ sprintf(priv->chip_vendor, "TSMC");
+ break;
+ case SYS_CFG_VENDOR_ID_SMIC:
+ sprintf(priv->chip_vendor, "SMIC");
+ priv->vendor_smic = 1;
+ break;
+ case SYS_CFG_VENDOR_ID_UMC:
+ sprintf(priv->chip_vendor, "UMC");
+ priv->vendor_umc = 1;
break;
default:
- if (sys_cfg & SYS_CFG_VENDOR_ID) {
- sprintf(priv->chip_vendor, "UMC");
- priv->vendor_umc = 1;
- } else {
- sprintf(priv->chip_vendor, "TSMC");
- }
+ sprintf(priv->chip_vendor, "unknown");
}
+}
- val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
- priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
+void rtl8xxxu_config_endpoints_sie(struct rtl8xxxu_priv *priv)
+{
+ u16 val16;
- /*
- * 8188FU vendor driver doesn't use REG_NORMAL_SIE_EP_TX,
- * it just decides the queue mapping based on nr_out_eps.
- * However, reading the register returns "0x321" which
- * results in a wrong ep_tx_count of 3 and most frames
- * not being transmitted.
- */
- if (priv->rtl_chip == RTL8188F)
- val16 = 0;
- else
- val16 = rtl8xxxu_read16(priv, REG_NORMAL_SIE_EP_TX);
+ val16 = rtl8xxxu_read16(priv, REG_NORMAL_SIE_EP_TX);
if (val16 & NORMAL_SIE_EP_TX_HIGH_MASK) {
priv->ep_tx_high_queue = 1;
@@ -1746,29 +1638,29 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
priv->ep_tx_low_queue = 1;
priv->ep_tx_count++;
}
+}
- /*
- * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
- */
- if (!priv->ep_tx_count) {
- switch (priv->nr_out_eps) {
- case 4:
- case 3:
- priv->ep_tx_low_queue = 1;
- priv->ep_tx_count++;
- fallthrough;
- case 2:
- priv->ep_tx_normal_queue = 1;
- priv->ep_tx_count++;
- fallthrough;
- case 1:
- priv->ep_tx_high_queue = 1;
- priv->ep_tx_count++;
- break;
- default:
- dev_info(dev, "Unsupported USB TX end-points\n");
- return -ENOTSUPP;
- }
+int rtl8xxxu_config_endpoints_no_sie(struct rtl8xxxu_priv *priv)
+{
+ struct device *dev = &priv->udev->dev;
+
+ switch (priv->nr_out_eps) {
+ case 4:
+ case 3:
+ priv->ep_tx_low_queue = 1;
+ priv->ep_tx_count++;
+ fallthrough;
+ case 2:
+ priv->ep_tx_normal_queue = 1;
+ priv->ep_tx_count++;
+ fallthrough;
+ case 1:
+ priv->ep_tx_high_queue = 1;
+ priv->ep_tx_count++;
+ break;
+ default:
+ dev_info(dev, "Unsupported USB TX end-points\n");
+ return -ENOTSUPP;
}
return 0;
@@ -6937,12 +6829,15 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
if (ret)
goto err_set_intfdata;
- ret = rtl8xxxu_identify_chip(priv);
+ ret = priv->fops->identify_chip(priv);
if (ret) {
dev_err(&udev->dev, "Fatal - failed to identify chip\n");
goto err_set_intfdata;
}
+ hw->wiphy->available_antennas_tx = BIT(priv->tx_paths) - 1;
+ hw->wiphy->available_antennas_rx = BIT(priv->rx_paths) - 1;
+
ret = rtl8xxxu_read_efuse(priv);
if (ret) {
dev_err(&udev->dev, "Fatal - failed to read EFuse\n");
--
2.38.0
> -----Original Message-----
> From: Bitterblue Smith <[email protected]>
> Sent: Sunday, November 6, 2022 6:53 AM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>
> Subject: [PATCH v2 1/3] wifi: rtl8xxxu: Move burst init to a function
>
> No changes to functionality, just moving code to make
> rtl8xxxu_init_device look nicer.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
> ---
> v2:
> - No change.
> ---
> .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +
> .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
> .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 +
> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 89 ++++++++++---------
> 4 files changed, 52 insertions(+), 41 deletions(-)
>
[...]
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 019f8ddd418b..282ad8a9b73d 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -3886,6 +3886,52 @@ static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
> rtl8xxxu_write32(priv, REG_RQPN, val32);
> }
>
> +void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv)
> +{
> + u8 val8;
> +
> + /*
> + * For USB high speed set 512B packets
> + */
> + val8 = rtl8xxxu_read8(priv, REG_RXDMA_PRO_8723B);
> + val8 &= ~(BIT(4) | BIT(5));
> + val8 |= BIT(4);
> + val8 |= BIT(1) | BIT(2) | BIT(3);
I think we can fix these magic numbers along with your patch.
#define DMA_MODE BIT(1) // set 0x1
#define DMA_BURST_CNT GENMASK(3, 2) // set 0x3
#define DMA_BURST_SIZE GENMASK(5, 4) // set 0x1
> + rtl8xxxu_write8(priv, REG_RXDMA_PRO_8723B, val8);
> +
> + /*
> + * Enable single packet AMPDU
> + */
> + val8 = rtl8xxxu_read8(priv, REG_HT_SINGLE_AMPDU_8723B);
> + val8 |= BIT(7);
#define EN_SINGLE_AMPDU BIT(7)
> + rtl8xxxu_write8(priv, REG_HT_SINGLE_AMPDU_8723B, val8);
> +
> + rtl8xxxu_write16(priv, REG_MAX_AGGR_NUM, 0x0c14);
> + if (priv->rtl_chip == RTL8723B)
> + val8 = 0x5e;
> + else if (priv->rtl_chip == RTL8188F)
> + val8 = 0x70; /* 0x5e would make it very slow */
> + rtl8xxxu_write8(priv, REG_AMPDU_MAX_TIME_8723B, val8);
> + rtl8xxxu_write32(priv, REG_AGGLEN_LMT, 0xffffffff);
> + rtl8xxxu_write8(priv, REG_RX_PKT_LIMIT, 0x18);
> + rtl8xxxu_write8(priv, REG_PIFS, 0x00);
> + if (priv->rtl_chip == RTL8188F) {
> + rtl8xxxu_write8(priv, REG_FWHW_TXQ_CTRL, FWHW_TXQ_CTRL_AMPDU_RETRY);
> + rtl8xxxu_write32(priv, REG_FAST_EDCA_CTRL, 0x03086666);
> + }
> + if (priv->rtl_chip == RTL8723B)
> + val8 = 0x50;
> + else if (priv->rtl_chip == RTL8188F)
> + val8 = 0x28; /* 0x50 would make the upload slow */
> + rtl8xxxu_write8(priv, REG_USTIME_TSF_8723B, val8);
> + rtl8xxxu_write8(priv, REG_USTIME_EDCA, val8);
> +
> + /* to prevent mac is reseted by bus. */
> + val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL);
> + val8 |= BIT(5) | BIT(6);
#define WLOCK_1C BIT(5)
#define DIS_PRST BIT(6)
> + rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
> +}
> +
[...]
I find some bit definitions, so we can have them meaningful names, and
please add proper prefix if need.
Ping-Ke
> -----Original Message-----
> From: Bitterblue Smith <[email protected]>
> Sent: Sunday, November 6, 2022 6:55 AM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>
> Subject: [PATCH v2 3/3] wifi: rtl8xxxu: Rename rtl8xxxu_8188f_channel_to_group
>
> This name is an anomaly. Change it to rtl8188f_channel_to_group to
> follow the same pattern as the other functions.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
Reviewed-by: Ping-Ke Shih <[email protected]>
> ---
> v2:
> - No change.
> ---
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> index 4d044a8baa30..0f77312dd0ca 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> @@ -352,7 +352,7 @@ static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
> return ret;
> }
>
> -static void rtl8xxxu_8188f_channel_to_group(int channel, int *group, int *cck_group)
> +static void rtl8188f_channel_to_group(int channel, int *group, int *cck_group)
> {
> if (channel < 3)
> *group = 0;
> @@ -378,7 +378,7 @@ rtl8188f_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
> u8 cck, ofdmbase, mcsbase;
> int group, cck_group;
>
> - rtl8xxxu_8188f_channel_to_group(channel, &group, &cck_group);
> + rtl8188f_channel_to_group(channel, &group, &cck_group);
>
> cck = priv->cck_tx_power_index_A[cck_group];
>
> --
> 2.38.0
>
> ------Please consider the environment before printing this e-mail.
> -----Original Message-----
> From: Bitterblue Smith <[email protected]>
> Sent: Sunday, November 6, 2022 6:54 AM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>
> Subject: [PATCH v2 2/3] wifi: rtl8xxxu: Split up rtl8xxxu_identify_chip
>
> Move the reusable parts into separate functions and create one
> identify_chip function for each chip type.
>
> This is preparation for supporting the RTL8710BU chip, which would
> need too many ugly changes to this function. Another reason to do this
> is to get rid of the long and scary if..else if..else block in the
> middle of the function.
>
> Everything should still work the same as before.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
> ---
> v2:
> - Make rtl8192cu_identify_chip and rtl8192eu_identify_chip static.
> Reported-by: kernel test robot <[email protected]>
> ---
> .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 5 +
> .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 32 +++
> .../realtek/rtl8xxxu/rtl8xxxu_8192c.c | 60 +++++
> .../realtek/rtl8xxxu/rtl8xxxu_8192e.c | 49 +++++
> .../realtek/rtl8xxxu/rtl8xxxu_8723a.c | 51 +++++
> .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 49 +++++
> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 207 +++++-------------
> 7 files changed, 297 insertions(+), 156 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> index 9f8b23160ed0..136992f0200c 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
> @@ -1470,6 +1470,7 @@ struct rtl8xxxu_tx_urb {
> };
>
> struct rtl8xxxu_fileops {
> + int (*identify_chip) (struct rtl8xxxu_priv *priv);
> int (*parse_efuse) (struct rtl8xxxu_priv *priv);
> int (*load_firmware) (struct rtl8xxxu_priv *priv);
> int (*power_on) (struct rtl8xxxu_priv *priv);
> @@ -1562,6 +1563,10 @@ int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
> int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name);
> void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv);
> void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv);
> +void rtl8xxxu_identify_vendor_1bit(struct rtl8xxxu_priv *priv, u32 vendor);
> +void rtl8xxxu_identify_vendor_2bits(struct rtl8xxxu_priv *priv, u32 vendor);
> +void rtl8xxxu_config_endpoints_sie(struct rtl8xxxu_priv *priv);
> +int rtl8xxxu_config_endpoints_no_sie(struct rtl8xxxu_priv *priv);
> int rtl8xxxu_read_efuse8(struct rtl8xxxu_priv *priv, u16 offset, u8 *data);
> void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv);
> int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv);
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> index 5eadeb02a762..4d044a8baa30 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> @@ -321,6 +321,37 @@ static const struct rtl8xxxu_rfregval rtl8188fu_cut_b_radioa_init_table[] = {
> {0xff, 0xffffffff}
> };
>
> +static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
> +{
> + struct device *dev = &priv->udev->dev;
> + u32 sys_cfg, vendor;
> + int ret = 0;
> +
> + sprintf(priv->chip_name, "8188FU");
strscpy(priv->chip_name, "8188FU", sizeof(priv->chip_name));
> + priv->rtl_chip = RTL8188F;
> + priv->rf_paths = 1;
> + priv->rx_paths = 1;
> + priv->tx_paths = 1;
> + 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 = FIELD_GET(SYS_CFG_CHIP_VERSION_MASK, sys_cfg);
Then, remove #define SYS_CFG_CHIP_VERSION_SHIFT.
> + if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
> + dev_info(dev, "Unsupported test chip\n");
> + ret = -ENOTSUPP;
> + goto out;
> + }
> +
> + vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
> + rtl8xxxu_identify_vendor_2bits(priv, vendor);
> +
> + ret = rtl8xxxu_config_endpoints_no_sie(priv);
> +
> +out:
> + return ret;
> +}
> +
> static void rtl8xxxu_8188f_channel_to_group(int channel, int *group, int *cck_group)
> {
> if (channel < 3)
> @@ -1690,6 +1721,7 @@ static s8 rtl8188f_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
> }
>
> struct rtl8xxxu_fileops rtl8188fu_fops = {
> + .identify_chip = rtl8188fu_identify_chip,
> .parse_efuse = rtl8188fu_parse_efuse,
> .load_firmware = rtl8188fu_load_firmware,
> .power_on = rtl8188fu_power_on,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
> index 9dfeeaa74927..815c1e278e4e 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c
> @@ -326,6 +326,65 @@ static const struct rtl8xxxu_rfregval rtl8188ru_radioa_1t_highpa_table[] = {
> {0xff, 0xffffffff}
> };
>
> +static int rtl8192cu_identify_chip(struct rtl8xxxu_priv *priv)
> +{
> + struct device *dev = &priv->udev->dev;
> + u32 val32, bonding, sys_cfg, vendor;
> + 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;
ditto.
> + if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
> + dev_info(dev, "Unsupported test chip\n");
> + ret = -ENOTSUPP;
> + goto out;
> + }
> +
> + if (sys_cfg & SYS_CFG_TYPE_ID) {
> + bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
> + bonding &= HPON_FSM_BONDING_MASK;
> + if (bonding == HPON_FSM_BONDING_1T2R) {
> + sprintf(priv->chip_name, "8191CU");
strscpy()
> + priv->tx_paths = 1;
> + priv->usb_interrupts = 1;
> + priv->rtl_chip = RTL8191C;
> + } else {
> + sprintf(priv->chip_name, "8192CU");
strscpy()
> + priv->tx_paths = 2;
> + priv->usb_interrupts = 0;
> + priv->rtl_chip = RTL8192C;
> + }
> + priv->rf_paths = 2;
> + priv->rx_paths = 2;
> + } else {
> + sprintf(priv->chip_name, "8188CU");
strscpy()
> + priv->rf_paths = 1;
> + priv->rx_paths = 1;
> + priv->tx_paths = 1;
> + priv->rtl_chip = RTL8188C;
> + priv->usb_interrupts = 0;
> + }
> + priv->has_wifi = 1;
> +
> + vendor = sys_cfg & SYS_CFG_VENDOR_ID;
> + 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 = FIELD_GET(GPIO_RF_RL_ID, valu32);
> +
> + rtl8xxxu_config_endpoints_sie(priv);
> +
> + /*
> + * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
> + */
> + if (!priv->ep_tx_count)
> + ret = rtl8xxxu_config_endpoints_no_sie(priv);
> +
> +out:
> + return ret;
> +}
> +
> static int rtl8192cu_load_firmware(struct rtl8xxxu_priv *priv)
> {
> char *fw_name;
> @@ -541,6 +600,7 @@ static int rtl8192cu_power_on(struct rtl8xxxu_priv *priv)
> }
>
> struct rtl8xxxu_fileops rtl8192cu_fops = {
> + .identify_chip = rtl8192cu_identify_chip,
> .parse_efuse = rtl8192cu_parse_efuse,
> .load_firmware = rtl8192cu_load_firmware,
> .power_on = rtl8192cu_power_on,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> index 973a02afc82b..7a182073832b 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
> @@ -478,6 +478,54 @@ static const struct rtl8xxxu_rfregval rtl8192eu_radiob_init_table[] = {
> {0xff, 0xffffffff}
> };
>
> +static int rtl8192eu_identify_chip(struct rtl8xxxu_priv *priv)
> +{
> + struct device *dev = &priv->udev->dev;
> + u32 val32, bonding, sys_cfg, vendor;
> + 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;
= FIELD_GET(...)
> + if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
> + dev_info(dev, "Unsupported test chip\n");
> + ret = -ENOTSUPP;
> + goto out;
> + }
> +
> + bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
> + bonding &= HPON_FSM_BONDING_MASK;
> + if (bonding == HPON_FSM_BONDING_1T2R) {
> + sprintf(priv->chip_name, "8191EU");
strscpy()
> + priv->tx_paths = 1;
> + priv->rtl_chip = RTL8191E;
> + } else {
> + sprintf(priv->chip_name, "8192EU");
strscpy()
> + priv->tx_paths = 2;
> + priv->rtl_chip = RTL8192E;
> + }
> + priv->rf_paths = 2;
> + priv->rx_paths = 2;
> + priv->has_wifi = 1;
> +
> + vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
> + rtl8xxxu_identify_vendor_2bits(priv, vendor);
> +
> + val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
> + priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
FIELD_GET()
> +
> + rtl8xxxu_config_endpoints_sie(priv);
> +
> + /*
> + * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
> + */
> + if (!priv->ep_tx_count)
> + ret = rtl8xxxu_config_endpoints_no_sie(priv);
> +
> +out:
> + return ret;
> +}
> +
> static void
> rtl8192e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
> {
> @@ -1693,6 +1741,7 @@ static s8 rtl8192e_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
> }
>
> struct rtl8xxxu_fileops rtl8192eu_fops = {
> + .identify_chip = rtl8192eu_identify_chip,
> .parse_efuse = rtl8192eu_parse_efuse,
> .load_firmware = rtl8192eu_load_firmware,
> .power_on = rtl8192eu_power_on,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> index 8d8eb16a0970..33a1114a5853 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> @@ -129,6 +129,56 @@ static const struct rtl8xxxu_rfregval rtl8723au_radioa_1t_init_table[] = {
> {0xff, 0xffffffff}
> };
>
> +static int rtl8723au_identify_chip(struct rtl8xxxu_priv *priv)
> +{
> + struct device *dev = &priv->udev->dev;
> + u32 val32, sys_cfg, vendor;
> + 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;
FIELD_GET()
> + if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
> + dev_info(dev, "Unsupported test chip\n");
> + ret = -ENOTSUPP;
> + goto out;
> + }
> +
> + sprintf(priv->chip_name, "8723AU");
strscpy()
> + priv->usb_interrupts = 1;
> + priv->rtl_chip = RTL8723A;
> +
> + priv->rf_paths = 1;
> + priv->rx_paths = 1;
> + priv->tx_paths = 1;
> +
> + val32 = rtl8xxxu_read32(priv, REG_MULTI_FUNC_CTRL);
> + if (val32 & MULTI_WIFI_FUNC_EN)
> + priv->has_wifi = 1;
> + if (val32 & MULTI_BT_FUNC_EN)
> + priv->has_bluetooth = 1;
> + if (val32 & MULTI_GPS_FUNC_EN)
> + priv->has_gps = 1;
> + priv->is_multi_func = 1;
> +
> + vendor = sys_cfg & SYS_CFG_VENDOR_ID;
> + rtl8xxxu_identify_vendor_1bit(priv, vendor);
> +
> + val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
> + priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
FIELD_GET()
> +
> + rtl8xxxu_config_endpoints_sie(priv);
> +
> + /*
> + * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
> + */
> + if (!priv->ep_tx_count)
> + ret = rtl8xxxu_config_endpoints_no_sie(priv);
> +
> +out:
> + return ret;
> +}
> +
> static int rtl8723au_parse_efuse(struct rtl8xxxu_priv *priv)
> {
> struct rtl8723au_efuse *efuse = &priv->efuse_wifi.efuse8723;
> @@ -409,6 +459,7 @@ s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
> }
>
> struct rtl8xxxu_fileops rtl8723au_fops = {
> + .identify_chip = rtl8723au_identify_chip,
> .parse_efuse = rtl8723au_parse_efuse,
> .load_firmware = rtl8723au_load_firmware,
> .power_on = rtl8723au_power_on,
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
> index 27df8805cb18..558572bdd2c8 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
> @@ -304,6 +304,54 @@ static const struct rtl8xxxu_rfregval rtl8723bu_radioa_1t_init_table[] = {
> {0xff, 0xffffffff}
> };
>
> +static int rtl8723bu_identify_chip(struct rtl8xxxu_priv *priv)
> +{
> + struct device *dev = &priv->udev->dev;
> + u32 val32, sys_cfg, vendor;
> + 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;
FIELD_GET()
> + if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
> + dev_info(dev, "Unsupported test chip\n");
> + ret = -ENOTSUPP;
> + goto out;
> + }
> +
> + sprintf(priv->chip_name, "8723BU");
strscpy()
> + priv->rtl_chip = RTL8723B;
> + priv->rf_paths = 1;
> + priv->rx_paths = 1;
> + priv->tx_paths = 1;
> +
> + val32 = rtl8xxxu_read32(priv, REG_MULTI_FUNC_CTRL);
> + if (val32 & MULTI_WIFI_FUNC_EN)
> + priv->has_wifi = 1;
> + if (val32 & MULTI_BT_FUNC_EN)
> + priv->has_bluetooth = 1;
> + if (val32 & MULTI_GPS_FUNC_EN)
> + priv->has_gps = 1;
> + priv->is_multi_func = 1;
> +
> + vendor = sys_cfg & SYS_CFG_VENDOR_EXT_MASK;
> + rtl8xxxu_identify_vendor_2bits(priv, vendor);
> +
> + val32 = rtl8xxxu_read32(priv, REG_GPIO_OUTSTS);
> + priv->rom_rev = (val32 & GPIO_RF_RL_ID) >> 28;
FIELD_GET()
> +
> + rtl8xxxu_config_endpoints_sie(priv);
> +
> + /*
> + * Fallback for devices that do not provide REG_NORMAL_SIE_EP_TX
> + */
> + if (!priv->ep_tx_count)
> + ret = rtl8xxxu_config_endpoints_no_sie(priv);
> +
> +out:
> + return ret;
> +}
> +
> static void rtl8723bu_write_btreg(struct rtl8xxxu_priv *priv, u8 reg, u8 data)
> {
> struct h2c_cmd h2c;
> @@ -1668,6 +1716,7 @@ static s8 rtl8723b_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
> }
>
> struct rtl8xxxu_fileops rtl8723bu_fops = {
> + .identify_chip = rtl8723bu_identify_chip,
> .parse_efuse = rtl8723bu_parse_efuse,
> .load_firmware = rtl8723bu_load_firmware,
> .power_on = rtl8723bu_power_on,
[..]
Only some similar comments about FIELD_GET() and strscpy().
Ping-Ke
On 07/11/2022 04:40, Ping-Ke Shih wrote:
>
>
>> -----Original Message-----
>> From: Bitterblue Smith <[email protected]>
>> Sent: Sunday, November 6, 2022 6:53 AM
>> To: [email protected]
>> Cc: Jes Sorensen <[email protected]>
>> Subject: [PATCH v2 1/3] wifi: rtl8xxxu: Move burst init to a function
>>
>> No changes to functionality, just moving code to make
>> rtl8xxxu_init_device look nicer.
>>
>> Signed-off-by: Bitterblue Smith <[email protected]>
>> ---
>> v2:
>> - No change.
>> ---
>> .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +
>> .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
>> .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 +
>> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 89 ++++++++++---------
>> 4 files changed, 52 insertions(+), 41 deletions(-)
>>
>
> [...]
>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index 019f8ddd418b..282ad8a9b73d 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -3886,6 +3886,52 @@ static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
>> rtl8xxxu_write32(priv, REG_RQPN, val32);
>> }
>>
>> +void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv)
>> +{
>> + u8 val8;
>> +
>> + /*
>> + * For USB high speed set 512B packets
>> + */
>> + val8 = rtl8xxxu_read8(priv, REG_RXDMA_PRO_8723B);
>> + val8 &= ~(BIT(4) | BIT(5));
>> + val8 |= BIT(4);
>> + val8 |= BIT(1) | BIT(2) | BIT(3);
>
> I think we can fix these magic numbers along with your patch.
>
> #define DMA_MODE BIT(1) // set 0x1
> #define DMA_BURST_CNT GENMASK(3, 2) // set 0x3
> #define DMA_BURST_SIZE GENMASK(5, 4) // set 0x1
>
Thanks, but I think the bit definitions should be added in a separate patch,
which I will send soon. Same for the changes you suggested for patch 2/3.
On 11/5/22 18:54, Bitterblue Smith wrote:
> This name is an anomaly. Change it to rtl8188f_channel_to_group to
> follow the same pattern as the other functions.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
> ---
> v2:
> - No change.
> ---
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Jes Sorensen <[email protected]>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> index 4d044a8baa30..0f77312dd0ca 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c
> @@ -352,7 +352,7 @@ static int rtl8188fu_identify_chip(struct rtl8xxxu_priv *priv)
> return ret;
> }
>
> -static void rtl8xxxu_8188f_channel_to_group(int channel, int *group, int *cck_group)
> +static void rtl8188f_channel_to_group(int channel, int *group, int *cck_group)
> {
> if (channel < 3)
> *group = 0;
> @@ -378,7 +378,7 @@ rtl8188f_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
> u8 cck, ofdmbase, mcsbase;
> int group, cck_group;
>
> - rtl8xxxu_8188f_channel_to_group(channel, &group, &cck_group);
> + rtl8188f_channel_to_group(channel, &group, &cck_group);
>
> cck = priv->cck_tx_power_index_A[cck_group];
>
On 11/6/22 21:40, Ping-Ke Shih wrote:
>
>
>> -----Original Message-----
>> From: Bitterblue Smith <[email protected]>
>> Sent: Sunday, November 6, 2022 6:53 AM
>> To: [email protected]
>> Cc: Jes Sorensen <[email protected]>
>> Subject: [PATCH v2 1/3] wifi: rtl8xxxu: Move burst init to a function
>>
>> No changes to functionality, just moving code to make
>> rtl8xxxu_init_device look nicer.
>>
>> Signed-off-by: Bitterblue Smith <[email protected]>
>> ---
>> v2:
>> - No change.
>> ---
>> .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +
>> .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 +
>> .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 +
>> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 89 ++++++++++---------
>> 4 files changed, 52 insertions(+), 41 deletions(-)
>>
>
> [...]
>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index 019f8ddd418b..282ad8a9b73d 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -3886,6 +3886,52 @@ static void rtl8xxxu_init_queue_reserved_page(struct rtl8xxxu_priv *priv)
>> rtl8xxxu_write32(priv, REG_RQPN, val32);
>> }
>>
>> +void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv)
>> +{
>> + u8 val8;
>> +
>> + /*
>> + * For USB high speed set 512B packets
>> + */
>> + val8 = rtl8xxxu_read8(priv, REG_RXDMA_PRO_8723B);
>> + val8 &= ~(BIT(4) | BIT(5));
>> + val8 |= BIT(4);
>> + val8 |= BIT(1) | BIT(2) | BIT(3);
>
> I think we can fix these magic numbers along with your patch.
>
> #define DMA_MODE BIT(1) // set 0x1
> #define DMA_BURST_CNT GENMASK(3, 2) // set 0x3
> #define DMA_BURST_SIZE GENMASK(5, 4) // set 0x1
Thanks for providing these definitions.
Jes
Bitterblue Smith <[email protected]> wrote:
> No changes to functionality, just moving code to make
> rtl8xxxu_init_device look nicer.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
3 patches applied to wireless-next.git, thanks.
bcfcb712e414 wifi: rtl8xxxu: Move burst init to a function
14566bbfdfaf wifi: rtl8xxxu: Split up rtl8xxxu_identify_chip
e948023d5fc8 wifi: rtl8xxxu: Rename rtl8xxxu_8188f_channel_to_group
--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches