From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46E30C83038 for ; Wed, 2 Jul 2025 17:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ikLWMyhZKlXIs40jM4QkUUZiF/UTiQOnKaCkmMfbejA=; b=q1FOL5hZamAhh/v8pJm278uU6Q PzRvpP1RyYCMjMvMWa3gkSb3wV+68oq760TlwvBDtIavt6NhY8TS6+y82snsj3Np8sbuqWNUpaQ6X wjMA4QGCGAl778fidJFTlCpEFkrJ9u0/jrC48pYq8e2P3lRg3+EXz6iA0fVZWSMg3v/Ij5pJudz4e Qk5K5+RTVsB6sRxVJdfgJ1q9lu8K7bGrl20ZKZYs5coI3uV8ifFONsp3etl8n+adCVygnL4AyDz2f mpXxl12/kD6FHar2oRn82d5DARIJ4QD2DRbDgDuxWsgsm5fmcbKoG3esMeT5Xp1vDwSN+ssy/BAt+ AGE/LXrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uX0q3-000000093HW-33PV; Wed, 02 Jul 2025 17:01:39 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uX0HT-00000008weI-0mB9 for linux-arm-kernel@bombadil.infradead.org; Wed, 02 Jul 2025 16:25:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=ikLWMyhZKlXIs40jM4QkUUZiF/UTiQOnKaCkmMfbejA=; b=d7ZP79I840YkKg6DvdzB2Fnc0x TbehRLEMBhsjSD8SNTcPYWA7xine1YvxSZpmb99wcuSTHYrYZvT2teLyv9saXvINr10nGQXaUfQfP HeDYe7Djei1CwkPmEA82QQQKHdi+IQXFCVQqN66RueV5hX3PgOwKyOoeT/2sZyVppqEnRtK2h4Nz4 Y2cCyWgA2y6Wa8wXNYkgzMm7Bc2FRS6LaY/wVutBBQk469qXktsyYdePtWlY41Y7AclzzsmGxe9L4 aMnohYyFHuR4GYLDuT7GLpav6W7h7IcuDFiIhdh/CV+9fGAX1qc2AWIu4vf/wiPgTQSMqilQBdtxa FdeaILrw==; Received: from server.couthit.com ([162.240.164.96]) by desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uX0HQ-00000007UsW-1CNH for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2025 16:25:54 +0000 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=ikLWMyhZKlXIs40jM4QkUUZiF/UTiQOnKaCkmMfbejA=; b=su41OIOoSNjybsDR5H8RnugOkg QL2+cYbMH109jVl+RJEZN+7MnJb3mvKptk+CFzhIaeKPBVxU+8AGjA+VcJjFF4tBOVzPpSbN0Hqj5 QcKYd0R0ok3hKNkfwwu6gxD0XofticNN4PmCwoK3LaQZNtYaJHpaja9I5Gd19y4eGeVTyg0964lBv l4VnqpSGOD9pdF1jtnhmd0TG/XpaNuSEkSZjJpMf7urWjxbK8pMWsu3WsWE10cKL2NLz7wt0cKOLI TF81+33Se1JkQlMqndlZRVrwImZihYNxRUgQ0IS0JIo+6SXHu287bFSU3+74rXieeBUcpeedKIY0v eQrVLhEw==; Received: from [122.175.9.182] (port=39304 helo=cypher.couthit.local) by server.couthit.com with esmtpa (Exim 4.98.1) (envelope-from ) id 1uX0HJ-00000004Tbr-1vBm; Wed, 02 Jul 2025 12:25:45 -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, vadim.fedorenko@linux.dev, 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 v10 09/11] net: ti: prueth: Adds power management support for PRU-ICSS Date: Wed, 2 Jul 2025 21:54:48 +0530 Message-Id: <20250702162450.1674937-10-parvathi@couthit.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250702140633.1612269-1-parvathi@couthit.com> References: <20250702140633.1612269-1-parvathi@couthit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 - lists.infradead.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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250702_172552_589870_E3B8D36C X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/ethernet/ti/icssm/icssm_prueth.c index 70d605c4c605..3fc895a2e355 100644 --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c @@ -2308,6 +2308,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, @@ -2333,6 +2390,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