/******************************************************************************
*
* Copyright(c) 2009-2010 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.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#include "../wifi.h"
#include "../pci.h"
#include "../ps.h"
#include "reg.h"
#include "def.h"
#include "phy.h"
#include "rf.h"
#include "dm.h"
#include "table.h"
#include "trx.h"
#include "../btcoexist/halbt_precomp.h"
#include "hw.h"
#include "../efuse.h"
#define READ_NEXT_PAIR(array_table, v1, v2, i) \
do { \
i += 2; \
v1 = array_table[i]; \
v2 = array_table[i+1]; \
} while (0)
static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 offset);
static void _rtl8821ae_phy_rf_serial_write(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 offset,
u32 data);
static u32 _rtl8821ae_phy_calculate_bit_shift(u32 bitmask);
static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw);
/*static bool _rtl8812ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);*/
static bool _rtl8821ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
static bool _rtl8821ae_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
u8 configtype);
static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
u8 configtype);
static void phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
static long _rtl8821ae_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
enum wireless_mode wirelessmode,
u8 txpwridx);
static void rtl8821ae_phy_set_rf_on(struct ieee80211_hw *hw);
static void rtl8821ae_phy_set_io(struct ieee80211_hw *hw);
static void rtl8812ae_fixspur(struct ieee80211_hw *hw,
enum ht_channel_width band_width, u8 channel)
{
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
/*C cut Item12 ADC FIFO CLOCK*/
if (IS_VENDOR_8812A_C_CUT(rtlhal->version)) {
if (band_width == HT_CHANNEL_WIDTH_20_40 && channel == 11)
rtl_set_bbreg(hw, RRFMOD, 0xC00, 0x3);
/* 0x8AC[11:10] = 2'b11*/
else
rtl_set_bbreg(hw, RRFMOD, 0xC00, 0x2);
/* 0x8AC[11:10] = 2'b10*/
/* <20120914, Kordan> A workarould to resolve
* 2480Mhz spur by setting ADC clock as 160M. (Asked by Binson)
*/
if (band_width == HT_CHANNEL_WIDTH_20 &&
(channel == 13 || channel == 14)) {
rtl_set_bbreg(hw, RRFMOD, 0x300, 0x3);
/*0x8AC[9:8] = 2'b11*/
rtl_set_bbreg(hw, RADC_BUF_CLK, BIT(30), 1);
/* 0x8C4[30] = 1*/
} else if (band_width == HT_CHANNEL_WIDTH_20_40 &&
channel == 11) {
rtl_set_bbreg(hw, RADC_BUF_CLK, BIT(30), 1);
/*0x8C4[30] = 1*/
} else if (band_width != HT_CHANNEL_WIDTH_80) {
rtl_set_bbreg(hw, RRFMOD, 0x300, 0x2);
/*0x8AC[9:8] = 2'b10*/
rtl_set_bbreg(hw, RADC_BUF_CLK, BIT(30), 0);
/*0x8C4[30] = 0*/
}
} else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
/* <20120914, Kordan> A workarould to resolve
* 2480Mhz spur by setting ADC clock as 160M.
*/
if (band_width == HT_CHANNEL_WIDTH_20 &&
(channel == 13 || channel == 14))
rtl_set_bbreg(hw, RRFMOD, 0x300, 0x3);
/*0x8AC[9:8] = 11*/
else if (channel <= 14) /*2.4G only*/
rtl_set_bbreg(hw, RRFMOD, 0x300, 0x2);
/*0x8AC[9:8] = 10*/
}
}
u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
u32 bitmask)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 returnvalue, originalvalue, bitshift;
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), bitmask(%#x)\n",
regaddr, bitmask);
originalvalue = rtl_read_dword(rtlpriv, regaddr);
bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
returnvalue = (originalvalue & bitmask) >> bitshift;
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"BBR MASK=0x%x Addr[0x%x]=0x%x\n",
bitmask, regaddr, originalvalue);
return returnvalue;
}
void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw,
u32 regaddr, u32 bitmask, u32 data)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 originalvalue, bitshift;
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), bitmask(%#x), data(%#x)\n",
regaddr, bitmask, data);
if (bitmask != MASKDWORD) {
originalvalue = rtl_read_dword(rtlpriv, regaddr);
bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
data = ((originalvalue & (~bitmask)) |
((data << bitshift) & bitmask));
}
rtl_write_dword(rtlpriv, regaddr, data);
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), bitmask(%#x), data(%#x)\n",
regaddr, bitmask, data);
}
u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 regaddr,
u32 bitmask)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 original_value, readback_value, bitshift;
unsigned long flags;
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
regaddr, rfpath, bitmask);
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
original_value = _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr);
bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
readback_value = (original_value & bitmask) >> bitshift;
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
regaddr, rfpath, bitmask, original_value);
return readback_value;
}
void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw,
enum radio_path rfpath,
u32 regaddr, u32 bitmask, u32 data)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 original_value, bitshift;
unsigned long flags;
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
regaddr, bitmask, data, rfpath);
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
if (bitmask != RFREG_OFFSET_MASK) {
original_value =
_rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr);
bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
data = ((original_value & (~bitmask)) | (data << bitshift));
}
_rtl8821ae_phy_rf_serial_write(hw, rfpath, regaddr, data);
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
regaddr, bitmask, data, rfpath);
}
static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 offset)
{
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
bool is_pi_mode = false;
u32 retvalue = 0;
/* 2009/06/17 MH We can not execute IO for power
save or other accident mode.*/
if (RT_CANNOT_IO(hw)) {
pr_err("return all one\n");
return 0xFFFFFFFF;
}
/* <20120809, Kordan> CCA OFF(when entering),
asked by James to avoid reading the wrong value.
<20120828, Kordan> Toggling CCA would affect RF 0x0, skip it!*/
if (offset != 0x0 &&
!((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) ||
(IS_VENDOR_8812A_C_CUT(rtlhal->version))))
rtl_set_bbreg(hw, RCCAONSEC, 0x8, 1);
offset &= 0xff;
if (rfpath == RF90_PATH_A)
is_pi_mode = (bool)rtl_get_bbreg(hw, 0xC00, 0x4);
else if (rfpath == RF90_PATH_B)
is_pi_mode = (bool)rtl_get_bbreg(hw, 0xE00, 0x4);
rtl_set_bbreg(hw, RHSSIREAD_8821AE, 0xff, offset);
if ((rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) ||
(IS_VENDOR_8812A_C_CU
没有合适的资源?快使用搜索试试~ 我知道了~
deepin配置无线安装包
共305个文件
h:140个
c:120个
bin:19个
需积分: 35 28 下载量 109 浏览量
2018-10-15
17:29:44
上传
评论
收藏 1.49MB ZIP 举报
温馨提示
进入rtlwifi_new-master文件夹,按鼠标右键,选在终端中打开,就进入了这个目录下的终端命令行模式。
资源推荐
资源详情
资源评论
收起资源包目录
deepin配置无线安装包 (305个子文件)
rtl8192sefw.old.bin 87KB
rtl8192sefw.bin 78KB
rtl8192eefw.bin 32KB
rtl8192eefw_new.bin 31KB
rtl8723befw_36.bin 31KB
rtl8192defw.bin 31KB
rtl8723befw.bin 30KB
rtl8821aefw_29.bin 28KB
rtl8821aefw.bin 28KB
rtl8812aefw.bin 27KB
rtl8723fw_B.bin 22KB
rtl8812aefw_wowlan.bin 21KB
rtl8192defw_12.bin 20KB
rtl8821aefw_wowlan.bin 19KB
rtl8192cfwU_B.bin 16KB
rtl8192cfw.bin 16KB
rtl8192cfwU.bin 14KB
rtl8723fw.bin 11KB
rtl8188efw.bin 11KB
phy.c 144KB
halbtc8723b2ant.c 141KB
halbtc8723b1ant.c 139KB
halbtc8821a2ant.c 133KB
hw.c 118KB
halbtc8192e2ant.c 118KB
phy.c 116KB
table.c 111KB
dm.c 97KB
halbtc8821a1ant.c 92KB
phy.c 88KB
hw.c 75KB
phy.c 75KB
fw.c 74KB
hw.c 72KB
hw.c 71KB
hw.c 70KB
base.c 70KB
hw.c 68KB
phy.c 68KB
pci.c 67KB
hw.c 67KB
hw.c 66KB
hw.c 65KB
dm.c 58KB
hal_btc.c 56KB
core.c 56KB
dm_common.c 53KB
phy_common.c 50KB
halbtcoutsrc.c 49KB
phy.c 49KB
phy.c 47KB
dm.c 46KB
dm.c 42KB
table.c 40KB
dm.c 39KB
table.c 36KB
efuse.c 35KB
usb.c 31KB
fw.c 30KB
trx.c 30KB
trx.c 29KB
debug.c 29KB
dm.c 27KB
halbtc8812a_ext.c 27KB
ps.c 26KB
trx.c 26KB
table.c 25KB
fw_common.c 25KB
fw.c 24KB
trx.c 24KB
fw.c 24KB
fw.c 23KB
mac.c 23KB
trx.c 22KB
dm.c 21KB
trx.c 21KB
trx.c 20KB
table.c 19KB
trx.c 19KB
rf.c 19KB
trx.c 18KB
fw.c 18KB
fw.c 17KB
phy.c 17KB
phy.c 17KB
hal_bt_coexist.c 16KB
table.c 16KB
sw.c 16KB
sw.c 15KB
rf.c 14KB
table.c 14KB
phy_common.c 14KB
rf.c 14KB
sw.c 14KB
rf.c 14KB
rf.c 14KB
sw.c 14KB
sw.c 14KB
table.c 14KB
rf.c 14KB
共 305 条
- 1
- 2
- 3
- 4
资源评论
iUncleXiang
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功