linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Corentin Labbe <clabbe@baylibre.com>
Cc: Ondrej Jirman <megous@megous.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
	Samuel Holland <samuel@sholland.org>
Subject: [PATCH net-next 5/5] net: stmmac: dwmac-sun8i: Add a shutdown callback
Date: Sun,  3 Jan 2021 05:25:42 -0600	[thread overview]
Message-ID: <20210103112542.35149-6-samuel@sholland.org> (raw)
In-Reply-To: <20210103112542.35149-1-samuel@sholland.org>

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 <samuel@sholland.org>
---
 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


  parent reply	other threads:[~2021-01-03 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 11:25 [PATCH net-next 0/5] dwmac-sun8i cleanup and shutdown hook Samuel Holland
2021-01-03 11:25 ` [PATCH net-next 1/5] net: stmmac: dwmac-sun8i: Return void from PHY unpower Samuel Holland
2021-01-06 10:00   ` Chen-Yu Tsai
2021-01-03 11:25 ` [PATCH net-next 2/5] net: stmmac: dwmac-sun8i: Remove unnecessary PHY power check Samuel Holland
2021-01-06 10:00   ` Chen-Yu Tsai
2021-01-03 11:25 ` [PATCH net-next 3/5] net: stmmac: dwmac-sun8i: Use reset_control_reset Samuel Holland
2021-01-06 10:00   ` Chen-Yu Tsai
2021-01-03 11:25 ` [PATCH net-next 4/5] net: stmmac: dwmac-sun8i: Minor probe function cleanup Samuel Holland
2021-01-06 10:01   ` Chen-Yu Tsai
2021-01-03 11:25 ` Samuel Holland [this message]
2021-01-06 10:07   ` [PATCH net-next 5/5] net: stmmac: dwmac-sun8i: Add a shutdown callback Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210103112542.35149-6-samuel@sholland.org \
    --to=samuel@sholland.org \
    --cc=alexandre.torgue@st.com \
    --cc=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=jernej.skrabec@siol.net \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=megous@megous.com \
    --cc=mripard@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).