diff options
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 58dc7c3835f4..88f180e98e81 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -86,8 +86,8 @@ static char *version = | |||
86 | 86 | ||
87 | /*====================================================================*/ | 87 | /*====================================================================*/ |
88 | 88 | ||
89 | static void axnet_config(dev_link_t *link); | 89 | static void axnet_config(struct pcmcia_device *link); |
90 | static void axnet_release(dev_link_t *link); | 90 | static void axnet_release(struct pcmcia_device *link); |
91 | static int axnet_open(struct net_device *dev); | 91 | static int axnet_open(struct net_device *dev); |
92 | static int axnet_close(struct net_device *dev); | 92 | static int axnet_close(struct net_device *dev); |
93 | static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 93 | static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
@@ -142,11 +142,10 @@ static inline axnet_dev_t *PRIV(struct net_device *dev) | |||
142 | 142 | ||
143 | ======================================================================*/ | 143 | ======================================================================*/ |
144 | 144 | ||
145 | static int axnet_attach(struct pcmcia_device *p_dev) | 145 | static int axnet_attach(struct pcmcia_device *link) |
146 | { | 146 | { |
147 | axnet_dev_t *info; | 147 | axnet_dev_t *info; |
148 | struct net_device *dev; | 148 | struct net_device *dev; |
149 | dev_link_t *link = dev_to_instance(p_dev); | ||
150 | 149 | ||
151 | DEBUG(0, "axnet_attach()\n"); | 150 | DEBUG(0, "axnet_attach()\n"); |
152 | 151 | ||
@@ -157,7 +156,7 @@ static int axnet_attach(struct pcmcia_device *p_dev) | |||
157 | return -ENOMEM; | 156 | return -ENOMEM; |
158 | 157 | ||
159 | info = PRIV(dev); | 158 | info = PRIV(dev); |
160 | info->p_dev = p_dev; | 159 | info->p_dev = link; |
161 | link->priv = dev; | 160 | link->priv = dev; |
162 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 161 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
163 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 162 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
@@ -184,9 +183,8 @@ static int axnet_attach(struct pcmcia_device *p_dev) | |||
184 | 183 | ||
185 | ======================================================================*/ | 184 | ======================================================================*/ |
186 | 185 | ||
187 | static void axnet_detach(struct pcmcia_device *p_dev) | 186 | static void axnet_detach(struct pcmcia_device *link) |
188 | { | 187 | { |
189 | dev_link_t *link = dev_to_instance(p_dev); | ||
190 | struct net_device *dev = link->priv; | 188 | struct net_device *dev = link->priv; |
191 | 189 | ||
192 | DEBUG(0, "axnet_detach(0x%p)\n", link); | 190 | DEBUG(0, "axnet_detach(0x%p)\n", link); |
@@ -206,7 +204,7 @@ static void axnet_detach(struct pcmcia_device *p_dev) | |||
206 | 204 | ||
207 | ======================================================================*/ | 205 | ======================================================================*/ |
208 | 206 | ||
209 | static int get_prom(dev_link_t *link) | 207 | static int get_prom(struct pcmcia_device *link) |
210 | { | 208 | { |
211 | struct net_device *dev = link->priv; | 209 | struct net_device *dev = link->priv; |
212 | kio_addr_t ioaddr = dev->base_addr; | 210 | kio_addr_t ioaddr = dev->base_addr; |
@@ -260,7 +258,7 @@ static int get_prom(dev_link_t *link) | |||
260 | #define CS_CHECK(fn, ret) \ | 258 | #define CS_CHECK(fn, ret) \ |
261 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 259 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
262 | 260 | ||
263 | static int try_io_port(dev_link_t *link) | 261 | static int try_io_port(struct pcmcia_device *link) |
264 | { | 262 | { |
265 | int j, ret; | 263 | int j, ret; |
266 | if (link->io.NumPorts1 == 32) { | 264 | if (link->io.NumPorts1 == 32) { |
@@ -281,18 +279,17 @@ static int try_io_port(dev_link_t *link) | |||
281 | for (j = 0; j < 0x400; j += 0x20) { | 279 | for (j = 0; j < 0x400; j += 0x20) { |
282 | link->io.BasePort1 = j ^ 0x300; | 280 | link->io.BasePort1 = j ^ 0x300; |
283 | link->io.BasePort2 = (j ^ 0x300) + 0x10; | 281 | link->io.BasePort2 = (j ^ 0x300) + 0x10; |
284 | ret = pcmcia_request_io(link->handle, &link->io); | 282 | ret = pcmcia_request_io(link, &link->io); |
285 | if (ret == CS_SUCCESS) return ret; | 283 | if (ret == CS_SUCCESS) return ret; |
286 | } | 284 | } |
287 | return ret; | 285 | return ret; |
288 | } else { | 286 | } else { |
289 | return pcmcia_request_io(link->handle, &link->io); | 287 | return pcmcia_request_io(link, &link->io); |
290 | } | 288 | } |
291 | } | 289 | } |
292 | 290 | ||
293 | static void axnet_config(dev_link_t *link) | 291 | static void axnet_config(struct pcmcia_device *link) |
294 | { | 292 | { |
295 | client_handle_t handle = link->handle; | ||
296 | struct net_device *dev = link->priv; | 293 | struct net_device *dev = link->priv; |
297 | axnet_dev_t *info = PRIV(dev); | 294 | axnet_dev_t *info = PRIV(dev); |
298 | tuple_t tuple; | 295 | tuple_t tuple; |
@@ -307,9 +304,9 @@ static void axnet_config(dev_link_t *link) | |||
307 | tuple.TupleDataMax = sizeof(buf); | 304 | tuple.TupleDataMax = sizeof(buf); |
308 | tuple.TupleOffset = 0; | 305 | tuple.TupleOffset = 0; |
309 | tuple.DesiredTuple = CISTPL_CONFIG; | 306 | tuple.DesiredTuple = CISTPL_CONFIG; |
310 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 307 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
311 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 308 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
312 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 309 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
313 | link->conf.ConfigBase = parse.config.base; | 310 | link->conf.ConfigBase = parse.config.base; |
314 | /* don't trust the CIS on this; Linksys got it wrong */ | 311 | /* don't trust the CIS on this; Linksys got it wrong */ |
315 | link->conf.Present = 0x63; | 312 | link->conf.Present = 0x63; |
@@ -319,13 +316,13 @@ static void axnet_config(dev_link_t *link) | |||
319 | 316 | ||
320 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 317 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
321 | tuple.Attributes = 0; | 318 | tuple.Attributes = 0; |
322 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 319 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
323 | while (last_ret == CS_SUCCESS) { | 320 | while (last_ret == CS_SUCCESS) { |
324 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 321 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
325 | cistpl_io_t *io = &(parse.cftable_entry.io); | 322 | cistpl_io_t *io = &(parse.cftable_entry.io); |
326 | 323 | ||
327 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 324 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
328 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0 || | 325 | pcmcia_parse_tuple(link, &tuple, &parse) != 0 || |
329 | cfg->index == 0 || cfg->io.nwin == 0) | 326 | cfg->index == 0 || cfg->io.nwin == 0) |
330 | goto next_entry; | 327 | goto next_entry; |
331 | 328 | ||
@@ -347,21 +344,21 @@ static void axnet_config(dev_link_t *link) | |||
347 | if (last_ret == CS_SUCCESS) break; | 344 | if (last_ret == CS_SUCCESS) break; |
348 | } | 345 | } |
349 | next_entry: | 346 | next_entry: |
350 | last_ret = pcmcia_get_next_tuple(handle, &tuple); | 347 | last_ret = pcmcia_get_next_tuple(link, &tuple); |
351 | } | 348 | } |
352 | if (last_ret != CS_SUCCESS) { | 349 | if (last_ret != CS_SUCCESS) { |
353 | cs_error(handle, RequestIO, last_ret); | 350 | cs_error(link, RequestIO, last_ret); |
354 | goto failed; | 351 | goto failed; |
355 | } | 352 | } |
356 | 353 | ||
357 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 354 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
358 | 355 | ||
359 | if (link->io.NumPorts2 == 8) { | 356 | if (link->io.NumPorts2 == 8) { |
360 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 357 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
361 | link->conf.Status = CCSR_AUDIO_ENA; | 358 | link->conf.Status = CCSR_AUDIO_ENA; |
362 | } | 359 | } |
363 | 360 | ||
364 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 361 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
365 | dev->irq = link->irq.AssignedIRQ; | 362 | dev->irq = link->irq.AssignedIRQ; |
366 | dev->base_addr = link->io.BasePort1; | 363 | dev->base_addr = link->io.BasePort1; |
367 | 364 | ||
@@ -398,7 +395,7 @@ static void axnet_config(dev_link_t *link) | |||
398 | Bit 2 of CCSR is active low. */ | 395 | Bit 2 of CCSR is active low. */ |
399 | if (i == 32) { | 396 | if (i == 32) { |
400 | conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; | 397 | conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; |
401 | pcmcia_access_configuration_register(link->handle, ®); | 398 | pcmcia_access_configuration_register(link, ®); |
402 | for (i = 0; i < 32; i++) { | 399 | for (i = 0; i < 32; i++) { |
403 | j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); | 400 | j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); |
404 | if ((j != 0) && (j != 0xffff)) break; | 401 | if ((j != 0) && (j != 0xffff)) break; |
@@ -408,7 +405,7 @@ static void axnet_config(dev_link_t *link) | |||
408 | info->phy_id = (i < 32) ? i : -1; | 405 | info->phy_id = (i < 32) ? i : -1; |
409 | link->dev_node = &info->node; | 406 | link->dev_node = &info->node; |
410 | link->state &= ~DEV_CONFIG_PENDING; | 407 | link->state &= ~DEV_CONFIG_PENDING; |
411 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 408 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
412 | 409 | ||
413 | if (register_netdev(dev) != 0) { | 410 | if (register_netdev(dev) != 0) { |
414 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); | 411 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); |
@@ -431,7 +428,7 @@ static void axnet_config(dev_link_t *link) | |||
431 | return; | 428 | return; |
432 | 429 | ||
433 | cs_failed: | 430 | cs_failed: |
434 | cs_error(link->handle, last_fn, last_ret); | 431 | cs_error(link, last_fn, last_ret); |
435 | failed: | 432 | failed: |
436 | axnet_release(link); | 433 | axnet_release(link); |
437 | link->state &= ~DEV_CONFIG_PENDING; | 434 | link->state &= ~DEV_CONFIG_PENDING; |
@@ -446,14 +443,13 @@ failed: | |||
446 | 443 | ||
447 | ======================================================================*/ | 444 | ======================================================================*/ |
448 | 445 | ||
449 | static void axnet_release(dev_link_t *link) | 446 | static void axnet_release(struct pcmcia_device *link) |
450 | { | 447 | { |
451 | pcmcia_disable_device(link->handle); | 448 | pcmcia_disable_device(link); |
452 | } | 449 | } |
453 | 450 | ||
454 | static int axnet_suspend(struct pcmcia_device *p_dev) | 451 | static int axnet_suspend(struct pcmcia_device *link) |
455 | { | 452 | { |
456 | dev_link_t *link = dev_to_instance(p_dev); | ||
457 | struct net_device *dev = link->priv; | 453 | struct net_device *dev = link->priv; |
458 | 454 | ||
459 | if ((link->state & DEV_CONFIG) && (link->open)) | 455 | if ((link->state & DEV_CONFIG) && (link->open)) |
@@ -462,9 +458,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev) | |||
462 | return 0; | 458 | return 0; |
463 | } | 459 | } |
464 | 460 | ||
465 | static int axnet_resume(struct pcmcia_device *p_dev) | 461 | static int axnet_resume(struct pcmcia_device *link) |
466 | { | 462 | { |
467 | dev_link_t *link = dev_to_instance(p_dev); | ||
468 | struct net_device *dev = link->priv; | 463 | struct net_device *dev = link->priv; |
469 | 464 | ||
470 | if ((link->state & DEV_CONFIG) && (link->open)) { | 465 | if ((link->state & DEV_CONFIG) && (link->open)) { |
@@ -540,7 +535,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value) | |||
540 | static int axnet_open(struct net_device *dev) | 535 | static int axnet_open(struct net_device *dev) |
541 | { | 536 | { |
542 | axnet_dev_t *info = PRIV(dev); | 537 | axnet_dev_t *info = PRIV(dev); |
543 | dev_link_t *link = info->p_dev; | 538 | struct pcmcia_device *link = info->p_dev; |
544 | 539 | ||
545 | DEBUG(2, "axnet_open('%s')\n", dev->name); | 540 | DEBUG(2, "axnet_open('%s')\n", dev->name); |
546 | 541 | ||
@@ -566,7 +561,7 @@ static int axnet_open(struct net_device *dev) | |||
566 | static int axnet_close(struct net_device *dev) | 561 | static int axnet_close(struct net_device *dev) |
567 | { | 562 | { |
568 | axnet_dev_t *info = PRIV(dev); | 563 | axnet_dev_t *info = PRIV(dev); |
569 | dev_link_t *link = info->p_dev; | 564 | struct pcmcia_device *link = info->p_dev; |
570 | 565 | ||
571 | DEBUG(2, "axnet_close('%s')\n", dev->name); | 566 | DEBUG(2, "axnet_close('%s')\n", dev->name); |
572 | 567 | ||