aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-01-19 05:58:12 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-02-15 03:26:30 -0500
commitc556167f819160e157b4d73937885de8754ea53c (patch)
tree6ffc0cb2346d1dc0e14215db2ea9497161ae00d1 /drivers/net/fec.c
parente497ba825b60727f02d8bc21869f445c5aad34e2 (diff)
net/fec: consistenly name struct net_device pointers "ndev"
A variable named "dev" usually (usually subjective) points to a struct device. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c242
1 files changed, 121 insertions, 121 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index d3dbff514d67..c70503a065bb 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -206,11 +206,11 @@ struct fec_enet_private {
206}; 206};
207 207
208static irqreturn_t fec_enet_interrupt(int irq, void * dev_id); 208static irqreturn_t fec_enet_interrupt(int irq, void * dev_id);
209static void fec_enet_tx(struct net_device *dev); 209static void fec_enet_tx(struct net_device *ndev);
210static void fec_enet_rx(struct net_device *dev); 210static void fec_enet_rx(struct net_device *ndev);
211static int fec_enet_close(struct net_device *dev); 211static int fec_enet_close(struct net_device *ndev);
212static void fec_restart(struct net_device *dev, int duplex); 212static void fec_restart(struct net_device *ndev, int duplex);
213static void fec_stop(struct net_device *dev); 213static void fec_stop(struct net_device *ndev);
214 214
215/* FEC MII MMFR bits definition */ 215/* FEC MII MMFR bits definition */
216#define FEC_MMFR_ST (1 << 30) 216#define FEC_MMFR_ST (1 << 30)
@@ -238,9 +238,9 @@ static void *swap_buffer(void *bufaddr, int len)
238} 238}
239 239
240static netdev_tx_t 240static netdev_tx_t
241fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) 241fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
242{ 242{
243 struct fec_enet_private *fep = netdev_priv(dev); 243 struct fec_enet_private *fep = netdev_priv(ndev);
244 const struct platform_device_id *id_entry = 244 const struct platform_device_id *id_entry =
245 platform_get_device_id(fep->pdev); 245 platform_get_device_id(fep->pdev);
246 struct bufdesc *bdp; 246 struct bufdesc *bdp;
@@ -261,9 +261,9 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
261 261
262 if (status & BD_ENET_TX_READY) { 262 if (status & BD_ENET_TX_READY) {
263 /* Ooops. All transmit buffers are full. Bail out. 263 /* Ooops. All transmit buffers are full. Bail out.
264 * This should not happen, since dev->tbusy should be set. 264 * This should not happen, since ndev->tbusy should be set.
265 */ 265 */
266 printk("%s: tx queue full!.\n", dev->name); 266 printk("%s: tx queue full!.\n", ndev->name);
267 spin_unlock_irqrestore(&fep->hw_lock, flags); 267 spin_unlock_irqrestore(&fep->hw_lock, flags);
268 return NETDEV_TX_BUSY; 268 return NETDEV_TX_BUSY;
269 } 269 }
@@ -298,13 +298,13 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
298 /* Save skb pointer */ 298 /* Save skb pointer */
299 fep->tx_skbuff[fep->skb_cur] = skb; 299 fep->tx_skbuff[fep->skb_cur] = skb;
300 300
301 dev->stats.tx_bytes += skb->len; 301 ndev->stats.tx_bytes += skb->len;
302 fep->skb_cur = (fep->skb_cur+1) & TX_RING_MOD_MASK; 302 fep->skb_cur = (fep->skb_cur+1) & TX_RING_MOD_MASK;
303 303
304 /* Push the data cache so the CPM does not get stale memory 304 /* Push the data cache so the CPM does not get stale memory
305 * data. 305 * data.
306 */ 306 */
307 bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr, 307 bdp->cbd_bufaddr = dma_map_single(&ndev->dev, bufaddr,
308 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); 308 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
309 309
310 /* Send it on its way. Tell FEC it's ready, interrupt when done, 310 /* Send it on its way. Tell FEC it's ready, interrupt when done,
@@ -325,7 +325,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
325 325
326 if (bdp == fep->dirty_tx) { 326 if (bdp == fep->dirty_tx) {
327 fep->tx_full = 1; 327 fep->tx_full = 1;
328 netif_stop_queue(dev); 328 netif_stop_queue(ndev);
329 } 329 }
330 330
331 fep->cur_tx = bdp; 331 fep->cur_tx = bdp;
@@ -336,22 +336,22 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
336} 336}
337 337
338static void 338static void
339fec_timeout(struct net_device *dev) 339fec_timeout(struct net_device *ndev)
340{ 340{
341 struct fec_enet_private *fep = netdev_priv(dev); 341 struct fec_enet_private *fep = netdev_priv(ndev);
342 342
343 dev->stats.tx_errors++; 343 ndev->stats.tx_errors++;
344 344
345 fec_restart(dev, fep->full_duplex); 345 fec_restart(ndev, fep->full_duplex);
346 netif_wake_queue(dev); 346 netif_wake_queue(ndev);
347} 347}
348 348
349static irqreturn_t 349static irqreturn_t
350fec_enet_interrupt(int irq, void * dev_id) 350fec_enet_interrupt(int irq, void *dev_id)
351{ 351{
352 struct net_device *dev = dev_id; 352 struct net_device *ndev = dev_id;
353 struct fec_enet_private *fep = netdev_priv(dev); 353 struct fec_enet_private *fep = netdev_priv(ndev);
354 uint int_events; 354 uint int_events;
355 irqreturn_t ret = IRQ_NONE; 355 irqreturn_t ret = IRQ_NONE;
356 356
357 do { 357 do {
@@ -360,7 +360,7 @@ fec_enet_interrupt(int irq, void * dev_id)
360 360
361 if (int_events & FEC_ENET_RXF) { 361 if (int_events & FEC_ENET_RXF) {
362 ret = IRQ_HANDLED; 362 ret = IRQ_HANDLED;
363 fec_enet_rx(dev); 363 fec_enet_rx(ndev);
364 } 364 }
365 365
366 /* Transmit OK, or non-fatal error. Update the buffer 366 /* Transmit OK, or non-fatal error. Update the buffer
@@ -369,7 +369,7 @@ fec_enet_interrupt(int irq, void * dev_id)
369 */ 369 */
370 if (int_events & FEC_ENET_TXF) { 370 if (int_events & FEC_ENET_TXF) {
371 ret = IRQ_HANDLED; 371 ret = IRQ_HANDLED;
372 fec_enet_tx(dev); 372 fec_enet_tx(ndev);
373 } 373 }
374 374
375 if (int_events & FEC_ENET_MII) { 375 if (int_events & FEC_ENET_MII) {
@@ -383,14 +383,14 @@ fec_enet_interrupt(int irq, void * dev_id)
383 383
384 384
385static void 385static void
386fec_enet_tx(struct net_device *dev) 386fec_enet_tx(struct net_device *ndev)
387{ 387{
388 struct fec_enet_private *fep; 388 struct fec_enet_private *fep;
389 struct bufdesc *bdp; 389 struct bufdesc *bdp;
390 unsigned short status; 390 unsigned short status;
391 struct sk_buff *skb; 391 struct sk_buff *skb;
392 392
393 fep = netdev_priv(dev); 393 fep = netdev_priv(ndev);
394 spin_lock(&fep->hw_lock); 394 spin_lock(&fep->hw_lock);
395 bdp = fep->dirty_tx; 395 bdp = fep->dirty_tx;
396 396
@@ -398,7 +398,7 @@ fec_enet_tx(struct net_device *dev)
398 if (bdp == fep->cur_tx && fep->tx_full == 0) 398 if (bdp == fep->cur_tx && fep->tx_full == 0)
399 break; 399 break;
400 400
401 dma_unmap_single(&dev->dev, bdp->cbd_bufaddr, FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); 401 dma_unmap_single(&ndev->dev, bdp->cbd_bufaddr, FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
402 bdp->cbd_bufaddr = 0; 402 bdp->cbd_bufaddr = 0;
403 403
404 skb = fep->tx_skbuff[fep->skb_dirty]; 404 skb = fep->tx_skbuff[fep->skb_dirty];
@@ -406,19 +406,19 @@ fec_enet_tx(struct net_device *dev)
406 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | 406 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC |
407 BD_ENET_TX_RL | BD_ENET_TX_UN | 407 BD_ENET_TX_RL | BD_ENET_TX_UN |
408 BD_ENET_TX_CSL)) { 408 BD_ENET_TX_CSL)) {
409 dev->stats.tx_errors++; 409 ndev->stats.tx_errors++;
410 if (status & BD_ENET_TX_HB) /* No heartbeat */ 410 if (status & BD_ENET_TX_HB) /* No heartbeat */
411 dev->stats.tx_heartbeat_errors++; 411 ndev->stats.tx_heartbeat_errors++;
412 if (status & BD_ENET_TX_LC) /* Late collision */ 412 if (status & BD_ENET_TX_LC) /* Late collision */
413 dev->stats.tx_window_errors++; 413 ndev->stats.tx_window_errors++;
414 if (status & BD_ENET_TX_RL) /* Retrans limit */ 414 if (status & BD_ENET_TX_RL) /* Retrans limit */
415 dev->stats.tx_aborted_errors++; 415 ndev->stats.tx_aborted_errors++;
416 if (status & BD_ENET_TX_UN) /* Underrun */ 416 if (status & BD_ENET_TX_UN) /* Underrun */
417 dev->stats.tx_fifo_errors++; 417 ndev->stats.tx_fifo_errors++;
418 if (status & BD_ENET_TX_CSL) /* Carrier lost */ 418 if (status & BD_ENET_TX_CSL) /* Carrier lost */
419 dev->stats.tx_carrier_errors++; 419 ndev->stats.tx_carrier_errors++;
420 } else { 420 } else {
421 dev->stats.tx_packets++; 421 ndev->stats.tx_packets++;
422 } 422 }
423 423
424 if (status & BD_ENET_TX_READY) 424 if (status & BD_ENET_TX_READY)
@@ -428,7 +428,7 @@ fec_enet_tx(struct net_device *dev)
428 * but we eventually sent the packet OK. 428 * but we eventually sent the packet OK.
429 */ 429 */
430 if (status & BD_ENET_TX_DEF) 430 if (status & BD_ENET_TX_DEF)
431 dev->stats.collisions++; 431 ndev->stats.collisions++;
432 432
433 /* Free the sk buffer associated with this last transmit */ 433 /* Free the sk buffer associated with this last transmit */
434 dev_kfree_skb_any(skb); 434 dev_kfree_skb_any(skb);
@@ -445,8 +445,8 @@ fec_enet_tx(struct net_device *dev)
445 */ 445 */
446 if (fep->tx_full) { 446 if (fep->tx_full) {
447 fep->tx_full = 0; 447 fep->tx_full = 0;
448 if (netif_queue_stopped(dev)) 448 if (netif_queue_stopped(ndev))
449 netif_wake_queue(dev); 449 netif_wake_queue(ndev);
450 } 450 }
451 } 451 }
452 fep->dirty_tx = bdp; 452 fep->dirty_tx = bdp;
@@ -460,9 +460,9 @@ fec_enet_tx(struct net_device *dev)
460 * effectively tossing the packet. 460 * effectively tossing the packet.
461 */ 461 */
462static void 462static void
463fec_enet_rx(struct net_device *dev) 463fec_enet_rx(struct net_device *ndev)
464{ 464{
465 struct fec_enet_private *fep = netdev_priv(dev); 465 struct fec_enet_private *fep = netdev_priv(ndev);
466 const struct platform_device_id *id_entry = 466 const struct platform_device_id *id_entry =
467 platform_get_device_id(fep->pdev); 467 platform_get_device_id(fep->pdev);
468 struct bufdesc *bdp; 468 struct bufdesc *bdp;
@@ -496,17 +496,17 @@ fec_enet_rx(struct net_device *dev)
496 /* Check for errors. */ 496 /* Check for errors. */
497 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO | 497 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_NO |
498 BD_ENET_RX_CR | BD_ENET_RX_OV)) { 498 BD_ENET_RX_CR | BD_ENET_RX_OV)) {
499 dev->stats.rx_errors++; 499 ndev->stats.rx_errors++;
500 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) { 500 if (status & (BD_ENET_RX_LG | BD_ENET_RX_SH)) {
501 /* Frame too long or too short. */ 501 /* Frame too long or too short. */
502 dev->stats.rx_length_errors++; 502 ndev->stats.rx_length_errors++;
503 } 503 }
504 if (status & BD_ENET_RX_NO) /* Frame alignment */ 504 if (status & BD_ENET_RX_NO) /* Frame alignment */
505 dev->stats.rx_frame_errors++; 505 ndev->stats.rx_frame_errors++;
506 if (status & BD_ENET_RX_CR) /* CRC Error */ 506 if (status & BD_ENET_RX_CR) /* CRC Error */
507 dev->stats.rx_crc_errors++; 507 ndev->stats.rx_crc_errors++;
508 if (status & BD_ENET_RX_OV) /* FIFO overrun */ 508 if (status & BD_ENET_RX_OV) /* FIFO overrun */
509 dev->stats.rx_fifo_errors++; 509 ndev->stats.rx_fifo_errors++;
510 } 510 }
511 511
512 /* Report late collisions as a frame error. 512 /* Report late collisions as a frame error.
@@ -514,15 +514,15 @@ fec_enet_rx(struct net_device *dev)
514 * have in the buffer. So, just drop this frame on the floor. 514 * have in the buffer. So, just drop this frame on the floor.
515 */ 515 */
516 if (status & BD_ENET_RX_CL) { 516 if (status & BD_ENET_RX_CL) {
517 dev->stats.rx_errors++; 517 ndev->stats.rx_errors++;
518 dev->stats.rx_frame_errors++; 518 ndev->stats.rx_frame_errors++;
519 goto rx_processing_done; 519 goto rx_processing_done;
520 } 520 }
521 521
522 /* Process the incoming frame. */ 522 /* Process the incoming frame. */
523 dev->stats.rx_packets++; 523 ndev->stats.rx_packets++;
524 pkt_len = bdp->cbd_datlen; 524 pkt_len = bdp->cbd_datlen;
525 dev->stats.rx_bytes += pkt_len; 525 ndev->stats.rx_bytes += pkt_len;
526 data = (__u8*)__va(bdp->cbd_bufaddr); 526 data = (__u8*)__va(bdp->cbd_bufaddr);
527 527
528 dma_unmap_single(NULL, bdp->cbd_bufaddr, bdp->cbd_datlen, 528 dma_unmap_single(NULL, bdp->cbd_bufaddr, bdp->cbd_datlen,
@@ -540,13 +540,13 @@ fec_enet_rx(struct net_device *dev)
540 540
541 if (unlikely(!skb)) { 541 if (unlikely(!skb)) {
542 printk("%s: Memory squeeze, dropping packet.\n", 542 printk("%s: Memory squeeze, dropping packet.\n",
543 dev->name); 543 ndev->name);
544 dev->stats.rx_dropped++; 544 ndev->stats.rx_dropped++;
545 } else { 545 } else {
546 skb_reserve(skb, NET_IP_ALIGN); 546 skb_reserve(skb, NET_IP_ALIGN);
547 skb_put(skb, pkt_len - 4); /* Make room */ 547 skb_put(skb, pkt_len - 4); /* Make room */
548 skb_copy_to_linear_data(skb, data, pkt_len - 4); 548 skb_copy_to_linear_data(skb, data, pkt_len - 4);
549 skb->protocol = eth_type_trans(skb, dev); 549 skb->protocol = eth_type_trans(skb, ndev);
550 netif_rx(skb); 550 netif_rx(skb);
551 } 551 }
552 552
@@ -577,9 +577,9 @@ rx_processing_done:
577} 577}
578 578
579/* ------------------------------------------------------------------------- */ 579/* ------------------------------------------------------------------------- */
580static void __inline__ fec_get_mac(struct net_device *dev) 580static void __inline__ fec_get_mac(struct net_device *ndev)
581{ 581{
582 struct fec_enet_private *fep = netdev_priv(dev); 582 struct fec_enet_private *fep = netdev_priv(ndev);
583 struct fec_platform_data *pdata = fep->pdev->dev.platform_data; 583 struct fec_platform_data *pdata = fep->pdev->dev.platform_data;
584 unsigned char *iap, tmpaddr[ETH_ALEN]; 584 unsigned char *iap, tmpaddr[ETH_ALEN];
585 585
@@ -615,11 +615,11 @@ static void __inline__ fec_get_mac(struct net_device *dev)
615 iap = &tmpaddr[0]; 615 iap = &tmpaddr[0];
616 } 616 }
617 617
618 memcpy(dev->dev_addr, iap, ETH_ALEN); 618 memcpy(ndev->dev_addr, iap, ETH_ALEN);
619 619
620 /* Adjust MAC if using macaddr */ 620 /* Adjust MAC if using macaddr */
621 if (iap == macaddr) 621 if (iap == macaddr)
622 dev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->pdev->id; 622 ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->pdev->id;
623} 623}
624 624
625/* ------------------------------------------------------------------------- */ 625/* ------------------------------------------------------------------------- */
@@ -627,9 +627,9 @@ static void __inline__ fec_get_mac(struct net_device *dev)
627/* 627/*
628 * Phy section 628 * Phy section
629 */ 629 */
630static void fec_enet_adjust_link(struct net_device *dev) 630static void fec_enet_adjust_link(struct net_device *ndev)
631{ 631{
632 struct fec_enet_private *fep = netdev_priv(dev); 632 struct fec_enet_private *fep = netdev_priv(ndev);
633 struct phy_device *phy_dev = fep->phy_dev; 633 struct phy_device *phy_dev = fep->phy_dev;
634 unsigned long flags; 634 unsigned long flags;
635 635
@@ -646,7 +646,7 @@ static void fec_enet_adjust_link(struct net_device *dev)
646 /* Duplex link change */ 646 /* Duplex link change */
647 if (phy_dev->link) { 647 if (phy_dev->link) {
648 if (fep->full_duplex != phy_dev->duplex) { 648 if (fep->full_duplex != phy_dev->duplex) {
649 fec_restart(dev, phy_dev->duplex); 649 fec_restart(ndev, phy_dev->duplex);
650 status_change = 1; 650 status_change = 1;
651 } 651 }
652 } 652 }
@@ -655,9 +655,9 @@ static void fec_enet_adjust_link(struct net_device *dev)
655 if (phy_dev->link != fep->link) { 655 if (phy_dev->link != fep->link) {
656 fep->link = phy_dev->link; 656 fep->link = phy_dev->link;
657 if (phy_dev->link) 657 if (phy_dev->link)
658 fec_restart(dev, phy_dev->duplex); 658 fec_restart(ndev, phy_dev->duplex);
659 else 659 else
660 fec_stop(dev); 660 fec_stop(ndev);
661 status_change = 1; 661 status_change = 1;
662 } 662 }
663 663
@@ -726,9 +726,9 @@ static int fec_enet_mdio_reset(struct mii_bus *bus)
726 return 0; 726 return 0;
727} 727}
728 728
729static int fec_enet_mii_probe(struct net_device *dev) 729static int fec_enet_mii_probe(struct net_device *ndev)
730{ 730{
731 struct fec_enet_private *fep = netdev_priv(dev); 731 struct fec_enet_private *fep = netdev_priv(ndev);
732 struct phy_device *phy_dev = NULL; 732 struct phy_device *phy_dev = NULL;
733 char mdio_bus_id[MII_BUS_ID_SIZE]; 733 char mdio_bus_id[MII_BUS_ID_SIZE];
734 char phy_name[MII_BUS_ID_SIZE + 3]; 734 char phy_name[MII_BUS_ID_SIZE + 3];
@@ -753,16 +753,16 @@ static int fec_enet_mii_probe(struct net_device *dev)
753 753
754 if (phy_id >= PHY_MAX_ADDR) { 754 if (phy_id >= PHY_MAX_ADDR) {
755 printk(KERN_INFO "%s: no PHY, assuming direct connection " 755 printk(KERN_INFO "%s: no PHY, assuming direct connection "
756 "to switch\n", dev->name); 756 "to switch\n", ndev->name);
757 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); 757 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
758 phy_id = 0; 758 phy_id = 0;
759 } 759 }
760 760
761 snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); 761 snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
762 phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0, 762 phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0,
763 PHY_INTERFACE_MODE_MII); 763 PHY_INTERFACE_MODE_MII);
764 if (IS_ERR(phy_dev)) { 764 if (IS_ERR(phy_dev)) {
765 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); 765 printk(KERN_ERR "%s: could not attach to PHY\n", ndev->name);
766 return PTR_ERR(phy_dev); 766 return PTR_ERR(phy_dev);
767 } 767 }
768 768
@@ -775,7 +775,7 @@ static int fec_enet_mii_probe(struct net_device *dev)
775 fep->full_duplex = 0; 775 fep->full_duplex = 0;
776 776
777 printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] " 777 printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] "
778 "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, 778 "(mii_bus:phy_addr=%s, irq=%d)\n", ndev->name,
779 fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev), 779 fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev),
780 fep->phy_dev->irq); 780 fep->phy_dev->irq);
781 781
@@ -785,8 +785,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
785static int fec_enet_mii_init(struct platform_device *pdev) 785static int fec_enet_mii_init(struct platform_device *pdev)
786{ 786{
787 static struct mii_bus *fec0_mii_bus; 787 static struct mii_bus *fec0_mii_bus;
788 struct net_device *dev = platform_get_drvdata(pdev); 788 struct net_device *ndev = platform_get_drvdata(pdev);
789 struct fec_enet_private *fep = netdev_priv(dev); 789 struct fec_enet_private *fep = netdev_priv(ndev);
790 const struct platform_device_id *id_entry = 790 const struct platform_device_id *id_entry =
791 platform_get_device_id(fep->pdev); 791 platform_get_device_id(fep->pdev);
792 int err = -ENXIO, i; 792 int err = -ENXIO, i;
@@ -844,7 +844,7 @@ static int fec_enet_mii_init(struct platform_device *pdev)
844 for (i = 0; i < PHY_MAX_ADDR; i++) 844 for (i = 0; i < PHY_MAX_ADDR; i++)
845 fep->mii_bus->irq[i] = PHY_POLL; 845 fep->mii_bus->irq[i] = PHY_POLL;
846 846
847 platform_set_drvdata(dev, fep->mii_bus); 847 platform_set_drvdata(ndev, fep->mii_bus);
848 848
849 if (mdiobus_register(fep->mii_bus)) 849 if (mdiobus_register(fep->mii_bus))
850 goto err_out_free_mdio_irq; 850 goto err_out_free_mdio_irq;
@@ -872,10 +872,10 @@ static void fec_enet_mii_remove(struct fec_enet_private *fep)
872 mdiobus_free(fep->mii_bus); 872 mdiobus_free(fep->mii_bus);
873} 873}
874 874
875static int fec_enet_get_settings(struct net_device *dev, 875static int fec_enet_get_settings(struct net_device *ndev,
876 struct ethtool_cmd *cmd) 876 struct ethtool_cmd *cmd)
877{ 877{
878 struct fec_enet_private *fep = netdev_priv(dev); 878 struct fec_enet_private *fep = netdev_priv(ndev);
879 struct phy_device *phydev = fep->phy_dev; 879 struct phy_device *phydev = fep->phy_dev;
880 880
881 if (!phydev) 881 if (!phydev)
@@ -884,10 +884,10 @@ static int fec_enet_get_settings(struct net_device *dev,
884 return phy_ethtool_gset(phydev, cmd); 884 return phy_ethtool_gset(phydev, cmd);
885} 885}
886 886
887static int fec_enet_set_settings(struct net_device *dev, 887static int fec_enet_set_settings(struct net_device *ndev,
888 struct ethtool_cmd *cmd) 888 struct ethtool_cmd *cmd)
889{ 889{
890 struct fec_enet_private *fep = netdev_priv(dev); 890 struct fec_enet_private *fep = netdev_priv(ndev);
891 struct phy_device *phydev = fep->phy_dev; 891 struct phy_device *phydev = fep->phy_dev;
892 892
893 if (!phydev) 893 if (!phydev)
@@ -896,14 +896,14 @@ static int fec_enet_set_settings(struct net_device *dev,
896 return phy_ethtool_sset(phydev, cmd); 896 return phy_ethtool_sset(phydev, cmd);
897} 897}
898 898
899static void fec_enet_get_drvinfo(struct net_device *dev, 899static void fec_enet_get_drvinfo(struct net_device *ndev,
900 struct ethtool_drvinfo *info) 900 struct ethtool_drvinfo *info)
901{ 901{
902 struct fec_enet_private *fep = netdev_priv(dev); 902 struct fec_enet_private *fep = netdev_priv(ndev);
903 903
904 strcpy(info->driver, fep->pdev->dev.driver->name); 904 strcpy(info->driver, fep->pdev->dev.driver->name);
905 strcpy(info->version, "Revision: 1.0"); 905 strcpy(info->version, "Revision: 1.0");
906 strcpy(info->bus_info, dev_name(&dev->dev)); 906 strcpy(info->bus_info, dev_name(&ndev->dev));
907} 907}
908 908
909static struct ethtool_ops fec_enet_ethtool_ops = { 909static struct ethtool_ops fec_enet_ethtool_ops = {
@@ -913,12 +913,12 @@ static struct ethtool_ops fec_enet_ethtool_ops = {
913 .get_link = ethtool_op_get_link, 913 .get_link = ethtool_op_get_link,
914}; 914};
915 915
916static int fec_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 916static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
917{ 917{
918 struct fec_enet_private *fep = netdev_priv(dev); 918 struct fec_enet_private *fep = netdev_priv(ndev);
919 struct phy_device *phydev = fep->phy_dev; 919 struct phy_device *phydev = fep->phy_dev;
920 920
921 if (!netif_running(dev)) 921 if (!netif_running(ndev))
922 return -EINVAL; 922 return -EINVAL;
923 923
924 if (!phydev) 924 if (!phydev)
@@ -927,9 +927,9 @@ static int fec_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
927 return phy_mii_ioctl(phydev, rq, cmd); 927 return phy_mii_ioctl(phydev, rq, cmd);
928} 928}
929 929
930static void fec_enet_free_buffers(struct net_device *dev) 930static void fec_enet_free_buffers(struct net_device *ndev)
931{ 931{
932 struct fec_enet_private *fep = netdev_priv(dev); 932 struct fec_enet_private *fep = netdev_priv(ndev);
933 int i; 933 int i;
934 struct sk_buff *skb; 934 struct sk_buff *skb;
935 struct bufdesc *bdp; 935 struct bufdesc *bdp;
@@ -939,7 +939,7 @@ static void fec_enet_free_buffers(struct net_device *dev)
939 skb = fep->rx_skbuff[i]; 939 skb = fep->rx_skbuff[i];
940 940
941 if (bdp->cbd_bufaddr) 941 if (bdp->cbd_bufaddr)
942 dma_unmap_single(&dev->dev, bdp->cbd_bufaddr, 942 dma_unmap_single(&ndev->dev, bdp->cbd_bufaddr,
943 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE); 943 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
944 if (skb) 944 if (skb)
945 dev_kfree_skb(skb); 945 dev_kfree_skb(skb);
@@ -951,9 +951,9 @@ static void fec_enet_free_buffers(struct net_device *dev)
951 kfree(fep->tx_bounce[i]); 951 kfree(fep->tx_bounce[i]);
952} 952}
953 953
954static int fec_enet_alloc_buffers(struct net_device *dev) 954static int fec_enet_alloc_buffers(struct net_device *ndev)
955{ 955{
956 struct fec_enet_private *fep = netdev_priv(dev); 956 struct fec_enet_private *fep = netdev_priv(ndev);
957 int i; 957 int i;
958 struct sk_buff *skb; 958 struct sk_buff *skb;
959 struct bufdesc *bdp; 959 struct bufdesc *bdp;
@@ -962,12 +962,12 @@ static int fec_enet_alloc_buffers(struct net_device *dev)
962 for (i = 0; i < RX_RING_SIZE; i++) { 962 for (i = 0; i < RX_RING_SIZE; i++) {
963 skb = dev_alloc_skb(FEC_ENET_RX_FRSIZE); 963 skb = dev_alloc_skb(FEC_ENET_RX_FRSIZE);
964 if (!skb) { 964 if (!skb) {
965 fec_enet_free_buffers(dev); 965 fec_enet_free_buffers(ndev);
966 return -ENOMEM; 966 return -ENOMEM;
967 } 967 }
968 fep->rx_skbuff[i] = skb; 968 fep->rx_skbuff[i] = skb;
969 969
970 bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data, 970 bdp->cbd_bufaddr = dma_map_single(&ndev->dev, skb->data,
971 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE); 971 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
972 bdp->cbd_sc = BD_ENET_RX_EMPTY; 972 bdp->cbd_sc = BD_ENET_RX_EMPTY;
973 bdp++; 973 bdp++;
@@ -994,47 +994,47 @@ static int fec_enet_alloc_buffers(struct net_device *dev)
994} 994}
995 995
996static int 996static int
997fec_enet_open(struct net_device *dev) 997fec_enet_open(struct net_device *ndev)
998{ 998{
999 struct fec_enet_private *fep = netdev_priv(dev); 999 struct fec_enet_private *fep = netdev_priv(ndev);
1000 int ret; 1000 int ret;
1001 1001
1002 /* I should reset the ring buffers here, but I don't yet know 1002 /* I should reset the ring buffers here, but I don't yet know
1003 * a simple way to do that. 1003 * a simple way to do that.
1004 */ 1004 */
1005 1005
1006 ret = fec_enet_alloc_buffers(dev); 1006 ret = fec_enet_alloc_buffers(ndev);
1007 if (ret) 1007 if (ret)
1008 return ret; 1008 return ret;
1009 1009
1010 /* Probe and connect to PHY when open the interface */ 1010 /* Probe and connect to PHY when open the interface */
1011 ret = fec_enet_mii_probe(dev); 1011 ret = fec_enet_mii_probe(ndev);
1012 if (ret) { 1012 if (ret) {
1013 fec_enet_free_buffers(dev); 1013 fec_enet_free_buffers(ndev);
1014 return ret; 1014 return ret;
1015 } 1015 }
1016 phy_start(fep->phy_dev); 1016 phy_start(fep->phy_dev);
1017 netif_start_queue(dev); 1017 netif_start_queue(ndev);
1018 fep->opened = 1; 1018 fep->opened = 1;
1019 return 0; 1019 return 0;
1020} 1020}
1021 1021
1022static int 1022static int
1023fec_enet_close(struct net_device *dev) 1023fec_enet_close(struct net_device *ndev)
1024{ 1024{
1025 struct fec_enet_private *fep = netdev_priv(dev); 1025 struct fec_enet_private *fep = netdev_priv(ndev);
1026 1026
1027 /* Don't know what to do yet. */ 1027 /* Don't know what to do yet. */
1028 fep->opened = 0; 1028 fep->opened = 0;
1029 netif_stop_queue(dev); 1029 netif_stop_queue(ndev);
1030 fec_stop(dev); 1030 fec_stop(ndev);
1031 1031
1032 if (fep->phy_dev) { 1032 if (fep->phy_dev) {
1033 phy_stop(fep->phy_dev); 1033 phy_stop(fep->phy_dev);
1034 phy_disconnect(fep->phy_dev); 1034 phy_disconnect(fep->phy_dev);
1035 } 1035 }
1036 1036
1037 fec_enet_free_buffers(dev); 1037 fec_enet_free_buffers(ndev);
1038 1038
1039 return 0; 1039 return 0;
1040} 1040}
@@ -1052,14 +1052,14 @@ fec_enet_close(struct net_device *dev)
1052#define HASH_BITS 6 /* #bits in hash */ 1052#define HASH_BITS 6 /* #bits in hash */
1053#define CRC32_POLY 0xEDB88320 1053#define CRC32_POLY 0xEDB88320
1054 1054
1055static void set_multicast_list(struct net_device *dev) 1055static void set_multicast_list(struct net_device *ndev)
1056{ 1056{
1057 struct fec_enet_private *fep = netdev_priv(dev); 1057 struct fec_enet_private *fep = netdev_priv(ndev);
1058 struct netdev_hw_addr *ha; 1058 struct netdev_hw_addr *ha;
1059 unsigned int i, bit, data, crc, tmp; 1059 unsigned int i, bit, data, crc, tmp;
1060 unsigned char hash; 1060 unsigned char hash;
1061 1061
1062 if (dev->flags & IFF_PROMISC) { 1062 if (ndev->flags & IFF_PROMISC) {
1063 tmp = readl(fep->hwp + FEC_R_CNTRL); 1063 tmp = readl(fep->hwp + FEC_R_CNTRL);
1064 tmp |= 0x8; 1064 tmp |= 0x8;
1065 writel(tmp, fep->hwp + FEC_R_CNTRL); 1065 writel(tmp, fep->hwp + FEC_R_CNTRL);
@@ -1070,7 +1070,7 @@ static void set_multicast_list(struct net_device *dev)
1070 tmp &= ~0x8; 1070 tmp &= ~0x8;
1071 writel(tmp, fep->hwp + FEC_R_CNTRL); 1071 writel(tmp, fep->hwp + FEC_R_CNTRL);
1072 1072
1073 if (dev->flags & IFF_ALLMULTI) { 1073 if (ndev->flags & IFF_ALLMULTI) {
1074 /* Catch all multicast addresses, so set the 1074 /* Catch all multicast addresses, so set the
1075 * filter to all 1's 1075 * filter to all 1's
1076 */ 1076 */
@@ -1085,7 +1085,7 @@ static void set_multicast_list(struct net_device *dev)
1085 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); 1085 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
1086 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); 1086 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
1087 1087
1088 netdev_for_each_mc_addr(ha, dev) { 1088 netdev_for_each_mc_addr(ha, ndev) {
1089 /* Only support group multicast for now */ 1089 /* Only support group multicast for now */
1090 if (!(ha->addr[0] & 1)) 1090 if (!(ha->addr[0] & 1))
1091 continue; 1091 continue;
@@ -1093,7 +1093,7 @@ static void set_multicast_list(struct net_device *dev)
1093 /* calculate crc32 value of mac address */ 1093 /* calculate crc32 value of mac address */
1094 crc = 0xffffffff; 1094 crc = 0xffffffff;
1095 1095
1096 for (i = 0; i < dev->addr_len; i++) { 1096 for (i = 0; i < ndev->addr_len; i++) {
1097 data = ha->addr[i]; 1097 data = ha->addr[i];
1098 for (bit = 0; bit < 8; bit++, data >>= 1) { 1098 for (bit = 0; bit < 8; bit++, data >>= 1) {
1099 crc = (crc >> 1) ^ 1099 crc = (crc >> 1) ^
@@ -1120,20 +1120,20 @@ static void set_multicast_list(struct net_device *dev)
1120 1120
1121/* Set a MAC change in hardware. */ 1121/* Set a MAC change in hardware. */
1122static int 1122static int
1123fec_set_mac_address(struct net_device *dev, void *p) 1123fec_set_mac_address(struct net_device *ndev, void *p)
1124{ 1124{
1125 struct fec_enet_private *fep = netdev_priv(dev); 1125 struct fec_enet_private *fep = netdev_priv(ndev);
1126 struct sockaddr *addr = p; 1126 struct sockaddr *addr = p;
1127 1127
1128 if (!is_valid_ether_addr(addr->sa_data)) 1128 if (!is_valid_ether_addr(addr->sa_data))
1129 return -EADDRNOTAVAIL; 1129 return -EADDRNOTAVAIL;
1130 1130
1131 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 1131 memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
1132 1132
1133 writel(dev->dev_addr[3] | (dev->dev_addr[2] << 8) | 1133 writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
1134 (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24), 1134 (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
1135 fep->hwp + FEC_ADDR_LOW); 1135 fep->hwp + FEC_ADDR_LOW);
1136 writel((dev->dev_addr[5] << 16) | (dev->dev_addr[4] << 24), 1136 writel((ndev->dev_addr[5] << 16) | (ndev->dev_addr[4] << 24),
1137 fep->hwp + FEC_ADDR_HIGH); 1137 fep->hwp + FEC_ADDR_HIGH);
1138 return 0; 1138 return 0;
1139} 1139}
@@ -1154,9 +1154,9 @@ static const struct net_device_ops fec_netdev_ops = {
1154 * XXX: We need to clean up on failure exits here. 1154 * XXX: We need to clean up on failure exits here.
1155 * 1155 *
1156 */ 1156 */
1157static int fec_enet_init(struct net_device *dev) 1157static int fec_enet_init(struct net_device *ndev)
1158{ 1158{
1159 struct fec_enet_private *fep = netdev_priv(dev); 1159 struct fec_enet_private *fep = netdev_priv(ndev);
1160 struct bufdesc *cbd_base; 1160 struct bufdesc *cbd_base;
1161 struct bufdesc *bdp; 1161 struct bufdesc *bdp;
1162 int i; 1162 int i;
@@ -1171,19 +1171,19 @@ static int fec_enet_init(struct net_device *dev)
1171 1171
1172 spin_lock_init(&fep->hw_lock); 1172 spin_lock_init(&fep->hw_lock);
1173 1173
1174 fep->netdev = dev; 1174 fep->netdev = ndev;
1175 1175
1176 /* Get the Ethernet address */ 1176 /* Get the Ethernet address */
1177 fec_get_mac(dev); 1177 fec_get_mac(ndev);
1178 1178
1179 /* Set receive and transmit descriptor base. */ 1179 /* Set receive and transmit descriptor base. */
1180 fep->rx_bd_base = cbd_base; 1180 fep->rx_bd_base = cbd_base;
1181 fep->tx_bd_base = cbd_base + RX_RING_SIZE; 1181 fep->tx_bd_base = cbd_base + RX_RING_SIZE;
1182 1182
1183 /* The FEC Ethernet specific entries in the device structure */ 1183 /* The FEC Ethernet specific entries in the device structure */
1184 dev->watchdog_timeo = TX_TIMEOUT; 1184 ndev->watchdog_timeo = TX_TIMEOUT;
1185 dev->netdev_ops = &fec_netdev_ops; 1185 ndev->netdev_ops = &fec_netdev_ops;
1186 dev->ethtool_ops = &fec_enet_ethtool_ops; 1186 ndev->ethtool_ops = &fec_enet_ethtool_ops;
1187 1187
1188 /* Initialize the receive buffer descriptors. */ 1188 /* Initialize the receive buffer descriptors. */
1189 bdp = fep->rx_bd_base; 1189 bdp = fep->rx_bd_base;
@@ -1212,7 +1212,7 @@ static int fec_enet_init(struct net_device *dev)
1212 bdp--; 1212 bdp--;
1213 bdp->cbd_sc |= BD_SC_WRAP; 1213 bdp->cbd_sc |= BD_SC_WRAP;
1214 1214
1215 fec_restart(dev, 0); 1215 fec_restart(ndev, 0);
1216 1216
1217 return 0; 1217 return 0;
1218} 1218}
@@ -1222,9 +1222,9 @@ static int fec_enet_init(struct net_device *dev)
1222 * duplex. 1222 * duplex.
1223 */ 1223 */
1224static void 1224static void
1225fec_restart(struct net_device *dev, int duplex) 1225fec_restart(struct net_device *ndev, int duplex)
1226{ 1226{
1227 struct fec_enet_private *fep = netdev_priv(dev); 1227 struct fec_enet_private *fep = netdev_priv(ndev);
1228 const struct platform_device_id *id_entry = 1228 const struct platform_device_id *id_entry =
1229 platform_get_device_id(fep->pdev); 1229 platform_get_device_id(fep->pdev);
1230 int i; 1230 int i;
@@ -1239,7 +1239,7 @@ fec_restart(struct net_device *dev, int duplex)
1239 * so need to reconfigure it. 1239 * so need to reconfigure it.
1240 */ 1240 */
1241 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) { 1241 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
1242 memcpy(&temp_mac, dev->dev_addr, ETH_ALEN); 1242 memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN);
1243 writel(cpu_to_be32(temp_mac[0]), fep->hwp + FEC_ADDR_LOW); 1243 writel(cpu_to_be32(temp_mac[0]), fep->hwp + FEC_ADDR_LOW);
1244 writel(cpu_to_be32(temp_mac[1]), fep->hwp + FEC_ADDR_HIGH); 1244 writel(cpu_to_be32(temp_mac[1]), fep->hwp + FEC_ADDR_HIGH);
1245 } 1245 }
@@ -1339,9 +1339,9 @@ fec_restart(struct net_device *dev, int duplex)
1339} 1339}
1340 1340
1341static void 1341static void
1342fec_stop(struct net_device *dev) 1342fec_stop(struct net_device *ndev)
1343{ 1343{
1344 struct fec_enet_private *fep = netdev_priv(dev); 1344 struct fec_enet_private *fep = netdev_priv(ndev);
1345 1345
1346 /* We cannot expect a graceful transmit stop without link !!! */ 1346 /* We cannot expect a graceful transmit stop without link !!! */
1347 if (fep->link) { 1347 if (fep->link) {