* [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions
@ 2016-11-05 13:04 Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 1/4] stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks Joachim Eastwood
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-11-05 13:04 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, heiko, linux-rockchip, vpalatin,
peppe.cavallaro, netdev
This patch set aims to remove the init/exit callbacks from the
dwmac-rk driver and instead use standard PM callbacks. Eventually
the init/exit callbacks will be deprecated and removed from all
drivers dwmac-* except for dwmac-generic. Drivers will be refactored
to use standard PM and remove callbacks.
This conversion was pretty straight forward, but it would really nice
if some chromium people could test suspend/resume with this patch set.
Joachim Eastwood (4):
stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks
stmmac: dwmac-rk: turn exit into standard driver remove callback
stmmac: dwmac-rk: absorb rk_gmac_init into probe
Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks"
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 89 +++++++++++-----------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 +-
include/linux/stmmac.h | 2 -
3 files changed, 46 insertions(+), 53 deletions(-)
--
2.10.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/4] stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
@ 2016-11-05 13:04 ` Joachim Eastwood
[not found] ` <20161105130452.24226-1-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-11-05 13:04 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, heiko, linux-rockchip, vpalatin,
peppe.cavallaro, netdev
Use standard PM resume/suspend callbacks instead of the hooks in
stmmac_platform. This gives the driver more control and flexibility
when implementing PM functionality. The hooks in stmmac_platform
also doesn't buy us anything extra.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 59 ++++++++++++++------------
1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 3740a44..d91acd5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -915,30 +915,6 @@ static void rk_gmac_exit(struct platform_device *pdev, void *priv)
rk_gmac_powerdown(bsp_priv);
}
-static void rk_gmac_suspend(struct platform_device *pdev, void *priv)
-{
- struct rk_priv_data *bsp_priv = priv;
-
- /* Keep the PHY up if we use Wake-on-Lan. */
- if (device_may_wakeup(&pdev->dev))
- return;
-
- rk_gmac_powerdown(bsp_priv);
- bsp_priv->suspended = true;
-}
-
-static void rk_gmac_resume(struct platform_device *pdev, void *priv)
-{
- struct rk_priv_data *bsp_priv = priv;
-
- /* The PHY was up for Wake-on-Lan. */
- if (!bsp_priv->suspended)
- return;
-
- rk_gmac_powerup(bsp_priv);
- bsp_priv->suspended = false;
-}
-
static void rk_fix_speed(void *priv, unsigned int speed)
{
struct rk_priv_data *bsp_priv = priv;
@@ -977,8 +953,6 @@ static int rk_gmac_probe(struct platform_device *pdev)
plat_dat->init = rk_gmac_init;
plat_dat->exit = rk_gmac_exit;
plat_dat->fix_mac_speed = rk_fix_speed;
- plat_dat->suspend = rk_gmac_suspend;
- plat_dat->resume = rk_gmac_resume;
plat_dat->bsp_priv = rk_gmac_setup(pdev, data);
if (IS_ERR(plat_dat->bsp_priv))
@@ -991,6 +965,37 @@ static int rk_gmac_probe(struct platform_device *pdev)
return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
}
+#ifdef CONFIG_PM_SLEEP
+static int rk_gmac_suspend(struct device *dev)
+{
+ struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(dev);
+ int ret = stmmac_suspend(dev);
+
+ /* Keep the PHY up if we use Wake-on-Lan. */
+ if (!device_may_wakeup(dev)) {
+ rk_gmac_powerdown(bsp_priv);
+ bsp_priv->suspended = true;
+ }
+
+ return ret;
+}
+
+static int rk_gmac_resume(struct device *dev)
+{
+ struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(dev);
+
+ /* The PHY was up for Wake-on-Lan. */
+ if (bsp_priv->suspended) {
+ rk_gmac_powerup(bsp_priv);
+ bsp_priv->suspended = false;
+ }
+
+ return stmmac_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static SIMPLE_DEV_PM_OPS(rk_gmac_pm_ops, rk_gmac_suspend, rk_gmac_resume);
+
static const struct of_device_id rk_gmac_dwmac_match[] = {
{ .compatible = "rockchip,rk3228-gmac", .data = &rk3228_ops },
{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_ops },
@@ -1006,7 +1011,7 @@ static struct platform_driver rk_gmac_dwmac_driver = {
.remove = stmmac_pltfr_remove,
.driver = {
.name = "rk_gmac-dwmac",
- .pm = &stmmac_pltfr_pm_ops,
+ .pm = &rk_gmac_pm_ops,
.of_match_table = rk_gmac_dwmac_match,
},
};
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/4] stmmac: dwmac-rk: turn exit into standard driver remove callback
[not found] ` <20161105130452.24226-1-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-11-05 13:04 ` Joachim Eastwood
0 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-11-05 13:04 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: vpalatin-F7+t8E8rja9g9hUCZPvPmw, heiko-4mtYJXux2i+zQB+pC5nmwQ,
netdev-u79uwXL29TY76Z2rM5mHXA, Joachim Eastwood,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
peppe.cavallaro-qxv4g6HH51o
Convert the exit hook into a standard driver remove function as
the hook doesn't really buy us anything extra.
Eventually the exit hook will be deprecated in favor of the driver
remove function.
Signed-off-by: Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index d91acd5..8506881 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -908,13 +908,6 @@ static int rk_gmac_init(struct platform_device *pdev, void *priv)
return rk_gmac_powerup(bsp_priv);
}
-static void rk_gmac_exit(struct platform_device *pdev, void *priv)
-{
- struct rk_priv_data *bsp_priv = priv;
-
- rk_gmac_powerdown(bsp_priv);
-}
-
static void rk_fix_speed(void *priv, unsigned int speed)
{
struct rk_priv_data *bsp_priv = priv;
@@ -951,7 +944,6 @@ static int rk_gmac_probe(struct platform_device *pdev)
plat_dat->has_gmac = true;
plat_dat->init = rk_gmac_init;
- plat_dat->exit = rk_gmac_exit;
plat_dat->fix_mac_speed = rk_fix_speed;
plat_dat->bsp_priv = rk_gmac_setup(pdev, data);
@@ -965,6 +957,16 @@ static int rk_gmac_probe(struct platform_device *pdev)
return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
}
+static int rk_gmac_remove(struct platform_device *pdev)
+{
+ struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(&pdev->dev);
+ int ret = stmmac_dvr_remove(&pdev->dev);
+
+ rk_gmac_powerdown(bsp_priv);
+
+ return ret;
+}
+
#ifdef CONFIG_PM_SLEEP
static int rk_gmac_suspend(struct device *dev)
{
@@ -1008,7 +1010,7 @@ MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match);
static struct platform_driver rk_gmac_dwmac_driver = {
.probe = rk_gmac_probe,
- .remove = stmmac_pltfr_remove,
+ .remove = rk_gmac_remove,
.driver = {
.name = "rk_gmac-dwmac",
.pm = &rk_gmac_pm_ops,
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/4] stmmac: dwmac-rk: absorb rk_gmac_init into probe
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 1/4] stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks Joachim Eastwood
[not found] ` <20161105130452.24226-1-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-11-05 13:04 ` Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 4/4] Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks" Joachim Eastwood
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-11-05 13:04 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, heiko, linux-rockchip, vpalatin,
peppe.cavallaro, netdev
Since the rk_gmac_init() only calls another function move this
function call into probe so rk_gmac_init() can be removed.
Since commit cecbc5563a02 ("stmmac: allow to split suspend/resume
from init/exit callbacks") the init hook is no longer used in
dwmac-rk so this can be removed.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 8506881..6b787d7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -901,13 +901,6 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
gmac_clk_enable(gmac, false);
}
-static int rk_gmac_init(struct platform_device *pdev, void *priv)
-{
- struct rk_priv_data *bsp_priv = priv;
-
- return rk_gmac_powerup(bsp_priv);
-}
-
static void rk_fix_speed(void *priv, unsigned int speed)
{
struct rk_priv_data *bsp_priv = priv;
@@ -943,14 +936,13 @@ static int rk_gmac_probe(struct platform_device *pdev)
return PTR_ERR(plat_dat);
plat_dat->has_gmac = true;
- plat_dat->init = rk_gmac_init;
plat_dat->fix_mac_speed = rk_fix_speed;
plat_dat->bsp_priv = rk_gmac_setup(pdev, data);
if (IS_ERR(plat_dat->bsp_priv))
return PTR_ERR(plat_dat->bsp_priv);
- ret = rk_gmac_init(pdev, plat_dat->bsp_priv);
+ ret = rk_gmac_powerup(plat_dat->bsp_priv);
if (ret)
return ret;
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/4] Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks"
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
` (2 preceding siblings ...)
2016-11-05 13:04 ` [PATCH net-next 3/4] stmmac: dwmac-rk: absorb rk_gmac_init into probe Joachim Eastwood
@ 2016-11-05 13:04 ` Joachim Eastwood
2016-11-09 18:21 ` [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions David Miller
2016-11-09 19:14 ` Heiko Stuebner
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-11-05 13:04 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, heiko, linux-rockchip, vpalatin,
peppe.cavallaro, netdev
Instead of adding hooks inside stmmac_platform it is better to just use
the standard PM callbacks within the specific dwmac-driver. This only
used by the dwmac-rk driver.
This reverts commit cecbc5563a02 ("stmmac: allow to split suspend/resume
from init/exit callbacks").
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++------
include/linux/stmmac.h | 2 --
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 0a0d6a8..4d544c3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -417,9 +417,7 @@ static int stmmac_pltfr_suspend(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
ret = stmmac_suspend(dev);
- if (priv->plat->suspend)
- priv->plat->suspend(pdev, priv->plat->bsp_priv);
- else if (priv->plat->exit)
+ if (priv->plat->exit)
priv->plat->exit(pdev, priv->plat->bsp_priv);
return ret;
@@ -438,9 +436,7 @@ static int stmmac_pltfr_resume(struct device *dev)
struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev);
- if (priv->plat->resume)
- priv->plat->resume(pdev, priv->plat->bsp_priv);
- else if (priv->plat->init)
+ if (priv->plat->init)
priv->plat->init(pdev, priv->plat->bsp_priv);
return stmmac_resume(dev);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 705840e..3537fb3 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -135,8 +135,6 @@ struct plat_stmmacenet_data {
void (*bus_setup)(void __iomem *ioaddr);
int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv);
- void (*suspend)(struct platform_device *pdev, void *priv);
- void (*resume)(struct platform_device *pdev, void *priv);
void *bsp_priv;
struct stmmac_axi *axi;
int has_gmac4;
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
` (3 preceding siblings ...)
2016-11-05 13:04 ` [PATCH net-next 4/4] Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks" Joachim Eastwood
@ 2016-11-09 18:21 ` David Miller
2016-11-09 19:14 ` Heiko Stuebner
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-11-09 18:21 UTC (permalink / raw)
To: manabian; +Cc: heiko, linux-rockchip, vpalatin, peppe.cavallaro, netdev
From: Joachim Eastwood <manabian@gmail.com>
Date: Sat, 5 Nov 2016 14:04:48 +0100
> This patch set aims to remove the init/exit callbacks from the
> dwmac-rk driver and instead use standard PM callbacks. Eventually
> the init/exit callbacks will be deprecated and removed from all
> drivers dwmac-* except for dwmac-generic. Drivers will be refactored
> to use standard PM and remove callbacks.
>
> This conversion was pretty straight forward, but it would really nice
> if some chromium people could test suspend/resume with this patch set.
Series applied, thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
` (4 preceding siblings ...)
2016-11-09 18:21 ` [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions David Miller
@ 2016-11-09 19:14 ` Heiko Stuebner
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Stuebner @ 2016-11-09 19:14 UTC (permalink / raw)
To: Joachim Eastwood; +Cc: davem, linux-rockchip, vpalatin, peppe.cavallaro, netdev
Am Samstag, 5. November 2016, 14:04:48 CET schrieb Joachim Eastwood:
> This patch set aims to remove the init/exit callbacks from the
> dwmac-rk driver and instead use standard PM callbacks. Eventually
> the init/exit callbacks will be deprecated and removed from all
> drivers dwmac-* except for dwmac-generic. Drivers will be refactored
> to use standard PM and remove callbacks.
>
> This conversion was pretty straight forward, but it would really nice
> if some chromium people could test suspend/resume with this patch set.
while I couldn't test suspens/resume specifically, I at least can confirm that
regular probing + usage still works :-)
Dave already applied the series, but anyway
Tested-by: Heiko Stuebner <heiko@sntech.de>
Heiko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-11-09 19:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-05 13:04 [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 1/4] stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks Joachim Eastwood
[not found] ` <20161105130452.24226-1-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-05 13:04 ` [PATCH net-next 2/4] stmmac: dwmac-rk: turn exit into standard driver remove callback Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 3/4] stmmac: dwmac-rk: absorb rk_gmac_init into probe Joachim Eastwood
2016-11-05 13:04 ` [PATCH net-next 4/4] Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks" Joachim Eastwood
2016-11-09 18:21 ` [PATCH net-next 0/4] stmmac: dwmac-rk: convert to standard PM/remove functions David Miller
2016-11-09 19:14 ` Heiko Stuebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.