Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2234675ybi; Thu, 20 Jun 2019 11:19:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZcaxSihfY2tr9sAJIKvDgMi1Vdtk1HhLpNxYz3yE+A2UCBpJJgdh7/yJr36jIVVuJkajx X-Received: by 2002:aa7:8145:: with SMTP id d5mr134524163pfn.11.1561054799059; Thu, 20 Jun 2019 11:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054799; cv=none; d=google.com; s=arc-20160816; b=gj8ZLKhU8Y5w5sA2btsqK8/uIwGnN+xoyWB5pgEqyhbzR5ikmP7/PtT6PXSP2C2zQC jvRSkMHCjZWJlgTSSYBzr2I12USHTjqnj5i+ftVieyA+EdpsNBxF87P1g7ir/IKcp2yl kTNBHMWuMTvw5Ct1rw3zmMa+9DKpfS8vjuBSkLkYotzOvx0te2dK0hX+pSdG0kqVvvMF FJB1crCitBBtyxJd1t+1WGCl+7iH77EZ8leBkulDXJONTOoXDl4VzKJo9NLln7lGNJ1P F9uvi6ZypDj0KqrRmLlUKu3miAvCeYzI0M8PpaKe/pX8FqtJnAnifBVp2ojd4xGCTwxH XgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JilZgVmM8XRrc8fFeLjcKsOewru9Eysw+9wGGXZ/kA8=; b=lfAKtKzZJp5KuIo0e4XfAvRn2kt0TeAgsemsTJiy+AAB17+aEDJc1LtnAJ4tLnXiGZ G9OGEVnXW0w6JnfhhS9A1aFYuI26RCqcHrlu/tDiXtEh24qhEj2BHp2RAV1NoKyj/mW/ YyB0VvzTOsYn8ZQXTwDWFfRCuoJQaeuNQNDwSi1sCw7HaYt1/5UrLfEwxd3YzKu+td+M XYvSBsKNFxSGyb/jV4EU6h+r+/O0kUNcAv9A4SmFcQRmTnFsHUFTzVIib8XiN+SMa/Qz N013ZYrG5kilRCi4xAQvTR4hvEWfTMlTUoX1xcOBy4utHS1gmC5Ef8pijoJ/U7qAUQ6d +qcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Snz0up14; 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 z10si172962pgv.233.2019.06.20.11.19.44; Thu, 20 Jun 2019 11:19:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Snz0up14; 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 S1729808AbfFTSQh (ORCPT + 99 others); Thu, 20 Jun 2019 14:16:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:45732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728814AbfFTSQc (ORCPT ); Thu, 20 Jun 2019 14:16:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00534215EA; Thu, 20 Jun 2019 18:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054591; bh=I8yePqN8pwCzyU8vApw9YiizwGXr64LMAq5Y4tEhAOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Snz0up14ImcdwgM6TdurfT/Aib00TW6DzcMATxBYlOLvlvOP8kDanQ8byQwvBa16a tgvluwfl50z2vjLkKlo/Prs0+aYnaa97JZBaiJBvbTFDKXa90EDmM75d/jRtBZtpPV eZz7EaUXslW3jNfbA1de3sWuPJg25wCSeQoVHJLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biao Huang , Alexandre TORGUE , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 53/98] net: stmmac: fix csr_clk cant be zero issue Date: Thu, 20 Jun 2019 19:57:20 +0200 Message-Id: <20190620174351.703795898@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5e7f7fc538d894b2d9aa41876b8dcf35f5fe11e6 ] The specific clk_csr value can be zero, and stmmac_clk is necessary for MDC clock which can be set dynamically. So, change the condition from plat->clk_csr to plat->stmmac_clk to fix clk_csr can't be zero issue. Fixes: cd7201f477b9 ("stmmac: MDC clock dynamically based on the csr clock input") Signed-off-by: Biao Huang Acked-by: Alexandre TORGUE Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8cebc44108b2..635d88d82610 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4380,10 +4380,10 @@ int stmmac_dvr_probe(struct device *device, * set the MDC clock dynamically according to the csr actual * clock input. */ - if (!priv->plat->clk_csr) - stmmac_clk_csr_set(priv); - else + if (priv->plat->clk_csr >= 0) priv->clk_csr = priv->plat->clk_csr; + else + stmmac_clk_csr_set(priv); stmmac_check_pcs_mode(priv); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3031f2bf15d6..f45bfbef97d0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -408,7 +408,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; - /* Get clk_csr from device tree */ + /* Default to get clk_csr from stmmac_clk_crs_set(), + * or get clk_csr from device tree. + */ + plat->clk_csr = -1; of_property_read_u32(np, "clk_csr", &plat->clk_csr); /* "snps,phy-addr" is not a standard property. Mark it as deprecated -- 2.20.1