rtlwifi: btcoex: 21a 2ant: settings before wifi firmware is ready
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Thu, 11 May 2017 19:01:13 +0000 (14:01 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 18 May 2017 14:07:29 +0000 (17:07 +0300)
Before firmware is ready, set GNT_BT to high to let bt transmit.

Routine ex_btc8821a2ant_pre_load_firmware() restored.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c

index 162d40ddf06daea8c2236e05c11927bf90e943a6..9aa140a46d46f72527a7d388d0f24d22e7a7d909 100644 (file)
@@ -3609,6 +3609,43 @@ void ex_btc8821a2ant_init_hwconfig(struct btc_coexist *btcoexist)
        btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
 }
 
+void ex_btc8821a2ant_pre_load_firmware(struct btc_coexist *btcoexist)
+{
+       struct btc_board_info *board_info = &btcoexist->board_info;
+       u8 u8tmp = 0x4; /* Set BIT2 by default since it's 2ant case */
+
+       /**
+        * S0 or S1 setting and Local register setting(By the setting fw can get
+        * ant number, S0/S1, ... info)
+        *
+        * Local setting bit define
+        *      BIT0: "0" for no antenna inverse; "1" for antenna inverse
+        *      BIT1: "0" for internal switch; "1" for external switch
+        *      BIT2: "0" for one antenna; "1" for two antenna
+        * NOTE: here default all internal switch and 1-antenna ==> BIT1=0 and
+        * BIT2=0
+        */
+       if (btcoexist->chip_interface == BTC_INTF_USB) {
+               /* fixed at S0 for USB interface */
+               u8tmp |= 0x1; /* antenna inverse */
+               btcoexist->btc_write_local_reg_1byte(btcoexist, 0xfe08, u8tmp);
+       } else {
+               /* for PCIE and SDIO interface, we check efuse 0xc3[6] */
+               if (board_info->single_ant_path == 0) {
+               } else if (board_info->single_ant_path == 1) {
+                       /* set to S0 */
+                       u8tmp |= 0x1; /* antenna inverse */
+               }
+
+               if (btcoexist->chip_interface == BTC_INTF_PCI)
+                       btcoexist->btc_write_local_reg_1byte(btcoexist, 0x384,
+                                                            u8tmp);
+               else if (btcoexist->chip_interface == BTC_INTF_SDIO)
+                       btcoexist->btc_write_local_reg_1byte(btcoexist, 0x60,
+                                                            u8tmp);
+       }
+}
+
 void ex_btc8821a2ant_init_coex_dm(struct btc_coexist *btcoexist)
 {
        struct rtl_priv *rtlpriv = btcoexist->adapter;