From patchwork Thu Jan 18 18:45:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125007 Delivered-To: patch@linaro.org Received: by 10.46.64.27 with SMTP id n27csp247438lja; Thu, 18 Jan 2018 10:46:25 -0800 (PST) X-Google-Smtp-Source: ACJfBouCtrk6saDf61SHiw518lf6GJrfrSi0hnAgumQmW8gdlJobnI82tUEv2h4iXcw8cN43kiF4 X-Received: by 2002:a17:902:121:: with SMTP id 30-v6mr238701plb.187.1516301185681; Thu, 18 Jan 2018 10:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516301185; cv=none; d=google.com; s=arc-20160816; b=NF2plMuI2+IYbaWV2vwgdNJTAmLOYow4Wk391Q5xrvJTdGSrmO+I8Aa0bqkbhXW7U9 i6on867rOSl94OvGhjukbtyMsoRQA4/SthClY9OXlFM9zw278nHEGTVaC/P3HpGQ7/A1 Paefuv9kLAs4goHW0up9KkaHOYOlk+5RaHOKqlxh8kmajnQowlp5U7xWoct9vfnDRozU 9pafMWl+KBRIdf3EocgpjU2XTwsVH9AOrMVbW9DCRwDGuHX/v6Qs4zF0QGAnjoPHBZHW fmS9cwnRHGpbirqJzK+h7IKLVv7oxlNw3PNvEISATNvKtEi7w5dMXts0hz72KtR2q4JR i+3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=w6EjjEdrPKEoNKhNDQMO21CbBaUHfd05Ifnbiyg/MxE=; b=A6p0Ma5eKKKvPu/sf0ywki+p9k9b6Cg1pjL/m7GWiSZ8OfYGImmtdp+WmSAyXXT61v 2TOcOYCgsqBNi8ninvLJ/7h/RnuoGiFnKs0TVXp87rVce3tHFX0n8C5Co+/EutjG9Xal lfXKGVIZs5q4n7U9BgAU73xAMK4Zo5iyqv+i+YqfhSifql0jy+cZXEfF+EL6Jsm20//Y m/Le01HuBXq41mEp1m8GJip5p+CfHGCnmDyMkAZMBMcrKw1d094mmnAGsn8zNVRTkL5M oO6OxeMXRm1BTwtFnEdOaz5Wab+7op0jFrV0Kmm2gXfc+IZTIvZlIvL4e9Gv/8eL7dPj Pzyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=zoBFtJMX; 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 s17si6624629pge.525.2018.01.18.10.46.25; Thu, 18 Jan 2018 10:46:25 -0800 (PST) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=zoBFtJMX; 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 S1756045AbeARSqX (ORCPT + 28 others); Thu, 18 Jan 2018 13:46:23 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38329 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755869AbeARSpm (ORCPT ); Thu, 18 Jan 2018 13:45:42 -0500 Received: by mail-wr0-f193.google.com with SMTP id x1so19458018wrb.5 for ; Thu, 18 Jan 2018 10:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w6EjjEdrPKEoNKhNDQMO21CbBaUHfd05Ifnbiyg/MxE=; b=zoBFtJMXCER7a3TimijtilHMxFHmZTGEBzXURfZTADoh6HtLoKzlBcelsaa5qCvdQ1 SV0NORFd/wUGTRfgoQMztf1zqgGkzHibo5Cl7Sh7B/SiWcwWxI/TUsjAkesiG93ifI41 d/+PBXo5+wNR7t9zkOIal/HcUTVrVwCv50JmfnnUQGQGDSDhIjEfA0/FJha5SQd2iLyE kp0h/U5l3kr3aKO/F16UT1fAx7elAoHALv6hUHop3xxKrqD6WFM2u0SK2RMI8se8Uehs hlWz9IKwfRKG2/BTm7IkQol1qPYvGoVubq08UyPe0OCbrDd/qvsddNcbzWPGU939r56A 3G+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w6EjjEdrPKEoNKhNDQMO21CbBaUHfd05Ifnbiyg/MxE=; b=I2MbDsiAhsWh0K6KoJKYtUqY18DAYagpfdpn45qmsfEcJqGdAJqSYL+bdc04muQWzf dwzkX/R4Ek+EIb7aTphgpBJaSmec0AQ8MAWbi7UPuBrLJTdOK6c0YxaLp+AlQmamCThB VldO71ydfbOTK94ycpudEfw7spLgmfpagy458mf7kZvJbbYS4h+pn8MFvwbmys0IMALP 0vfdc6G4HQYpkSZrCRZg1nfst6Hg44WYPdAZ2qYdheRKzh3g2tTDuLZ/CSCWZ+1ArDHx ZE2zFpwZ6GcjZQElopFFjmrhc1wHcrnfP/2TfDBbIS7v1xC0GD7pBlHMmpU9dt2ueuIX D5hA== X-Gm-Message-State: AKwxytemocvgAtL5SmXyM43AgosBxvn23xoVdzGuFAMKIoQWW9S/bB88 5e9vPC3LXqq/JILltZ8b7CiVgg== X-Received: by 10.223.139.11 with SMTP id n11mr6596027wra.102.1516301141638; Thu, 18 Jan 2018 10:45:41 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id y62sm6240236wrb.48.2018.01.18.10.45.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 10:45:41 -0800 (PST) From: Jerome Brunet To: Neil Armstrong Cc: Jerome Brunet , Kevin Hilman , Carlo Caione , Michael Turquette , Stephen Boyd , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] clk: meson: fix pll with fractional part calculation Date: Thu, 18 Jan 2018 19:45:30 +0100 Message-Id: <20180118184532.6856-8-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180118184532.6856-1-jbrunet@baylibre.com> References: <20180118184532.6856-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rate of the parent should not be multiplied by 2 when there is a fractional part to the pll. This is making the rate calculation of gxl_hdmi_pll wrong (and others as well). This multiplication is specific to the hdmi_pll of gxbb and is most likely due to a multiplier sitting in front of this particular pll. Add fixed factor clock in front on the gxbb pll and remove this constant from the calculation Fixes: 4a47295144dd ("clk: meson: fractional pll support") Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 1 - drivers/clk/meson/gxbb.c | 14 +++++++++++++- drivers/clk/meson/gxbb.h | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) -- 2.14.3 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 3f560b2cd83b..8845f65aeb07 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -87,7 +87,6 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, frac = PARM_GET(p->width, p->shift, reg); rate += (u64)parent_rate * frac >> p->width; - rate *= 2; } return (rate / n) >> od >> od2 >> od3; diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 08b3e1cdba5b..9a92e64b428c 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -212,6 +212,17 @@ static struct meson_clk_pll gxbb_fixed_pll = { }, }; +static struct clk_fixed_factor gxbb_hdmi_pll_pre_mult = { + .mult = 2, + .div = 1, + .hw.init = &(struct clk_init_data){ + .name = "hdmi_pll_pre_mult", + .ops = &clk_fixed_factor_ops, + .parent_names = (const char *[]){ "xtal" }, + .num_parents = 1, + }, +}; + static struct meson_clk_pll gxbb_hdmi_pll = { .m = { .reg_off = HHI_HDMI_PLL_CNTL, @@ -247,7 +258,7 @@ static struct meson_clk_pll gxbb_hdmi_pll = { .hw.init = &(struct clk_init_data){ .name = "hdmi_pll", .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, + .parent_names = (const char *[]){ "hdmi_pll_pre_mult" }, .num_parents = 1, .flags = CLK_GET_RATE_NOCACHE, }, @@ -1558,6 +1569,7 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = { [CLKID_VAPB_1] = &gxbb_vapb_1.hw, [CLKID_VAPB_SEL] = &gxbb_vapb_sel.hw, [CLKID_VAPB] = &gxbb_vapb.hw, + [CLKID_HDMI_PLL_PRE_MULT] = &gxbb_hdmi_pll_pre_mult.hw, [NR_CLKS] = NULL, }, .num = NR_CLKS, diff --git a/drivers/clk/meson/gxbb.h b/drivers/clk/meson/gxbb.h index aee6fbba2004..42573b28a137 100644 --- a/drivers/clk/meson/gxbb.h +++ b/drivers/clk/meson/gxbb.h @@ -194,8 +194,9 @@ #define CLKID_VPU_1_DIV 130 #define CLKID_VAPB_0_DIV 134 #define CLKID_VAPB_1_DIV 137 +#define CLKID_HDMI_PLL_PRE_MULT 141 -#define NR_CLKS 141 +#define NR_CLKS 142 /* include the CLKIDs that have been made part of the DT binding */ #include