From patchwork Wed Mar 15 07:41:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 70063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2191668wrd; Wed, 15 Mar 2023 00:53:08 -0700 (PDT) X-Google-Smtp-Source: AK7set/vnHXlo92mc8chpzum6a4lY8KjrRjrsRLeqwTpeEZMEJxJnj3YivHRm+Nb5c0gud5QFLjv X-Received: by 2002:a05:6a20:4b0f:b0:d3:5c72:8fb4 with SMTP id fp15-20020a056a204b0f00b000d35c728fb4mr11620096pzb.60.1678866788532; Wed, 15 Mar 2023 00:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678866788; cv=none; d=google.com; s=arc-20160816; b=x35UMzv0LEWRGfhH1IKdHlsYn3kXYZ07XTCZlvZWGxAIHXHMxEuKJ/v3qkkm7TpaZY 7dMuk14Gu32Q6g8nT/8jRaeXQmlrtbS210aScykA9jmEttkrM8w9Af8Afy25F9PFBKmA ApKOlw5D/DqwxFONF8uz0Hz1YoZN/i77l39Jo0Dwcq+ysvtNwLUosfqKXiRFit+liW4r ix4SxqcFCrqF5kjTbNBLLV9GDxpr2KF05m1K7g/4+Rhc5gVCqx5t9KxNBStqHTTeB2pP 4JcNqH9N1xu+T7WfC1KFZt9LOS40TBtqyb+JwfYJgIRkAmcWXskveE+BTsz/KOnMGsQT JtPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XuDADNbTIA0u404jbbW1PxIL0/jnQYuL12rdn/bRaOE=; b=ZpfovhtrUcfNvRHqINIW4gbpdnWRZ2zGQS+TCrzyO3XOYgR3CCp752kYxHaUfKVVrD kR4lGJyLws0FVeIf5SWmSpWt8XeqsPEpTnlQnWbXDlFl4mMOXldbv1+is3llJg1TU5Am pjImexDYyQlmXJ0H1TdNL6LJreTAwNt1E2V5Bk0NEI0wQ1QTpvxgb29SWppbzllnDpdY 3CBokfu5VC9A9A9Q9Z0NvDXonyhlGxsUj7jUGgTgP9w9pKcBl1rK94iImab22K4Zjw2u dWpvHnxpQIAGUjHvgZe0vQom4brKEiTSyc7peHjbIbfO5PkOEK8b9aHGdmMzeyGNaG6/ VVMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=KhIQ3ll1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a636e02000000b00502d65e848asi4356800pgc.466.2023.03.15.00.52.55; Wed, 15 Mar 2023 00:53:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=KhIQ3ll1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbjCOHlt (ORCPT + 99 others); Wed, 15 Mar 2023 03:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbjCOHlb (ORCPT ); Wed, 15 Mar 2023 03:41:31 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43981114B for ; Wed, 15 Mar 2023 00:41:19 -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=m7UEnYSG6OR+ed oEfclQR+s4WbTHqh7EZ3BJ4PdJrU0=; b=KhIQ3ll1W8AM6b4pQ83K3+GY7XIjlk zSUMld3QD9amKUy+FdCXF/9qTRNkRCXUttxSjJqfnHC0KdEIKMWRApFW/QgHvSyi uUGGvwWSsIXBVKjJtaZiT66xbAicU93YgEX5CbQoeJXmtuT7XCNVyHdKW8eMSaJY 4i5N7c156kxko= Received: (qmail 3360682 invoked from network); 15 Mar 2023 08:41:17 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Mar 2023 08:41:17 +0100 X-UD-Smtp-Session: l3s3148p1@C3woeOv2Jo0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , Heiner Kallweit , Michal Kubiak , Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven , Florian Fainelli , linux-kernel@vger.kernel.org Subject: [PATCH net v2 1/2] ravb: avoid PHY being resumed when interface is not up Date: Wed, 15 Mar 2023 08:41:14 +0100 Message-Id: <20230315074115.3008-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230315074115.3008-1-wsa+renesas@sang-engineering.com> References: <20230315074115.3008-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760419421907530095?= X-GMAIL-MSGID: =?utf-8?q?1760419421907530095?= 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 Reviewed-by: Michal Kubiak Reviewed-by: Sergey Shtylyov Reviewed-by: Florian Fainelli --- 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 Wed Mar 15 07:41:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 70060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2189488wrd; Wed, 15 Mar 2023 00:45:14 -0700 (PDT) X-Google-Smtp-Source: AK7set9duuWiiJnvvJzi2becZKCenV8ri6xwkaPHxTtuXRbgkXSRlmNKJql0RUFSP4Dn4jnq2k/C X-Received: by 2002:a17:902:d2d0:b0:19e:8bfe:7d70 with SMTP id n16-20020a170902d2d000b0019e8bfe7d70mr1948844plc.52.1678866314628; Wed, 15 Mar 2023 00:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678866314; cv=none; d=google.com; s=arc-20160816; b=HyjR1GetAEjSUTDYMNl9rkOjXGdUhchWp4sVmYpQpKICE7TYgLvL7b/rBxZUOdyu/A +uqrk1Uuo9CkICOtbvEuPEuIxIpHHvDxLm/ipbRO1xg5dDIBwnJlNGw6OqRL6IVl/FzU bn3SHtKciYT1NVtbC6IKWHm0K/groY3bwE+1SV2Hpon6+c/4namhm8UhUJUzthSOnMQ6 cJoCOml+3cpzz2L3JMYKB/fRxunkZQ260rkpdyqdu8QJCfUA9I0lV2iGCUf/bEgB6CcK b8+/MC3hgP+DKBsYMdnVSVKEaHuytnLHhrS/M/NxPp4avGch+7H6+B1NkejHkVclSfDI YOHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QSx1bB82zYgxaRG5xfS9Fv41wa7/NlD14UAM+wEL84c=; b=N/K2ln7q+a8TbeBBYLSfAKKC5tbIdq/Uz50Cjg8BX0cCvsiJ6gmlV7xxeU8eWB7niT XgwZ2XZvBOgjVU7VrVxHUB0yTu9fa3dN15rooDohwd5848jDD6uQWKMecwcfIMgswNfl cgxVE6vemZ1lDhOa/P4oZcQp2WY3pTjdLiZnOC6smn/V3FMpEaFbBOgK/OFxx6fX4Z+u IIWXg8YQG4dJuYlpKOBveeKCuXMKD0j7XrrzvqRUke3jW3p20+9FB5RLFfd/meiOSg2v GQ3rhHpTZUG0uhDb2MM1p8zBnaJewK5Pt6Cuqt6pUfC3Q656DM5vs0TIJqNKRoOqxzEQ YN/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=nxBrUs2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw3-20020a170903278300b0019abafb4d46si4293037plb.299.2023.03.15.00.45.01; Wed, 15 Mar 2023 00:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=nxBrUs2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbjCOHlw (ORCPT + 99 others); Wed, 15 Mar 2023 03:41:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231705AbjCOHlc (ORCPT ); Wed, 15 Mar 2023 03:41:32 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9694761B1 for ; Wed, 15 Mar 2023 00:41:21 -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=E5D8bY9VkslgBK gjYCUz9jbFzM7EgGZJl6fep7xHb4A=; b=nxBrUs2R/+ciWpikYWkTvmvM2TZ8Vw 75h9TLng598l75dA7oA5Pmzx1ilQYae78Q4LGX6APq8pQCrqzWP1v+yjUx6o/jjq VDt/37cvO0FzPpO87Q9OKvLib92rZu6G+w0jhoAIOzDDF13Cc3wccE+cY1FUUL5+ VfVKtFJTmePoQ= Received: (qmail 3360734 invoked from network); 15 Mar 2023 08:41:18 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Mar 2023 08:41:18 +0100 X-UD-Smtp-Session: l3s3148p1@tVoyeOv2No0ujnvb From: Wolfram Sang To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , Heiner Kallweit , Michal Kubiak , Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven , Florian Fainelli , linux-kernel@vger.kernel.org Subject: [PATCH net v2 2/2] sh_eth: avoid PHY being resumed when interface is not up Date: Wed, 15 Mar 2023 08:41:15 +0100 Message-Id: <20230315074115.3008-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230315074115.3008-1-wsa+renesas@sang-engineering.com> References: <20230315074115.3008-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760418924667460108?= X-GMAIL-MSGID: =?utf-8?q?1760418924667460108?= 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 Reviewed-by: Michal Kubiak Reviewed-by: Sergey Shtylyov --- 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: