Received: by 10.192.165.156 with SMTP id m28csp1083941imm; Wed, 11 Apr 2018 12:06:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+3IXl1X6icpD+Zjcr+JJfdSKZ0uh91ScFGb0u/OsVUjx7LaVshY8YgI7CdUHROvSPWV7dN X-Received: by 10.99.152.10 with SMTP id q10mr4461932pgd.40.1523473607233; Wed, 11 Apr 2018 12:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473607; cv=none; d=google.com; s=arc-20160816; b=J4P0VHB3PpMWhDjS3g5CNk5/Uch/ZmzJJKEBvxdVYT+ZAgAp+2efAStgeBGRyEsuL7 O8r8989NbIn0inavpu7XfvvVLssIwMoaXS082P12n21ubPqRjPq5Zqgz7GNRBC2t0ssq u+PpXxDgo526GUpAU59TYYUKlYJ8WUMPXXjXo1CpeneSuSfA9j+kHA8TR44B8xXguU19 pf0T589E6env3LLWX7g9C71pUEkaMKFEBw92lRmFdeEjoTKF19XQRs22S4AZyQDVyOWf 8ecy8t6zNteBa9QO37ENPbilepDT+5JetCd14zzrGdGSOvUZUNuVBzFA8Bx2iN5jB+jo 2SEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=psperO3aldDXEVPisCA2gm2xB2nZDFxTx8TWcz+i6ro=; b=P7McjfR1NFXFVaMZCZ+wlZFwwo3c4xhsbEnuWw8SbzOwCjEOCG7wmcayUJL0Ahfq6U rIIvPSpPKeZwelgr8uQMPcAXSksjXuvpOAivGFyVhq35TJBKSyTe4FtU9X6OrIkv0aT8 47970JOi0f7jlu4wZn2WIwd7jabYSxAKQwjsuzgzTTDOmGUawdrxOkJ6SCryiSj9SFvG 176oj3OT8SnkgBdkKTAN1ClmPLlSp7RbtKmcl6fymZbxMV0/MvXpfULSJZPhfuGkBalv Wq189CXjBaXn4Paj687dkDJHwizUsHGkWrzKzjjVenu0O1dAd5FdeyJb4Xc+ixiNZgc8 wVUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si1645071plk.94.2018.04.11.12.06.10; Wed, 11 Apr 2018 12:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934492AbeDKTCb (ORCPT + 99 others); Wed, 11 Apr 2018 15:02:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38536 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934460AbeDKTC3 (ORCPT ); Wed, 11 Apr 2018 15:02:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5F4CADAC; Wed, 11 Apr 2018 19:02:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 181/310] net: phy: micrel: Restore led_mode and clk_sel on resume Date: Wed, 11 Apr 2018 20:35:20 +0200 Message-Id: <20180411183630.390575424@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leonard Crestez [ Upstream commit 79e498a9c7da0737829ff864aae44df434105676 ] These bits seem to be lost after a suspend/resume cycle so just set them again. Do this by splitting the handling of these bits into a function that is also called on resume. This patch fixes ethernet suspend/resume on imx6ul-14x14-evk boards. Signed-off-by: Leonard Crestez Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/micrel.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -268,23 +268,12 @@ out: return ret; } -static int kszphy_config_init(struct phy_device *phydev) +/* Some config bits need to be set again on resume, handle them here. */ +static int kszphy_config_reset(struct phy_device *phydev) { struct kszphy_priv *priv = phydev->priv; - const struct kszphy_type *type; int ret; - if (!priv) - return 0; - - type = priv->type; - - if (type->has_broadcast_disable) - kszphy_broadcast_disable(phydev); - - if (type->has_nand_tree_disable) - kszphy_nand_tree_disable(phydev); - if (priv->rmii_ref_clk_sel) { ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); if (ret) { @@ -295,7 +284,7 @@ static int kszphy_config_init(struct phy } if (priv->led_mode >= 0) - kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); + kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode); if (phy_interrupt_is_valid(phydev)) { int ctl = phy_read(phydev, MII_BMCR); @@ -311,6 +300,25 @@ static int kszphy_config_init(struct phy return 0; } +static int kszphy_config_init(struct phy_device *phydev) +{ + struct kszphy_priv *priv = phydev->priv; + const struct kszphy_type *type; + + if (!priv) + return 0; + + type = priv->type; + + if (type->has_broadcast_disable) + kszphy_broadcast_disable(phydev); + + if (type->has_nand_tree_disable) + kszphy_nand_tree_disable(phydev); + + return kszphy_config_reset(phydev); +} + static int ksz8041_config_init(struct phy_device *phydev) { struct device_node *of_node = phydev->mdio.dev.of_node; @@ -715,8 +723,14 @@ static int kszphy_suspend(struct phy_dev static int kszphy_resume(struct phy_device *phydev) { + int ret; + genphy_resume(phydev); + ret = kszphy_config_reset(phydev); + if (ret) + return ret; + /* Enable PHY Interrupts */ if (phy_interrupt_is_valid(phydev)) { phydev->interrupts = PHY_INTERRUPT_ENABLED;