aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index a32230bbe195..29234380e6c6 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -367,7 +367,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
367 367
368 spin_unlock_irqrestore(&fep->hw_lock, flags); 368 spin_unlock_irqrestore(&fep->hw_lock, flags);
369 369
370 return 0; 370 return NETDEV_TX_OK;
371} 371}
372 372
373static void 373static void
@@ -427,7 +427,7 @@ fec_enet_tx(struct net_device *dev)
427 struct sk_buff *skb; 427 struct sk_buff *skb;
428 428
429 fep = netdev_priv(dev); 429 fep = netdev_priv(dev);
430 spin_lock_irq(&fep->hw_lock); 430 spin_lock(&fep->hw_lock);
431 bdp = fep->dirty_tx; 431 bdp = fep->dirty_tx;
432 432
433 while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) { 433 while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {
@@ -486,7 +486,7 @@ fec_enet_tx(struct net_device *dev)
486 } 486 }
487 } 487 }
488 fep->dirty_tx = bdp; 488 fep->dirty_tx = bdp;
489 spin_unlock_irq(&fep->hw_lock); 489 spin_unlock(&fep->hw_lock);
490} 490}
491 491
492 492
@@ -509,7 +509,7 @@ fec_enet_rx(struct net_device *dev)
509 flush_cache_all(); 509 flush_cache_all();
510#endif 510#endif
511 511
512 spin_lock_irq(&fep->hw_lock); 512 spin_lock(&fep->hw_lock);
513 513
514 /* First, grab all of the stats for the incoming packet. 514 /* First, grab all of the stats for the incoming packet.
515 * These get messed up if we get called due to a busy condition. 515 * These get messed up if we get called due to a busy condition.
@@ -604,7 +604,7 @@ rx_processing_done:
604 } 604 }
605 fep->cur_rx = bdp; 605 fep->cur_rx = bdp;
606 606
607 spin_unlock_irq(&fep->hw_lock); 607 spin_unlock(&fep->hw_lock);
608} 608}
609 609
610/* called from interrupt context */ 610/* called from interrupt context */
@@ -615,7 +615,7 @@ fec_enet_mii(struct net_device *dev)
615 mii_list_t *mip; 615 mii_list_t *mip;
616 616
617 fep = netdev_priv(dev); 617 fep = netdev_priv(dev);
618 spin_lock_irq(&fep->mii_lock); 618 spin_lock(&fep->mii_lock);
619 619
620 if ((mip = mii_head) == NULL) { 620 if ((mip = mii_head) == NULL) {
621 printk("MII and no head!\n"); 621 printk("MII and no head!\n");
@@ -633,20 +633,19 @@ fec_enet_mii(struct net_device *dev)
633 writel(mip->mii_regval, fep->hwp + FEC_MII_DATA); 633 writel(mip->mii_regval, fep->hwp + FEC_MII_DATA);
634 634
635unlock: 635unlock:
636 spin_unlock_irq(&fep->mii_lock); 636 spin_unlock(&fep->mii_lock);
637} 637}
638 638
639static int 639static int
640mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_device *)) 640mii_queue_unlocked(struct net_device *dev, int regval,
641 void (*func)(uint, struct net_device *))
641{ 642{
642 struct fec_enet_private *fep; 643 struct fec_enet_private *fep;
643 unsigned long flags;
644 mii_list_t *mip; 644 mii_list_t *mip;
645 int retval; 645 int retval;
646 646
647 /* Add PHY address to register command */ 647 /* Add PHY address to register command */
648 fep = netdev_priv(dev); 648 fep = netdev_priv(dev);
649 spin_lock_irqsave(&fep->mii_lock, flags);
650 649
651 regval |= fep->phy_addr << 23; 650 regval |= fep->phy_addr << 23;
652 retval = 0; 651 retval = 0;
@@ -667,6 +666,19 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi
667 retval = 1; 666 retval = 1;
668 } 667 }
669 668
669 return retval;
670}
671
672static int
673mii_queue(struct net_device *dev, int regval,
674 void (*func)(uint, struct net_device *))
675{
676 struct fec_enet_private *fep;
677 unsigned long flags;
678 int retval;
679 fep = netdev_priv(dev);
680 spin_lock_irqsave(&fep->mii_lock, flags);
681 retval = mii_queue_unlocked(dev, regval, func);
670 spin_unlock_irqrestore(&fep->mii_lock, flags); 682 spin_unlock_irqrestore(&fep->mii_lock, flags);
671 return retval; 683 return retval;
672} 684}
@@ -1363,11 +1375,11 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
1363 1375
1364 /* Got first part of ID, now get remainder */ 1376 /* Got first part of ID, now get remainder */
1365 fep->phy_id = phytype << 16; 1377 fep->phy_id = phytype << 16;
1366 mii_queue(dev, mk_mii_read(MII_REG_PHYIR2), 1378 mii_queue_unlocked(dev, mk_mii_read(MII_REG_PHYIR2),
1367 mii_discover_phy3); 1379 mii_discover_phy3);
1368 } else { 1380 } else {
1369 fep->phy_addr++; 1381 fep->phy_addr++;
1370 mii_queue(dev, mk_mii_read(MII_REG_PHYIR1), 1382 mii_queue_unlocked(dev, mk_mii_read(MII_REG_PHYIR1),
1371 mii_discover_phy); 1383 mii_discover_phy);
1372 } 1384 }
1373 } else { 1385 } else {