aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pxa168_eth.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
commite548833df83c3554229eff0672900bfe958b45fd (patch)
tree85efc4a76dc356593d6d394776aeb845dc580fb6 /drivers/net/pxa168_eth.c
parentcbd9da7be869f676afc204e1a664163778c770bd (diff)
parent053d8f6622701f849fda2ca2c9ae596c13599ba9 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/mac80211/main.c
Diffstat (limited to 'drivers/net/pxa168_eth.c')
-rw-r--r--drivers/net/pxa168_eth.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
index 764aa9099468..75c2ff99d66d 100644
--- a/drivers/net/pxa168_eth.c
+++ b/drivers/net/pxa168_eth.c
@@ -652,15 +652,15 @@ static void eth_port_start(struct net_device *dev)
652 /* Assignment of Tx CTRP of given queue */ 652 /* Assignment of Tx CTRP of given queue */
653 tx_curr_desc = pep->tx_curr_desc_q; 653 tx_curr_desc = pep->tx_curr_desc_q;
654 wrl(pep, ETH_C_TX_DESC_1, 654 wrl(pep, ETH_C_TX_DESC_1,
655 (u32) ((struct tx_desc *)pep->tx_desc_dma + tx_curr_desc)); 655 (u32) (pep->tx_desc_dma + tx_curr_desc * sizeof(struct tx_desc)));
656 656
657 /* Assignment of Rx CRDP of given queue */ 657 /* Assignment of Rx CRDP of given queue */
658 rx_curr_desc = pep->rx_curr_desc_q; 658 rx_curr_desc = pep->rx_curr_desc_q;
659 wrl(pep, ETH_C_RX_DESC_0, 659 wrl(pep, ETH_C_RX_DESC_0,
660 (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); 660 (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc)));
661 661
662 wrl(pep, ETH_F_RX_DESC_0, 662 wrl(pep, ETH_F_RX_DESC_0,
663 (u32) ((struct rx_desc *)pep->rx_desc_dma + rx_curr_desc)); 663 (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc)));
664 664
665 /* Clear all interrupts */ 665 /* Clear all interrupts */
666 wrl(pep, INT_CAUSE, 0); 666 wrl(pep, INT_CAUSE, 0);
@@ -1347,7 +1347,7 @@ static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr,
1347{ 1347{
1348 struct pxa168_eth_private *pep = netdev_priv(dev); 1348 struct pxa168_eth_private *pep = netdev_priv(dev);
1349 if (pep->phy != NULL) 1349 if (pep->phy != NULL)
1350 return phy_mii_ioctl(pep->phy, if_mii(ifr), cmd); 1350 return phy_mii_ioctl(pep->phy, ifr, cmd);
1351 1351
1352 return -EOPNOTSUPP; 1352 return -EOPNOTSUPP;
1353} 1353}
@@ -1411,10 +1411,8 @@ static int ethernet_phy_setup(struct net_device *dev)
1411{ 1411{
1412 struct pxa168_eth_private *pep = netdev_priv(dev); 1412 struct pxa168_eth_private *pep = netdev_priv(dev);
1413 1413
1414 if (pep->pd != NULL) { 1414 if (pep->pd->init)
1415 if (pep->pd->init) 1415 pep->pd->init();
1416 pep->pd->init();
1417 }
1418 pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f); 1416 pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f);
1419 if (pep->phy != NULL) 1417 if (pep->phy != NULL)
1420 phy_init(pep, pep->pd->speed, pep->pd->duplex); 1418 phy_init(pep, pep->pd->speed, pep->pd->duplex);
@@ -1496,7 +1494,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1496 dev = alloc_etherdev(sizeof(struct pxa168_eth_private)); 1494 dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
1497 if (!dev) { 1495 if (!dev) {
1498 err = -ENOMEM; 1496 err = -ENOMEM;
1499 goto out; 1497 goto err_clk;
1500 } 1498 }
1501 1499
1502 platform_set_drvdata(pdev, dev); 1500 platform_set_drvdata(pdev, dev);
@@ -1506,12 +1504,12 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1506 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1504 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1507 if (res == NULL) { 1505 if (res == NULL) {
1508 err = -ENODEV; 1506 err = -ENODEV;
1509 goto out; 1507 goto err_netdev;
1510 } 1508 }
1511 pep->base = ioremap(res->start, res->end - res->start + 1); 1509 pep->base = ioremap(res->start, res->end - res->start + 1);
1512 if (pep->base == NULL) { 1510 if (pep->base == NULL) {
1513 err = -ENOMEM; 1511 err = -ENOMEM;
1514 goto out; 1512 goto err_netdev;
1515 } 1513 }
1516 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1514 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1517 BUG_ON(!res); 1515 BUG_ON(!res);
@@ -1548,7 +1546,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1548 pep->smi_bus = mdiobus_alloc(); 1546 pep->smi_bus = mdiobus_alloc();
1549 if (pep->smi_bus == NULL) { 1547 if (pep->smi_bus == NULL) {
1550 err = -ENOMEM; 1548 err = -ENOMEM;
1551 goto out; 1549 goto err_base;
1552 } 1550 }
1553 pep->smi_bus->priv = pep; 1551 pep->smi_bus->priv = pep;
1554 pep->smi_bus->name = "pxa168_eth smi"; 1552 pep->smi_bus->name = "pxa168_eth smi";
@@ -1557,31 +1555,31 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1557 snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id); 1555 snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
1558 pep->smi_bus->parent = &pdev->dev; 1556 pep->smi_bus->parent = &pdev->dev;
1559 pep->smi_bus->phy_mask = 0xffffffff; 1557 pep->smi_bus->phy_mask = 0xffffffff;
1560 if (mdiobus_register(pep->smi_bus) < 0) { 1558 err = mdiobus_register(pep->smi_bus);
1561 err = -ENOMEM; 1559 if (err)
1562 goto out; 1560 goto err_free_mdio;
1563 } 1561
1564 pxa168_init_hw(pep); 1562 pxa168_init_hw(pep);
1565 err = ethernet_phy_setup(dev); 1563 err = ethernet_phy_setup(dev);
1566 if (err) 1564 if (err)
1567 goto out; 1565 goto err_mdiobus;
1568 SET_NETDEV_DEV(dev, &pdev->dev); 1566 SET_NETDEV_DEV(dev, &pdev->dev);
1569 err = register_netdev(dev); 1567 err = register_netdev(dev);
1570 if (err) 1568 if (err)
1571 goto out; 1569 goto err_mdiobus;
1572 return 0; 1570 return 0;
1573out: 1571
1574 if (pep->clk) { 1572err_mdiobus:
1575 clk_disable(pep->clk); 1573 mdiobus_unregister(pep->smi_bus);
1576 clk_put(pep->clk); 1574err_free_mdio:
1577 pep->clk = NULL; 1575 mdiobus_free(pep->smi_bus);
1578 } 1576err_base:
1579 if (pep->base) { 1577 iounmap(pep->base);
1580 iounmap(pep->base); 1578err_netdev:
1581 pep->base = NULL; 1579 free_netdev(dev);
1582 } 1580err_clk:
1583 if (dev) 1581 clk_disable(clk);
1584 free_netdev(dev); 1582 clk_put(clk);
1585 return err; 1583 return err;
1586} 1584}
1587 1585
@@ -1605,6 +1603,8 @@ static int pxa168_eth_remove(struct platform_device *pdev)
1605 1603
1606 iounmap(pep->base); 1604 iounmap(pep->base);
1607 pep->base = NULL; 1605 pep->base = NULL;
1606 mdiobus_unregister(pep->smi_bus);
1607 mdiobus_free(pep->smi_bus);
1608 unregister_netdev(dev); 1608 unregister_netdev(dev);
1609 flush_scheduled_work(); 1609 flush_scheduled_work();
1610 free_netdev(dev); 1610 free_netdev(dev);