Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4143105pxb; Mon, 27 Sep 2021 10:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl21XH/09tnhGH2LrkrfwemGfcmNy28d2cqvTfgz7VwSS3szyinmtfhfjrz3/90SMmd+w+ X-Received: by 2002:a62:7696:0:b0:44b:4b19:6417 with SMTP id r144-20020a627696000000b0044b4b196417mr1004325pfc.5.1632762922425; Mon, 27 Sep 2021 10:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632762922; cv=none; d=google.com; s=arc-20160816; b=UMTGKSSn+SAM2nW/MyahSuXt9nj9s6ZG0izLWk/5c0u6WDVlrjiYlep7lYmx1Q59f7 RFkGvUYjumdoT/LDqaQ7ECLwVsfyJpkKH/LIFhugQLwrWR1rfX0INbKYrueyH188oIRV L7H7Bc0iTV+gnyAyKKHJ5aAC6CPkzvBHj0wHQrh+OoUMu9xCJqrL80leClXAKFcZqTsV yLlZKZrqPCvI0HeUlqaQ+hwbBTboZFzH2Ns3d8usk7XeGt6bqRZQNPaOGiZRzZk3QfOu RWQBw/DbdMtZYw9kVpy+uyfPdf5B+S6qZDIiuNaOMAOoYZDbjA+uSiQojY41Z6OIbBfK vBMQ== 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=3+3ApSJ4G+Y1Ggl0GaqNJBP8Y89s03+IKOR89s1Q7SA=; b=s/8fVLzjA0+X5terPptGAztfTp8W0QfyszgZByCQIAppZ661xvcTM0ZexZu+HMw05R 8HXsHDXUaP6jTnHT7sSH0k0cYoTOZWvzCvFXfYE2IyHKpSl4BydepqsKlyoHPVGPrzBj 85zRV0Rz3w3CGc59ikzHbkWgAQ6IfPCA9GHRv7dtLIy62KAsl5IbWhh8TkKlr4D9UGWk Yeqecsi4Ew0M4o6G+q7Q+wul/MS7w16dimWFTsyWCPR4uIjqrHnEdm/+lJZBtzqzzkTi R0oPLZSz/xPxApCK7xSclDZfqyJyMd9X4KAuF10nyyU52YFXsvmuiwg3rbjLcCS/VeSy 5HCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0R5tcrwp; 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 k17si25648444plk.277.2021.09.27.10.15.09; Mon, 27 Sep 2021 10:15:22 -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=0R5tcrwp; 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 S236532AbhI0RQD (ORCPT + 99 others); Mon, 27 Sep 2021 13:16:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:56430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237072AbhI0RNk (ORCPT ); Mon, 27 Sep 2021 13:13:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4558761353; Mon, 27 Sep 2021 17:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632762574; bh=iYpl6L5fOp4387zjSGV1cXurR6OkgsLZgjvPou4icdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0R5tcrwpSJmRoaFgDRrfvAxLAFSI30uvbXFy6aruLXtIhKONtN3Rw7muY5wmHKlvy PqBD+9dPMc8qnZIcw5vLZC9SRuWez3UAbTte1CLkXlMCJ9ktqNxZRynaPnj6la4LNG ChmeglBx4qGxpP88IiuvbJj7NzUJ1C041PB5TZig= 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.10 075/103] net: stmmac: allow CSR clock of 300MHz Date: Mon, 27 Sep 2021 19:02:47 +0200 Message-Id: <20210927170228.359878338@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210927170225.702078779@linuxfoundation.org> References: <20210927170225.702078779@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 3134f7e669f8..6133b2fe8a78 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -226,7 +226,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