hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2016 - 2017 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
#include "mp_precomp.h"
 
 
VOID
ex_hal8723b_wifi_only_hw_config(
   IN struct wifi_only_cfg *pwifionlycfg
   )
{
   struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
 
 
   halwifionly_write1byte(pwifionlycfg, 0x778, 0x3); /* Set pta for wifi first priority, 0x1 need to reference pta table to determine wifi and bt priority */
   halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x40, 0x20, 0x1);
 
   /* Set Antenna path to Wifi */
   halwifionly_write2byte(pwifionlycfg, 0x0765, 0x8); /* Set pta for wifi first priority, 0x0 need to reference pta table to determine wifi and bt priority */
   halwifionly_write2byte(pwifionlycfg, 0x076e, 0xc);
 
   halwifionly_write4byte(pwifionlycfg, 0x000006c0, 0xaaaaaaaa); /* pta table, 0xaaaaaaaa means wifi is higher priority than bt */
   halwifionly_write4byte(pwifionlycfg, 0x000006c4, 0xaaaaaaaa);
 
   halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
 
   /* 0x948 setting */
   if (pwifionlycfg->chip_interface == WIFIONLY_INTF_PCI) {
       /* HP Foxconn NGFF at S0
        not sure HP pg correct or not(EEPROMBluetoothSingleAntPath), so here we just write
        0x948=0x280 for HP HW id NIC. */
       if (pwifionly_haldata->customer_id == CUSTOMER_HP_1) {
           halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
           halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */
           return;
       }
   }
 
   if (pwifionly_haldata->efuse_pg_antnum == 2) {
       halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
   } else {
   /* 3Attention !!! For 8723BU  !!!!
    For 8723BU single ant case: jira [USB-1237]
          Because of 8723BU S1 has HW problem, we only can use S0 instead.
          Whether Efuse 0xc3 [6] is 0 or 1, we should always use S0 and write 0x948 to 80/280
 
    --------------------------------------------------
    BT Team :
         When in Single Ant case, Reg[0x948] has two case : 0x80 or 0x200
        When in Two Ant case, Reg[0x948] has two case : 0x280 or 0x0
         Efuse 0xc3 [6] Antenna Path
         0xc3 [6] = 0     ==>  S1     ==>   0x948 = 0/40/200
         0xc3 [6] = 1     ==>  S0     ==>   0x948 = 80/240/280 */
 
       if (pwifionlycfg->chip_interface == WIFIONLY_INTF_USB)
           halwifionly_write4byte(pwifionlycfg, 0x948, 0x80);
       else {
           if (pwifionly_haldata->efuse_pg_antpath == 0)
               halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
           else
               halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
       }
 
   }
 
 
   /* after 8723B F-cut, TRx Mask should be set when 0x948=0x0 or 0x280
   PHY_SetRFReg(Adapter, 0, 0x1, 0xfffff, 0x780); WiFi TRx Mask on */
   halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /*WiFi TRx Mask off */
 
}