From patchwork Sun Jan 3 11:25:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 11995695 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65F57C433E0 for ; Sun, 3 Jan 2021 11:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A6872080D for ; Sun, 3 Jan 2021 11:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbhACL1U (ORCPT ); Sun, 3 Jan 2021 06:27:20 -0500 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:51585 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbhACL1S (ORCPT ); Sun, 3 Jan 2021 06:27:18 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 9A7DA560; Sun, 3 Jan 2021 06:25:47 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 03 Jan 2021 06:25:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=tlnaBS7FSiuy8 9dtVFPSHFaRijf3RFl2XE8UL3ebeVg=; b=A9e8wgKMfa37hxsHSSJiRVBTIrFZI 1HT8//uK1OtNmGQGz/g/3IWs9q3N84SV5Sy2jmlFYdroFCj2DUQDVVKc14hyTt9f Qi6w7wYnp4qTmzU2JYom0kWTrlPv186lePm+HJBLRCBygqbehAcAlvNtnjKyzZYR b94wySQDqnE4RxAQcdPBeiov7UrzPpSHuWPy0DU5NkWKRvF//epwkhBRATJwROZ1 7dyc8xP/3kBSuShzCQOCQWcmv5n2nkVv3JxeY72eOnoRW0RaZ7aB9yaedU4rIF6k EKNQJk8yjHExW40KbUP/eIuRlIbk/LbAiFH3Zqgu4R5fxIHFZnA7SejFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=tlnaBS7FSiuy89dtVFPSHFaRijf3RFl2XE8UL3ebeVg=; b=q3idQXzM OEXMQd8zvA3a/jW1H/U7Fkg1PUoRWRqch+rYReTm7/S8mSZps/0Ym2wrmSPBtCRu 16CBUuz8yeLQdj5nNAhW0zxqCg3Ot91Xu7tAnLldX9F29AS8Edetl/yVF2wuboes NgQuf6ZGgPZ4wvJKn1fEMIhSvKuRI0+KhNRZ0QJK0LKW0iGz+x6CE5y7bQAaRY7p ECLwxi5pVtRz4Lty0I24jX82Isz/EX7W+yJj5GPkJygeIfj4149/7NBIKxtxs9mw /Sh37xvRjWF6K8c4/5sKAQA5IjCsTN3xizURaW2zteQgo4Q6uY2KHwdZhyUZGmqB RywOVHvTprK9NQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdefuddgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id B3E8C1080064; Sun, 3 Jan 2021 06:25:45 -0500 (EST) From: Samuel Holland To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Corentin Labbe Cc: Ondrej Jirman , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Samuel Holland Subject: [PATCH net-next 5/5] net: stmmac: dwmac-sun8i: Add a shutdown callback Date: Sun, 3 Jan 2021 05:25:42 -0600 Message-Id: <20210103112542.35149-6-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210103112542.35149-1-samuel@sholland.org> References: <20210103112542.35149-1-samuel@sholland.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.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 Reviewed-by: Chen-Yu Tsai --- 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,