Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4415296pxu; Mon, 21 Dec 2020 11:53:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4ETlHczCcREhdveHyoI5NJkyQAklmkd/qUVMpxP2jMT8d13bc/QXk9eFYVBYvH6hYPGC1 X-Received: by 2002:a17:906:d1cb:: with SMTP id bs11mr2605144ejb.535.1608580409149; Mon, 21 Dec 2020 11:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608580409; cv=none; d=google.com; s=arc-20160816; b=JyjCzp/m/iy2LJ3kJHpnWdYXw7gaRFmbe9lNsnxi5d70ProjyxMg0y5PGJPB0vbM82 /X/TDbhZ6Pnhiv/xoHegp9EDWBctBZpcJjTQ/6oCaLgcC+D1GrpuJNIlC3wfK2NijMMu RtFsDK9qwwNkiUXXK7Yzm/cQeG1W/6CoLd5SysqkOMgDUH8xVQmKhXASUnwUoEAXuVqC lvDWhrJkf1T506hp4wTRFhdQF+Bs47lgWAsdkvE/R8t05IdXbSXm7VJBxONrzWiGZ7eu UnpZLkL2wL+hdDGBUQ3B7hq+DrW8NpbGxaqx4SmA/w3IZyJFOboZGwielmTRg1OXdKV5 jnfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EKHYKYvJjr3SdNV5NJTpZB/AVd6o6kMyWNYzPfDbcJc=; b=EElaazoUr/QF0QH+rzi5cc8rKgSkP12IETAHukt6NO8M7RSXEkL4pYM5vVzv+SM4yK 1OBLPYhVf8cuDpNVyiMeTcz8CpYUo7UiyEpd4zlVXvqNNca2Scvc0iEWlS/vFadPGDNi 8wQYfS5LobASWPz/9hST68kPYWAkDTd/ffzRNy1eFB4eJjFGBeOHuS41d8BYbeTG7UuS XbbhVcY5BPYgip979qluJaXZwN2vBZqKQlK3xrpA2ohRAyTvs6TVt/6PSg/i07wp7I5k FsyluJWwW+c8vHuaeQvjJPba6/Mk8QBO+AoxHxcGV+RTHvjBFvHRgo/0i8AyrlpQa5aY ZiFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=YnXqy4eX; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si11989526edl.62.2020.12.21.11.53.06; Mon, 21 Dec 2020 11:53:29 -0800 (PST) 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=@googlemail.com header.s=20161025 header.b=YnXqy4eX; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbgLUTvJ (ORCPT + 99 others); Mon, 21 Dec 2020 14:51:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgLUTvI (ORCPT ); Mon, 21 Dec 2020 14:51:08 -0500 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 994D8C0613D3; Mon, 21 Dec 2020 11:50:28 -0800 (PST) Received: by mail-oi1-x22b.google.com with SMTP id l207so12450097oib.4; Mon, 21 Dec 2020 11:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EKHYKYvJjr3SdNV5NJTpZB/AVd6o6kMyWNYzPfDbcJc=; b=YnXqy4eXAFUfb3hjUiHXsYInF3Oc2mtZnO/TB8nfwAaTHeA37m/d6ewTHREipO8DV7 Hh7p4CfD3gHI7eMtGXxeOQqxb0sLu4BSSjT/qMZBuEU5ucUzX74/tb1ckPOEyxsk8Lmf Jl7d8+KNZ/KPwq3hNvuK8HsnneueBecghDuCixOWKMWKXduVPPfm7C7sYEIvg4lzQpTI Ufe1LmNSMDPB3asTurRECDfSaMLCWCvpm6GvDYkbDIwney/WkQqT3lCUab4KloXfVGD/ 37eNollIh5mENPH6JICo0VdKF3jw/+roj1BwC9SUBc3TKkcsUwyEDNzfQ+S2zvzjUQx7 FwSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EKHYKYvJjr3SdNV5NJTpZB/AVd6o6kMyWNYzPfDbcJc=; b=WMcilFwJeIBcNqyNpL/GzpbEPC7nnv2g8FAX+SWahLRTTMnrK+PIMgS0lkXSu0iU8w /dqFMWVhWO6ZsjYi8fRJlMsdz65gD+lePT3Tv+aRwSmGbTEJGPYwMM7JpqrwJCEkwtpg Y/Jiu0zmt1y1jUpS+S9OgWWeoNklkRPsd9FDsVhjXkl8/PefT2YeaTKx5uPpE10+JvpE eaV3PMk8u4tQAqTQR4b4XQGu6c6b7lZGxEdHulSkzD7fOI1WGkgW24uJWmKdN2B/OzLU 2E09+ln0IN/fSapwSFl1lDSLtx/bFfja3YunRP8kadicpTy4JwK5LBwG+I1zgNhhglIW ZOfg== X-Gm-Message-State: AOAM5327lvRhy1JuscwoE0rPUbqp5mLvIYIzUey319onGBTroGX+FNxF Wa68zvEeZV8E8VhvjZPS83uLmVj4iKcPmIYh43o= X-Received: by 2002:aca:3306:: with SMTP id z6mr1799369oiz.141.1608580228062; Mon, 21 Dec 2020 11:50:28 -0800 (PST) MIME-Version: 1.0 References: <20201219135036.3216017-1-martin.blumenstingl@googlemail.com> In-Reply-To: <20201219135036.3216017-1-martin.blumenstingl@googlemail.com> From: Thomas Graichen Date: Mon, 21 Dec 2020 20:50:14 +0100 Message-ID: Subject: Re: [PATCH] net: stmmac: dwmac-meson8b: ignore the second clock input To: Martin Blumenstingl Cc: netdev@vger.kernel.org, linux-amlogic@lists.infradead.org, davem@davemloft.net, kuba@kernel.org, khilman@baylibre.com, jbrunet@baylibre.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 19, 2020 at 2:52 PM Martin Blumenstingl wrote: > > The dwmac glue registers on Amlogic Meson8b and newer SoCs has two clock > inputs: > - Meson8b and Meson8m2: MPLL2 and MPLL2 (the same parent is wired to > both inputs) > - GXBB, GXL, GXM, AXG, G12A, G12B, SM1: FCLK_DIV2 and MPLL2 > > All known vendor kernels and u-boots are using the first input only. We > let the common clock framework automatically choose the "right" parent. > For some boards this causes a problem though, specificially with G12A and > newer SoCs. The clock input is used for generating the 125MHz RGMII TX > clock. For the two input clocks this means on G12A: > - FCLK_DIV2: 999999985Hz / 8 = 124999998.125Hz > - MPLL2: 499999993Hz / 4 = 124999998.25Hz > > In theory MPLL2 is the "better" clock input because it's gets us 0.125Hz > closer to the requested frequency than FCLK_DIV2. In reality however > there is a resource conflict because MPLL2 is needed to generate some of > the audio clocks. dwmac-meson8b probes first and sets up the clock tree > with MPLL2. This works fine until the audio driver comes and "steals" > the MPLL2 clocks and configures it with it's own rate (294909637Hz). The > common clock framework happily changes the MPLL2 rate but does not > reconfigure our RGMII TX clock tree, which then ends up at 73727409Hz, > which is more than 40% off the requested 125MHz. > > Don't use the second clock input for now to force the common clock > framework to always select the first parent. This mimics the behavior > from the vendor driver and fixes the clock resource conflict with the > audio driver on G12A boards. Once the common clock framework can handle > this situation this change can be reverted again. > > Fixes: 566e8251625304 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC") > Reported-by: Thomas Graichen > Signed-off-by: Martin Blumenstingl Tested-by: thomas graichen > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > index 459ae715b33d..f184b00f5116 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > @@ -135,7 +135,7 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) > struct device *dev = dwmac->dev; > static const struct clk_parent_data mux_parents[] = { > { .fw_name = "clkin0", }, > - { .fw_name = "clkin1", }, > + { .index = -1, }, > }; > static const struct clk_div_table div_table[] = { > { .div = 2, .val = 2, }, > -- > 2.29.2 >