diff options
author | Arun Parameswaran <arun.parameswaran@broadcom.com> | 2018-08-01 17:53:53 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-02 14:36:49 -0700 |
commit | 2c7230446bc90bc883890007e2a5da60c399e88a (patch) | |
tree | 7068e95dd3751fb19b4a7b329a778c95332643a2 | |
parent | 56aea577c8c08c9888d805a5ad81def62f89da55 (diff) | |
download | blackbird-op-linux-2c7230446bc90bc883890007e2a5da60c399e88a.tar.gz blackbird-op-linux-2c7230446bc90bc883890007e2a5da60c399e88a.zip |
net: phy: Add pm support to Broadcom iProc mdio mux driver
Add support for suspend and resume to the Broadcom iProc mdio
mux driver.
Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/mdio-mux-bcm-iproc.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c index c5aae5e3f20f..c017486e9b86 100644 --- a/drivers/net/phy/mdio-mux-bcm-iproc.c +++ b/drivers/net/phy/mdio-mux-bcm-iproc.c @@ -286,6 +286,32 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int mdio_mux_iproc_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct iproc_mdiomux_desc *md = platform_get_drvdata(pdev); + + clk_disable_unprepare(md->core_clk); + + return 0; +} + +static int mdio_mux_iproc_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct iproc_mdiomux_desc *md = platform_get_drvdata(pdev); + + clk_prepare_enable(md->core_clk); + mdio_mux_iproc_config(md); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(mdio_mux_iproc_pm_ops, + mdio_mux_iproc_suspend, mdio_mux_iproc_resume); + static const struct of_device_id mdio_mux_iproc_match[] = { { .compatible = "brcm,mdio-mux-iproc", @@ -298,6 +324,7 @@ static struct platform_driver mdiomux_iproc_driver = { .driver = { .name = "mdio-mux-iproc", .of_match_table = mdio_mux_iproc_match, + .pm = &mdio_mux_iproc_pm_ops, }, .probe = mdio_mux_iproc_probe, .remove = mdio_mux_iproc_remove, |