aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c83
1 files changed, 9 insertions, 74 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 4765bbd654cd..27829e1e2e38 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -54,6 +54,11 @@ static bool modparam_nohwcrypt = false;
54module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); 54module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
55MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 55MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
56 56
57static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
58{
59 return modparam_nohwcrypt;
60}
61
57static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) 62static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
58{ 63{
59 unsigned int i; 64 unsigned int i;
@@ -965,85 +970,14 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance)
965/* 970/*
966 * Device probe functions. 971 * Device probe functions.
967 */ 972 */
968static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) 973static void rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
969{ 974{
970 /*
971 * Read EEPROM into buffer
972 */
973 if (rt2x00_is_soc(rt2x00dev)) 975 if (rt2x00_is_soc(rt2x00dev))
974 rt2800pci_read_eeprom_soc(rt2x00dev); 976 rt2800pci_read_eeprom_soc(rt2x00dev);
975 else if (rt2800pci_efuse_detect(rt2x00dev)) 977 else if (rt2800pci_efuse_detect(rt2x00dev))
976 rt2800pci_read_eeprom_efuse(rt2x00dev); 978 rt2800pci_read_eeprom_efuse(rt2x00dev);
977 else 979 else
978 rt2800pci_read_eeprom_pci(rt2x00dev); 980 rt2800pci_read_eeprom_pci(rt2x00dev);
979
980 return rt2800_validate_eeprom(rt2x00dev);
981}
982
983static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
984{
985 int retval;
986 u32 reg;
987
988 /*
989 * Allocate eeprom data.
990 */
991 retval = rt2800pci_validate_eeprom(rt2x00dev);
992 if (retval)
993 return retval;
994
995 retval = rt2800_init_eeprom(rt2x00dev);
996 if (retval)
997 return retval;
998
999 /*
1000 * Enable rfkill polling by setting GPIO direction of the
1001 * rfkill switch GPIO pin correctly.
1002 */
1003 rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
1004 rt2x00_set_field32(&reg, GPIO_CTRL_CFG_GPIOD_BIT2, 1);
1005 rt2x00pci_register_write(rt2x00dev, GPIO_CTRL_CFG, reg);
1006
1007 /*
1008 * Initialize hw specifications.
1009 */
1010 retval = rt2800_probe_hw_mode(rt2x00dev);
1011 if (retval)
1012 return retval;
1013
1014 /*
1015 * This device has multiple filters for control frames
1016 * and has a separate filter for PS Poll frames.
1017 */
1018 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
1019 __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
1020
1021 /*
1022 * This device has a pre tbtt interrupt and thus fetches
1023 * a new beacon directly prior to transmission.
1024 */
1025 __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags);
1026
1027 /*
1028 * This device requires firmware.
1029 */
1030 if (!rt2x00_is_soc(rt2x00dev))
1031 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
1032 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags);
1033 __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
1034 __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
1035 __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
1036 if (!modparam_nohwcrypt)
1037 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
1038 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
1039 __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
1040
1041 /*
1042 * Set the rssi offset.
1043 */
1044 rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET;
1045
1046 return 0;
1047} 981}
1048 982
1049static const struct ieee80211_ops rt2800pci_mac80211_ops = { 983static const struct ieee80211_ops rt2800pci_mac80211_ops = {
@@ -1081,6 +1015,8 @@ static const struct rt2800_ops rt2800pci_rt2800_ops = {
1081 .register_multiread = rt2x00pci_register_multiread, 1015 .register_multiread = rt2x00pci_register_multiread,
1082 .register_multiwrite = rt2x00pci_register_multiwrite, 1016 .register_multiwrite = rt2x00pci_register_multiwrite,
1083 .regbusy_read = rt2x00pci_regbusy_read, 1017 .regbusy_read = rt2x00pci_regbusy_read,
1018 .read_eeprom = rt2800pci_read_eeprom,
1019 .hwcrypt_disabled = rt2800pci_hwcrypt_disabled,
1084 .drv_write_firmware = rt2800pci_write_firmware, 1020 .drv_write_firmware = rt2800pci_write_firmware,
1085 .drv_init_registers = rt2800pci_init_registers, 1021 .drv_init_registers = rt2800pci_init_registers,
1086 .drv_get_txwi = rt2800pci_get_txwi, 1022 .drv_get_txwi = rt2800pci_get_txwi,
@@ -1093,7 +1029,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
1093 .tbtt_tasklet = rt2800pci_tbtt_tasklet, 1029 .tbtt_tasklet = rt2800pci_tbtt_tasklet,
1094 .rxdone_tasklet = rt2800pci_rxdone_tasklet, 1030 .rxdone_tasklet = rt2800pci_rxdone_tasklet,
1095 .autowake_tasklet = rt2800pci_autowake_tasklet, 1031 .autowake_tasklet = rt2800pci_autowake_tasklet,
1096 .probe_hw = rt2800pci_probe_hw, 1032 .probe_hw = rt2800_probe_hw,
1097 .get_firmware_name = rt2800pci_get_firmware_name, 1033 .get_firmware_name = rt2800pci_get_firmware_name,
1098 .check_firmware = rt2800_check_firmware, 1034 .check_firmware = rt2800_check_firmware,
1099 .load_firmware = rt2800_load_firmware, 1035 .load_firmware = rt2800_load_firmware,
@@ -1152,7 +1088,6 @@ static const struct data_queue_desc rt2800pci_queue_bcn = {
1152static const struct rt2x00_ops rt2800pci_ops = { 1088static const struct rt2x00_ops rt2800pci_ops = {
1153 .name = KBUILD_MODNAME, 1089 .name = KBUILD_MODNAME,
1154 .drv_data_size = sizeof(struct rt2800_drv_data), 1090 .drv_data_size = sizeof(struct rt2800_drv_data),
1155 .max_sta_intf = 1,
1156 .max_ap_intf = 8, 1091 .max_ap_intf = 8,
1157 .eeprom_size = EEPROM_SIZE, 1092 .eeprom_size = EEPROM_SIZE,
1158 .rf_size = RF_SIZE, 1093 .rf_size = RF_SIZE,