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: 69647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1782406wrd; Tue, 14 Mar 2023 07:12:19 -0700 (PDT) X-Google-Smtp-Source: AK7set8l5QJPV3HC/9+0IKTUKMmr8ENbf6G74/WmwN9czF4ASoseNiSWhVWcCBn29E5iKfMQ/1EG X-Received: by 2002:a17:902:ab97:b0:19a:e96a:58b3 with SMTP id f23-20020a170902ab9700b0019ae96a58b3mr31635830plr.22.1678803139484; Tue, 14 Mar 2023 07:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678803139; cv=none; d=google.com; s=arc-20160816; b=qYAyty3a36JYcPD/brAhw87K1w5BaBJ5RDNDHrwKuo+YCe19M1t2AaE+ixCA734cMW 59eFY44DN5cZCAsh0MT0urAVxCQFy2gcJADvPp3daF4O+a5TjFQTQ9a3VHAzNjZoT8FW nDC+AytGSJVwaLDq+SK44AjtfK3nk2effWzYRFaN3mLQFkkDJHCBy/kR+PQQN+ziWTGP oEyGOd4FT9J0sZlpvsIM2m6BSyt+HbUQvgVKS1DUC+I/4kgicIiXEY3fEBXTqtrqvR5c /j2LKs/u9xxJxcS0nKK+oPiolLdVHzWnaMbW6cFoel/DdjinNhkVJM3S5ApAaeKRaSwi YDeg== 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=Q8ZMw2KD5v3fCHjrS9Jk+uMrQDI3g1q9092LC222Wak=; b=WBraim9uFFmLytnl0rmPDUd+ZtQAOCGYOxZxdfizvptYvdWMl7Y+ynaO6olTWWtc/O cNSR26j0e/OvPkXfce3WAypLnaJYULkhZfvWrBoKJV3ResgUO8JvWCoeY0QTODPd9+IX AiDMRlatAY1vdOfVW3zvVkCsrxYsrhM5xtG6nsPboD27OGaeGf3phswZqaG5V1m+bRu+ 7dqyTFEI4Jqp50HHlPgCHZVGlFRstAmZNwOAUykw7TpI7MHylsTgKHjAnrWHLveVUxlG mmUrcqNpKTDrICkeAWJn90Bp/upwtIDvyDiJSwnRN0CxwsxvBN+sdUdG4OVvOOv/MjVd mbXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=G4U+u0yQ; 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 kc15-20020a17090333cf00b0019f269f06fbsi2471013plb.3.2023.03.14.07.12.02; Tue, 14 Mar 2023 07:12:19 -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=G4U+u0yQ; 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 S232124AbjCNNTX (ORCPT + 99 others); Tue, 14 Mar 2023 09:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232008AbjCNNSp (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 B3C5CAB8A8 for ; Tue, 14 Mar 2023 06:15:35 -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 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?1760352680859942460?= X-GMAIL-MSGID: =?utf-8?q?1760352680859942460?= 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: