aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-09 17:44:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-13 16:02:36 -0400
commita7f3a06cbb63a16ad7a1720506591d8d12a03029 (patch)
tree8aa483a960b4ac9de30e6e1fcb28fdd900cde247 /drivers/net/wireless/rt2x00/rt61pci.c
parent5f46c4d0537a870f9d9c1fd998aa9d6dac682595 (diff)
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/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 13b918db1850..23b3e163b9ba 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -24,6 +24,7 @@
24 Supported chipsets: RT2561, RT2561s, RT2661. 24 Supported chipsets: RT2561, RT2561s, RT2661.
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>
@@ -856,7 +857,7 @@ dynamic_cca_tune:
856} 857}
857 858
858/* 859/*
859 * Firmware name function. 860 * Firmware functions
860 */ 861 */
861static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) 862static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev)
862{ 863{
@@ -880,9 +881,23 @@ static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev)
880 return fw_name; 881 return fw_name;
881} 882}
882 883
883/* 884static u16 rt61pci_get_firmware_crc(void *data, const size_t len)
884 * Initialization functions. 885{
885 */ 886 u16 crc;
887
888 /*
889 * Use the crc itu-t algorithm.
890 * The last 2 bytes in the firmware array are the crc checksum itself,
891 * this means that we should never pass those 2 bytes to the crc
892 * algorithm.
893 */
894 crc = crc_itu_t(0, data, len - 2);
895 crc = crc_itu_t_byte(crc, 0);
896 crc = crc_itu_t_byte(crc, 0);
897
898 return crc;
899}
900
886static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, 901static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
887 const size_t len) 902 const size_t len)
888{ 903{
@@ -963,6 +978,9 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
963 return 0; 978 return 0;
964} 979}
965 980
981/*
982 * Initialization functions.
983 */
966static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev, 984static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev,
967 struct queue_entry *entry) 985 struct queue_entry *entry)
968{ 986{
@@ -2257,7 +2275,6 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
2257 * This device requires firmware. 2275 * This device requires firmware.
2258 */ 2276 */
2259 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); 2277 __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
2260 __set_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags);
2261 2278
2262 /* 2279 /*
2263 * Set the rssi offset. 2280 * Set the rssi offset.
@@ -2457,6 +2474,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
2457 .irq_handler = rt61pci_interrupt, 2474 .irq_handler = rt61pci_interrupt,
2458 .probe_hw = rt61pci_probe_hw, 2475 .probe_hw = rt61pci_probe_hw,
2459 .get_firmware_name = rt61pci_get_firmware_name, 2476 .get_firmware_name = rt61pci_get_firmware_name,
2477 .get_firmware_crc = rt61pci_get_firmware_crc,
2460 .load_firmware = rt61pci_load_firmware, 2478 .load_firmware = rt61pci_load_firmware,
2461 .initialize = rt2x00pci_initialize, 2479 .initialize = rt2x00pci_initialize,
2462 .uninitialize = rt2x00pci_uninitialize, 2480 .uninitialize = rt2x00pci_uninitialize,