From patchwork Thu Apr 23 19:34:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 220676 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=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 A2A9CC54FCB for ; Thu, 23 Apr 2020 19:34:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D0C12076C for ; Thu, 23 Apr 2020 19:34:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DtJWMvus" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728809AbgDWTeg (ORCPT ); Thu, 23 Apr 2020 15:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbgDWTeg (ORCPT ); Thu, 23 Apr 2020 15:34:36 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16F9FC09B042 for ; Thu, 23 Apr 2020 12:34:36 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id h2so7767217wmb.4 for ; Thu, 23 Apr 2020 12:34:36 -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=hXV8Wtun0GovOWCgeFyuMPagkqdRp/yW2NQOzdJWQko=; b=DtJWMvuseVoQv3cxoFxfdZgY0LMK9sdtkhDsEOpXfCrjJf/F2A/GzQnCc3MaeqKWK2 y0BTehqBvmZIsndjQMEHIeShBjZ4QGL/Ms8PHlSviTLlLOc2RZXMMb4ShG8JgmmXE623 upuCIdfMiO3AUND2LTubX6/lclWyvTOOQEzx1Vx8IVRRcKyhvyeMg6rGbymfWMKBc0/a 1beU32s4gq64ifvVO0vMNr0FRvxnMHi9JFkBg1Ds0HRufa0ai0DADJ0o89dPSHnd6VWG 0cRJ4gzaylhlOcyQo1SgzYWojfCUao4XOmBiFbSl6jIe0QgGUEUrgDUyyGf0KIxibc+z 12WQ== 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=hXV8Wtun0GovOWCgeFyuMPagkqdRp/yW2NQOzdJWQko=; b=iPJ24e8PJc0NLM2eCZc0xrhzpksbHwzWPYysPUxUZIFvmc6lbrXTivezddDT2bbO8q PUcrsMDH5RX+QA60COMDQW6ZD7GQsaz9/4JO9y70iaVq/Lb1Rpq6gyfUaN4ozVA0AlYU VOYrDbjh/JiwSXPBw7AcvrTMKxMQILCRe7dLF2s/l1ke9L6OIreBwVQ9zKZ8JRA4z2w+ me+3Gan9alnsnewGt96w0lyJKcoAbillrVWcNxZRgmoBpZyt4B63iCesYPg5GFGOIUiK VyK6gjwKHdGKGNY5spdHGfgXQnjs6Fdo9b1IaxsQez+eiOUZ3UrEML574IYTxakgnv+k Ujiw== X-Gm-Message-State: AGi0PuZpfFouqA2rj5VZU03KILEr4kmBQ1S/7yGikmX95lFG8IzVmCZv CXCIs15zSFMiGincvfqn17TwZNAI X-Google-Smtp-Source: APiQypIiUX5PBSSydsYoHmlLN/0Mv3h0Csvm2AE25rIvHxL0sypl/z7mA1N1mZwqcWGqhM6G9Me5hQ== X-Received: by 2002:a5d:660d:: with SMTP id n13mr6427082wru.369.1587670474558; Thu, 23 Apr 2020 12:34:34 -0700 (PDT) Received: from ?IPv6:2003:ea:8f29:6000:c569:21dc:2ec:9a23? (p200300EA8F296000C56921DC02EC9A23.dip0.t-ipconnect.de. [2003:ea:8f29:6000:c569:21dc:2ec:9a23]) by smtp.googlemail.com with ESMTPSA id h3sm4990073wrm.73.2020.04.23.12.34.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Apr 2020 12:34:34 -0700 (PDT) Subject: [PATCH net-next 1/3] net: phy: make phy_suspend a no-op if PHY is suspended already From: Heiner Kallweit To: Andrew Lunn , Florian Fainelli , Russell King - ARM Linux , David Miller Cc: "netdev@vger.kernel.org" References: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Message-ID: Date: Thu, 23 Apr 2020 21:34:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Gently handle the case that phy_suspend() is called whilst PHY is in power-down. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ac2784192..206d98502 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1524,6 +1524,9 @@ int phy_suspend(struct phy_device *phydev) struct phy_driver *phydrv = phydev->drv; int ret; + if (phydev->suspended) + return 0; + /* If the device has WOL enabled, we cannot suspend the PHY */ phy_ethtool_get_wol(phydev, &wol); if (wol.wolopts || (netdev && netdev->wol_enabled)) From patchwork Thu Apr 23 19:35:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 220675 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=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 3AE0FC54FD0 for ; Thu, 23 Apr 2020 19:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13BC120724 for ; Thu, 23 Apr 2020 19:35:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hehvpdQJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbgDWTfk (ORCPT ); Thu, 23 Apr 2020 15:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbgDWTfj (ORCPT ); Thu, 23 Apr 2020 15:35:39 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 745EDC09B042 for ; Thu, 23 Apr 2020 12:35:39 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id t63so7756967wmt.3 for ; Thu, 23 Apr 2020 12:35:39 -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=eDAtPijhSrs76CNWOwIulZGXzdOaO4o0eOmiiHP2RT8=; b=hehvpdQJK4kII4zYely2Ll7b7ib/F0n1TqihyoJv7Zu/oYxcajHun33M8Lq6D5p+AE 7yA5XifZWz+QJyDBWBo8+3ov+UTSFQuAvPMQc5ExZU9s1aQWSF8bttP3qwAm/DKLXjTp l4T106UFSDySBxjY2nTOGz0G4ou1wJ1rtue0J771u18rIBz1yDVNpZa7JzDNhSKCKoEI iXuv/L430h/CMdd1V93A6RSfXUS79DoP1wXMvNyS8+0d47yThWwta3+tyagphr3+Hrx9 evNVlG40bpClwvWTIecgcZ4WSpyK8zbFsfyRG22WA1nTBjb2tVWj7TinVlgupCb7gCx4 Lduw== 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=eDAtPijhSrs76CNWOwIulZGXzdOaO4o0eOmiiHP2RT8=; b=O+PhTFJ9VP73PfNOo/E/lbvjKiqbsatLZXJkDyfILbROchbOY/GFFqEAu852UblD6q EIwex5VemDYjF3s4dwXlITUF4tbB6+rxU5wa1YWBT4hXrLQRkPmLkTzcj4rhE6cnbwcL M6qQV5we+OzD4TuLWYxef3I4wv2/dFq7N0lW3x45BJ5V+HwZkLmLD1qHk3DlCIPOM98r 98l0D19Y3XLyvF5ebjN1/+Xj6u1V2TntycoawP1HBsckXy1AA02VmRhvKOPTjciLVUHD 0yWQwcn9f8yhxOdowJRSwiPTYJP/maSwsQOo0dS61I/iRHfgMw8K0j5HWL186n8EW8aV kmxA== X-Gm-Message-State: AGi0PuZ1u/uyDfbXLpuGZt+0W+g1Er4DXvUoPf82YFtMWzMmgq72vgAk lVoLgI0iw/uaVqqQ62tPNbYsuixw X-Google-Smtp-Source: APiQypK9mpUBDu60FA2TOkcplHvI++AK1kY+xWrETnQVmUZCKmwb2yTWgn8mP3Xzhsf5Cos004+RNg== X-Received: by 2002:adf:edcc:: with SMTP id v12mr6784557wro.317.1587670537887; Thu, 23 Apr 2020 12:35:37 -0700 (PDT) Received: from ?IPv6:2003:ea:8f29:6000:c569:21dc:2ec:9a23? (p200300EA8F296000C56921DC02EC9A23.dip0.t-ipconnect.de. [2003:ea:8f29:6000:c569:21dc:2ec:9a23]) by smtp.googlemail.com with ESMTPSA id 74sm5407142wrk.30.2020.04.23.12.35.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Apr 2020 12:35:37 -0700 (PDT) Subject: [PATCH net-next 2/3] net: phy: remove genphy_no_soft_reset From: Heiner Kallweit To: Andrew Lunn , Florian Fainelli , Russell King - ARM Linux , David Miller Cc: "netdev@vger.kernel.org" References: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Message-ID: <5a6bac65-ae8e-0231-ac23-1a079c14fd3b@gmail.com> Date: Thu, 23 Apr 2020 21:35:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since 6e2d85ec0559 ("net: phy: Stop with excessive soft reset") we don't need genphy_no_soft_reset() any longer. Not setting callback soft_reset results in a no-op now. Signed-off-by: Heiner Kallweit --- drivers/net/phy/cortina.c | 1 - drivers/net/phy/marvell10g.c | 2 -- drivers/net/phy/phy-c45.c | 1 - drivers/net/phy/phy_device.c | 1 - drivers/net/phy/teranetics.c | 1 - include/linux/phy.h | 4 ---- 6 files changed, 10 deletions(-) diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c index 856cdc36a..aac51362c 100644 --- a/drivers/net/phy/cortina.c +++ b/drivers/net/phy/cortina.c @@ -82,7 +82,6 @@ static struct phy_driver cortina_driver[] = { .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, - .soft_reset = genphy_no_soft_reset, .probe = cortina_probe, }, }; diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 95e3f4644..80cbc77ff 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -727,7 +727,6 @@ static struct phy_driver mv3310_drivers[] = { .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", .get_features = mv3310_get_features, - .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .probe = mv3310_probe, .suspend = mv3310_suspend, @@ -745,7 +744,6 @@ static struct phy_driver mv3310_drivers[] = { .probe = mv3310_probe, .suspend = mv3310_suspend, .resume = mv3310_resume, - .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .config_aneg = mv3310_config_aneg, .aneg_done = mv3310_aneg_done, diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 67ba47ae5..defe09d94 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -564,6 +564,5 @@ struct phy_driver genphy_c45_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic Clause 45 PHY", - .soft_reset = genphy_no_soft_reset, .read_status = genphy_c45_read_status, }; diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 206d98502..c8f8fd990 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2630,7 +2630,6 @@ static struct phy_driver genphy_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic PHY", - .soft_reset = genphy_no_soft_reset, .get_features = genphy_read_abilities, .suspend = genphy_suspend, .resume = genphy_resume, diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index beb054b93..8057ea8db 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -78,7 +78,6 @@ static struct phy_driver teranetics_driver[] = { .phy_id_mask = 0xffffffff, .name = "Teranetics TN2020", .features = PHY_10GBIT_FEATURES, - .soft_reset = genphy_no_soft_reset, .aneg_done = teranetics_aneg_done, .config_aneg = gen10g_config_aneg, .read_status = teranetics_read_status, diff --git a/include/linux/phy.h b/include/linux/phy.h index 3941a6bcb..e2bfb9240 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1251,10 +1251,6 @@ static inline int genphy_config_aneg(struct phy_device *phydev) return __genphy_config_aneg(phydev, false); } -static inline int genphy_no_soft_reset(struct phy_device *phydev) -{ - return 0; -} static inline int genphy_no_ack_interrupt(struct phy_device *phydev) { return 0; From patchwork Thu Apr 23 19:38:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 220674 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=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 3D017C54FD0 for ; Thu, 23 Apr 2020 19:38:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16DC220724 for ; Thu, 23 Apr 2020 19:38:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QeMftwk3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbgDWTiq (ORCPT ); Thu, 23 Apr 2020 15:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726216AbgDWTip (ORCPT ); Thu, 23 Apr 2020 15:38:45 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E08C09B042 for ; Thu, 23 Apr 2020 12:38:45 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id g12so7945236wmh.3 for ; Thu, 23 Apr 2020 12:38:45 -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=LPDfm1bWMc1tOXzhfJc7Hh2VRBSeCLo2rYZ2ZoMb5UA=; b=QeMftwk3YsnEXtoCWf+MPLDy/nYfUoZ/5bzYW1rzzIoKGVd5nF4HFAPVl1xh0TLHfi seI0H9NcPyoQPgx0AnyPYiqNPnBEXdYleWhZQmGfuq5lZlgZiRKAGLb1q6JqftrUdauE hB1/tZkerFTt+yJFmE/xalr0zKFlY08Z3XXVbIAFv4jeHZ6TgNjVfhl7+F7Ub7bvYf3i MK8yuT1Z6nNZvo/8yydW40slHejqD/VJ4He4XDsvLJcXPCRsqVWNgFubD4DA7zr7h6p/ 2w1GkFJXrVYvAlcpxPZc2gZNE30WFIAC8hqtbmKBG/n3CaDBczUeph/iKSz8gV7EiSC5 D2Yg== 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=LPDfm1bWMc1tOXzhfJc7Hh2VRBSeCLo2rYZ2ZoMb5UA=; b=VPoMt+hpO9ZRTDkt6JOl3wyLst+f7CejNYkXaHJCcLYTfhL7L/EogONEPn5xo6GKvq dGf4mM7AWos/mSs7H8pUkjJFJaQ0MTeLPWhORpDO6bs/KP5EKOHu8/AtJINC/mGe8MVb KTeVXXLQkaa92MUBxQR4yTTwLjPAOoJ3Xlc9Ns59DdN4AqqVdPWW2aCQWgpGc7u1rVJY hg/sIwP39COpV6wt+fhZRw3jPI/pUEhhfeHXfrfJ8Bxf/9Yg1Yyk9fhN8D3ZwrCV/RUu p139seJysEKTCR6MwBprBec2ElKRkoVi0beSmpfTsMNpQNSVHW3k8ZYVDIm025kDtaiX K2RQ== X-Gm-Message-State: AGi0PuZeyuG4Rd9xUpW3CVKQysIqpcgyAQQYNIbdIoAnFqT1BPiiL8yQ vkVlmWCw279TNnsGJ3/lhqaNg9Gb X-Google-Smtp-Source: APiQypIoevss9x4ztefjIfJqh21GSZtJZvT1ky7Gw5ztWd5qa5zk2REnBwUt1OLagE7ixXclsOd/pg== X-Received: by 2002:a5d:6851:: with SMTP id o17mr6492142wrw.267.1587670723879; Thu, 23 Apr 2020 12:38:43 -0700 (PDT) Received: from ?IPv6:2003:ea:8f29:6000:c569:21dc:2ec:9a23? (p200300EA8F296000C56921DC02EC9A23.dip0.t-ipconnect.de. [2003:ea:8f29:6000:c569:21dc:2ec:9a23]) by smtp.googlemail.com with ESMTPSA id y9sm4751480wmm.26.2020.04.23.12.38.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Apr 2020 12:38:43 -0700 (PDT) Subject: [PATCH net-next 3/3] net: phy: clear phydev->suspended after soft reset From: Heiner Kallweit To: Andrew Lunn , Florian Fainelli , Russell King - ARM Linux , David Miller Cc: "netdev@vger.kernel.org" References: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Message-ID: Date: Thu, 23 Apr 2020 21:38:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <705e2fc1-5220-d5a8-e880-5ff04e528ded@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If a soft reset is triggered whilst PHY is in power-down, then phydev->suspended will remain set. Seems we didn't face any issue yet caused by this, but better reset the suspended flag after soft reset. See also the following from 22.2.4.1.1 Resetting a PHY is accomplished by setting bit 0.15 to a logic one. This action shall set the status and control registers to their default states. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy_device.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c8f8fd990..7e1ddd574 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1082,8 +1082,12 @@ int phy_init_hw(struct phy_device *phydev) if (!phydev->drv) return 0; - if (phydev->drv->soft_reset) + if (phydev->drv->soft_reset) { ret = phydev->drv->soft_reset(phydev); + /* see comment in genphy_soft_reset for an explanation */ + if (!ret) + phydev->suspended = 0; + } if (ret < 0) return ret; @@ -2157,6 +2161,12 @@ int genphy_soft_reset(struct phy_device *phydev) if (ret < 0) return ret; + /* Clause 22 states that setting bit BMCR_RESET sets control registers + * to their default value. Therefore the POWER DOWN bit is supposed to + * be cleared after soft reset. + */ + phydev->suspended = 0; + ret = phy_poll_reset(phydev); if (ret) return ret;