diff options
author | Cristian Sovaiala <cristian.sovaiala@freescale.com> | 2013-10-24 13:36:56 (GMT) |
---|---|---|
committer | Madalin-Cristian Bucur <madalin.bucur@freescale.com> | 2014-01-06 16:07:19 (GMT) |
commit | 424bf3e7d0ffd2ece17a5793c263bbe00739233f (patch) | |
tree | 7f7441b80fdf57e88dbde89ceb0d5cae9a497004 /drivers | |
parent | 638a980faf5b59fbfa1c88cdd1ed9b9f66f0c942 (diff) | |
download | linux-fsl-qoriq-424bf3e7d0ffd2ece17a5793c263bbe00739233f.tar.xz |
dpaa_eth: Add support for Power Management in DPAA Shared Driver
Implement Power Management suspend_noirq/resume_noirq specific
callbacks where we disable/enable the port if it is not AutoResponse
enabled (the decision is taken by the FMan driver), otherwise the
port remains enabled during deep sleep state.
Signed-off-by: Cristian Sovaiala <cristian.sovaiala@freescale.com>
Change-Id: I44e82ba583ca96ff38e1fb92f4b01c4fa4598569
Reviewed-on: http://git.am.freescale.net:8181/6843
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Ruxandra Ioana Radulescu <ruxandra.radulescu@freescale.com>
Reviewed-by: Marian Cristian Rotariu <marian.rotariu@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/7695
Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Tested-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c index ab7b830..8d5bb06 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c @@ -575,6 +575,71 @@ static int dpa_shared_netdev_init(struct device_node *dpa_node, return dpa_netdev_init(dpa_node, net_dev, mac_addr, tx_timeout); } +#ifdef CONFIG_PM + +static int dpa_shared_suspend_noirq(struct device *dev) +{ + struct net_device *net_dev; + struct dpa_priv_s *priv; + struct mac_device *mac_dev; + int err = 0; + + net_dev = dev_get_drvdata(dev); + if (net_dev->flags & IFF_UP) { + priv = netdev_priv(net_dev); + mac_dev = priv->mac_dev; + + err = fm_port_suspend(mac_dev->port_dev[RX]); + if (err) + goto port_suspend_failed; + + err = fm_port_suspend(mac_dev->port_dev[TX]); + if (err) + err = fm_port_resume(mac_dev->port_dev[RX]); + } + +port_suspend_failed: + return err; +} + +static int dpa_shared_resume_noirq(struct device *dev) +{ + struct net_device *net_dev; + struct dpa_priv_s *priv; + struct mac_device *mac_dev; + int err = 0; + + net_dev = dev_get_drvdata(dev); + if (net_dev->flags & IFF_UP) { + priv = netdev_priv(net_dev); + mac_dev = priv->mac_dev; + + err = fm_port_resume(mac_dev->port_dev[TX]); + if (err) + goto port_resume_failed; + + err = fm_port_resume(mac_dev->port_dev[RX]); + if (err) + err = fm_port_suspend(mac_dev->port_dev[TX]); + } + +port_resume_failed: + return err; +} + +static const struct dev_pm_ops shared_pm_ops = { + .suspend_noirq = dpa_shared_suspend_noirq, + .resume_noirq = dpa_shared_resume_noirq, +}; + +#define SHARED_PM_OPS (&shared_pm_ops) + +#else /* CONFIG_PM */ + +#define SHARED_PM_OPS NULL + +#endif /* CONFIG_PM */ + static int dpaa_eth_shared_probe(struct platform_device *_of_dev) { @@ -774,6 +839,7 @@ static struct platform_driver dpa_shared_driver = { .name = KBUILD_MODNAME, .of_match_table = dpa_shared_match, .owner = THIS_MODULE, + .pm = SHARED_PM_OPS, }, .probe = dpaa_eth_shared_probe, .remove = dpa_remove |