rtl8xxxu: Improve 8723bu init code
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 29 Feb 2016 22:04:43 +0000 (17:04 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 10 Mar 2016 13:29:03 +0000 (15:29 +0200)
Implement additional init sequence code for the 8723bu.

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
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h

index 70543942e8d4b630d2722e60091d16ca30b9a603..91f189a8505765c5bd1a78ef04814162076a6265 100644 (file)
@@ -2984,14 +2984,18 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
         *       addresses, which is initialized here. Do we need this?
         */
 
-       val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
-       udelay(2);
-       val8 |= AFE_PLL_320_ENABLE;
-       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
-       udelay(2);
+       if (priv->rtlchip == 0x8723b) {
+               rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00);
+       } else {
+               val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
+               udelay(2);
+               val8 |= AFE_PLL_320_ENABLE;
+               rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL, val8);
+               udelay(2);
 
-       rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff);
-       udelay(2);
+               rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff);
+               udelay(2);
+       }
 
        val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC);
        val8 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB;
@@ -5603,6 +5607,21 @@ static void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x0e);
 }
 
+static void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
+                                 u8 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5)
+{
+       struct h2c_cmd h2c;
+
+       memset(&h2c, 0, sizeof(struct h2c_cmd));
+       h2c.b_type_dma.cmd = H2C_8723B_B_TYPE_TDMA;
+       h2c.b_type_dma.data1 = arg1;
+       h2c.b_type_dma.data2 = arg2;
+       h2c.b_type_dma.data3 = arg3;
+       h2c.b_type_dma.data4 = arg4;
+       h2c.b_type_dma.data5 = arg5;
+       rtl8723a_h2c_cmd(priv, &h2c, sizeof(h2c.b_type_dma));
+}
+
 static void rtl8723bu_init_bt(struct rtl8xxxu_priv *priv)
 {
        struct h2c_cmd h2c;
@@ -5683,7 +5702,17 @@ static void rtl8723bu_init_bt(struct rtl8xxxu_priv *priv)
        /*
         * 0x280, 0x00, 0x200, 0x80 - not clear
         */
-       rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x280);
+       rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00);
+
+       /*
+        * Software control, antenna at WiFi side
+        */
+       rtl8723bu_set_ps_tdma(priv, 0x00, 0x00, 0x00, 0x00, 0x00);
+
+       rtl8xxxu_write32(priv, REG_BT_COEX_TABLE1, 0x55555555);
+       rtl8xxxu_write32(priv, REG_BT_COEX_TABLE2, 0x5a5a5a5a);
+       rtl8xxxu_write32(priv, REG_BT_COEX_TABLE3, 0x00ffffff);
+       rtl8xxxu_write32(priv, REG_BT_COEX_TABLE4, 0x00000003);
 }
 
 static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
index bcbdc78e9de6aa1c2dc1dd7b70066a40eadb819e..c4c0b287127bf205a8db51e95507b5463a6083a5 100644 (file)
@@ -740,6 +740,14 @@ struct h2c_cmd {
                        u8 arg;
                        __le16 mask_lo;
                } __packed ramask;
+               struct {
+                       u8 cmd;
+                       u8 data1;
+                       u8 data2;
+                       u8 data3;
+                       u8 data4;
+                       u8 data5;
+               } __packed b_type_dma;
                struct {
                        u8 cmd;
                        u8 data;
index 248f64c7f8e3488f1c4c9e0d238306dfd67878d1..a82c0ba7931df9b131d6bec8e56110bea1cde923 100644 (file)
 #define REG_BCN_PSR_RPT                        0x06a8
 #define REG_CALB32K_CTRL               0x06ac
 #define REG_PKT_MON_CTRL               0x06b4
-#define REG_BT_COEX_TABLE              0x06c0
+#define REG_BT_COEX_TABLE1             0x06c0
+#define REG_BT_COEX_TABLE2             0x06c4
+#define REG_BT_COEX_TABLE3             0x06c8
+#define REG_BT_COEX_TABLE4             0x06cc
 #define REG_WMAC_RESP_TXINFO           0x06d8
 
 #define REG_MACID1                     0x0700
This page took 0.040945 seconds and 5 git commands to generate.