From: MD Danish Anwar <danishanwar@ti.com>
To: Randy Dunlap <rdunlap@infradead.org>,
Roger Quadros <rogerq@kernel.org>,
Simon Horman <simon.horman@corigine.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
Andrew Lunn <andrew@lunn.ch>,
Richard Cochran <richardcochran@gmail.com>,
Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
MD Danish Anwar <danishanwar@ti.com>
Cc: <nm@ti.com>, <srk@ti.com>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>, <netdev@vger.kernel.org>,
<linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH v13 10/10] net: ti: icssg-prueth: Add Power management support
Date: Tue, 1 Aug 2023 14:44:28 +0530 [thread overview]
Message-ID: <20230801091428.1359979-11-danishanwar@ti.com> (raw)
In-Reply-To: <20230801091428.1359979-1-danishanwar@ti.com>
Add suspend / resume APIs to support power management in ICSSG ethernet
driver.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 57 ++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 80721d82f6c5..47b941fb0198 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -1813,6 +1813,62 @@ static void prueth_remove(struct platform_device *pdev)
prueth_put_cores(prueth, ICSS_SLICE0);
}
+#ifdef CONFIG_PM_SLEEP
+static int prueth_suspend(struct device *dev)
+{
+ struct prueth *prueth = dev_get_drvdata(dev);
+ struct net_device *ndev;
+ int i, ret;
+
+ for (i = 0; i < PRUETH_NUM_MACS; i++) {
+ ndev = prueth->registered_netdevs[i];
+
+ if (!ndev)
+ continue;
+
+ if (netif_running(ndev)) {
+ netif_device_detach(ndev);
+ ret = emac_ndo_stop(ndev);
+ if (ret < 0) {
+ netdev_err(ndev, "failed to stop: %d", ret);
+ return ret;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int prueth_resume(struct device *dev)
+{
+ struct prueth *prueth = dev_get_drvdata(dev);
+ struct net_device *ndev;
+ int i, ret;
+
+ for (i = 0; i < PRUETH_NUM_MACS; i++) {
+ ndev = prueth->registered_netdevs[i];
+
+ if (!ndev)
+ continue;
+
+ if (netif_running(ndev)) {
+ ret = emac_ndo_open(ndev);
+ if (ret < 0) {
+ netdev_err(ndev, "failed to start: %d", ret);
+ return ret;
+ }
+ netif_device_attach(ndev);
+ }
+ }
+
+ return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops prueth_dev_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(prueth_suspend, prueth_resume)
+};
+
static const struct prueth_pdata am654_icssg_pdata = {
.fdqring_mode = K3_RINGACC_RING_MODE_MESSAGE,
.quirk_10m_link_issue = 1,
@@ -1830,6 +1886,7 @@ static struct platform_driver prueth_driver = {
.driver = {
.name = "icssg-prueth",
.of_match_table = prueth_dt_match,
+ .pm = &prueth_dev_pm_ops,
},
};
module_platform_driver(prueth_driver);
--
2.34.1
next prev parent reply other threads:[~2023-08-01 9:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 9:14 [PATCH v13 00/10] Introduce ICSSG based ethernet Driver MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 01/10] net: ti: icssg-prueth: Add Firmware Interface for ICSSG Ethernet driver MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 02/10] net: ti: icssg-prueth: Add mii helper apis and macros MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 03/10] net: ti: icssg-prueth: Add Firmware config and classification APIs MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 04/10] net: ti: icssg-prueth: Add icssg queues APIs and macros MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 05/10] dt-bindings: net: Add ICSSG Ethernet MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 06/10] net: ti: icssg-prueth: Add ICSSG ethernet driver MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 07/10] net: ti: icssg-prueth: Add ICSSG Stats MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 08/10] net: ti: icssg-prueth: Add Standard network staticstics MD Danish Anwar
2023-08-01 9:14 ` [PATCH v13 09/10] net: ti: icssg-prueth: Add ethtool ops for ICSSG Ethernet driver MD Danish Anwar
2023-08-01 9:14 ` MD Danish Anwar [this message]
2023-08-02 9:50 ` [PATCH v13 00/10] Introduce ICSSG based ethernet Driver patchwork-bot+netdevbpf
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=20230801091428.1359979-11-danishanwar@ti.com \
--to=danishanwar@ti.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--cc=robh+dt@kernel.org \
--cc=rogerq@kernel.org \
--cc=simon.horman@corigine.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
/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).