From patchwork Tue Mar 14 13:14:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13174420 X-Patchwork-Delegate: geert@linux-m68k.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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1338EC6FD1C for ; Tue, 14 Mar 2023 13:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231892AbjCNNTW (ORCPT ); Tue, 14 Mar 2023 09:19:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbjCNNSp (ORCPT ); Tue, 14 Mar 2023 09:18:45 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 418C3AB8B4 for ; Tue, 14 Mar 2023 06:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=5TX7Vu8A/Hblqz ptlgcq+EvT8rUB/Nkipsy3xPzbH9s=; b=G4U+u0yQCQSeXTUMeBLWkC3GwCba8V DIL81KqVgCbn8j9Wh09ol42vqzA90q0DCgeGWCMNXnHD9ryvB5c5XjxQPiRwXhca gJqVdSQl+rGuBQklmyQHBTWcWyk0W2QPmGtkON0jWKv3WhxxESNIRzEe1ezby1/U M/pyyUKzvaZQc= Received: (qmail 3111568 invoked from network); 14 Mar 2023 14:14:56 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 14 Mar 2023 14:14:56 +0100 X-UD-Smtp-Session: l3s3148p1@yjiKA9z2js0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de, Wolfram Sang , Heiner Kallweit , Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven , Florian Fainelli , linux-kernel@vger.kernel.org Subject: [PATCH net 1/4] ravb: avoid PHY being resumed when interface is not up Date: Tue, 14 Mar 2023 14:14:39 +0100 Message-Id: <20230314131443.46342-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> References: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org RAVB doesn't need mdiobus suspend/resume, that's why it sets 'mac_managed_pm'. However, setting it needs to be moved from init to probe, so mdiobus PM functions will really never be called (e.g. when the interface is not up yet during suspend/resume). Fixes: 4924c0cdce75 ("net: ravb: Fix PHY state warning splat during system resume") Suggested-by: Heiner Kallweit Signed-off-by: Wolfram Sang --- drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0f54849a3823..894e2690c643 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1455,8 +1455,6 @@ static int ravb_phy_init(struct net_device *ndev) phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); } - /* Indicate that the MAC is responsible for managing PHY PM */ - phydev->mac_managed_pm = true; phy_attached_info(phydev); return 0; @@ -2379,6 +2377,8 @@ static int ravb_mdio_init(struct ravb_private *priv) { struct platform_device *pdev = priv->pdev; struct device *dev = &pdev->dev; + struct phy_device *phydev; + struct device_node *pn; int error; /* Bitbang init */ @@ -2400,6 +2400,14 @@ static int ravb_mdio_init(struct ravb_private *priv) if (error) goto out_free_bus; + pn = of_parse_phandle(dev->of_node, "phy-handle", 0); + phydev = of_phy_find_device(pn); + if (phydev) { + phydev->mac_managed_pm = true; + put_device(&phydev->mdio.dev); + } + of_node_put(pn); + return 0; out_free_bus: From patchwork Tue Mar 14 13:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13174423 X-Patchwork-Delegate: geert@linux-m68k.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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CB1DC6FD1D for ; Tue, 14 Mar 2023 13:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231863AbjCNNTc (ORCPT ); Tue, 14 Mar 2023 09:19:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbjCNNTC (ORCPT ); Tue, 14 Mar 2023 09:19:02 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79DE5ABAEF for ; Tue, 14 Mar 2023 06:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=tavda8UXLKrs9l ANFo8U4RN/BFpi0fs4WuVKPhmPVs0=; b=F2zKgF211WIEEAdGUWvHapL/d26hH9 GHKORGNixFd0+NOffB0rFLhuyGFsgRO9sRCrV3EEVZrA++DhZY6vzBNx3xh+u33w lBWL4ElLJYCoTcwNLafQpi/9fmN/7lJAenIg0eNIdAUd9Ezr2wpYcaTa7c5IBhSS g/ycwkUlajY+M= Received: (qmail 3111634 invoked from network); 14 Mar 2023 14:14:57 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 14 Mar 2023 14:14:57 +0100 X-UD-Smtp-Session: l3s3148p1@uxuWA9z2ms0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de, Wolfram Sang , Heiner Kallweit , Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Geert Uytterhoeven , linux-kernel@vger.kernel.org Subject: [PATCH net 2/4] sh_eth: avoid PHY being resumed when interface is not up Date: Tue, 14 Mar 2023 14:14:40 +0100 Message-Id: <20230314131443.46342-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> References: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org SH_ETH doesn't need mdiobus suspend/resume, that's why it sets 'mac_managed_pm'. However, setting it needs to be moved from init to probe, so mdiobus PM functions will really never be called (e.g. when the interface is not up yet during suspend/resume). Fixes: 6a1dbfefdae4 ("net: sh_eth: Fix PHY state warning splat during system resume") Suggested-by: Heiner Kallweit Signed-off-by: Wolfram Sang --- drivers/net/ethernet/renesas/sh_eth.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index ed17163d7811..d8ec729825be 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2029,8 +2029,6 @@ static int sh_eth_phy_init(struct net_device *ndev) if (mdp->cd->register_type != SH_ETH_REG_GIGABIT) phy_set_max_speed(phydev, SPEED_100); - /* Indicate that the MAC is responsible for managing PHY PM */ - phydev->mac_managed_pm = true; phy_attached_info(phydev); return 0; @@ -3097,6 +3095,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp, struct bb_info *bitbang; struct platform_device *pdev = mdp->pdev; struct device *dev = &mdp->pdev->dev; + struct phy_device *phydev; + struct device_node *pn; /* create bit control struct for PHY */ bitbang = devm_kzalloc(dev, sizeof(struct bb_info), GFP_KERNEL); @@ -3133,6 +3133,14 @@ static int sh_mdio_init(struct sh_eth_private *mdp, if (ret) goto out_free_bus; + pn = of_parse_phandle(dev->of_node, "phy-handle", 0); + phydev = of_phy_find_device(pn); + if (phydev) { + phydev->mac_managed_pm = true; + put_device(&phydev->mdio.dev); + } + of_node_put(pn); + return 0; out_free_bus: From patchwork Tue Mar 14 13:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13174422 X-Patchwork-Delegate: geert@linux-m68k.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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E32C6FD1C for ; Tue, 14 Mar 2023 13:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232378AbjCNNTa (ORCPT ); Tue, 14 Mar 2023 09:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbjCNNSz (ORCPT ); Tue, 14 Mar 2023 09:18:55 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13AE2AB8BE for ; Tue, 14 Mar 2023 06:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=VjTn3E20TaRsaW HsM1MQTWl0oPBdqH1Fh0HrLM/sBLQ=; b=EQCfCw6pYRkDgljCsJYRNtEbYyyLTu go8Oyi1uENTxLGwzL8K5CG5Jl+he9MDhaqZsFZB78NH8WB6/Kn3YzIFuVdktfoqG 3WVDlFSuzWysobydUzl2tABDGnX05VuRwysFwLgGQKCk8YHpomsGfkx807wSDVK9 1QH62rX1QU9FM= Received: (qmail 3111673 invoked from network); 14 Mar 2023 14:14:57 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 14 Mar 2023 14:14:57 +0100 X-UD-Smtp-Session: l3s3148p1@5b2gA9z2ps0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de, Wolfram Sang , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/4] fec: add FIXME to move 'mac_managed_pm' to probe Date: Tue, 14 Mar 2023 14:14:41 +0100 Message-Id: <20230314131443.46342-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> References: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Renesas hardware, we had issues because the above flag was set during 'open'. It was concluded that it needs to be set during 'probe'. It looks like FEC needs the same fix but I can't test it because I don't have the hardware. At least, leave a note about the issue. Signed-off-by: Wolfram Sang --- drivers/net/ethernet/freescale/fec_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index c73e25f8995e..b16f56208d66 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2318,6 +2318,7 @@ static int fec_enet_mii_probe(struct net_device *ndev) fep->link = 0; fep->full_duplex = 0; + /* FIXME: should be set right after mdiobus is registered */ phy_dev->mac_managed_pm = true; phy_attached_info(phy_dev); From patchwork Tue Mar 14 13:14:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13174421 X-Patchwork-Delegate: geert@linux-m68k.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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C79CAC6FD1D for ; Tue, 14 Mar 2023 13:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbjCNNT1 (ORCPT ); Tue, 14 Mar 2023 09:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232399AbjCNNSr (ORCPT ); Tue, 14 Mar 2023 09:18:47 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C92984C9 for ; Tue, 14 Mar 2023 06:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=SsTC9UU9wdPdSI 0PbPhntycZBlShn3e/V5pFPLMU5/8=; b=ZvcXfLKABiDC9npZb4SVa4ELduNGUH JYWlTOq5gC2b1Av3MwV0fQnLvYANm1jrF0pT40lXXp0CxRsKZsy3vYQ9Tq9h8aJr 28EY9RgVIc3Y//DR8263wPxS2Mdmzx+kTMLxVu0VBVJZZG9mv8UlX+qnZXcuzzXG m9CExX8bF7Wg4= Received: (qmail 3111703 invoked from network); 14 Mar 2023 14:14:58 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 14 Mar 2023 14:14:58 +0100 X-UD-Smtp-Session: l3s3148p1@fFKrA9z2ts0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, kernel@pengutronix.de, Wolfram Sang , Steve Glendinning , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/4] smsc911x: add FIXME to move 'mac_managed_pm' to probe Date: Tue, 14 Mar 2023 14:14:42 +0100 Message-Id: <20230314131443.46342-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> References: <20230314131443.46342-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Renesas hardware, we had issues because the above flag was set during 'open'. It was concluded that it needs to be set during 'probe'. It looks like SMS911x needs the same fix but I can't test it because I don't have the hardware. At least, leave a note about the issue. Signed-off-by: Wolfram Sang --- drivers/net/ethernet/smsc/smsc911x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index a2e511912e6a..745e0180eb34 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -1038,6 +1038,7 @@ static int smsc911x_mii_probe(struct net_device *dev) } /* Indicate that the MAC is responsible for managing PHY PM */ + /* FIXME: should be set right after mdiobus is registered */ phydev->mac_managed_pm = true; phy_attached_info(phydev);