xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8822bs/hal/btc/halbtc8822bwifionly.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2016 - 2017 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #include "mp_precomp.h"
16 
17 
18 VOID
ex_hal8822b_wifi_only_hw_config(IN struct wifi_only_cfg * pwifionlycfg)19 ex_hal8822b_wifi_only_hw_config(
20 	IN struct wifi_only_cfg  *pwifionlycfg
21 	)
22 {
23 	/*BB control*/
24 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x4c, 0x01800000, 0x2);
25 	/*SW control*/
26 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcb4, 0xff, 0x77);
27 	/*antenna mux switch */
28 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x974, 0x300, 0x3);
29 
30 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1990, 0x300, 0x0);
31 
32 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x80000, 0x0);
33 	/*switch to WL side controller and gnt_wl gnt_bt debug signal */
34 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x70, 0xff000000, 0x0e);
35 	/*gnt_wl=1 , gnt_bt=0*/
36 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1704, 0xffffffff, 0x7700);
37 	halwifionly_phy_set_bb_reg(pwifionlycfg, 0x1700, 0xffffffff, 0xc00f0038);
38 }
39 
40 VOID
ex_hal8822b_wifi_only_scannotify(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)41 ex_hal8822b_wifi_only_scannotify(
42 	IN struct wifi_only_cfg *pwifionlycfg,
43 	IN u1Byte  is_5g
44 	)
45 {
46 	hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
47 }
48 
49 VOID
ex_hal8822b_wifi_only_switchbandnotify(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)50 ex_hal8822b_wifi_only_switchbandnotify(
51 	IN struct wifi_only_cfg *pwifionlycfg,
52 	IN u1Byte  is_5g
53 	)
54 {
55 	hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
56 }
57 
58 VOID
ex_hal8822b_wifi_only_connectnotify(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)59 ex_hal8822b_wifi_only_connectnotify(
60 	IN struct wifi_only_cfg *pwifionlycfg,
61 	IN u1Byte  is_5g
62 	)
63 {
64 	hal8822b_wifi_only_switch_antenna(pwifionlycfg, is_5g);
65 }
66 
67 
68 VOID
hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg * pwifionlycfg,IN u1Byte is_5g)69 hal8822b_wifi_only_switch_antenna(IN struct wifi_only_cfg *pwifionlycfg,
70 	IN u1Byte  is_5g
71 	)
72 {
73 
74 	if (is_5g)
75 		halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x1);
76 	else
77 		halwifionly_phy_set_bb_reg(pwifionlycfg, 0xcbc, 0x300, 0x2);
78 }
79