aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 785664090bb4..5c410989c4d7 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -5,12 +5,12 @@
5 Copyright 2000-2001 ATMEL Corporation. 5 Copyright 2000-2001 ATMEL Corporation.
6 Copyright 2003 Simon Kelley. 6 Copyright 2003 Simon Kelley.
7 7
8 This code was developed from version 2.1.1 of the Atmel drivers, 8 This code was developed from version 2.1.1 of the Atmel drivers,
9 released by Atmel corp. under the GPL in December 2002. It also 9 released by Atmel corp. under the GPL in December 2002. It also
10 includes code from the Linux aironet drivers (C) Benjamin Reed, 10 includes code from the Linux aironet drivers (C) Benjamin Reed,
11 and the Linux PCMCIA package, (C) David Hinds. 11 and the Linux PCMCIA package, (C) David Hinds.
12 12
13 For all queries about this code, please contact the current author, 13 For all queries about this code, please contact the current author,
14 Simon Kelley <simon@thekelleys.org.uk> and not Atmel Corporation. 14 Simon Kelley <simon@thekelleys.org.uk> and not Atmel Corporation.
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
@@ -87,7 +87,7 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
87 event is received. The config() and release() entry points are 87 event is received. The config() and release() entry points are
88 used to configure or release a socket, in response to card 88 used to configure or release a socket, in response to card
89 insertion and ejection events. They are invoked from the atmel_cs 89 insertion and ejection events. They are invoked from the atmel_cs
90 event handler. 90 event handler.
91*/ 91*/
92 92
93static int atmel_config(struct pcmcia_device *link); 93static int atmel_config(struct pcmcia_device *link);
@@ -133,22 +133,22 @@ static void atmel_detach(struct pcmcia_device *p_dev);
133 device IO routines can use a flag like this to throttle IO to a 133 device IO routines can use a flag like this to throttle IO to a
134 card that is not ready to accept it. 134 card that is not ready to accept it.
135*/ 135*/
136 136
137typedef struct local_info_t { 137typedef struct local_info_t {
138 dev_node_t node; 138 dev_node_t node;
139 struct net_device *eth_dev; 139 struct net_device *eth_dev;
140} local_info_t; 140} local_info_t;
141 141
142/*====================================================================== 142/*======================================================================
143 143
144 atmel_attach() creates an "instance" of the driver, allocating 144 atmel_attach() creates an "instance" of the driver, allocating
145 local data structures for one device. The device is registered 145 local data structures for one device. The device is registered
146 with Card Services. 146 with Card Services.
147 147
148 The dev_link structure is initialized, but we don't actually 148 The dev_link structure is initialized, but we don't actually
149 configure the card at this point -- we wait until we receive a 149 configure the card at this point -- we wait until we receive a
150 card insertion event. 150 card insertion event.
151 151
152 ======================================================================*/ 152 ======================================================================*/
153 153
154static int atmel_probe(struct pcmcia_device *p_dev) 154static int atmel_probe(struct pcmcia_device *p_dev)
@@ -184,12 +184,12 @@ static int atmel_probe(struct pcmcia_device *p_dev)
184} /* atmel_attach */ 184} /* atmel_attach */
185 185
186/*====================================================================== 186/*======================================================================
187 187
188 This deletes a driver "instance". The device is de-registered 188 This deletes a driver "instance". The device is de-registered
189 with Card Services. If it has been released, all local data 189 with Card Services. If it has been released, all local data
190 structures are freed. Otherwise, the structures will be freed 190 structures are freed. Otherwise, the structures will be freed
191 when the device is released. 191 when the device is released.
192 192
193 ======================================================================*/ 193 ======================================================================*/
194 194
195static void atmel_detach(struct pcmcia_device *link) 195static void atmel_detach(struct pcmcia_device *link)
@@ -202,11 +202,11 @@ static void atmel_detach(struct pcmcia_device *link)
202} 202}
203 203
204/*====================================================================== 204/*======================================================================
205 205
206 atmel_config() is scheduled to run after a CARD_INSERTION event 206 atmel_config() is scheduled to run after a CARD_INSERTION event
207 is received, to configure the PCMCIA socket, and to make the 207 is received, to configure the PCMCIA socket, and to make the
208 device available to the system. 208 device available to the system.
209 209
210 ======================================================================*/ 210 ======================================================================*/
211 211
212#define CS_CHECK(fn, ret) \ 212#define CS_CHECK(fn, ret) \
@@ -237,12 +237,12 @@ static int atmel_config(struct pcmcia_device *link)
237 did = handle_to_dev(link).driver_data; 237 did = handle_to_dev(link).driver_data;
238 238
239 DEBUG(0, "atmel_config(0x%p)\n", link); 239 DEBUG(0, "atmel_config(0x%p)\n", link);
240 240
241 tuple.Attributes = 0; 241 tuple.Attributes = 0;
242 tuple.TupleData = buf; 242 tuple.TupleData = buf;
243 tuple.TupleDataMax = sizeof(buf); 243 tuple.TupleDataMax = sizeof(buf);
244 tuple.TupleOffset = 0; 244 tuple.TupleOffset = 0;
245 245
246 /* 246 /*
247 This reads the card's CONFIG tuple to find its configuration 247 This reads the card's CONFIG tuple to find its configuration
248 registers. 248 registers.
@@ -258,7 +258,7 @@ static int atmel_config(struct pcmcia_device *link)
258 In this loop, we scan the CIS for configuration table entries, 258 In this loop, we scan the CIS for configuration table entries,
259 each of which describes a valid card configuration, including 259 each of which describes a valid card configuration, including
260 voltage, IO window, memory window, and interrupt settings. 260 voltage, IO window, memory window, and interrupt settings.
261 261
262 We make no assumptions about the card to be configured: we use 262 We make no assumptions about the card to be configured: we use
263 just the information available in the CIS. In an ideal world, 263 just the information available in the CIS. In an ideal world,
264 this would work for any PCMCIA card, but it requires a complete 264 this would work for any PCMCIA card, but it requires a complete
@@ -274,17 +274,17 @@ static int atmel_config(struct pcmcia_device *link)
274 if (pcmcia_get_tuple_data(link, &tuple) != 0 || 274 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
275 pcmcia_parse_tuple(link, &tuple, &parse) != 0) 275 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
276 goto next_entry; 276 goto next_entry;
277 277
278 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 278 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
279 if (cfg->index == 0) goto next_entry; 279 if (cfg->index == 0) goto next_entry;
280 link->conf.ConfigIndex = cfg->index; 280 link->conf.ConfigIndex = cfg->index;
281 281
282 /* Does this card need audio output? */ 282 /* Does this card need audio output? */
283 if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 283 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
284 link->conf.Attributes |= CONF_ENABLE_SPKR; 284 link->conf.Attributes |= CONF_ENABLE_SPKR;
285 link->conf.Status = CCSR_AUDIO_ENA; 285 link->conf.Status = CCSR_AUDIO_ENA;
286 } 286 }
287 287
288 /* Use power settings for Vcc and Vpp if present */ 288 /* Use power settings for Vcc and Vpp if present */
289 /* Note that the CIS values need to be rescaled */ 289 /* Note that the CIS values need to be rescaled */
290 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 290 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
@@ -293,11 +293,11 @@ static int atmel_config(struct pcmcia_device *link)
293 else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 293 else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
294 link->conf.Vpp = 294 link->conf.Vpp =
295 dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 295 dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
296 296
297 /* Do we need to allocate an interrupt? */ 297 /* Do we need to allocate an interrupt? */
298 if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) 298 if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
299 link->conf.Attributes |= CONF_ENABLE_IRQ; 299 link->conf.Attributes |= CONF_ENABLE_IRQ;
300 300
301 /* IO window settings */ 301 /* IO window settings */
302 link->io.NumPorts1 = link->io.NumPorts2 = 0; 302 link->io.NumPorts1 = link->io.NumPorts2 = 0;
303 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { 303 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
@@ -315,18 +315,18 @@ static int atmel_config(struct pcmcia_device *link)
315 link->io.NumPorts2 = io->win[1].len; 315 link->io.NumPorts2 = io->win[1].len;
316 } 316 }
317 } 317 }
318 318
319 /* This reserves IO space but doesn't actually enable it */ 319 /* This reserves IO space but doesn't actually enable it */
320 if (pcmcia_request_io(link, &link->io) != 0) 320 if (pcmcia_request_io(link, &link->io) != 0)
321 goto next_entry; 321 goto next_entry;
322 322
323 /* If we got this far, we're cool! */ 323 /* If we got this far, we're cool! */
324 break; 324 break;
325 325
326 next_entry: 326 next_entry:
327 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); 327 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
328 } 328 }
329 329
330 /* 330 /*
331 Allocate an interrupt line. Note that this does not assign a 331 Allocate an interrupt line. Note that this does not assign a
332 handler to the interrupt, unless the 'Handler' member of the 332 handler to the interrupt, unless the 'Handler' member of the
@@ -334,31 +334,31 @@ static int atmel_config(struct pcmcia_device *link)
334 */ 334 */
335 if (link->conf.Attributes & CONF_ENABLE_IRQ) 335 if (link->conf.Attributes & CONF_ENABLE_IRQ)
336 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 336 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
337 337
338 /* 338 /*
339 This actually configures the PCMCIA socket -- setting up 339 This actually configures the PCMCIA socket -- setting up
340 the I/O windows and the interrupt mapping, and putting the 340 the I/O windows and the interrupt mapping, and putting the
341 card and host interface into "Memory and IO" mode. 341 card and host interface into "Memory and IO" mode.
342 */ 342 */
343 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 343 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
344 344
345 if (link->irq.AssignedIRQ == 0) { 345 if (link->irq.AssignedIRQ == 0) {
346 printk(KERN_ALERT 346 printk(KERN_ALERT
347 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); 347 "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config.");
348 goto cs_failed; 348 goto cs_failed;
349 } 349 }
350 350
351 ((local_info_t*)link->priv)->eth_dev = 351 ((local_info_t*)link->priv)->eth_dev =
352 init_atmel_card(link->irq.AssignedIRQ, 352 init_atmel_card(link->irq.AssignedIRQ,
353 link->io.BasePort1, 353 link->io.BasePort1,
354 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 354 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
355 &handle_to_dev(link), 355 &handle_to_dev(link),
356 card_present, 356 card_present,
357 link); 357 link);
358 if (!((local_info_t*)link->priv)->eth_dev) 358 if (!((local_info_t*)link->priv)->eth_dev)
359 goto cs_failed; 359 goto cs_failed;
360 360
361 361
362 /* 362 /*
363 At this point, the dev_node_t structure(s) need to be 363 At this point, the dev_node_t structure(s) need to be
364 initialized and arranged in a linked list at link->dev_node. 364 initialized and arranged in a linked list at link->dev_node.
@@ -376,11 +376,11 @@ static int atmel_config(struct pcmcia_device *link)
376} 376}
377 377
378/*====================================================================== 378/*======================================================================
379 379
380 After a card is removed, atmel_release() will unregister the 380 After a card is removed, atmel_release() will unregister the
381 device, and release the PCMCIA configuration. If the device is 381 device, and release the PCMCIA configuration. If the device is
382 still open, this will be postponed until it is closed. 382 still open, this will be postponed until it is closed.
383 383
384 ======================================================================*/ 384 ======================================================================*/
385 385
386static void atmel_release(struct pcmcia_device *link) 386static void atmel_release(struct pcmcia_device *link)
@@ -517,7 +517,7 @@ static void atmel_cs_cleanup(void)
517 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 517 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
518 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 518 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
519 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 519 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
520 POSSIBILITY OF SUCH DAMAGE. 520 POSSIBILITY OF SUCH DAMAGE.
521*/ 521*/
522 522
523module_init(atmel_cs_init); 523module_init(atmel_cs_init);