Commit 3ca7b32c authored by Jes Sorensen's avatar Jes Sorensen Committed by Kalle Valo

rtl8xxxu: Improve 8723bu init code

Implement additional init sequence code for the 8723bu.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 368633ce
...@@ -2984,6 +2984,9 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv) ...@@ -2984,6 +2984,9 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
* addresses, which is initialized here. Do we need this? * addresses, which is initialized here. Do we need this?
*/ */
if (priv->rtlchip == 0x8723b) {
rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00);
} else {
val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL); val8 = rtl8xxxu_read8(priv, REG_AFE_PLL_CTRL);
udelay(2); udelay(2);
val8 |= AFE_PLL_320_ENABLE; val8 |= AFE_PLL_320_ENABLE;
...@@ -2992,6 +2995,7 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv) ...@@ -2992,6 +2995,7 @@ static int rtl8xxxu_init_phy_bb(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff); rtl8xxxu_write8(priv, REG_AFE_PLL_CTRL + 1, 0xff);
udelay(2); udelay(2);
}
val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC);
val8 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB; val8 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB;
...@@ -5603,6 +5607,21 @@ static void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv) ...@@ -5603,6 +5607,21 @@ static void rtl8xxxu_power_off(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x0e); 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) static void rtl8723bu_init_bt(struct rtl8xxxu_priv *priv)
{ {
struct h2c_cmd h2c; struct h2c_cmd h2c;
...@@ -5683,7 +5702,17 @@ static void rtl8723bu_init_bt(struct rtl8xxxu_priv *priv) ...@@ -5683,7 +5702,17 @@ static void rtl8723bu_init_bt(struct rtl8xxxu_priv *priv)
/* /*
* 0x280, 0x00, 0x200, 0x80 - not clear * 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) static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
......
...@@ -740,6 +740,14 @@ struct h2c_cmd { ...@@ -740,6 +740,14 @@ struct h2c_cmd {
u8 arg; u8 arg;
__le16 mask_lo; __le16 mask_lo;
} __packed ramask; } __packed ramask;
struct {
u8 cmd;
u8 data1;
u8 data2;
u8 data3;
u8 data4;
u8 data5;
} __packed b_type_dma;
struct { struct {
u8 cmd; u8 cmd;
u8 data; u8 data;
......
...@@ -709,7 +709,10 @@ ...@@ -709,7 +709,10 @@
#define REG_BCN_PSR_RPT 0x06a8 #define REG_BCN_PSR_RPT 0x06a8
#define REG_CALB32K_CTRL 0x06ac #define REG_CALB32K_CTRL 0x06ac
#define REG_PKT_MON_CTRL 0x06b4 #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_WMAC_RESP_TXINFO 0x06d8
#define REG_MACID1 0x0700 #define REG_MACID1 0x0700
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment