From nobody Thu Oct 9 00:34:39 2025 Received: from server.couthit.com (server.couthit.com [162.240.164.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1775327D776; Mon, 23 Jun 2025 16:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.240.164.96 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750697022; cv=none; b=s/PC8FjOudKvfRQPlHbjc44ArwID/JS9ReXl4Rsml0ht0tILf2cggtK7kxzBi5I/mC7BZtbXsbpCTRZ2sR7UKtMEaxlD6Ho+d4Z8QwdM5fHbd6UhgpW5sR8ak5Z6Mm7R3p+1jjSgP3e/taz4qxx+qcDU72RxBObmjhKJFo6yD7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750697022; c=relaxed/simple; bh=ZXTdfeb26uaNXAv97gaN9xQM3pNDrS6rzxQ8R7JlYqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Vhx4UhR7VbVwv/WosyeOgOefVL3HbHUhWolfSGTBenYTR9Q+qxPZyFEwTvfVwV9KMXa9rQRmdotKJyGhlFqWw6Cm/CeITlEqitJphs7AUbEaLJoHsRcOa/htQqnpGw4xf7SgRqhdhPRLiB3oiXqLnlim8YJFpLZehqeK1K6zbtw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=couthit.com; spf=pass smtp.mailfrom=couthit.com; dkim=pass (2048-bit key) header.d=couthit.com header.i=@couthit.com header.b=JUd/y+n4; arc=none smtp.client-ip=162.240.164.96 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=couthit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=couthit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=couthit.com header.i=@couthit.com header.b="JUd/y+n4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=couthit.com ; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tPDgy8YT+1r/YyiodNlgBj8cY39Os8WV0X93E3xwm5c=; b=JUd/y+n4SZQwzXuqbLKWWc6kw5 QtT/TTbu8cS2Pd8Vnik0hg6kMwz0svBZJnHSL7woL+BHFWPYYBeEXtSaoD6uDSQZGt9IobqRpc0qH J37z0ntkRiC0o+Ott7LMM+7vUBB5uTQaNA9VtdoRxiWM6o6wFZojNqJl0ah8xPrHjFpFem1AxMLKQ iuBsJZqTUhjHWrMeOGjcpsT2JE2/c09x7a4/XeBS1OHUQqRTlwP4MNEUJqqJaFQvHa3UzY4h2+P1l jOYG2dQ/3oYYkbIYB8QYDhSvptm3Pul6opqAgpBzMdvQCn2y6IYu9OiMx7p0tzWYD5OhtwmYZJHZx LeG0XqlA==; Received: from [122.175.9.182] (port=13719 helo=cypher.couthit.local) by server.couthit.com with esmtpa (Exim 4.98.1) (envelope-from ) id 1uTkGd-00000006VGn-0xuV; Mon, 23 Jun 2025 12:43:35 -0400 From: Parvathi Pudi 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 Message-Id: <20250623164236.255083-10-parvathi@couthit.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250623135949.254674-1-parvathi@couthit.com> References: <20250623135949.254674-1-parvathi@couthit.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.couthit.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - couthit.com X-Get-Message-Sender-Via: server.couthit.com: authenticated_id: parvathi@couthit.com X-Authenticated-Sender: server.couthit.com: parvathi@couthit.com X-Source: X-Source-Args: X-Source-Dir: Content-Type: text/plain; charset="utf-8" From: Roger Quadros 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 Signed-off-by: Andrew F. Davis Signed-off-by: Basharath Hussain Khaja Signed-off-by: Parvathi Pudi --- 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/eth= ernet/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_devi= ce *pdev) pru_rproc_put(prueth->pru1); } =20 +#ifdef CONFIG_PM_SLEEP +static int icssm_prueth_suspend(struct device *dev) +{ + struct prueth *prueth =3D dev_get_drvdata(dev); + struct net_device *ndev; + int i, ret; + + for (i =3D 0; i < PRUETH_NUM_MACS; i++) { + ndev =3D prueth->registered_netdevs[i]; + + if (!ndev) + continue; + + if (netif_running(ndev)) { + netif_device_detach(ndev); + ret =3D 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 =3D dev_get_drvdata(dev); + struct net_device *ndev; + int i, ret; + + for (i =3D 0; i < PRUETH_NUM_MACS; i++) { + ndev =3D prueth->registered_netdevs[i]; + + if (!ndev) + continue; + + if (netif_running(ndev)) { + ret =3D 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 =3D { + SET_SYSTEM_SLEEP_PM_OPS(icssm_prueth_suspend, icssm_prueth_resume) +}; + /* AM57xx SoC-specific firmware data */ static struct prueth_private_data am57xx_prueth_pdata =3D { .driver_data =3D PRUSS_AM57XX, @@ -2349,6 +2406,7 @@ static struct platform_driver prueth_driver =3D { .driver =3D { .name =3D "prueth", .of_match_table =3D prueth_dt_match, + .pm =3D &prueth_dev_pm_ops, }, }; module_platform_driver(prueth_driver); --=20 2.34.1