Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6556179rwb; Mon, 12 Dec 2022 03:35:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5yxJz1qa/1zgtTUpHXMlcBt3U9uDvYt+ypjx9JBIQ8YgixC4fTU2f6MPV2LOUdl+A0fjyQ X-Received: by 2002:a05:6402:2b95:b0:460:5706:d1fa with SMTP id fj21-20020a0564022b9500b004605706d1famr12310943edb.18.1670844955336; Mon, 12 Dec 2022 03:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670844955; cv=none; d=google.com; s=arc-20160816; b=fWjhIN1TWXWF2f15rEddAnazbhgsfcULQ2EPy8PzRhj6UkBII1AxtX4NmHtJFx982t 2gO5l20uHfAvUiAi7aJxGNREmeH3TgqqF2t/vWUxNrKtU0Rgq5EaPwpjwKY/0FnVt2zq oV9APjIR/ckAb6y81bz5DBUCKg+HjzCF3vTar1hEAMKrNI2qI5aNtYn/CuNcQawtwaE2 Ykl61BvXYp7bh/ZvGIrFWB40gvAprWf8W2X2I7vnWRNo2PEc/9ED71oB7eGjpWu2W+Nl 5U6gLv1YmNNUsri7PNlLfmbYgYDBw6TzI/HSya+JF8hsF6firOXG5/jEImjIZj3cSVOl ovOA== 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=HkpAtFaB7Mse9vde/nAl7iN4X+aL5zOO+OIoUjczACY=; b=SpjCKqjqq0fBeNXZjMUPlCaN/WSiFpP2JAjd3HHyo+GiRICLc8xYoAjzsGVelk0bk4 3WZqIbxo6rRQkKSK9i+CsqEeGJwG3Oq4pdWzG8ABrHJ508jK7SMG2ry0mZ6siXXpEf/p CDOUs3WXu7SNDqun5zj9Oat+OfyuH8qrws8Vd68Yz+KbZHtiMQg0SzbHw4sZpizRgNFI kJJcMnOcFqVMSOSt6M1ySdMZgYiT0PoVSbYUHxX0oa4H9Ta/cNEOPmhu2amKI+907C1O vjgBM/j80W2PShttRG1eY8z6eYN8dYu4uO3Yl8T1J4N4CwZqFfiaV7MwTQNSXWIl+n6W SVVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=nxGyc62m; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb7-20020a0564020d0700b00461aa80dfa8si8464508edb.429.2022.12.12.03.35.37; Mon, 12 Dec 2022 03:35:55 -0800 (PST) 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=pass header.i=@microchip.com header.s=mchp header.b=nxGyc62m; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbiLLLYe (ORCPT + 75 others); Mon, 12 Dec 2022 06:24:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbiLLLYE (ORCPT ); Mon, 12 Dec 2022 06:24:04 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D6DCC; Mon, 12 Dec 2022 03:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670844218; x=1702380218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gDWgZWt68B2FUuPmIEy3AshiMsSgCuxMFYszX/kL4qo=; b=nxGyc62mBqB4PLBG3IqkKK2SAXy6UroVDVzUMEPXSY2rqPG+N7YCmznu B1Ct03zDWln6QC9znslXSMSzJbKofWdldWewHC9HgVOq7T0Foh1hfqrXY +FV1s5R0v+ldNcrd4VAcns8SMNxnVlfJfUSQKda3D9ab5Cas7CikNsvTU IlMA1Z4HE36DRaEGOq5XJfSUIZlU0YaO5XAxplZHsi1exXGI+2RR3AjVI GJoux6N77hsWnjZAkUlZV36qf2ulkD+e7hacYUXYOUIVnSVoCcm5MGej/ YvYUFui72X992QC6eJJmAGcpUFdgvSmCTzxUxyMWpSqt5IoAmCKb7dbBv w==; X-IronPort-AV: E=Sophos;i="5.96,238,1665471600"; d="scan'208";a="127662351" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 12 Dec 2022 04:23:37 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 12 Dec 2022 04:23:35 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 12 Dec 2022 04:23:32 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , Claudiu Beznea Subject: [PATCH v2 1/2] net: phylink: init phydev on phylink_resume() Date: Mon, 12 Dec 2022 13:28:44 +0200 Message-ID: <20221212112845.73290-2-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20221212112845.73290-1-claudiu.beznea@microchip.com> References: <20221212112845.73290-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 There are scenarios where PHY power is cut off on system suspend. There are also MAC drivers which handles themselves the PHY on suspend/resume path. For such drivers the struct phy_device::mac_managed_phy is set to true and thus the mdio_bus_phy_suspend()/mdio_bus_phy_resume() wouldn't do the proper PHY suspend/resume. For such scenarios call phy_init_hw() from phylink_resume(). Suggested-by: Russell King (Oracle) Signed-off-by: Claudiu Beznea --- Hi, Russel, I let phy_init_hw() to execute for all devices. I can restrict it only for PHYs that has struct phy_device::mac_managed_phy = true. Please let me know what you think. Thank you, Claudiu Beznea drivers/net/phy/phylink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 09cc65c0da93..6003c329638e 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2031,6 +2031,12 @@ void phylink_resume(struct phylink *pl) { ASSERT_RTNL(); + if (pl->phydev) { + int ret = phy_init_hw(pl->phydev); + if (ret) + return; + } + if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) { /* Wake-on-Lan enabled, MAC handling */ -- 2.34.1