diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/fec.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fec.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 8f2cf8c09e2d..ff7f4c5115a1 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -207,7 +207,8 @@ struct fec_enet_private { | |||
207 | 207 | ||
208 | struct net_device *netdev; | 208 | struct net_device *netdev; |
209 | 209 | ||
210 | struct clk *clk; | 210 | struct clk *clk_ipg; |
211 | struct clk *clk_ahb; | ||
211 | 212 | ||
212 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ | 213 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ |
213 | unsigned char *tx_bounce[TX_RING_SIZE]; | 214 | unsigned char *tx_bounce[TX_RING_SIZE]; |
@@ -1065,7 +1066,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
1065 | * Reference Manual has an error on this, and gets fixed on i.MX6Q | 1066 | * Reference Manual has an error on this, and gets fixed on i.MX6Q |
1066 | * document. | 1067 | * document. |
1067 | */ | 1068 | */ |
1068 | fep->phy_speed = DIV_ROUND_UP(clk_get_rate(fep->clk), 5000000); | 1069 | fep->phy_speed = DIV_ROUND_UP(clk_get_rate(fep->clk_ahb), 5000000); |
1069 | if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) | 1070 | if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) |
1070 | fep->phy_speed--; | 1071 | fep->phy_speed--; |
1071 | fep->phy_speed <<= 1; | 1072 | fep->phy_speed <<= 1; |
@@ -1618,12 +1619,20 @@ fec_probe(struct platform_device *pdev) | |||
1618 | goto failed_pin; | 1619 | goto failed_pin; |
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | fep->clk = clk_get(&pdev->dev, NULL); | 1622 | fep->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); |
1622 | if (IS_ERR(fep->clk)) { | 1623 | if (IS_ERR(fep->clk_ipg)) { |
1623 | ret = PTR_ERR(fep->clk); | 1624 | ret = PTR_ERR(fep->clk_ipg); |
1624 | goto failed_clk; | 1625 | goto failed_clk; |
1625 | } | 1626 | } |
1626 | clk_prepare_enable(fep->clk); | 1627 | |
1628 | fep->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); | ||
1629 | if (IS_ERR(fep->clk_ahb)) { | ||
1630 | ret = PTR_ERR(fep->clk_ahb); | ||
1631 | goto failed_clk; | ||
1632 | } | ||
1633 | |||
1634 | clk_prepare_enable(fep->clk_ahb); | ||
1635 | clk_prepare_enable(fep->clk_ipg); | ||
1627 | 1636 | ||
1628 | ret = fec_enet_init(ndev); | 1637 | ret = fec_enet_init(ndev); |
1629 | if (ret) | 1638 | if (ret) |
@@ -1646,8 +1655,8 @@ failed_register: | |||
1646 | fec_enet_mii_remove(fep); | 1655 | fec_enet_mii_remove(fep); |
1647 | failed_mii_init: | 1656 | failed_mii_init: |
1648 | failed_init: | 1657 | failed_init: |
1649 | clk_disable_unprepare(fep->clk); | 1658 | clk_disable_unprepare(fep->clk_ahb); |
1650 | clk_put(fep->clk); | 1659 | clk_disable_unprepare(fep->clk_ipg); |
1651 | failed_pin: | 1660 | failed_pin: |
1652 | failed_clk: | 1661 | failed_clk: |
1653 | for (i = 0; i < FEC_IRQ_NUM; i++) { | 1662 | for (i = 0; i < FEC_IRQ_NUM; i++) { |
@@ -1680,8 +1689,8 @@ fec_drv_remove(struct platform_device *pdev) | |||
1680 | if (irq > 0) | 1689 | if (irq > 0) |
1681 | free_irq(irq, ndev); | 1690 | free_irq(irq, ndev); |
1682 | } | 1691 | } |
1683 | clk_disable_unprepare(fep->clk); | 1692 | clk_disable_unprepare(fep->clk_ahb); |
1684 | clk_put(fep->clk); | 1693 | clk_disable_unprepare(fep->clk_ipg); |
1685 | iounmap(fep->hwp); | 1694 | iounmap(fep->hwp); |
1686 | free_netdev(ndev); | 1695 | free_netdev(ndev); |
1687 | 1696 | ||
@@ -1705,7 +1714,8 @@ fec_suspend(struct device *dev) | |||
1705 | fec_stop(ndev); | 1714 | fec_stop(ndev); |
1706 | netif_device_detach(ndev); | 1715 | netif_device_detach(ndev); |
1707 | } | 1716 | } |
1708 | clk_disable_unprepare(fep->clk); | 1717 | clk_disable_unprepare(fep->clk_ahb); |
1718 | clk_disable_unprepare(fep->clk_ipg); | ||
1709 | 1719 | ||
1710 | return 0; | 1720 | return 0; |
1711 | } | 1721 | } |
@@ -1716,7 +1726,8 @@ fec_resume(struct device *dev) | |||
1716 | struct net_device *ndev = dev_get_drvdata(dev); | 1726 | struct net_device *ndev = dev_get_drvdata(dev); |
1717 | struct fec_enet_private *fep = netdev_priv(ndev); | 1727 | struct fec_enet_private *fep = netdev_priv(ndev); |
1718 | 1728 | ||
1719 | clk_prepare_enable(fep->clk); | 1729 | clk_prepare_enable(fep->clk_ahb); |
1730 | clk_prepare_enable(fep->clk_ipg); | ||
1720 | if (netif_running(ndev)) { | 1731 | if (netif_running(ndev)) { |
1721 | fec_restart(ndev, fep->full_duplex); | 1732 | fec_restart(ndev, fep->full_duplex); |
1722 | netif_device_attach(ndev); | 1733 | netif_device_attach(ndev); |