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.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index edfff92a6d8e..b4afd7a6ee29 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -210,7 +210,7 @@ static void fec_stop(struct net_device *dev);
210/* Transmitter timeout */ 210/* Transmitter timeout */
211#define TX_TIMEOUT (2 * HZ) 211#define TX_TIMEOUT (2 * HZ)
212 212
213static int 213static netdev_tx_t
214fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) 214fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
215{ 215{
216 struct fec_enet_private *fep = netdev_priv(dev); 216 struct fec_enet_private *fep = netdev_priv(dev);
@@ -679,30 +679,24 @@ static int fec_enet_mii_probe(struct net_device *dev)
679{ 679{
680 struct fec_enet_private *fep = netdev_priv(dev); 680 struct fec_enet_private *fep = netdev_priv(dev);
681 struct phy_device *phy_dev = NULL; 681 struct phy_device *phy_dev = NULL;
682 int phy_addr; 682 int ret;
683 683
684 fep->phy_dev = NULL; 684 fep->phy_dev = NULL;
685 685
686 /* find the first phy */ 686 /* find the first phy */
687 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { 687 phy_dev = phy_find_first(fep->mii_bus);
688 if (fep->mii_bus->phy_map[phy_addr]) {
689 phy_dev = fep->mii_bus->phy_map[phy_addr];
690 break;
691 }
692 }
693
694 if (!phy_dev) { 688 if (!phy_dev) {
695 printk(KERN_ERR "%s: no PHY found\n", dev->name); 689 printk(KERN_ERR "%s: no PHY found\n", dev->name);
696 return -ENODEV; 690 return -ENODEV;
697 } 691 }
698 692
699 /* attach the mac to the phy */ 693 /* attach the mac to the phy */
700 phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), 694 ret = phy_connect_direct(dev, phy_dev,
701 &fec_enet_adjust_link, 0, 695 &fec_enet_adjust_link, 0,
702 PHY_INTERFACE_MODE_MII); 696 PHY_INTERFACE_MODE_MII);
703 if (IS_ERR(phy_dev)) { 697 if (ret) {
704 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 698 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
705 return PTR_ERR(phy_dev); 699 return ret;
706 } 700 }
707 701
708 /* mask with MAC supported features */ 702 /* mask with MAC supported features */
@@ -1365,10 +1359,11 @@ fec_drv_remove(struct platform_device *pdev)
1365 return 0; 1359 return 0;
1366} 1360}
1367 1361
1362#ifdef CONFIG_PM
1368static int 1363static int
1369fec_suspend(struct platform_device *dev, pm_message_t state) 1364fec_suspend(struct device *dev)
1370{ 1365{
1371 struct net_device *ndev = platform_get_drvdata(dev); 1366 struct net_device *ndev = dev_get_drvdata(dev);
1372 struct fec_enet_private *fep; 1367 struct fec_enet_private *fep;
1373 1368
1374 if (ndev) { 1369 if (ndev) {
@@ -1381,9 +1376,9 @@ fec_suspend(struct platform_device *dev, pm_message_t state)
1381} 1376}
1382 1377
1383static int 1378static int
1384fec_resume(struct platform_device *dev) 1379fec_resume(struct device *dev)
1385{ 1380{
1386 struct net_device *ndev = platform_get_drvdata(dev); 1381 struct net_device *ndev = dev_get_drvdata(dev);
1387 struct fec_enet_private *fep; 1382 struct fec_enet_private *fep;
1388 1383
1389 if (ndev) { 1384 if (ndev) {
@@ -1395,15 +1390,26 @@ fec_resume(struct platform_device *dev)
1395 return 0; 1390 return 0;
1396} 1391}
1397 1392
1393static const struct dev_pm_ops fec_pm_ops = {
1394 .suspend = fec_suspend,
1395 .resume = fec_resume,
1396 .freeze = fec_suspend,
1397 .thaw = fec_resume,
1398 .poweroff = fec_suspend,
1399 .restore = fec_resume,
1400};
1401#endif
1402
1398static struct platform_driver fec_driver = { 1403static struct platform_driver fec_driver = {
1399 .driver = { 1404 .driver = {
1400 .name = "fec", 1405 .name = "fec",
1401 .owner = THIS_MODULE, 1406 .owner = THIS_MODULE,
1407#ifdef CONFIG_PM
1408 .pm = &fec_pm_ops,
1409#endif
1402 }, 1410 },
1403 .probe = fec_probe, 1411 .probe = fec_probe,
1404 .remove = __devexit_p(fec_drv_remove), 1412 .remove = __devexit_p(fec_drv_remove),
1405 .suspend = fec_suspend,
1406 .resume = fec_resume,
1407}; 1413};
1408 1414
1409static int __init 1415static int __init