aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-04-02 05:35:09 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-02 16:43:10 -0400
commit509070437d15ed06c3b0aa674661adc2906b83f2 (patch)
tree8feb885942f9fc5e0dbd6931b68b8976f9a9462d /drivers/net
parentf9b124901cd7cf43f272b86008d813ec89d9508b (diff)
net/cadence/macb: Simplify OF dependencies
With of_get_mac_address() and of_get_phy_mode() now defined as dummy functions if OF_NET is not configured, it is no longer necessary to provide OF dependent functions as front-end. Also, the two functions depend on OF_NET, not on OF, so the conditional code was not correct anyway. Drop the front-end functions and call of_get_mac_address() and of_get_phy_mode() directly instead. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cadence/macb.c43
1 files changed, 6 insertions, 37 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index ed2cb130f988..7fd0e3e977af 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1476,41 +1476,7 @@ static const struct of_device_id macb_dt_ids[] = {
1476 { .compatible = "cdns,gem" }, 1476 { .compatible = "cdns,gem" },
1477 { /* sentinel */ } 1477 { /* sentinel */ }
1478}; 1478};
1479
1480MODULE_DEVICE_TABLE(of, macb_dt_ids); 1479MODULE_DEVICE_TABLE(of, macb_dt_ids);
1481
1482static int macb_get_phy_mode_dt(struct platform_device *pdev)
1483{
1484 struct device_node *np = pdev->dev.of_node;
1485
1486 if (np)
1487 return of_get_phy_mode(np);
1488
1489 return -ENODEV;
1490}
1491
1492static int macb_get_hwaddr_dt(struct macb *bp)
1493{
1494 struct device_node *np = bp->pdev->dev.of_node;
1495 if (np) {
1496 const char *mac = of_get_mac_address(np);
1497 if (mac) {
1498 memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
1499 return 0;
1500 }
1501 }
1502
1503 return -ENODEV;
1504}
1505#else
1506static int macb_get_phy_mode_dt(struct platform_device *pdev)
1507{
1508 return -ENODEV;
1509}
1510static int macb_get_hwaddr_dt(struct macb *bp)
1511{
1512 return -ENODEV;
1513}
1514#endif 1480#endif
1515 1481
1516static int __init macb_probe(struct platform_device *pdev) 1482static int __init macb_probe(struct platform_device *pdev)
@@ -1523,6 +1489,7 @@ static int __init macb_probe(struct platform_device *pdev)
1523 u32 config; 1489 u32 config;
1524 int err = -ENXIO; 1490 int err = -ENXIO;
1525 struct pinctrl *pinctrl; 1491 struct pinctrl *pinctrl;
1492 const char *mac;
1526 1493
1527 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1494 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1528 if (!regs) { 1495 if (!regs) {
@@ -1596,11 +1563,13 @@ static int __init macb_probe(struct platform_device *pdev)
1596 config |= macb_dbw(bp); 1563 config |= macb_dbw(bp);
1597 macb_writel(bp, NCFGR, config); 1564 macb_writel(bp, NCFGR, config);
1598 1565
1599 err = macb_get_hwaddr_dt(bp); 1566 mac = of_get_mac_address(pdev->dev.of_node);
1600 if (err < 0) 1567 if (mac)
1568 memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
1569 else
1601 macb_get_hwaddr(bp); 1570 macb_get_hwaddr(bp);
1602 1571
1603 err = macb_get_phy_mode_dt(pdev); 1572 err = of_get_phy_mode(pdev->dev.of_node);
1604 if (err < 0) { 1573 if (err < 0) {
1605 pdata = pdev->dev.platform_data; 1574 pdata = pdev->dev.platform_data;
1606 if (pdata && pdata->is_rmii) 1575 if (pdata && pdata->is_rmii)