2021-01-03 11:29:26

by Samuel Holland

[permalink] [raw]
Subject: [PATCH net-next 0/5] dwmac-sun8i cleanup and shutdown hook

These patches clean up some things I noticed while fixing suspend/resume
behavior. The first four are minor code improvements. The last one adds
a shutdown hook to minimize power consumption on boards without a PMIC.

Samuel Holland (5):
net: stmmac: dwmac-sun8i: Return void from PHY unpower
net: stmmac: dwmac-sun8i: Remove unnecessary PHY power check
net: stmmac: dwmac-sun8i: Use reset_control_reset
net: stmmac: dwmac-sun8i: Minor probe function cleanup
net: stmmac: dwmac-sun8i: Add a shutdown callback

.../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 31 ++++++++++++-------
1 file changed, 19 insertions(+), 12 deletions(-)

--
2.26.2


2021-01-03 11:30:14

by Samuel Holland

[permalink] [raw]
Subject: [PATCH net-next 5/5] net: stmmac: dwmac-sun8i: Add a shutdown callback

The Ethernet MAC and PHY are usually major consumers of power on boards
which may not be able to fully power off (that have no PMIC). Powering
down the MAC and internal PHY saves power while these boards are "off".

Signed-off-by: Samuel Holland <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 4638d4203af5..926e8d5e8963 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -1282,6 +1282,15 @@ static int sun8i_dwmac_remove(struct platform_device *pdev)
return 0;
}

+static void sun8i_dwmac_shutdown(struct platform_device *pdev)
+{
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+
+ sun8i_dwmac_exit(pdev, gmac);
+}
+
static const struct of_device_id sun8i_dwmac_match[] = {
{ .compatible = "allwinner,sun8i-h3-emac",
.data = &emac_variant_h3 },
@@ -1302,6 +1311,7 @@ MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
static struct platform_driver sun8i_dwmac_driver = {
.probe = sun8i_dwmac_probe,
.remove = sun8i_dwmac_remove,
+ .shutdown = sun8i_dwmac_shutdown,
.driver = {
.name = "dwmac-sun8i",
.pm = &stmmac_pltfr_pm_ops,
--
2.26.2

2021-01-06 10:10:10

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH net-next 5/5] net: stmmac: dwmac-sun8i: Add a shutdown callback

On Sun, Jan 3, 2021 at 7:25 PM Samuel Holland <[email protected]> wrote:
>
> The Ethernet MAC and PHY are usually major consumers of power on boards
> which may not be able to fully power off (that have no PMIC). Powering
> down the MAC and internal PHY saves power while these boards are "off".
>
> Signed-off-by: Samuel Holland <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>