diff options
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 79 |
1 files changed, 16 insertions, 63 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 39c6cdf7f3f7..b1bbc8e8e91f 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -22,58 +22,23 @@ | |||
22 | #define PFX DRIVER_NAME ": " | 22 | #define PFX DRIVER_NAME ": " |
23 | 23 | ||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | #ifdef __IN_PCMCIA_PACKAGE__ | ||
26 | #include <pcmcia/k_compat.h> | ||
27 | #endif /* __IN_PCMCIA_PACKAGE__ */ | ||
28 | |||
29 | #include <linux/module.h> | 25 | #include <linux/module.h> |
30 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
31 | #include <linux/init.h> | 27 | #include <linux/init.h> |
32 | #include <linux/sched.h> | 28 | #include <linux/delay.h> |
33 | #include <linux/ptrace.h> | 29 | #include <linux/firmware.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/string.h> | ||
36 | #include <linux/ioport.h> | ||
37 | #include <linux/netdevice.h> | ||
38 | #include <linux/if_arp.h> | ||
39 | #include <linux/etherdevice.h> | ||
40 | #include <linux/wireless.h> | ||
41 | |||
42 | #include <pcmcia/cs_types.h> | 30 | #include <pcmcia/cs_types.h> |
43 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
44 | #include <pcmcia/cistpl.h> | 32 | #include <pcmcia/cistpl.h> |
45 | #include <pcmcia/cisreg.h> | 33 | #include <pcmcia/cisreg.h> |
46 | #include <pcmcia/ds.h> | 34 | #include <pcmcia/ds.h> |
47 | 35 | ||
48 | #include <asm/uaccess.h> | ||
49 | #include <asm/io.h> | ||
50 | #include <asm/system.h> | ||
51 | |||
52 | #include "orinoco.h" | 36 | #include "orinoco.h" |
53 | 37 | ||
54 | /* | ||
55 | * If SPECTRUM_FW_INCLUDED is defined, the firmware is hardcoded into | ||
56 | * the driver. Use get_symbol_fw script to generate spectrum_fw.h and | ||
57 | * copy it to the same directory as spectrum_cs.c. | ||
58 | * | ||
59 | * If SPECTRUM_FW_INCLUDED is not defined, the firmware is loaded at the | ||
60 | * runtime using hotplug. Use the same get_symbol_fw script to generate | ||
61 | * files symbol_sp24t_prim_fw symbol_sp24t_sec_fw, copy them to the | ||
62 | * hotplug firmware directory (typically /usr/lib/hotplug/firmware) and | ||
63 | * make sure that you have hotplug installed and enabled in the kernel. | ||
64 | */ | ||
65 | /* #define SPECTRUM_FW_INCLUDED 1 */ | ||
66 | |||
67 | #ifdef SPECTRUM_FW_INCLUDED | ||
68 | /* Header with the firmware */ | ||
69 | #include "spectrum_fw.h" | ||
70 | #else /* !SPECTRUM_FW_INCLUDED */ | ||
71 | #include <linux/firmware.h> | ||
72 | static unsigned char *primsym; | 38 | static unsigned char *primsym; |
73 | static unsigned char *secsym; | 39 | static unsigned char *secsym; |
74 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 40 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
75 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 41 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; |
76 | #endif /* !SPECTRUM_FW_INCLUDED */ | ||
77 | 42 | ||
78 | /********************************************************************/ | 43 | /********************************************************************/ |
79 | /* Module stuff */ | 44 | /* Module stuff */ |
@@ -124,17 +89,8 @@ static dev_link_t *dev_list; /* = NULL */ | |||
124 | /* Function prototypes */ | 89 | /* Function prototypes */ |
125 | /********************************************************************/ | 90 | /********************************************************************/ |
126 | 91 | ||
127 | /* device methods */ | 92 | static void spectrum_cs_release(dev_link_t *link); |
128 | static int spectrum_cs_hard_reset(struct orinoco_private *priv); | 93 | static void spectrum_cs_detach(dev_link_t *link); |
129 | |||
130 | /* PCMCIA gumpf */ | ||
131 | static void spectrum_cs_config(dev_link_t * link); | ||
132 | static void spectrum_cs_release(dev_link_t * link); | ||
133 | static int spectrum_cs_event(event_t event, int priority, | ||
134 | event_callback_args_t * args); | ||
135 | |||
136 | static dev_link_t *spectrum_cs_attach(void); | ||
137 | static void spectrum_cs_detach(dev_link_t *); | ||
138 | 94 | ||
139 | /********************************************************************/ | 95 | /********************************************************************/ |
140 | /* Firmware downloader */ | 96 | /* Firmware downloader */ |
@@ -182,8 +138,8 @@ static void spectrum_cs_detach(dev_link_t *); | |||
182 | * Each block has the following structure. | 138 | * Each block has the following structure. |
183 | */ | 139 | */ |
184 | struct dblock { | 140 | struct dblock { |
185 | u32 _addr; /* adapter address where to write the block */ | 141 | __le32 _addr; /* adapter address where to write the block */ |
186 | u16 _len; /* length of the data only, in bytes */ | 142 | __le16 _len; /* length of the data only, in bytes */ |
187 | char data[0]; /* data to be written */ | 143 | char data[0]; /* data to be written */ |
188 | } __attribute__ ((packed)); | 144 | } __attribute__ ((packed)); |
189 | 145 | ||
@@ -193,9 +149,9 @@ struct dblock { | |||
193 | * items with matching ID should be written. | 149 | * items with matching ID should be written. |
194 | */ | 150 | */ |
195 | struct pdr { | 151 | struct pdr { |
196 | u32 _id; /* record ID */ | 152 | __le32 _id; /* record ID */ |
197 | u32 _addr; /* adapter address where to write the data */ | 153 | __le32 _addr; /* adapter address where to write the data */ |
198 | u32 _len; /* expected length of the data, in bytes */ | 154 | __le32 _len; /* expected length of the data, in bytes */ |
199 | char next[0]; /* next PDR starts here */ | 155 | char next[0]; /* next PDR starts here */ |
200 | } __attribute__ ((packed)); | 156 | } __attribute__ ((packed)); |
201 | 157 | ||
@@ -206,8 +162,8 @@ struct pdr { | |||
206 | * be plugged into the secondary firmware. | 162 | * be plugged into the secondary firmware. |
207 | */ | 163 | */ |
208 | struct pdi { | 164 | struct pdi { |
209 | u16 _len; /* length of ID and data, in words */ | 165 | __le16 _len; /* length of ID and data, in words */ |
210 | u16 _id; /* record ID */ | 166 | __le16 _id; /* record ID */ |
211 | char data[0]; /* plug data */ | 167 | char data[0]; /* plug data */ |
212 | } __attribute__ ((packed));; | 168 | } __attribute__ ((packed));; |
213 | 169 | ||
@@ -414,7 +370,7 @@ spectrum_plug_pdi(hermes_t *hw, struct pdr *first_pdr, struct pdi *pdi) | |||
414 | 370 | ||
415 | /* Read PDA from the adapter */ | 371 | /* Read PDA from the adapter */ |
416 | static int | 372 | static int |
417 | spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | 373 | spectrum_read_pda(hermes_t *hw, __le16 *pda, int pda_len) |
418 | { | 374 | { |
419 | int ret; | 375 | int ret; |
420 | int pda_size; | 376 | int pda_size; |
@@ -445,7 +401,7 @@ spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | |||
445 | /* Parse PDA and write the records into the adapter */ | 401 | /* Parse PDA and write the records into the adapter */ |
446 | static int | 402 | static int |
447 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, | 403 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, |
448 | u16 *pda) | 404 | __le16 *pda) |
449 | { | 405 | { |
450 | int ret; | 406 | int ret; |
451 | struct pdi *pdi; | 407 | struct pdi *pdi; |
@@ -511,7 +467,7 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link, | |||
511 | const struct dblock *first_block; | 467 | const struct dblock *first_block; |
512 | 468 | ||
513 | /* Plug Data Area (PDA) */ | 469 | /* Plug Data Area (PDA) */ |
514 | u16 pda[PDA_WORDS]; | 470 | __le16 pda[PDA_WORDS]; |
515 | 471 | ||
516 | /* Binary block begins after the 0x1A marker */ | 472 | /* Binary block begins after the 0x1A marker */ |
517 | ptr = image; | 473 | ptr = image; |
@@ -571,8 +527,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
571 | { | 527 | { |
572 | int ret; | 528 | int ret; |
573 | client_handle_t handle = link->handle; | 529 | client_handle_t handle = link->handle; |
574 | |||
575 | #ifndef SPECTRUM_FW_INCLUDED | ||
576 | const struct firmware *fw_entry; | 530 | const struct firmware *fw_entry; |
577 | 531 | ||
578 | if (request_firmware(&fw_entry, primary_fw_name, | 532 | if (request_firmware(&fw_entry, primary_fw_name, |
@@ -592,7 +546,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
592 | secondary_fw_name); | 546 | secondary_fw_name); |
593 | return -ENOENT; | 547 | return -ENOENT; |
594 | } | 548 | } |
595 | #endif | ||
596 | 549 | ||
597 | /* Load primary firmware */ | 550 | /* Load primary firmware */ |
598 | ret = spectrum_dl_image(hw, link, primsym); | 551 | ret = spectrum_dl_image(hw, link, primsym); |
@@ -1085,7 +1038,7 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
1085 | static struct pcmcia_device_id spectrum_cs_ids[] = { | 1038 | static struct pcmcia_device_id spectrum_cs_ids[] = { |
1086 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ | 1039 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ |
1087 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ | 1040 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ |
1088 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), /* Intel PRO/Wireless 2011B */ | 1041 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ |
1089 | PCMCIA_DEVICE_NULL, | 1042 | PCMCIA_DEVICE_NULL, |
1090 | }; | 1043 | }; |
1091 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); | 1044 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); |
@@ -1096,8 +1049,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
1096 | .name = DRIVER_NAME, | 1049 | .name = DRIVER_NAME, |
1097 | }, | 1050 | }, |
1098 | .attach = spectrum_cs_attach, | 1051 | .attach = spectrum_cs_attach, |
1099 | .event = spectrum_cs_event, | ||
1100 | .detach = spectrum_cs_detach, | 1052 | .detach = spectrum_cs_detach, |
1053 | .event = spectrum_cs_event, | ||
1101 | .id_table = spectrum_cs_ids, | 1054 | .id_table = spectrum_cs_ids, |
1102 | }; | 1055 | }; |
1103 | 1056 | ||