diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-04-07 01:09:47 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-08 16:55:26 -0400 |
commit | 3d604da1e9547c09c9dcc0ee443c306c9ae1a480 (patch) | |
tree | 2e85712f508c10f5b7a82c3cc9344da3810d9267 /drivers/net | |
parent | d5b40921aa09a0ccc24867a035ec0f13730a1e34 (diff) |
net: mvmdio: get and enable optional clock
Marvell mdio driver uses internal registers that can be clock gated on
some SoCs. This patch just adds optional clock handling, to allow to pass
and enable the corresponding clock.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/marvell/mvmdio.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index 7b5158f654c2..e2f662660313 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -28,6 +28,7 @@ #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/clk.h> #include <linux/of_mdio.h> #include <linux/sched.h> #include <linux/wait.h> @@ -46,6 +47,7 @@ struct orion_mdio_dev { struct mutex lock; void __iomem *regs; + struct clk *clk; /* * If we have access to the error interrupt pin (which is * somewhat misnamed as it not only reflects internal errors @@ -230,6 +232,10 @@ static int orion_mdio_probe(struct platform_device *pdev) init_waitqueue_head(&dev->smi_busy_wait); + dev->clk = devm_clk_get(&pdev->dev, NULL); + if (!IS_ERR(dev->clk)) + clk_prepare_enable(dev->clk); + dev->err_interrupt = platform_get_irq(pdev, 0); if (dev->err_interrupt != -ENXIO) { ret = devm_request_irq(&pdev->dev, dev->err_interrupt, @@ -258,6 +264,8 @@ static int orion_mdio_probe(struct platform_device *pdev) return 0; out_mdio: + if (!IS_ERR(dev->clk)) + clk_disable_unprepare(dev->clk); kfree(bus->irq); mdiobus_free(bus); return ret; @@ -272,6 +280,9 @@ static int orion_mdio_remove(struct platform_device *pdev) mdiobus_unregister(bus); kfree(bus->irq); mdiobus_free(bus); + if (!IS_ERR(dev->clk)) + clk_disable_unprepare(dev->clk); + return 0; } |