Commit 0a168b48 authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

rtlwifi: rtl8723ae: rtl8723-common: Create new driver for common code

The drivers for RTL8723AE and RTL8723BE have some code in common.
This commit creates a driver for this code that will be shared, and
copies those common routines from rtl8723ae's phy code.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2cddad3c
...@@ -48,6 +48,7 @@ config RTL8723AE ...@@ -48,6 +48,7 @@ config RTL8723AE
depends on PCI depends on PCI
select RTLWIFI select RTLWIFI
select RTLWIFI_PCI select RTLWIFI_PCI
select RTL8723_COMMON
select RTLBTCOEXIST select RTLBTCOEXIST
---help--- ---help---
This is the driver for Realtek RTL8723AE 802.11n PCIe This is the driver for Realtek RTL8723AE 802.11n PCIe
...@@ -102,6 +103,11 @@ config RTL8192C_COMMON ...@@ -102,6 +103,11 @@ config RTL8192C_COMMON
depends on RTL8192CE || RTL8192CU depends on RTL8192CE || RTL8192CU
default y default y
config RTL8723_COMMON
tristate
depends on RTL8723AE
default y
config RTLBTCOEXIST config RTLBTCOEXIST
tristate tristate
depends on RTL8723AE depends on RTL8723AE
......
...@@ -26,5 +26,6 @@ obj-$(CONFIG_RTL8192DE) += rtl8192de/ ...@@ -26,5 +26,6 @@ obj-$(CONFIG_RTL8192DE) += rtl8192de/
obj-$(CONFIG_RTL8723AE) += rtl8723ae/ obj-$(CONFIG_RTL8723AE) += rtl8723ae/
obj-$(CONFIG_RTL8188EE) += rtl8188ee/ obj-$(CONFIG_RTL8188EE) += rtl8188ee/
obj-$(CONFIG_RTLBTCOEXIST) += btcoexist/ obj-$(CONFIG_RTLBTCOEXIST) += btcoexist/
obj-$(CONFIG_RTL8723_COMMON) += rtl8723com/
ccflags-y += -D__CHECK_ENDIAN__ ccflags-y += -D__CHECK_ENDIAN__
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "hal_btc.h" #include "hal_btc.h"
#include "../pci.h" #include "../pci.h"
#include "phy.h" #include "phy.h"
#include "../rtl8723com/phy_common.h"
#include "fw.h" #include "fw.h"
#include "reg.h" #include "reg.h"
#include "def.h" #include "def.h"
...@@ -391,13 +392,13 @@ static void rtl8723ae_dm_bt_set_sw_full_time_dac_swing(struct ieee80211_hw *hw, ...@@ -391,13 +392,13 @@ static void rtl8723ae_dm_bt_set_sw_full_time_dac_swing(struct ieee80211_hw *hw,
if (sw_dac_swing_on) { if (sw_dac_swing_on) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE,
"[BTCoex], SwDacSwing = 0x%x\n", sw_dac_swing_lvl); "[BTCoex], SwDacSwing = 0x%x\n", sw_dac_swing_lvl);
rtl8723ae_phy_set_bb_reg(hw, 0x880, 0xff000000, rtl8723_phy_set_bb_reg(hw, 0x880, 0xff000000,
sw_dac_swing_lvl); sw_dac_swing_lvl);
rtlpcipriv->bt_coexist.sw_coexist_all_off = false; rtlpcipriv->bt_coexist.sw_coexist_all_off = false;
} else { } else {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE,
"[BTCoex], SwDacSwing Off!\n"); "[BTCoex], SwDacSwing Off!\n");
rtl8723ae_phy_set_bb_reg(hw, 0x880, 0xff000000, 0xc0); rtl8723_phy_set_bb_reg(hw, 0x880, 0xff000000, 0xc0);
} }
} }
......
...@@ -76,23 +76,6 @@ ...@@ -76,23 +76,6 @@
#define RTL92C_MAX_PATH_NUM 2 #define RTL92C_MAX_PATH_NUM 2
enum swchnlcmd_id {
CMDID_END,
CMDID_SET_TXPOWEROWER_LEVEL,
CMDID_BBREGWRITE10,
CMDID_WRITEPORT_ULONG,
CMDID_WRITEPORT_USHORT,
CMDID_WRITEPORT_UCHAR,
CMDID_RF_WRITEREG,
};
struct swchnlcmd {
enum swchnlcmd_id cmdid;
u32 para1;
u32 para2;
u32 msdelay;
};
enum hw90_block_e { enum hw90_block_e {
HW90_BLOCK_MAC = 0, HW90_BLOCK_MAC = 0,
HW90_BLOCK_PHY0 = 1, HW90_BLOCK_PHY0 = 1,
...@@ -183,10 +166,6 @@ struct tx_power_struct { ...@@ -183,10 +166,6 @@ struct tx_power_struct {
u32 mcs_original_offset[4][16]; u32 mcs_original_offset[4][16];
}; };
u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw,
u32 regaddr, u32 bitmask);
void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw,
u32 regaddr, u32 bitmask, u32 data);
u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 regaddr, enum radio_path rfpath, u32 regaddr,
u32 bitmask); u32 bitmask);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "reg.h" #include "reg.h"
#include "def.h" #include "def.h"
#include "phy.h" #include "phy.h"
#include "../rtl8723com/phy_common.h"
#include "dm.h" #include "dm.h"
#include "hw.h" #include "hw.h"
#include "sw.h" #include "sw.h"
...@@ -231,8 +232,8 @@ static struct rtl_hal_ops rtl8723ae_hal_ops = { ...@@ -231,8 +232,8 @@ static struct rtl_hal_ops rtl8723ae_hal_ops = {
.set_key = rtl8723ae_set_key, .set_key = rtl8723ae_set_key,
.init_sw_leds = rtl8723ae_init_sw_leds, .init_sw_leds = rtl8723ae_init_sw_leds,
.allow_all_destaddr = rtl8723ae_allow_all_destaddr, .allow_all_destaddr = rtl8723ae_allow_all_destaddr,
.get_bbreg = rtl8723ae_phy_query_bb_reg, .get_bbreg = rtl8723_phy_query_bb_reg,
.set_bbreg = rtl8723ae_phy_set_bb_reg, .set_bbreg = rtl8723_phy_set_bb_reg,
.get_rfreg = rtl8723ae_phy_query_rf_reg, .get_rfreg = rtl8723ae_phy_query_rf_reg,
.set_rfreg = rtl8723ae_phy_set_rf_reg, .set_rfreg = rtl8723ae_phy_set_rf_reg,
.c2h_command_handle = rtl_8723e_c2h_command_handle, .c2h_command_handle = rtl_8723e_c2h_command_handle,
......
rtl8723-common-objs := \
main.o \
phy_common.o
obj-$(CONFIG_RTL8723_COMMON) += rtl8723-common.o
ccflags-y += -D__CHECK_ENDIAN__
/******************************************************************************
*
* Copyright(c) 2009-2014 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 <linux/module.h>
MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Realtek RTL8723AE/RTL8723BE 802.11n PCI wireless common routines");
This diff is collapsed.
...@@ -26,6 +26,25 @@ ...@@ -26,6 +26,25 @@
#ifndef __PHY_COMMON__ #ifndef __PHY_COMMON__
#define __PHY_COMMON__ #define __PHY_COMMON__
#define RT_CANNOT_IO(hw) false
enum swchnlcmd_id {
CMDID_END,
CMDID_SET_TXPOWEROWER_LEVEL,
CMDID_BBREGWRITE10,
CMDID_WRITEPORT_ULONG,
CMDID_WRITEPORT_USHORT,
CMDID_WRITEPORT_UCHAR,
CMDID_RF_WRITEREG,
};
struct swchnlcmd {
enum swchnlcmd_id cmdid;
u32 para1;
u32 para2;
u32 msdelay;
};
u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw, u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw,
u32 regaddr, u32 bitmask); u32 regaddr, u32 bitmask);
void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
...@@ -36,11 +55,6 @@ u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw, ...@@ -36,11 +55,6 @@ u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw,
void rtl8723_phy_rf_serial_write(struct ieee80211_hw *hw, void rtl8723_phy_rf_serial_write(struct ieee80211_hw *hw,
enum radio_path rfpath, enum radio_path rfpath,
u32 offset, u32 data); u32 offset, u32 data);
u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw,
u32 regaddr, u32 bitmask);
u32 rtl8723_phy_calculate_bit_shift(u32 bitmask);
void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
u32 bitmask, u32 data);
long rtl8723_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, long rtl8723_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
enum wireless_mode wirelessmode, enum wireless_mode wirelessmode,
u8 txpwridx); u8 txpwridx);
...@@ -58,8 +72,8 @@ void rtl8723_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw, ...@@ -58,8 +72,8 @@ void rtl8723_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw,
bool btxonly); bool btxonly);
void rtl8723_save_adda_registers(struct ieee80211_hw *hw, u32 *addareg, void rtl8723_save_adda_registers(struct ieee80211_hw *hw, u32 *addareg,
u32 *addabackup, u32 registernum); u32 *addabackup, u32 registernum);
static void rtl8723_phy_save_mac_registers(struct ieee80211_hw *hw, void rtl8723_phy_save_mac_registers(struct ieee80211_hw *hw,
u32 *macreg, u32 *macbackup); u32 *macreg, u32 *macbackup);
void rtl8723_phy_reload_adda_registers(struct ieee80211_hw *hw, void rtl8723_phy_reload_adda_registers(struct ieee80211_hw *hw,
u32 *addareg, u32 *addabackup, u32 *addareg, u32 *addabackup,
u32 regiesternum); u32 regiesternum);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment