diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 82dd4ced4005..72c2827ee57c 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -24,6 +24,7 @@ | |||
24 | Supported chipsets: rt2571W & rt2671. | 24 | Supported chipsets: rt2571W & rt2671. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/crc-itu-t.h> | ||
27 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
28 | #include <linux/etherdevice.h> | 29 | #include <linux/etherdevice.h> |
29 | #include <linux/init.h> | 30 | #include <linux/init.h> |
@@ -817,16 +818,30 @@ dynamic_cca_tune: | |||
817 | } | 818 | } |
818 | 819 | ||
819 | /* | 820 | /* |
820 | * Firmware name function. | 821 | * Firmware functions |
821 | */ | 822 | */ |
822 | static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 823 | static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
823 | { | 824 | { |
824 | return FIRMWARE_RT2571; | 825 | return FIRMWARE_RT2571; |
825 | } | 826 | } |
826 | 827 | ||
827 | /* | 828 | static u16 rt73usb_get_firmware_crc(void *data, const size_t len) |
828 | * Initialization functions. | 829 | { |
829 | */ | 830 | u16 crc; |
831 | |||
832 | /* | ||
833 | * Use the crc itu-t algorithm. | ||
834 | * The last 2 bytes in the firmware array are the crc checksum itself, | ||
835 | * this means that we should never pass those 2 bytes to the crc | ||
836 | * algorithm. | ||
837 | */ | ||
838 | crc = crc_itu_t(0, data, len - 2); | ||
839 | crc = crc_itu_t_byte(crc, 0); | ||
840 | crc = crc_itu_t_byte(crc, 0); | ||
841 | |||
842 | return crc; | ||
843 | } | ||
844 | |||
830 | static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, | 845 | static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, |
831 | const size_t len) | 846 | const size_t len) |
832 | { | 847 | { |
@@ -896,6 +911,9 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, | |||
896 | return 0; | 911 | return 0; |
897 | } | 912 | } |
898 | 913 | ||
914 | /* | ||
915 | * Initialization functions. | ||
916 | */ | ||
899 | static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev) | 917 | static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev) |
900 | { | 918 | { |
901 | u32 reg; | 919 | u32 reg; |
@@ -1852,7 +1870,6 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1852 | * This device requires firmware. | 1870 | * This device requires firmware. |
1853 | */ | 1871 | */ |
1854 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); | 1872 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
1855 | __set_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags); | ||
1856 | 1873 | ||
1857 | /* | 1874 | /* |
1858 | * Set the rssi offset. | 1875 | * Set the rssi offset. |
@@ -2061,6 +2078,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { | |||
2061 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | 2078 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { |
2062 | .probe_hw = rt73usb_probe_hw, | 2079 | .probe_hw = rt73usb_probe_hw, |
2063 | .get_firmware_name = rt73usb_get_firmware_name, | 2080 | .get_firmware_name = rt73usb_get_firmware_name, |
2081 | .get_firmware_crc = rt73usb_get_firmware_crc, | ||
2064 | .load_firmware = rt73usb_load_firmware, | 2082 | .load_firmware = rt73usb_load_firmware, |
2065 | .initialize = rt2x00usb_initialize, | 2083 | .initialize = rt2x00usb_initialize, |
2066 | .uninitialize = rt2x00usb_uninitialize, | 2084 | .uninitialize = rt2x00usb_uninitialize, |