Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4136360pxb; Mon, 27 Sep 2021 10:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/xxvMNyCYnaTWhezYWS0oscN2DzMpJ+sIb89IS6WCshznZXU8t22hZpD5jWl8TpIFhTa4 X-Received: by 2002:a17:902:7286:b0:13d:c0f4:a9e5 with SMTP id d6-20020a170902728600b0013dc0f4a9e5mr533614pll.67.1632762452835; Mon, 27 Sep 2021 10:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632762452; cv=none; d=google.com; s=arc-20160816; b=S7/Uahv9bNyI96+VXYqFD8ah//oC8GCJf+rsX1bfuW3MQZiTgngLVEettlYW8HmnAH 6r8R005LmnPMIkW5r9JJ620/RiwyM/IAB4cjFC0Hh/A6LNsOW/cSO8QBoRQeZA8VWauP T28ku86e3xBdEAT3OiOMCvw6faPoO7cCNVaFrhVYUagObxIZEnqRdWDicDecXzGNenjH u8DZ0oKbyRpXxONLscJHQaupnRZQnn1PqhrnOHD/mN+CuNot6hU+g33nLzeS+lZ77XNz NtDvmaoa7bP6M96rq1R3WYgK2tKW8PHAs5GaEUFHHlPQpc7CR2W8roVSXEHVzo8n1smW 3njw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EUgVupEAVdVNKWRcO7640SFSb5Lw588gjXE4vyLuwpg=; b=wLj5o6cXofi1eX3su9FVKzxg7jmBFLeWs0RLGXG/frymtBwbcfgSYkrgebMw7p5FrV V09q0x25WduwX9jx3+ePM1iOQwcfSfCtYb21DhJH6H8w3dMNLRTUMIN4/Mf31DgfikGD DanAuYIsYyWyKqRXoQv3gDVLTrV2tY6fhQRJBnKPyBTlLv5OHBtRrMrRW56CUWmzAHAE 7JEUiWv+iWdEPU/PU+8PFTAsQhTayPZ3CSAfin/5CIZZ8MmcblZnlGoFMLSjFpQ0Azlp qrAJ9qBWlMCBPK/BtBvYM8aALi3kUmZrStu/tTCEcZXtx2H2W25pluPSHRNI/I4A6o1p 7ecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KhFmoxKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si24670842pgv.84.2021.09.27.10.07.19; Mon, 27 Sep 2021 10:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KhFmoxKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235945AbhI0RHw (ORCPT + 99 others); Mon, 27 Sep 2021 13:07:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:44696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236125AbhI0RHA (ORCPT ); Mon, 27 Sep 2021 13:07:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A18BE6113D; Mon, 27 Sep 2021 17:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632762322; bh=91tkeF1TBEBXT5hC66b9JpV7J9SXbiRfIF/ZZlWtu3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhFmoxKFJJFKTPnaA6nJy2b5+UifaVQvpV7DBirxlt7uQBVLbxDlJ8nchqGSNzjzl J3ztL59sItBJSOhupJIWNVeXjaPDchGg4OvryD9FJ0TC0eeSPY+01mft4Bve7gcXQe DipHEJlNlBtEDPjHgfTXrcLf+SWz9lgxhoQe3KeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesper Nilsson , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 47/68] net: stmmac: allow CSR clock of 300MHz Date: Mon, 27 Sep 2021 19:02:43 +0200 Message-Id: <20210927170221.590131744@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210927170219.901812470@linuxfoundation.org> References: <20210927170219.901812470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesper Nilsson [ Upstream commit 08dad2f4d541fcfe5e7bfda72cc6314bbfd2802f ] The Synopsys Ethernet IP uses the CSR clock as a base clock for MDC. The divisor used is set in the MAC_MDIO_Address register field CR (Clock Rate) The divisor is there to change the CSR clock into a clock that falls below the IEEE 802.3 specified max frequency of 2.5MHz. If the CSR clock is 300MHz, the code falls back to using the reset value in the MAC_MDIO_Address register, as described in the comment above this code. However, 300MHz is actually an allowed value and the proper divider can be estimated quite easily (it's just 1Hz difference!) A CSR frequency of 300MHz with the maximum clock rate value of 0x5 (STMMAC_CSR_250_300M, a divisor of 124) gives somewhere around ~2.42MHz which is below the IEEE 802.3 specified maximum. For the ARTPEC-8 SoC, the CSR clock is this problematic 300MHz, and unfortunately, the reset-value of the MAC_MDIO_Address CR field is 0x0. This leads to a clock rate of zero and a divisor of 42, and gives an MDC frequency of ~7.14MHz. Allow CSR clock of 300MHz by making the comparison inclusive. Signed-off-by: Jesper Nilsson Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4e7cfd3bfcd2..e09851c7da9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -225,7 +225,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) priv->clk_csr = STMMAC_CSR_100_150M; else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M)) priv->clk_csr = STMMAC_CSR_150_250M; - else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M)) + else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) priv->clk_csr = STMMAC_CSR_250_300M; } -- 2.33.0