aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index b65758d3c6c5..f4e293bd04dc 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -225,8 +225,8 @@ static char mii_preamble_required = 0;
225 225
226/* Index of functions. */ 226/* Index of functions. */
227 227
228static void tc574_config(dev_link_t *link); 228static void tc574_config(struct pcmcia_device *link);
229static void tc574_release(dev_link_t *link); 229static void tc574_release(struct pcmcia_device *link);
230 230
231static void mdio_sync(kio_addr_t ioaddr, int bits); 231static void mdio_sync(kio_addr_t ioaddr, int bits);
232static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); 232static int mdio_read(kio_addr_t ioaddr, int phy_id, int location);
@@ -256,11 +256,10 @@ static void tc574_detach(struct pcmcia_device *p_dev);
256 with Card Services. 256 with Card Services.
257*/ 257*/
258 258
259static int tc574_attach(struct pcmcia_device *p_dev) 259static int tc574_attach(struct pcmcia_device *link)
260{ 260{
261 struct el3_private *lp; 261 struct el3_private *lp;
262 struct net_device *dev; 262 struct net_device *dev;
263 dev_link_t *link = dev_to_instance(p_dev);
264 263
265 DEBUG(0, "3c574_attach()\n"); 264 DEBUG(0, "3c574_attach()\n");
266 265
@@ -270,7 +269,7 @@ static int tc574_attach(struct pcmcia_device *p_dev)
270 return -ENOMEM; 269 return -ENOMEM;
271 lp = netdev_priv(dev); 270 lp = netdev_priv(dev);
272 link->priv = dev; 271 link->priv = dev;
273 lp->p_dev = p_dev; 272 lp->p_dev = link;
274 273
275 spin_lock_init(&lp->window_lock); 274 spin_lock_init(&lp->window_lock);
276 link->io.NumPorts1 = 32; 275 link->io.NumPorts1 = 32;
@@ -312,9 +311,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
312 311
313*/ 312*/
314 313
315static void tc574_detach(struct pcmcia_device *p_dev) 314static void tc574_detach(struct pcmcia_device *link)
316{ 315{
317 dev_link_t *link = dev_to_instance(p_dev);
318 struct net_device *dev = link->priv; 316 struct net_device *dev = link->priv;
319 317
320 DEBUG(0, "3c574_detach(0x%p)\n", link); 318 DEBUG(0, "3c574_detach(0x%p)\n", link);
@@ -339,9 +337,8 @@ static void tc574_detach(struct pcmcia_device *p_dev)
339 337
340static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 338static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
341 339
342static void tc574_config(dev_link_t *link) 340static void tc574_config(struct pcmcia_device *link)
343{ 341{
344 client_handle_t handle = link->handle;
345 struct net_device *dev = link->priv; 342 struct net_device *dev = link->priv;
346 struct el3_private *lp = netdev_priv(dev); 343 struct el3_private *lp = netdev_priv(dev);
347 tuple_t tuple; 344 tuple_t tuple;
@@ -359,12 +356,12 @@ static void tc574_config(dev_link_t *link)
359 356
360 tuple.Attributes = 0; 357 tuple.Attributes = 0;
361 tuple.DesiredTuple = CISTPL_CONFIG; 358 tuple.DesiredTuple = CISTPL_CONFIG;
362 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 359 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
363 tuple.TupleData = (cisdata_t *)buf; 360 tuple.TupleData = (cisdata_t *)buf;
364 tuple.TupleDataMax = 64; 361 tuple.TupleDataMax = 64;
365 tuple.TupleOffset = 0; 362 tuple.TupleOffset = 0;
366 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 363 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
367 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 364 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
368 link->conf.ConfigBase = parse.config.base; 365 link->conf.ConfigBase = parse.config.base;
369 link->conf.Present = parse.config.rmask[0]; 366 link->conf.Present = parse.config.rmask[0];
370 367
@@ -374,15 +371,15 @@ static void tc574_config(dev_link_t *link)
374 link->io.IOAddrLines = 16; 371 link->io.IOAddrLines = 16;
375 for (i = j = 0; j < 0x400; j += 0x20) { 372 for (i = j = 0; j < 0x400; j += 0x20) {
376 link->io.BasePort1 = j ^ 0x300; 373 link->io.BasePort1 = j ^ 0x300;
377 i = pcmcia_request_io(link->handle, &link->io); 374 i = pcmcia_request_io(link, &link->io);
378 if (i == CS_SUCCESS) break; 375 if (i == CS_SUCCESS) break;
379 } 376 }
380 if (i != CS_SUCCESS) { 377 if (i != CS_SUCCESS) {
381 cs_error(link->handle, RequestIO, i); 378 cs_error(link, RequestIO, i);
382 goto failed; 379 goto failed;
383 } 380 }
384 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 381 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
385 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 382 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
386 383
387 dev->irq = link->irq.AssignedIRQ; 384 dev->irq = link->irq.AssignedIRQ;
388 dev->base_addr = link->io.BasePort1; 385 dev->base_addr = link->io.BasePort1;
@@ -393,8 +390,8 @@ static void tc574_config(dev_link_t *link)
393 the hardware address. The future products may include a modem chip 390 the hardware address. The future products may include a modem chip
394 and put the address in the CIS. */ 391 and put the address in the CIS. */
395 tuple.DesiredTuple = 0x88; 392 tuple.DesiredTuple = 0x88;
396 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { 393 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
397 pcmcia_get_tuple_data(handle, &tuple); 394 pcmcia_get_tuple_data(link, &tuple);
398 for (i = 0; i < 3; i++) 395 for (i = 0; i < 3; i++)
399 phys_addr[i] = htons(buf[i]); 396 phys_addr[i] = htons(buf[i]);
400 } else { 397 } else {
@@ -408,9 +405,9 @@ static void tc574_config(dev_link_t *link)
408 } 405 }
409 } 406 }
410 tuple.DesiredTuple = CISTPL_VERS_1; 407 tuple.DesiredTuple = CISTPL_VERS_1;
411 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS && 408 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
412 pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS && 409 pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
413 pcmcia_parse_tuple(handle, &tuple, &parse) == CS_SUCCESS) { 410 pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
414 cardname = parse.version_1.str + parse.version_1.ofs[1]; 411 cardname = parse.version_1.str + parse.version_1.ofs[1];
415 } else 412 } else
416 cardname = "3Com 3c574"; 413 cardname = "3Com 3c574";
@@ -471,7 +468,7 @@ static void tc574_config(dev_link_t *link)
471 468
472 link->state &= ~DEV_CONFIG_PENDING; 469 link->state &= ~DEV_CONFIG_PENDING;
473 link->dev_node = &lp->node; 470 link->dev_node = &lp->node;
474 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 471 SET_NETDEV_DEV(dev, &handle_to_dev(link));
475 472
476 if (register_netdev(dev) != 0) { 473 if (register_netdev(dev) != 0) {
477 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 474 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
@@ -492,7 +489,7 @@ static void tc574_config(dev_link_t *link)
492 return; 489 return;
493 490
494cs_failed: 491cs_failed:
495 cs_error(link->handle, last_fn, last_ret); 492 cs_error(link, last_fn, last_ret);
496failed: 493failed:
497 tc574_release(link); 494 tc574_release(link);
498 return; 495 return;
@@ -505,14 +502,13 @@ failed:
505 still open, this will be postponed until it is closed. 502 still open, this will be postponed until it is closed.
506*/ 503*/
507 504
508static void tc574_release(dev_link_t *link) 505static void tc574_release(struct pcmcia_device *link)
509{ 506{
510 pcmcia_disable_device(link->handle); 507 pcmcia_disable_device(link);
511} 508}
512 509
513static int tc574_suspend(struct pcmcia_device *p_dev) 510static int tc574_suspend(struct pcmcia_device *link)
514{ 511{
515 dev_link_t *link = dev_to_instance(p_dev);
516 struct net_device *dev = link->priv; 512 struct net_device *dev = link->priv;
517 513
518 if ((link->state & DEV_CONFIG) && (link->open)) 514 if ((link->state & DEV_CONFIG) && (link->open))
@@ -521,9 +517,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev)
521 return 0; 517 return 0;
522} 518}
523 519
524static int tc574_resume(struct pcmcia_device *p_dev) 520static int tc574_resume(struct pcmcia_device *link)
525{ 521{
526 dev_link_t *link = dev_to_instance(p_dev);
527 struct net_device *dev = link->priv; 522 struct net_device *dev = link->priv;
528 523
529 if ((link->state & DEV_CONFIG) && (link->open)) { 524 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -739,7 +734,7 @@ static void tc574_reset(struct net_device *dev)
739static int el3_open(struct net_device *dev) 734static int el3_open(struct net_device *dev)
740{ 735{
741 struct el3_private *lp = netdev_priv(dev); 736 struct el3_private *lp = netdev_priv(dev);
742 dev_link_t *link = lp->p_dev; 737 struct pcmcia_device *link = lp->p_dev;
743 738
744 if (!DEV_OK(link)) 739 if (!DEV_OK(link))
745 return -ENODEV; 740 return -ENODEV;
@@ -1185,7 +1180,7 @@ static int el3_close(struct net_device *dev)
1185{ 1180{
1186 kio_addr_t ioaddr = dev->base_addr; 1181 kio_addr_t ioaddr = dev->base_addr;
1187 struct el3_private *lp = netdev_priv(dev); 1182 struct el3_private *lp = netdev_priv(dev);
1188 dev_link_t *link = lp->p_dev; 1183 struct pcmcia_device *link = lp->p_dev;
1189 1184
1190 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1185 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
1191 1186