1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2014 Realtek Corporation.*/
11 static bool _rtl92ee_phy_rf6052_config_parafile(struct ieee80211_hw
*hw
);
13 void rtl92ee_phy_rf6052_set_bandwidth(struct ieee80211_hw
*hw
, u8 bandwidth
)
15 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
16 struct rtl_phy
*rtlphy
= &rtlpriv
->phy
;
19 case HT_CHANNEL_WIDTH_20
:
20 rtlphy
->rfreg_chnlval
[0] = ((rtlphy
->rfreg_chnlval
[0] &
21 0xfffff3ff) | BIT(10) | BIT(11));
22 rtl_set_rfreg(hw
, RF90_PATH_A
, RF_CHNLBW
, RFREG_OFFSET_MASK
,
23 rtlphy
->rfreg_chnlval
[0]);
24 rtl_set_rfreg(hw
, RF90_PATH_B
, RF_CHNLBW
, RFREG_OFFSET_MASK
,
25 rtlphy
->rfreg_chnlval
[0]);
27 case HT_CHANNEL_WIDTH_20_40
:
28 rtlphy
->rfreg_chnlval
[0] = ((rtlphy
->rfreg_chnlval
[0] &
29 0xfffff3ff) | BIT(10));
30 rtl_set_rfreg(hw
, RF90_PATH_A
, RF_CHNLBW
, RFREG_OFFSET_MASK
,
31 rtlphy
->rfreg_chnlval
[0]);
32 rtl_set_rfreg(hw
, RF90_PATH_B
, RF_CHNLBW
, RFREG_OFFSET_MASK
,
33 rtlphy
->rfreg_chnlval
[0]);
36 pr_err("unknown bandwidth: %#X\n", bandwidth
);
41 bool rtl92ee_phy_rf6052_config(struct ieee80211_hw
*hw
)
43 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
44 struct rtl_phy
*rtlphy
= &rtlpriv
->phy
;
46 if (rtlphy
->rf_type
== RF_1T1R
)
47 rtlphy
->num_total_rfpath
= 1;
49 rtlphy
->num_total_rfpath
= 2;
51 return _rtl92ee_phy_rf6052_config_parafile(hw
);
54 static bool _rtl92ee_phy_rf6052_config_parafile(struct ieee80211_hw
*hw
)
56 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
57 struct rtl_phy
*rtlphy
= &rtlpriv
->phy
;
61 struct bb_reg_def
*pphyreg
;
63 for (rfpath
= 0; rfpath
< rtlphy
->num_total_rfpath
; rfpath
++) {
64 pphyreg
= &rtlphy
->phyreg_def
[rfpath
];
69 u4_regvalue
= rtl_get_bbreg(hw
, pphyreg
->rfintfs
,
74 u4_regvalue
= rtl_get_bbreg(hw
, pphyreg
->rfintfs
,
79 rtl_set_bbreg(hw
, pphyreg
->rfintfe
, BRFSI_RFENV
<< 16, 0x1);
82 rtl_set_bbreg(hw
, pphyreg
->rfintfo
, BRFSI_RFENV
, 0x1);
85 rtl_set_bbreg(hw
, pphyreg
->rfhssi_para2
,
86 B3WIREADDREAALENGTH
, 0x0);
89 rtl_set_bbreg(hw
, pphyreg
->rfhssi_para2
, B3WIREDATALENGTH
, 0x0);
94 rtstatus
= rtl92ee_phy_config_rf_with_headerfile(hw
,
95 (enum radio_path
)rfpath
);
98 rtstatus
= rtl92ee_phy_config_rf_with_headerfile(hw
,
99 (enum radio_path
)rfpath
);
110 rtl_set_bbreg(hw
, pphyreg
->rfintfs
,
111 BRFSI_RFENV
, u4_regvalue
);
115 rtl_set_bbreg(hw
, pphyreg
->rfintfs
,
116 BRFSI_RFENV
<< 16, u4_regvalue
);
121 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
122 "Radio[%d] Fail!!\n", rfpath
);
127 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
, "\n");