public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Parvathi Pudi <parvathi@couthit.com>
To: danishanwar@ti.com, rogerq@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, ssantosh@kernel.org,
	richardcochran@gmail.com, s.hauer@pengutronix.de,
	m-karicheri2@ti.com, glaroque@baylibre.com, afd@ti.com,
	saikrishnag@marvell.com, m-malladi@ti.com,
	jacob.e.keller@intel.com, diogo.ivo@siemens.com,
	javier.carrasco.cruz@gmail.com, horms@kernel.org, s-anna@ti.com,
	basharath@couthit.com, parvathi@couthit.com
Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	pratheesh@ti.com, prajith@ti.com, vigneshr@ti.com,
	praneeth@ti.com, srk@ti.com, rogerq@ti.com, krishna@couthit.com,
	pmohan@couthit.com, mohan@couthit.com
Subject: [PATCH net-next v9 09/11] net: ti: prueth: Adds power management support for PRU-ICSS
Date: Mon, 23 Jun 2025 22:12:34 +0530	[thread overview]
Message-ID: <20250623164236.255083-10-parvathi@couthit.com> (raw)
In-Reply-To: <20250623135949.254674-1-parvathi@couthit.com>

From: Roger Quadros <rogerq@ti.com>

Changes for supporting the sleep/resume feature for PRU-ICSS.

PRU-ICSS will be kept in IDLE mode for optimal power consumption by Linux
power management subsystem and will be resumed when it is required.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>
Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
---
 drivers/net/ethernet/ti/icssm/icssm_prueth.c | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
index 3b90c9f7b76d..299bfd35077e 100644
--- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
+++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
@@ -2324,6 +2324,63 @@ static void icssm_prueth_remove(struct platform_device *pdev)
 		pru_rproc_put(prueth->pru1);
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int icssm_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 = icssm_emac_ndo_stop(ndev);
+			if (ret < 0) {
+				netdev_err(ndev, "failed to stop: %d", ret);
+				return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int icssm_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 = icssm_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(icssm_prueth_suspend, icssm_prueth_resume)
+};
+
 /* AM57xx SoC-specific firmware data */
 static struct prueth_private_data am57xx_prueth_pdata = {
 	.driver_data = PRUSS_AM57XX,
@@ -2349,6 +2406,7 @@ static struct platform_driver prueth_driver = {
 	.driver = {
 		.name = "prueth",
 		.of_match_table = prueth_dt_match,
+		.pm = &prueth_dev_pm_ops,
 	},
 };
 module_platform_driver(prueth_driver);
-- 
2.34.1



  parent reply	other threads:[~2025-06-23 21:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 13:59 [PATCH net-next v9 00/11] PRU-ICSSM Ethernet Driver Parvathi Pudi
2025-06-23 13:59 ` [PATCH net-next v9 01/11] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx, AM43xx and AM33xx SOCs Parvathi Pudi
2025-06-23 13:59 ` [PATCH net-next v9 02/11] net: ti: prueth: Adds ICSSM Ethernet driver Parvathi Pudi
2025-06-23 13:59 ` [PATCH net-next v9 03/11] net: ti: prueth: Adds PRUETH HW and SW configuration Parvathi Pudi
2025-06-23 15:26 ` [PATCH net-next v9 04/11] net: ti: prueth: Adds link detection, RX and TX support Parvathi Pudi
2025-06-23 15:26 ` [PATCH net-next v9 05/11] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Parvathi Pudi
2025-06-23 15:26 ` [PATCH net-next v9 06/11] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Parvathi Pudi
2025-06-24 11:05   ` Vadim Fedorenko
2025-06-25 13:18     ` Parvathi Pudi
2025-06-23 15:26 ` [PATCH net-next v9 07/11] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Parvathi Pudi
2025-06-23 16:42 ` [PATCH net-next v9 08/11] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Parvathi Pudi
2025-06-23 16:42 ` Parvathi Pudi [this message]
2025-06-23 16:42 ` [PATCH net-next v9 10/11] net: ti: prueth: Adds support for PRUETH on AM33x and AM43x SOCs Parvathi Pudi
2025-06-23 16:42 ` [PATCH net-next v9 11/11] net: ti: prueth: Adds PTP OC Support for AM335x and AM437x Parvathi Pudi
2025-06-24 11:29   ` Vadim Fedorenko
2025-06-25 13:32     ` Parvathi Pudi
2025-07-02 10:29       ` Parvathi Pudi

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=20250623164236.255083-10-parvathi@couthit.com \
    --to=parvathi@couthit.com \
    --cc=afd@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=basharath@couthit.com \
    --cc=conor+dt@kernel.org \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=diogo.ivo@siemens.com \
    --cc=edumazet@google.com \
    --cc=glaroque@baylibre.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=krishna@couthit.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=m-malladi@ti.com \
    --cc=mohan@couthit.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmohan@couthit.com \
    --cc=prajith@ti.com \
    --cc=praneeth@ti.com \
    --cc=pratheesh@ti.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=saikrishnag@marvell.com \
    --cc=srk@ti.com \
    --cc=ssantosh@kernel.org \
    --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