aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800usb.c
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2012-09-02 21:25:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-09-07 15:08:40 -0400
commitad417a533a5bddedbf6b64c12cc26af7c80866f8 (patch)
tree2cdb9a20ade6b59e2ce5cbadf2221483240918af /drivers/net/wireless/rt2x00/rt2800usb.c
parent99bdf51a6892e7fdff8d879890f075b3bf51d4ef (diff)
rt2x00: rt2800 - Make probe_hw function common between PCI and USB.
Refactor the probe_hw code so that more code can be shared between rt2800pci and rt2800usb. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c61
1 files changed, 11 insertions, 50 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index b13b3142996a..603b65d6f28b 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -49,6 +49,11 @@ static bool modparam_nohwcrypt;
49module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); 49module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
50MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 50MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
51 51
52static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
53{
54 return modparam_nohwcrypt;
55}
56
52/* 57/*
53 * Queue handlers. 58 * Queue handlers.
54 */ 59 */
@@ -730,73 +735,27 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
730/* 735/*
731 * Device probe functions. 736 * Device probe functions.
732 */ 737 */
733static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) 738static void rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
734{ 739{
735 if (rt2800_efuse_detect(rt2x00dev)) 740 if (rt2800_efuse_detect(rt2x00dev))
736 rt2800_read_eeprom_efuse(rt2x00dev); 741 rt2800_read_eeprom_efuse(rt2x00dev);
737 else 742 else
738 rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, 743 rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
739 EEPROM_SIZE); 744 EEPROM_SIZE);
740
741 return rt2800_validate_eeprom(rt2x00dev);
742} 745}
743 746
744static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) 747static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
745{ 748{
746 int retval; 749 int retval;
747 u32 reg;
748 750
749 /* 751 retval = rt2800_probe_hw(rt2x00dev);
750 * Allocate eeprom data.
751 */
752 retval = rt2800usb_validate_eeprom(rt2x00dev);
753 if (retval) 752 if (retval)
754 return retval; 753 return retval;
755 754
756 retval = rt2800_init_eeprom(rt2x00dev);
757 if (retval)
758 return retval;
759
760 /*
761 * Enable rfkill polling by setting GPIO direction of the
762 * rfkill switch GPIO pin correctly.
763 */
764 rt2x00usb_register_read(rt2x00dev, GPIO_CTRL, &reg);
765 rt2x00_set_field32(&reg, GPIO_CTRL_DIR2, 1);
766 rt2x00usb_register_write(rt2x00dev, GPIO_CTRL, reg);
767
768 /*
769 * Initialize hw specifications.
770 */
771 retval = rt2800_probe_hw_mode(rt2x00dev);
772 if (retval)
773 return retval;
774
775 /*
776 * This device has multiple filters for control frames
777 * and has a separate filter for PS Poll frames.
778 */
779 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags);
780 __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags);
781
782 /*
783 * This device requires firmware.
784 */
785 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
786 __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
787 if (!modparam_nohwcrypt)
788 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
789 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
790 __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
791 __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
792 __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags);
793
794 rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout,
795
796 /* 755 /*
797 * Set the rssi offset. 756 * Set txstatus timer function.
798 */ 757 */
799 rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; 758 rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout;
800 759
801 /* 760 /*
802 * Overwrite TX done handler 761 * Overwrite TX done handler
@@ -842,6 +801,8 @@ static const struct rt2800_ops rt2800usb_rt2800_ops = {
842 .register_multiread = rt2x00usb_register_multiread, 801 .register_multiread = rt2x00usb_register_multiread,
843 .register_multiwrite = rt2x00usb_register_multiwrite, 802 .register_multiwrite = rt2x00usb_register_multiwrite,
844 .regbusy_read = rt2x00usb_regbusy_read, 803 .regbusy_read = rt2x00usb_regbusy_read,
804 .read_eeprom = rt2800usb_read_eeprom,
805 .hwcrypt_disabled = rt2800usb_hwcrypt_disabled,
845 .drv_write_firmware = rt2800usb_write_firmware, 806 .drv_write_firmware = rt2800usb_write_firmware,
846 .drv_init_registers = rt2800usb_init_registers, 807 .drv_init_registers = rt2800usb_init_registers,
847 .drv_get_txwi = rt2800usb_get_txwi, 808 .drv_get_txwi = rt2800usb_get_txwi,