From patchwork Wed Apr 7 15:51:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12188773 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB8F2C433B4 for ; Wed, 7 Apr 2021 15:54:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81FCA61353 for ; Wed, 7 Apr 2021 15:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347376AbhDGPy3 (ORCPT ); Wed, 7 Apr 2021 11:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353919AbhDGPyP (ORCPT ); Wed, 7 Apr 2021 11:54:15 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB62C061756 for ; Wed, 7 Apr 2021 08:54:05 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id a12so8744576wrq.13 for ; Wed, 07 Apr 2021 08:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2+JHVerYYa6GG4c08d4TcVEUoR33xnyDOTHyaZRdooA=; b=Lco4dhkEWUPD3Eae9DRMc32aokoBJIlVgPw3sUSiFRf6114OFHxmw3yERd7ipP08Xa m77rWhKcTSdRChbK+scckFJIoAb55zOZ/B03R5Emtbi4nXnHJ4V4SZ18Hzp4wM5NmbMW S19K+bArXbgnsu8twfqQsn/prT4nd7bCz1QGnj0ktUmw0f5YuB9RNux7SaZFwiF0akPj 2km6AOsjz1eusNawNFay0nrxq8rp1SJY+X89wXbYdioUY02msf4WntyZL4FwstFdVLQG jm8ED7btqP1P1loTME1uXRZ4WtnfgHHDfWnUB8QPRoopPJ3KhigD9x3XnldUquwQ9RNF 9lEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2+JHVerYYa6GG4c08d4TcVEUoR33xnyDOTHyaZRdooA=; b=kuTdb/nTI5fI8VbJVo5DUi3AOgY6dM0PgTo6Ury9x4eNQZZ5YzEFC6KwAFavYVKX/S oXh9gxg0ag1JDh/hx4YkWqES3wATJDCvW3jS3G25Yb/k8EJwQ88kNWFtzf07YH54u7aq +g1+DLoqprsJtpu6PXu+/+lAlCjYnqLVGMum+ArdR2uoxDaZWifHCZshcHr6y1Y/p82u oKa+BMN8b73uY7X8hhUEWxo9ooPRPq/xH+GjvyTH3Vv555J1J0LME4AI6emZqEByXH2N hIvAisZNDgjsHyW9DRry4nNWKsnXLoTx0b/wbqip0DOHmnOEgjaVqccTSJ5Vp9fEsjvo EN/w== X-Gm-Message-State: AOAM5323VjaDMbx3wDLFZfOzrwt6WZF9T4FeGnq9IrakhBNzWIno4Yyg PLLEUUG3IgT0Qad5fw9Uimk= X-Google-Smtp-Source: ABdhPJxiDlCmzAWtgkJabVGxWmC758KeMSZrKooxAIVOLl9c/c3YqOunmeopdErhjcIuqFtmvCnCWQ== X-Received: by 2002:a05:6000:1204:: with SMTP id e4mr5302049wrx.266.1617810844136; Wed, 07 Apr 2021 08:54:04 -0700 (PDT) Received: from ?IPv6:2003:ea:8f38:4600:15f8:68c8:25bd:c1f8? (p200300ea8f38460015f868c825bdc1f8.dip0.t-ipconnect.de. [2003:ea:8f38:4600:15f8:68c8:25bd:c1f8]) by smtp.googlemail.com with ESMTPSA id l9sm7685984wmq.2.2021.04.07.08.54.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 08:54:03 -0700 (PDT) Subject: [PATCH net-next 1/3] net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Jakub Kicinski , David Miller , Fugang Duan Cc: "netdev@vger.kernel.org" , Joakim Zhang References: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Message-ID: Date: Wed, 7 Apr 2021 17:51:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Resume callback of the PHY driver is called after the one for the MAC driver. The PHY driver resume callback calls phy_init_hw(), and this is potentially problematic if the MAC driver calls phy_start() in its resume callback. One issue was reported with the fec driver and a KSZ8081 PHY which seems to become unstable if a soft reset is triggered during aneg. The new flag allows MAC drivers to indicate that they take care of suspending/resuming the PHY. Then the MAC PM callbacks can handle any dependency between MAC and PHY PM. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy_device.c | 6 ++++++ include/linux/phy.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index a009d1769..73d29fd5e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -273,6 +273,9 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) { struct phy_device *phydev = to_phy_device(dev); + if (phydev->mac_managed_pm) + return 0; + /* We must stop the state machine manually, otherwise it stops out of * control, possibly with the phydev->lock held. Upon resume, netdev * may call phy routines that try to grab the same lock, and that may @@ -294,6 +297,9 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev) struct phy_device *phydev = to_phy_device(dev); int ret; + if (phydev->mac_managed_pm) + return 0; + if (!phydev->suspended_by_mdio_bus) goto no_resume; diff --git a/include/linux/phy.h b/include/linux/phy.h index 8e2cf84b2..98fb441dd 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -493,6 +493,7 @@ struct macsec_ops; * @loopback_enabled: Set true if this PHY has been loopbacked successfully. * @downshifted_rate: Set true if link speed has been downshifted. * @is_on_sfp_module: Set true if PHY is located on an SFP module. + * @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY * @state: State of the PHY for management purposes * @dev_flags: Device-specific flags used by the PHY driver. * @irq: IRQ number of the PHY's interrupt (-1 if none) @@ -567,6 +568,7 @@ struct phy_device { unsigned loopback_enabled:1; unsigned downshifted_rate:1; unsigned is_on_sfp_module:1; + unsigned mac_managed_pm:1; unsigned autoneg:1; /* The most recently read link state */ From patchwork Wed Apr 7 15:52:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12188775 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D459C43460 for ; Wed, 7 Apr 2021 15:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BF2D61382 for ; Wed, 7 Apr 2021 15:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245406AbhDGPya (ORCPT ); Wed, 7 Apr 2021 11:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353957AbhDGPyS (ORCPT ); Wed, 7 Apr 2021 11:54:18 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3499C061756 for ; Wed, 7 Apr 2021 08:54:08 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id j4-20020a05600c4104b029010c62bc1e20so1451020wmi.3 for ; Wed, 07 Apr 2021 08:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aMGyAFd9YLfxjRcx8M/V4oDEl2++Et9egjLBfgDzzzQ=; b=aRMuSCDXgFT9oBEKC6xwl5XNGMuL9USVJJHPJLmeH+p6eHly1yHlU3c+I0AbjAvpvJ aWOcMHbmYw3LjUvQjGaixJfCfNq5PAt4KIhVaPbNBs1xnuLa8KI+7XGhytby12MiQg2X P5+zet08UrJ8Ten5KoMmUUUdMzpQpyWKGS77LPWtAYqHHZVIVD8FMyjITWcjAl5AECBb 7EzFc+pgRi0wzhUJdP1HWvfo1RtkoG68U9qss0/seOFIkidkzNTG+nGJWWG2zsPK4p/E kJ9tKzTxF5XupjRItZzSbhgGmkKQ0HHo6bgrs4buy7hRh+LSsmEVZ1vOoqLmItpjBCNS YQjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aMGyAFd9YLfxjRcx8M/V4oDEl2++Et9egjLBfgDzzzQ=; b=DhGLZIII27EcimKhp1zxld68Fmd80CB4oxec14Np1RZ/5ubmnNzmsJlzCyGz7/yInt 1QbnkFjWcwcq3rXVqEjAZ3t/Cws3IRQH5hGm7zlcGEfnf3K6IW/l6TRZZv7OuvkqZGwt cS3s1x28GrI7L6OJI8En9kq0ccNrtKsR6adJyc4AV3jHrsG7Weoddw4PDb0RsFPWiUXR YHSSc8o7b4IERphqXhVtFOASdlpAcCbrkEmUvyacX0WDe/NrJ2bQOu+CkSGPNNKc0rts 0+Jj6jAC4ywBTRLOmE66OYXTtGQbg/4IcLlY7y1lf/qkg4W7A+d9djRr6xGZa/R0lp/A KQXA== X-Gm-Message-State: AOAM532BHKhdOz8T0aVwCzb1h7BdsMA9WS+iWYlRSWqSjngXevtmwzvX djsfPxHfTE4s0MJGji8bsYKGR/HCicQ= X-Google-Smtp-Source: ABdhPJzWdkGCei0FS+/ZbMMlYQbiBRNr3ICGZmkL/MjheaPGlQLVLPdAEwVEwg3eKJuy94YG4R9l2A== X-Received: by 2002:a05:600c:4d13:: with SMTP id u19mr3690879wmp.16.1617810847508; Wed, 07 Apr 2021 08:54:07 -0700 (PDT) Received: from ?IPv6:2003:ea:8f38:4600:15f8:68c8:25bd:c1f8? (p200300ea8f38460015f868c825bdc1f8.dip0.t-ipconnect.de. [2003:ea:8f38:4600:15f8:68c8:25bd:c1f8]) by smtp.googlemail.com with ESMTPSA id k13sm48751069wri.27.2021.04.07.08.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 08:54:07 -0700 (PDT) Subject: [PATCH net-next 2/3] net: fec: use mac-managed PHY PM From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Jakub Kicinski , David Miller , Fugang Duan Cc: "netdev@vger.kernel.org" , Joakim Zhang References: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Message-ID: Date: Wed, 7 Apr 2021 17:52:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new mac_managed_pm flag to work around an issue with KSZ8081 PHY that becomes unstable when a soft reset is triggered during aneg. Reported-by: Joakim Zhang Tested-by: Joakim Zhang Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/freescale/fec_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 3db882322..70aea9c27 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2048,6 +2048,8 @@ static int fec_enet_mii_probe(struct net_device *ndev) fep->link = 0; fep->full_duplex = 0; + phy_dev->mac_managed_pm = 1; + phy_attached_info(phy_dev); return 0; @@ -3864,6 +3866,7 @@ static int __maybe_unused fec_resume(struct device *dev) netif_device_attach(ndev); netif_tx_unlock_bh(ndev); napi_enable(&fep->napi); + phy_init_hw(ndev->phydev); phy_start(ndev->phydev); } rtnl_unlock(); From patchwork Wed Apr 7 15:53:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12188777 X-Patchwork-Delegate: kuba@kernel.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 X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53965C433B4 for ; Wed, 7 Apr 2021 15:54:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C94D61132 for ; Wed, 7 Apr 2021 15:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347410AbhDGPyb (ORCPT ); Wed, 7 Apr 2021 11:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353970AbhDGPy0 (ORCPT ); Wed, 7 Apr 2021 11:54:26 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B715C061756 for ; Wed, 7 Apr 2021 08:54:12 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so1450786wmj.2 for ; Wed, 07 Apr 2021 08:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=efbz/GwThlVr8RRLmY0y4aySzgCVx2n3UbGV1TUmSjg=; b=AdL8tjOKi/4kiORc2IpcNa3nNHvJI/KyVILaal+Gi2fb5J4oJ0iqTtnc6at+f+WmPL 30p6PviENeQ3BKlwAdLn+2QoF+uJcgHScmbCtSgbUWs2dRsST5K8u1ezSHwGNa0nFNRR P7SlNmMjKV7DJ9dROER4FWY4d1DCpRY7O5vLsrz/7yr6XH4e5n8lokFq/mnxKGkkIE9y Bj6l9DWrCxek28L1D6tw61k7nEVvoUK4jjObQQPBggkzXO6wOGGUbGNec2+Ba3ClW+iq 7tJ5v9sX0/NglS5US4fV9KNz7PBrat9+f5J86iij6yaZAoJIg1PnaVK9kSM2UegAKjXA +5gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=efbz/GwThlVr8RRLmY0y4aySzgCVx2n3UbGV1TUmSjg=; b=KrkspAVotRxKR52NIcMUIhf075t3GhCcwAXVnaCCrO2BmEeLepOCQ/ZII2qFUd0b00 ldEME2JrU7bHgVXtLv54jKKHlLNMOVhALJObMd7YEZm20XPJBmA+iafp/j/m0vwJ7+2U z7ULd6u9Es/MqXKsv8Xc/U75XxjYEj8y9l2VZIrL5GKj51dr6hDE0mRAKfKLXtYLM9R2 F81kFC0B+t0FdMv4ctLMzumTZnc87LThUZu9L43RxJCDb8ak9ACjnxrkmUU3xUrYPMmE pPKEo8PgxR4AORAbIt/HEAznYdlB3uvdurZAvflnyltQZdps9jXglUjHFT37QS948cHL 6KTA== X-Gm-Message-State: AOAM531AnMFb7WuqixFJriN+a6FpamhKMMtaruowvmepws/FziNQAqul 9EGS/Wg4T9o7MbiJ0wBpjCvSGUnkZr4= X-Google-Smtp-Source: ABdhPJwe9jORt9X+z8ZfOt1ojJ8h5Jw1LHFAiH2uxJ6OD8zrrwHWqsXGmSdyRu5OF9KOanmsIpTQNw== X-Received: by 2002:a05:600c:35c1:: with SMTP id r1mr3679661wmq.60.1617810850874; Wed, 07 Apr 2021 08:54:10 -0700 (PDT) Received: from ?IPv6:2003:ea:8f38:4600:15f8:68c8:25bd:c1f8? (p200300ea8f38460015f868c825bdc1f8.dip0.t-ipconnect.de. [2003:ea:8f38:4600:15f8:68c8:25bd:c1f8]) by smtp.googlemail.com with ESMTPSA id x12sm30791143wrr.7.2021.04.07.08.54.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 08:54:10 -0700 (PDT) Subject: [PATCH net-next 3/3] r8169: use mac-managed PHY PM From: Heiner Kallweit To: Andrew Lunn , Russell King - ARM Linux , Jakub Kicinski , David Miller , Fugang Duan Cc: "netdev@vger.kernel.org" , Joakim Zhang References: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Message-ID: Date: Wed, 7 Apr 2021 17:53:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <9e695411-ab1d-34fe-8b90-3e8192ab84f6@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new mac_managed_pm flag to indicate that the driver takes care of PHY power management. Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/realtek/r8169_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index a838187b9..eb6da93ac 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4646,6 +4646,7 @@ static void rtl8169_down(struct rtl8169_private *tp) static void rtl8169_up(struct rtl8169_private *tp) { pci_set_master(tp->pci_dev); + phy_init_hw(tp->phydev); phy_resume(tp->phydev); rtl8169_init_phy(tp); napi_enable(&tp->napi); @@ -5071,6 +5072,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) return -EUNATCH; } + tp->phydev->mac_managed_pm = 1; + /* PHY will be woken up in rtl_open() */ phy_suspend(tp->phydev);