rtl8xxxu: Handle XTAL_K value in efuse specific location
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 29 Feb 2016 22:04:55 +0000 (17:04 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 10 Mar 2016 13:29:06 +0000 (15:29 +0200)
Retrieve the XTAL_K value in the parse_efuse() functions as it's
location various on a per device basis. For parts that do not provide
an XTAL_K value, skip setting it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h

index e879fe28a99bf5a908172dd6207bbf6b2f2a409e..7f69a1b6980de1b51abcc061804b826fd1426cf5 100644 (file)
@@ -2314,6 +2314,10 @@ static int rtl8723au_parse_efuse(struct rtl8xxxu_priv *priv)
               efuse->ht20_max_power_offset,
               sizeof(priv->ht20_max_power_offset));
 
+       if (priv->efuse_wifi.efuse8723.version >= 0x01) {
+               priv->has_xtalk = 1;
+               priv->xtalk = priv->efuse_wifi.efuse8723.xtal_k & 0x3f;
+       }
        dev_info(&priv->udev->dev, "Vendor: %.7s\n",
                 efuse->vendor_name);
        dev_info(&priv->udev->dev, "Product: %.41s\n",
@@ -2340,6 +2344,9 @@ static int rtl8723bu_parse_efuse(struct rtl8xxxu_priv *priv)
        memcpy(priv->ht40_1s_tx_power_index_B, efuse->ht40_1s_tx_power_index_B,
               sizeof(priv->ht40_1s_tx_power_index_B));
 
+       priv->has_xtalk = 1;
+       priv->xtalk = priv->efuse_wifi.efuse8723bu.xtal_k & 0x3f;
+
        dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name);
        dev_info(&priv->udev->dev, "Product: %.41s\n", efuse->device_name);
 
@@ -2444,6 +2451,9 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv)
 
        ether_addr_copy(priv->mac_addr, efuse->mac_addr);
 
+       priv->has_xtalk = 1;
+       priv->xtalk = priv->efuse_wifi.efuse8192eu.xtal_k & 0x3f;
+
        dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name);
        dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name);
        dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial);
@@ -3122,11 +3132,10 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
        else
                rtl8xxxu_init_phy_regs(priv, rtl8xxx_agc_standard_table);
 
-       if ((priv->rtlchip == 0x8723a || priv->rtlchip == 0x8723b) &&
-           priv->efuse_wifi.efuse8723.version >= 0x01) {
+       if (priv->has_xtalk) {
                val32 = rtl8xxxu_read32(priv, REG_MAC_PHY_CTRL);
 
-               val8 = priv->efuse_wifi.efuse8723.xtal_k & 0x3f;
+               val8 = priv->xtalk;
                val32 &= 0xff000fff;
                val32 |= ((val8 | (val8 << 6)) << 12);
 
index ea0b28a9a519a8451e81ddd51d37a821dd031f71..2250e1b17d6056cdabab27d80014ecd54a45cc5b 100644 (file)
@@ -1063,6 +1063,8 @@ struct rtl8xxxu_priv {
        u32 ep_tx_high_queue:1;
        u32 ep_tx_normal_queue:1;
        u32 ep_tx_low_queue:1;
+       u32 has_xtalk:1;
+       u8 xtalk;
        unsigned int pipe_interrupt;
        unsigned int pipe_in;
        unsigned int pipe_out[TXDESC_QUEUE_MAX];