Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6141562rwb; Mon, 5 Dec 2022 08:27:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lzFeTM6lJ9pdQDPisz7cG/KbRtjeTTGGF4MI1DaUY9Bsx8ODP1A1GVXeijJ3hBAEVqlnr X-Received: by 2002:aa7:cd18:0:b0:46c:7d92:239d with SMTP id b24-20020aa7cd18000000b0046c7d92239dmr7764033edw.313.1670257666517; Mon, 05 Dec 2022 08:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670257666; cv=none; d=google.com; s=arc-20160816; b=gRY1SPeuIyJ5ItBYZSUMEwf4K0LMBQ8pW5GZ53/u4Asdzixa2yKSIClt8vWexqL0PS JlThDi4GKwofnJxvjHl02ZgVK9Qjl03iSx1ztHrAJAEdLVt0CKvgJ/roUzJPBmAQ1DiQ gfKK/Q+8v5+CkHj305JLoaLyAkOG2CGXaQAOXxuw/WPv/uRG5m5n2piuq5BH+qo238uG tNYLL+nUkqGbn04Yd0woZg6R1/3I4ALf93qriya3aOlW4+/p/u9eXq14kKouiuvp1+eV tFCuKRbIDQ+9ARbh3KG9EGFZHa4xlUzuDmRnkOkZMM8hoanAWziT+b4QxFvhXRzKPzgk jfAA== 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=zRC0cmDFwccJTAFTxy77ItmPTRcXrVGHrZcKFTHFGSc=; b=VFRL/pii6/6KDqrF52VH/PH3rPcGmQ1TIDrsAB5cvQpKpx/ZCyASeegVhgiAlS4R59 q5izwRY6Lb3TGTsvFNbCSjaJJ+IGbDo0gyVsnjo6nQPWbzpXyT+ecaRP5MQi1qq4NVNA /j8C7oSO8AB+dX04yZFSyuGQaL+WA9xVfK8klI7b0LXvQprk5a6+KpIKgECR7JjXv/2L H2ivCF1r3vg1X6QEw5xjYg6lKaW9pJr8l/YS3TxBQV/JQy6Joo897MDpOE1AD08bOas1 bsG6TBRpoLQ4Tu5X74/sNnef1eLuF1NvLbsmcgkVOG8IDJUqV47/s/fLMV71vbIvi2cs O7SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=faemkw3L; 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 w8-20020a056402268800b004616acd9cbcsi2866172edd.360.2022.12.05.08.27.27; Mon, 05 Dec 2022 08:27:46 -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=faemkw3L; 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 S230306AbiLEPbK (ORCPT + 81 others); Mon, 5 Dec 2022 10:31:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232724AbiLEPar (ORCPT ); Mon, 5 Dec 2022 10:30:47 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C825BE78; Mon, 5 Dec 2022 07:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670254182; x=1701790182; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CTju6p3lEQWouZLK24Wd4h6927YMxUYLWgbCTRU7lrk=; b=faemkw3LRsYUBpYjJmp86x0LkskVbWJJE2HcxiPKpxcraaJPs8aFWcEq mt9H4/V4YGNRzRumHcyqEspcud9SbcrBHJ0wskXDEfEbui8k3Gp1+NFQS NVkHyzVJo/kou15eW8LnLGGZ+Haor86JiCg9rHG3AjZ6jCVRO9z36+ZxP jAXoIa3amZRoYo3aBNVuWI8IMhmJnvXi8fu6Y7XsSOeuHizx8CXVleSFt H1R/LqEK1BFKfpQVm08o9yfH6XoISPcNz2AUDHRzRQzkFxz+Uli+DT22y EYNkIFIqSRQe3jXN9elQ+j5+hHvpqjqYOOcycf0Jt9R8fVxIrWIsc2OpJ g==; X-IronPort-AV: E=Sophos;i="5.96,219,1665471600"; d="scan'208";a="190082671" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 05 Dec 2022 08:29:41 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Mon, 5 Dec 2022 08:29:39 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Mon, 5 Dec 2022 08:29:37 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , Claudiu Beznea Subject: [PATCH 2/2] net: macb: fix connectivity after resume Date: Mon, 5 Dec 2022 17:33:28 +0200 Message-ID: <20221205153328.503576-3-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20221205153328.503576-1-claudiu.beznea@microchip.com> References: <20221205153328.503576-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, 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 Commit bf0ad1893442 ("net: macb: Specify PHY PM management done by MAC") signals to PHY layer that the PHY PM management is done by the MAC driver itself. In case this is done the mdio_bus_phy_suspend() and mdio_bus_phy_resume() will return just at its beginning letting the MAC driver to handle the PHY power management. AT91 devices (e.g. SAMA7G5, SAMA5D2) has a special power saving mode called backup and self-refresh where most of the SoCs parts are shutdown on suspend and RAM is switched to self-refresh. The rail powering the on-board ethernet PHY could also be closed. For scenarios where backup and self-refresh is used the MACB driver needs to re-initialize the PHY device itself when resuming. Otherwise there is poor or missing connectivity (e.g. SAMA7G5-EK uses KSZ9131 in RGMII mode which needs its DLL settings to satisfy RGMII timings). For this phylink_init_phydev() has been called on resume path before phylink_start(). Up to commit bf0ad1893442 ("net: macb: Specify PHY PM management done by MAC") this has been handled by mdio_bus_phy_resume(). This has been tested on SAMA7G5-EK (with KSZ9131 and KSZ8081 PHYs), on SAMA5D2 (with KSZ8081 PHY), on SAM9X60 (with KSZ8081 PHY). Fixes: bf0ad1893442 ("net: macb: Specify PHY PM management done by MAC") Signed-off-by: Claudiu Beznea --- This patch depends on patch 1/2 from this series. For proper backporting to older kernel (in case this series is integrated as is) please add the Depends-on tag on this patch after patch 1/2 is integrated in networking tree. Thank you, Claudiu Beznea drivers/net/ethernet/cadence/macb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 95667b979fab..8baa53706721 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -5238,6 +5238,7 @@ static int __maybe_unused macb_resume(struct device *dev) if (!device_may_wakeup(&bp->dev->dev)) phy_init(bp->sgmii_phy); + phylink_init_phydev(bp->phylink); phylink_start(bp->phylink); rtnl_unlock(); -- 2.34.1