summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-09 22:44:54 +0100
committerJohn W. Linville <linville@tuxdriver.com>2008-03-13 16:02:36 -0400
commita7f3a06cbb63a16ad7a1720506591d8d12a03029 (patch)
tree8aa483a960b4ac9de30e6e1fcb28fdd900cde247 /drivers/net/wireless/rt2x00/rt73usb.c
parent5f46c4d0537a870f9d9c1fd998aa9d6dac682595 (diff)
downloadop-kernel-dev-a7f3a06cbb63a16ad7a1720506591d8d12a03029.zip
op-kernel-dev-a7f3a06cbb63a16ad7a1720506591d8d12a03029.tar.gz
rt2x00: Move firmware checksumming to driver
rt2x00lib depended on 2 crc algorithms because rt61/rt73 use a different algorithm then rt2800. This means that even when only 1 algorithm was needed, the dependency was still present for both. By moving the checksum generation to the driver we can clean up 2 annoying flags (which indicated which checksum was required) and move the dependency to where it belongs: the driver. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 82dd4ce..72c2827e 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -24,6 +24,7 @@
Supported chipsets: rt2571W & rt2671.
*/
+#include <linux/crc-itu-t.h>
#include <linux/delay.h>
#include <linux/etherdevice.h>
#include <linux/init.h>
@@ -817,16 +818,30 @@ dynamic_cca_tune:
}
/*
- * Firmware name function.
+ * Firmware functions
*/
static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
{
return FIRMWARE_RT2571;
}
-/*
- * Initialization functions.
- */
+static u16 rt73usb_get_firmware_crc(void *data, const size_t len)
+{
+ u16 crc;
+
+ /*
+ * Use the crc itu-t algorithm.
+ * The last 2 bytes in the firmware array are the crc checksum itself,
+ * this means that we should never pass those 2 bytes to the crc
+ * algorithm.
+ */
+ crc = crc_itu_t(0, data, len - 2);
+ crc = crc_itu_t_byte(crc, 0);
+ crc = crc_itu_t_byte(crc, 0);
+
+ return crc;
+}
+
static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
const size_t len)
{
@@ -896,6 +911,9 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
return 0;
}
+/*
+ * Initialization functions.
+ */
static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
@@ -1852,7 +1870,6 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
* This device requires firmware.
*/
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
- __set_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags);
/*
* Set the rssi offset.
@@ -2061,6 +2078,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
.probe_hw = rt73usb_probe_hw,
.get_firmware_name = rt73usb_get_firmware_name,
+ .get_firmware_crc = rt73usb_get_firmware_crc,
.load_firmware = rt73usb_load_firmware,
.initialize = rt2x00usb_initialize,
.uninitialize = rt2x00usb_uninitialize,
OpenPOWER on IntegriCloud