net: wireless: rockchip_wlan: add rtl8723cs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / hal / btc / halbtc8723bwifionly.c
1 #include "mp_precomp.h"
2
3
4 VOID
5 ex_hal8723b_wifi_only_hw_config(
6         IN struct wifi_only_cfg *pwifionlycfg
7         )
8 {
9         struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
10
11
12         halwifionly_write1byte(pwifionlycfg, 0x778, 0x3); /* Set pta for wifi first priority, 0x1 need to reference pta table to determine wifi and bt priority */
13         halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x40, 0x20, 0x1);
14
15         /* Set Antenna path to Wifi */
16         halwifionly_write2byte(pwifionlycfg, 0x0765, 0x8); /* Set pta for wifi first priority, 0x0 need to reference pta table to determine wifi and bt priority */
17         halwifionly_write2byte(pwifionlycfg, 0x076e, 0xc);
18
19         halwifionly_write4byte(pwifionlycfg, 0x000006c0, 0xaaaaaaaa); /* pta table, 0xaaaaaaaa means wifi is higher priority than bt */
20         halwifionly_write4byte(pwifionlycfg, 0x000006c4, 0xaaaaaaaa);
21
22         halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
23
24         /* 0x948 setting */
25         if (pwifionlycfg->chip_interface == WIFIONLY_INTF_PCI) {
26                 /* HP Foxconn NGFF at S0
27                  not sure HP pg correct or not(EEPROMBluetoothSingleAntPath), so here we just write
28                  0x948=0x280 for HP HW id NIC. */
29                 if (pwifionly_haldata->customer_id == CUSTOMER_HP_1) {
30                         halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
31                         halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */
32                         return;
33                 }
34         }
35
36         if (pwifionly_haldata->efuse_pg_antnum == 2) {
37                 halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
38         } else {
39         /* 3Attention !!! For 8723BU  !!!!
40          For 8723BU single ant case: jira [USB-1237]
41                    Because of 8723BU S1 has HW problem, we only can use S0 instead.
42                    Whether Efuse 0xc3 [6] is 0 or 1, we should always use S0 and write 0x948 to 80/280
43
44          --------------------------------------------------
45          BT Team :
46                   When in Single Ant case, Reg[0x948] has two case : 0x80 or 0x200
47                  When in Two Ant case, Reg[0x948] has two case : 0x280 or 0x0
48                   Efuse 0xc3 [6] Antenna Path
49                   0xc3 [6] = 0   ==>  S1         ==>   0x948 = 0/40/200
50                   0xc3 [6] = 1   ==>  S0         ==>   0x948 = 80/240/280 */
51
52                 if (pwifionlycfg->chip_interface == WIFIONLY_INTF_USB)
53                         halwifionly_write4byte(pwifionlycfg, 0x948, 0x80);
54                 else {
55                         if (pwifionly_haldata->efuse_pg_antpath == 0)
56                                 halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
57                         else
58                                 halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
59                 }
60
61         }
62
63
64         /* after 8723B F-cut, TRx Mask should be set when 0x948=0x0 or 0x280
65         PHY_SetRFReg(Adapter, 0, 0x1, 0xfffff, 0x780); WiFi TRx Mask on */
66         halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /*WiFi TRx Mask off */
67
68 }