From patchwork Fri Jan 19 15:55:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125178 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp351877ljf; Fri, 19 Jan 2018 07:55:57 -0800 (PST) X-Google-Smtp-Source: ACJfBotnfJ4UK4efeJ2E/wJ5yNEonyjDr9E6NxRoFLioYNsHoZvzxl2dL135CboWMkXOTLJO+IL6 X-Received: by 2002:a17:902:9005:: with SMTP id a5-v6mr1811694plp.251.1516377356956; Fri, 19 Jan 2018 07:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377356; cv=none; d=google.com; s=arc-20160816; b=V4tb9AKjv8Z0vpvMkr5JgFv/uv905QhZfd1EzC3FyK9kfxiC+12t5Tg26pqewDB/9p mh34m88Ce4Ynpjz/HWaQt8l/GtpfVet0T7KOxU3Hh6XVIuHmfWjVFIfL+PHqhSG60xnt eAh3igKToxs+4WW8svrIEMg11Kd/rillr7n1HmjF/KAp00+4XwRlp06kYZE9Pe04ZGuu 9QFP6MLmA37F0XxSR/QiuvgH3YvUEEwdDxWuQ1r5ihPgXq9LDjVBCjh8mKIWDLcAYaBb bbbuHPYiP7PhgtypjcwIzLlJxtU7i8EufDvwBlxVfm3sh6Wfxrg5oL1iA77m1HNk+vrd tBTg== 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=+CYyxrVVxNH+8Ei+RzyXZs/ZSdycdi/I3Lbu7pw+1BE=; b=lOdFlDS81TCdpBmJ20DS9KPjO7Od2RFjAEC+rBVF5CYWYa6N4dRnZVxMlLJZokkkhX D5ruPGM51fQy4hpYo96TtP1ht0KdQI8OcmM8miPvR++adGepbmLs6OHcMVx13HLone7V E+LEYX8PgVV4SJjV8wl2NJrqecAQ5YFQPAXYhkknSDNul5hIrRwaqijhyGO7x/oHdYsH ljffTuqkykfPa1qhOZM3YnNKcVrPc9kyvoLMrhWdYLpJc2i+p7gJodF8urnMXA5ulhYl qH6Q8LSVzdaSBjijPRHfJ/4/+wnKFGmm0rKsnwrlaUAWKYQpktBY7ZiJsPw3ZsQQaPC7 Trgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=qmN4jeNg; 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 x12-v6si919617pln.126.2018.01.19.07.55.56; Fri, 19 Jan 2018 07:55:56 -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=qmN4jeNg; 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 S1755825AbeASPzw (ORCPT + 28 others); Fri, 19 Jan 2018 10:55:52 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:44136 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755524AbeASPze (ORCPT ); Fri, 19 Jan 2018 10:55:34 -0500 Received: by mail-wr0-f195.google.com with SMTP id w50so1967965wrc.11 for ; Fri, 19 Jan 2018 07:55:34 -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=+CYyxrVVxNH+8Ei+RzyXZs/ZSdycdi/I3Lbu7pw+1BE=; b=qmN4jeNg2RMqC2pSggEZNpo8MF4cqQp0h3wKCX8LuQ2MROFG7PTuJ7afWUyVx0sael M7/5lJqJi4YO0IpHqiA5KUKJ0sB7hwCERu92gyqKJU4HyTLn3kzCp0PYE54/Lcw5K1bk uc/3cpg0qfgC4pucI2DeTIjKMdN98vVxFnTiCnvS3proY0VFtYtw4Q6NPNJW3RCZOnks S/0V71hrVL2WfRzVB0fnRk4b7Pvp7f0RldBlAEEXq1NiPE8MwaQIHtlU4pEmGvgYQPG9 y3vKgFOVpmZd69NGbmyesi0q/bY8/PQQslGKH7NPT0ZgEiZRZTzIPdPb8YnqYWnL0wBT aTRA== 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=+CYyxrVVxNH+8Ei+RzyXZs/ZSdycdi/I3Lbu7pw+1BE=; b=bDYYMyRYSLfqTXiQrW/j1qbVn/ApcNnYKdM77+UjFkpwicHVwxU5MDCoD0JlU59tdj fiE8hAl59XOvGj0KdV2H0C7K7Z1vTE4X+S1JZ9c4A/ivTq6rShGBmv7OXCteISIjTxXG 3H3N9YbCgw8XdZFeUlJOMMvgtPJ5hNVsU4nX5gOgFCXnwvVpu2vgCvSiTHEcC55wMbwH pwwS1Fqa1n+BubPm6uf7RWjtM9l5pvkCnOa//TqY/kBPPumA3G+zh3ncqQHwgscL7p0o x85H5Py5YQeK555ZxhRHc0IqVT9lPOXGIR4TlKHooMhz/hffsi0/VYiYtzGTmEMwDf0c Yk3Q== X-Gm-Message-State: AKwxytcMnOQBAQc/LFtgGRp0yY4PRVCj0/wB6vdoYv04MTuEVIYuORTz ml0d7nXzJsULXEaxcmhs8RL1LQ== X-Received: by 10.223.134.227 with SMTP id 32mr10601104wry.176.1516377333534; Fri, 19 Jan 2018 07:55:33 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:32 -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 v2 1/9] clk: meson: check pll rate param table before using it Date: Fri, 19 Jan 2018 16:55:21 +0100 Message-Id: <20180119155529.11532-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure the rate param table is available before using it. Some read-only plls don't provide it, which is ok since the table is not used by read-only clocks. R/W clocks are supposed to provide it, but it does not hurt check it. Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.14.3 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 01341553f50b..2614341fc4ad 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -94,6 +94,13 @@ static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, const struct pll_rate_table *rate_table = pll->rate_table; int i; + /* + * if the table is missing, just return the current rate + * since we don't have the other available frequencies + */ + if (!rate_table) + return meson_clk_pll_recalc_rate(hw, *parent_rate); + for (i = 0; i < pll->rate_count; i++) { if (rate <= rate_table[i].rate) return rate_table[i].rate; @@ -109,6 +116,9 @@ static const struct pll_rate_table *meson_clk_get_pll_settings(struct meson_clk_ const struct pll_rate_table *rate_table = pll->rate_table; int i; + if (!rate_table) + return NULL; + for (i = 0; i < pll->rate_count; i++) { if (rate == rate_table[i].rate) return &rate_table[i]; From patchwork Fri Jan 19 15:55:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125186 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352628ljf; Fri, 19 Jan 2018 07:57:44 -0800 (PST) X-Google-Smtp-Source: ACJfBoujriuK19g4+BUCD1G/x3YZ8J9nDAgwzU4Lc+JocYlPBbJmCovbdZyYKANYHqcrjBr1x/Kv X-Received: by 10.98.33.198 with SMTP id o67mr38815324pfj.0.1516377463952; Fri, 19 Jan 2018 07:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377463; cv=none; d=google.com; s=arc-20160816; b=xR9VN3vuXpkLZizbvTLlrWtSmJ66gyp07F6y9gby64eR1h4uFztIBxwUQgOMXNxaKS tVwBhl7BfPThpwgPg2mQMwSqTamsBDzmF5SllR26OfWPWi3RCvr2w4qBOGPvptGogV0t HzpuoF4els/Rg5kX/2yuVA+dKXwSV67VyWV3TCdUpxLt9I6tX8oqjUOvEtnmKmz5ldCK t0K9YyVpXqd509KixZLNZd5qaaBan/KzqBBHCL1jKnXgsdBvMo+RM9ehHda3JXO6o0Wb 6tM5U7BY0uTO/WtmJNmQOVBgLq1Qks0m1aTjw4NIFfhUvFkfqPRDoTVKFm91YaU3qCwl MNqA== 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=54KHmCVD7/cRHTRGdEo3uWrlZqiRlSWDbc/zurKFmXM=; b=WT/GOqgLYbUpCx89EyN3cFVitAmXSXwxvC/Ulls+7x/uga1DFgkHCdMEbU87knX5kU DQ5Iy4OPKIbAXqRIr0JnPDFK+UkcDWA0OpooPxVcSUTTBKnugv5gtlTk7DeO1xU+FRN4 LIjdRBsh+CI1aaQ2FzInLGNRSjzxxMs4Ri1m6nyIcgtod6c+YFY7VVreSoafQ+Nu7sGe FwL6f70vU/wNO6UAzC62wukQONgOHMO4I0ozSMmWx4dldTYfLU9L7qxA0oeaHbln9GUf kvHSnpnkoqHN14EBkzGrMjAWzu0dYGFLd9T8i43U9JOgK2/7SADSUKz0g5l/Nuxa5w/c JpnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=HmPAN6g8; 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 e4si9490104pfb.84.2018.01.19.07.57.43; Fri, 19 Jan 2018 07:57:43 -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=HmPAN6g8; 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 S1755830AbeASP5m (ORCPT + 28 others); Fri, 19 Jan 2018 10:57:42 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41690 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755702AbeASPzf (ORCPT ); Fri, 19 Jan 2018 10:55:35 -0500 Received: by mail-wr0-f194.google.com with SMTP id o7so1981123wro.8 for ; Fri, 19 Jan 2018 07:55:35 -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=54KHmCVD7/cRHTRGdEo3uWrlZqiRlSWDbc/zurKFmXM=; b=HmPAN6g8aL5wgXO6yspAYGQa+HTdT/YnvCSfBL9pXTrOQH9sW+Bb09++uDViZHaJ6Y AKYPkZ5WENNJoWQDFpeQRb4i5b5DB/CvSQ/DZVaTFndYPq6TWLY7FdFCapDU83klrd+Q AIcjUgnbblUd0/AhxFmDaubG9KGsJkLpMn5LMb5jZHk35sxH1aJxgt3SwluPxlUcO/Gh ILzbPsr5X1DWL3O7EG7qqXvA2wqTU91cbLNKM1r4fRVR5byafEM9GlxUXX0YyFpeJmSP 718yDojGGw4Qg6M0gfLpzmwmN5wSLe0uEzHtfnYYcvE5bEwC1YZmPOwCDBbn0rtnYB1S LSEw== 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=54KHmCVD7/cRHTRGdEo3uWrlZqiRlSWDbc/zurKFmXM=; b=PZmgE8kut6DNmVDHjxlTGL5+HBTHKtrLrniT+EYXpazq8ItsbE1kVQNB9uI2+yw2pt JFHjvPxsrPPeXDN+j81V5nFR8GTuf5fLZMQNcZTteh8FstDuLWQjx1zhuBwnAZ9eZo/k Uxi39T9SMoiaMuTJLdHx3PfzMgx3djLi5jV1MCHf9ct0+pYDLscFQNqulQWJ/7bReow2 7nhyzmmRrhxRWYkwuL3OSnDRAF0G12AoHgVVkvW8bjYJb70W8OMMeToOnJStpgQCMsQL VSzDaU9TjOUPEZTa2nX4PYtAjDufKOYCGPDoh6eTU7LpRb0NbXbVbm9YzxwxzLG5O/wM 6H9A== X-Gm-Message-State: AKwxytdAp6O4sgCS7LQ6a+4ib2F96Wlo6o/GMaoUohnxD9kMxuoU8AFa mESpbFuMTJ4zuXyBSTYEOZ/3SA== X-Received: by 10.223.135.115 with SMTP id 48mr9839883wrz.122.1516377334468; Fri, 19 Jan 2018 07:55:34 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:33 -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 v2 2/9] clk: meson: remove useless pll rate params tables Date: Fri, 19 Jan 2018 16:55:22 +0100 Message-Id: <20180119155529.11532-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Read-only plls don't need param table to recalculate the rate. Providing them with a param table is just a waste of memory. Remove the useless tables from sys_pll on gxbb and axg. Signed-off-by: Jerome Brunet --- drivers/clk/meson/axg.c | 94 ------------------------------------------------ drivers/clk/meson/gxbb.c | 94 ------------------------------------------------ 2 files changed, 188 deletions(-) -- 2.14.3 diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 02f4401d7bc3..56806c6bd9d5 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -21,98 +21,6 @@ static DEFINE_SPINLOCK(meson_clk_lock); -static const struct pll_rate_table sys_pll_rate_table[] = { - PLL_RATE(24000000, 56, 1, 2), - PLL_RATE(48000000, 64, 1, 2), - PLL_RATE(72000000, 72, 1, 2), - PLL_RATE(96000000, 64, 1, 2), - PLL_RATE(120000000, 80, 1, 2), - PLL_RATE(144000000, 96, 1, 2), - PLL_RATE(168000000, 56, 1, 1), - PLL_RATE(192000000, 64, 1, 1), - PLL_RATE(216000000, 72, 1, 1), - PLL_RATE(240000000, 80, 1, 1), - PLL_RATE(264000000, 88, 1, 1), - PLL_RATE(288000000, 96, 1, 1), - PLL_RATE(312000000, 52, 1, 2), - PLL_RATE(336000000, 56, 1, 2), - PLL_RATE(360000000, 60, 1, 2), - PLL_RATE(384000000, 64, 1, 2), - PLL_RATE(408000000, 68, 1, 2), - PLL_RATE(432000000, 72, 1, 2), - PLL_RATE(456000000, 76, 1, 2), - PLL_RATE(480000000, 80, 1, 2), - PLL_RATE(504000000, 84, 1, 2), - PLL_RATE(528000000, 88, 1, 2), - PLL_RATE(552000000, 92, 1, 2), - PLL_RATE(576000000, 96, 1, 2), - PLL_RATE(600000000, 50, 1, 1), - PLL_RATE(624000000, 52, 1, 1), - PLL_RATE(648000000, 54, 1, 1), - PLL_RATE(672000000, 56, 1, 1), - PLL_RATE(696000000, 58, 1, 1), - PLL_RATE(720000000, 60, 1, 1), - PLL_RATE(744000000, 62, 1, 1), - PLL_RATE(768000000, 64, 1, 1), - PLL_RATE(792000000, 66, 1, 1), - PLL_RATE(816000000, 68, 1, 1), - PLL_RATE(840000000, 70, 1, 1), - PLL_RATE(864000000, 72, 1, 1), - PLL_RATE(888000000, 74, 1, 1), - PLL_RATE(912000000, 76, 1, 1), - PLL_RATE(936000000, 78, 1, 1), - PLL_RATE(960000000, 80, 1, 1), - PLL_RATE(984000000, 82, 1, 1), - PLL_RATE(1008000000, 84, 1, 1), - PLL_RATE(1032000000, 86, 1, 1), - PLL_RATE(1056000000, 88, 1, 1), - PLL_RATE(1080000000, 90, 1, 1), - PLL_RATE(1104000000, 92, 1, 1), - PLL_RATE(1128000000, 94, 1, 1), - PLL_RATE(1152000000, 96, 1, 1), - PLL_RATE(1176000000, 98, 1, 1), - PLL_RATE(1200000000, 50, 1, 0), - PLL_RATE(1224000000, 51, 1, 0), - PLL_RATE(1248000000, 52, 1, 0), - PLL_RATE(1272000000, 53, 1, 0), - PLL_RATE(1296000000, 54, 1, 0), - PLL_RATE(1320000000, 55, 1, 0), - PLL_RATE(1344000000, 56, 1, 0), - PLL_RATE(1368000000, 57, 1, 0), - PLL_RATE(1392000000, 58, 1, 0), - PLL_RATE(1416000000, 59, 1, 0), - PLL_RATE(1440000000, 60, 1, 0), - PLL_RATE(1464000000, 61, 1, 0), - PLL_RATE(1488000000, 62, 1, 0), - PLL_RATE(1512000000, 63, 1, 0), - PLL_RATE(1536000000, 64, 1, 0), - PLL_RATE(1560000000, 65, 1, 0), - PLL_RATE(1584000000, 66, 1, 0), - PLL_RATE(1608000000, 67, 1, 0), - PLL_RATE(1632000000, 68, 1, 0), - PLL_RATE(1656000000, 68, 1, 0), - PLL_RATE(1680000000, 68, 1, 0), - PLL_RATE(1704000000, 68, 1, 0), - PLL_RATE(1728000000, 69, 1, 0), - PLL_RATE(1752000000, 69, 1, 0), - PLL_RATE(1776000000, 69, 1, 0), - PLL_RATE(1800000000, 69, 1, 0), - PLL_RATE(1824000000, 70, 1, 0), - PLL_RATE(1848000000, 70, 1, 0), - PLL_RATE(1872000000, 70, 1, 0), - PLL_RATE(1896000000, 70, 1, 0), - PLL_RATE(1920000000, 71, 1, 0), - PLL_RATE(1944000000, 71, 1, 0), - PLL_RATE(1968000000, 71, 1, 0), - PLL_RATE(1992000000, 71, 1, 0), - PLL_RATE(2016000000, 72, 1, 0), - PLL_RATE(2040000000, 72, 1, 0), - PLL_RATE(2064000000, 72, 1, 0), - PLL_RATE(2088000000, 72, 1, 0), - PLL_RATE(2112000000, 73, 1, 0), - { /* sentinel */ }, -}; - static struct meson_clk_pll axg_fixed_pll = { .m = { .reg_off = HHI_MPLL_CNTL, @@ -154,8 +62,6 @@ static struct meson_clk_pll axg_sys_pll = { .shift = 10, .width = 2, }, - .rate_table = sys_pll_rate_table, - .rate_count = ARRAY_SIZE(sys_pll_rate_table), .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "sys_pll", diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 472a3cfbfbc5..2d851bad13fa 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -29,98 +29,6 @@ static DEFINE_SPINLOCK(meson_clk_lock); -static const struct pll_rate_table sys_pll_rate_table[] = { - PLL_RATE(24000000, 56, 1, 2), - PLL_RATE(48000000, 64, 1, 2), - PLL_RATE(72000000, 72, 1, 2), - PLL_RATE(96000000, 64, 1, 2), - PLL_RATE(120000000, 80, 1, 2), - PLL_RATE(144000000, 96, 1, 2), - PLL_RATE(168000000, 56, 1, 1), - PLL_RATE(192000000, 64, 1, 1), - PLL_RATE(216000000, 72, 1, 1), - PLL_RATE(240000000, 80, 1, 1), - PLL_RATE(264000000, 88, 1, 1), - PLL_RATE(288000000, 96, 1, 1), - PLL_RATE(312000000, 52, 1, 2), - PLL_RATE(336000000, 56, 1, 2), - PLL_RATE(360000000, 60, 1, 2), - PLL_RATE(384000000, 64, 1, 2), - PLL_RATE(408000000, 68, 1, 2), - PLL_RATE(432000000, 72, 1, 2), - PLL_RATE(456000000, 76, 1, 2), - PLL_RATE(480000000, 80, 1, 2), - PLL_RATE(504000000, 84, 1, 2), - PLL_RATE(528000000, 88, 1, 2), - PLL_RATE(552000000, 92, 1, 2), - PLL_RATE(576000000, 96, 1, 2), - PLL_RATE(600000000, 50, 1, 1), - PLL_RATE(624000000, 52, 1, 1), - PLL_RATE(648000000, 54, 1, 1), - PLL_RATE(672000000, 56, 1, 1), - PLL_RATE(696000000, 58, 1, 1), - PLL_RATE(720000000, 60, 1, 1), - PLL_RATE(744000000, 62, 1, 1), - PLL_RATE(768000000, 64, 1, 1), - PLL_RATE(792000000, 66, 1, 1), - PLL_RATE(816000000, 68, 1, 1), - PLL_RATE(840000000, 70, 1, 1), - PLL_RATE(864000000, 72, 1, 1), - PLL_RATE(888000000, 74, 1, 1), - PLL_RATE(912000000, 76, 1, 1), - PLL_RATE(936000000, 78, 1, 1), - PLL_RATE(960000000, 80, 1, 1), - PLL_RATE(984000000, 82, 1, 1), - PLL_RATE(1008000000, 84, 1, 1), - PLL_RATE(1032000000, 86, 1, 1), - PLL_RATE(1056000000, 88, 1, 1), - PLL_RATE(1080000000, 90, 1, 1), - PLL_RATE(1104000000, 92, 1, 1), - PLL_RATE(1128000000, 94, 1, 1), - PLL_RATE(1152000000, 96, 1, 1), - PLL_RATE(1176000000, 98, 1, 1), - PLL_RATE(1200000000, 50, 1, 0), - PLL_RATE(1224000000, 51, 1, 0), - PLL_RATE(1248000000, 52, 1, 0), - PLL_RATE(1272000000, 53, 1, 0), - PLL_RATE(1296000000, 54, 1, 0), - PLL_RATE(1320000000, 55, 1, 0), - PLL_RATE(1344000000, 56, 1, 0), - PLL_RATE(1368000000, 57, 1, 0), - PLL_RATE(1392000000, 58, 1, 0), - PLL_RATE(1416000000, 59, 1, 0), - PLL_RATE(1440000000, 60, 1, 0), - PLL_RATE(1464000000, 61, 1, 0), - PLL_RATE(1488000000, 62, 1, 0), - PLL_RATE(1512000000, 63, 1, 0), - PLL_RATE(1536000000, 64, 1, 0), - PLL_RATE(1560000000, 65, 1, 0), - PLL_RATE(1584000000, 66, 1, 0), - PLL_RATE(1608000000, 67, 1, 0), - PLL_RATE(1632000000, 68, 1, 0), - PLL_RATE(1656000000, 68, 1, 0), - PLL_RATE(1680000000, 68, 1, 0), - PLL_RATE(1704000000, 68, 1, 0), - PLL_RATE(1728000000, 69, 1, 0), - PLL_RATE(1752000000, 69, 1, 0), - PLL_RATE(1776000000, 69, 1, 0), - PLL_RATE(1800000000, 69, 1, 0), - PLL_RATE(1824000000, 70, 1, 0), - PLL_RATE(1848000000, 70, 1, 0), - PLL_RATE(1872000000, 70, 1, 0), - PLL_RATE(1896000000, 70, 1, 0), - PLL_RATE(1920000000, 71, 1, 0), - PLL_RATE(1944000000, 71, 1, 0), - PLL_RATE(1968000000, 71, 1, 0), - PLL_RATE(1992000000, 71, 1, 0), - PLL_RATE(2016000000, 72, 1, 0), - PLL_RATE(2040000000, 72, 1, 0), - PLL_RATE(2064000000, 72, 1, 0), - PLL_RATE(2088000000, 72, 1, 0), - PLL_RATE(2112000000, 73, 1, 0), - { /* sentinel */ }, -}; - static const struct pll_rate_table gxbb_gp0_pll_rate_table[] = { PLL_RATE(96000000, 32, 1, 3), PLL_RATE(99000000, 33, 1, 3), @@ -356,8 +264,6 @@ static struct meson_clk_pll gxbb_sys_pll = { .shift = 10, .width = 2, }, - .rate_table = sys_pll_rate_table, - .rate_count = ARRAY_SIZE(sys_pll_rate_table), .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "sys_pll", From patchwork Fri Jan 19 15:55:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125185 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352546ljf; Fri, 19 Jan 2018 07:57:34 -0800 (PST) X-Google-Smtp-Source: ACJfBouRnp1bFVV0LTLamGyn/dKFUu1+72iUl2Q0CY/96OjUIWSxmIKfk4W4AekMZNANZL8NE233 X-Received: by 10.98.248.75 with SMTP id c11mr7690501pfm.54.1516377454838; Fri, 19 Jan 2018 07:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377454; cv=none; d=google.com; s=arc-20160816; b=AR6nCI0WnqljDor6JUDkOjUbIRbONjTjDwOzXVBjc4rg1dwelJH25xgAfCdgqvohCh +HS+r/QRWYV3pYwgpYrohaKfRqNglENnZL3TOQz1Qm7PchQwlZ3LUhwCz7ivNUP2dLhl NM8fzbo1/o5AAAWqfwmEBFsL9gGBeH0Rt6XNrwWgNJgRP0fVn+bgRj8Q6M2xSbMUqlMs RnjPa99LXaZ2+5cV7mKKW+2Z3TG0IFs6bAbqJ8YP1djix4hYWSOjVlDavCKOZlDE8/ps FDb3fYi1vAqVR4M5ubajD388Wgez9pYDEQhk2qLKN6VMw3cCH73fjhn76beBQAAJ5Pt/ FG3Q== 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=4724/3o8t3bh3HP6dUvswXdhaFjRmyLkXK8BEyrtt2E=; b=fCYekFZ1+HQLEn9/lSDtbHXIjkyDlaqbqOMuxLx2l3jUwaCuJlkigCTVN5VCrw2CiM thLqL147UVhywhDoMlAkdmnXQfhHzIKCc2oOX1vgHtF8IPUhtwzSDaQcwwvMoAUXWrS/ Mk3SdHeiJa96wc4SPieW26yEfCBtN9nf/wdVL3W5cVBl0195j90JOEwBcVNhDAbhhKqY S9DinlG855j3QjTpI4t+Dp0m3vOjqzqOsfStX1Zot6lgCsIpyvSG+Q6UG626GLll9q0h 1zlzCbrIvdHmNxhle0dI+8JrCVqxHYNG+M94tXOs9M6g3889f42o4l0iO2HCGi81Pv91 Wfsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=UJw7KJV5; 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 e4si9490104pfb.84.2018.01.19.07.57.34; Fri, 19 Jan 2018 07:57:34 -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=UJw7KJV5; 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 S932479AbeASP5a (ORCPT + 28 others); Fri, 19 Jan 2018 10:57:30 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45481 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755766AbeASPzg (ORCPT ); Fri, 19 Jan 2018 10:55:36 -0500 Received: by mail-wr0-f194.google.com with SMTP id 16so1971823wry.12 for ; Fri, 19 Jan 2018 07:55:36 -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=4724/3o8t3bh3HP6dUvswXdhaFjRmyLkXK8BEyrtt2E=; b=UJw7KJV5kVs4ZFopnuB0+nJNFJMaH7OavelhGArmhYbWJ6US9BGuGVisdGJdiI9TzH XuN4NHxi0BOJDy13eI99LZEVQR5ytdc7j00HH3+wxufYrYPIvCJw/x+FNne0oxy3U/5P TM+9n7bDwb6V8/7JzpvdJmpYL5r2Q0U9UbuXoQ7Ex60y/cEuqyeqv+f0AI6EAfX7zFKT SeODuvVENkJK+eePsu/lDt07TV1Zrg9Z72ixQNUKx52Uu+49pmYwrF25Mw0U7bDQP9mR Q1XEiN/YyOsmJdegwORJAY1gRBE+usgdtIODpAPLOEwDMmwhfZ8sWqomPKC0N44KiZSD 1O2w== 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=4724/3o8t3bh3HP6dUvswXdhaFjRmyLkXK8BEyrtt2E=; b=im97iloda41i8rUVESkkwSKr7HaGz+wUui9GWn/ZXZCb+/bgHzoSyXH5QXRGNT/DZN 47Ws6F/Vwx/17Cs5zKBHAJjoLmb4qVqWZIYe0tWLAYf/TwYCJNUy5YINpZkVL+NmPSd1 1FR5CjbhebKE9YvZfO/aq9D/6HyCMcbjadUKPCWiiq+86iOUSG3g8X3WCwtYVwyq0ClC RxHXJr3J3g6gMmj9R8aexcueSHxK2wS2mdFQ0RJobI0xJdpXxHfoNm0QzFQSSu3ATXAg AJ4E0TpOwwijbEErOZn/Uu283qij82XjyULKmWzTFB7uwFcZR5txOA93fr5NFXXb3JMB hrow== X-Gm-Message-State: AKwxyteSqkzCcQ25QLpytuIzWemcFy9kCS3m6hxOlasjeJRrqMTFyXjw mbuudCj0b6xfJAjOpaMCQ+WYAmsd X-Received: by 10.223.177.207 with SMTP id r15mr10591980wra.32.1516377335463; Fri, 19 Jan 2018 07:55:35 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:34 -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 v2 3/9] clk: meson: remove unnecessary rounding in the pll clock Date: Fri, 19 Jan 2018 16:55:23 +0100 Message-Id: <20180119155529.11532-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pll driver performs the rate calculation in Mhz, which adds an unnecessary rounding down to the Mhz of the rate. Use 64bits long integers to perform this calculation safely on meson8b and perform the calculation in Hz instead Fixes: 7a29a869434e ("clk: meson: Add support for Meson clock controller") Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.14.3 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 2614341fc4ad..087dfc532ba8 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -51,8 +52,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, { struct meson_clk_pll *pll = to_meson_clk_pll(hw); struct parm *p; - unsigned long parent_rate_mhz = parent_rate / 1000000; - unsigned long rate_mhz; + u64 rate; u16 n, m, frac = 0, od, od2 = 0; u32 reg; @@ -74,17 +74,18 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, od2 = PARM_GET(p->width, p->shift, reg); } + rate = (u64)parent_rate * m; + p = &pll->frac; if (p->width) { reg = readl(pll->base + p->reg_off); frac = PARM_GET(p->width, p->shift, reg); - rate_mhz = (parent_rate_mhz * m + \ - (parent_rate_mhz * frac >> 12)) * 2 / n; - rate_mhz = rate_mhz >> od >> od2; - } else - rate_mhz = (parent_rate_mhz * m / n) >> od >> od2; - return rate_mhz * 1000000; + rate += mul_u64_u32_shr(parent_rate, frac, 12); + rate *= 2; + } + + return div_u64(rate, n) >> od >> od2; } static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, From patchwork Fri Jan 19 15:55:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125184 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352454ljf; Fri, 19 Jan 2018 07:57:22 -0800 (PST) X-Google-Smtp-Source: ACJfBotOJJTyYHlLpUnS9Ks2nZfClOkBiXOHA78VHZwsAM8R0QFj+8OTbUBQ+Kzz8uOo9TvI4A1L X-Received: by 2002:a17:902:8608:: with SMTP id f8-v6mr1851727plo.366.1516377442744; Fri, 19 Jan 2018 07:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377442; cv=none; d=google.com; s=arc-20160816; b=XrNBlNA/GBESrTYFQW0AYtPgeR+xw+Peh8VpuRTfEew7YRcJ8+5I/WittLf5x/DIHG HUyN9SdT/ZylvBxtta6hHkaRr76WXyLReELA1hXL8h7lR3Kpu6FkHAbI4OS5BP7WGu+p Fvy/M2jruVpHRM1EYPFwwNaii/yGptB6yuHPw7hk41dcDf7SrB8UzBLIFEmeypg/zGDg dYdewGy+kma4iQ/ngH8kzl7HGnq+dZDfEMKsDPYcHum/HOyjIhnaKFD+WTSj4OVy+Xpp FN/oTI1/kQxboWWMT7vvw000NHZn1z0KeY93MRU865x60eYrgWnry/dlMcUiYNZBDFaT tkNQ== 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=pNAvyYwCwVdEwJMus5QJBxVS74uTWVJ+A9XZFNLXlss=; b=mBIz53ImJ4ws+m/njzBPytQGKOrxhHBMEZ9oMev6a3pNn65Jpf/PyahlR1v7mBG0F0 04oKgQqnZ9kNYIPpf7TTkZXibsxZXuyivL1FJJjp6qOoRiRWsW1LRPvYuYI4qZ3GjdMA uGjJCBO+5yaTWeu3v6nXOOKB4IhVOzJV3ikmNQXF1ASP1uNGBBu3/wXks2JMarW8ONmJ 893dzob4Vtdy/7X0JBNQlpKsncD1mqy3Vl2U+f2XTyv3LY1zAdrWW0sVFnOVXffRpGbm qEVR0iBbxRswnVQlM1w3iyTRbemYd/cf1nou1rYN9LWO2C+xPR0tjC25VRW97hnLA+7h ALew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=IE5IYox2; 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 w12si8602523pge.666.2018.01.19.07.57.22; Fri, 19 Jan 2018 07:57:22 -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=IE5IYox2; 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 S932413AbeASP5T (ORCPT + 28 others); Fri, 19 Jan 2018 10:57:19 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38041 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755815AbeASPzi (ORCPT ); Fri, 19 Jan 2018 10:55:38 -0500 Received: by mail-wm0-f65.google.com with SMTP id 141so4435533wme.3 for ; Fri, 19 Jan 2018 07:55:37 -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=pNAvyYwCwVdEwJMus5QJBxVS74uTWVJ+A9XZFNLXlss=; b=IE5IYox20hV/6BDOOs8tfc4aeWrR6FQg/b3vQXmWX20RzsfdeRWIuSGpN6em8foz14 /lxJwIAjZqGmOVZTsJWz7vxN0CFthLWC7XE8zaR5SysXN12hnl0ZEgOO2ILzzQmFbxAL zFx/8k9mxU4ykkrfiXwsfiUqy32gMD0z8RAxVh7XVOWg0eD2c1HAzUXP643qvtd4rj8k hyGnFMlGUDZm8LLYvMESpEHLJEhnTZraJeiJKnZkjozA2XDoqRRy9zx3a2t+hEjSwdex /uIkvIhrDotIhAd3LF6XWDgC5KZW5pFHjUSv9W7luVZrm3Yonw/o+OQmibq5NtsqQTl+ 4ghw== 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=pNAvyYwCwVdEwJMus5QJBxVS74uTWVJ+A9XZFNLXlss=; b=YxXVBnNnz001Kc5PBlScxgH0JD7xsr2h2WwgbVkPlKqubeufZ858ShzSHnz9QVgbit UE5Fvnz4DIa4wWBfQ01E4Erii7bWEt0wwvSfPHxOeKYP1KrxzNwrtJsjLDBQ8OJL2ReX aOkGyOpgnNZ5Wcr91TUGU9f4IGKxjU1fohOuPeJrZ2jdoYFtio4dTFfFT9bNxWS/R3LK 0vpaBgZGsQ2t/u31fjxWkKn6ncJl6LiYoGYN3QhKa5hOEhN8atT+W42bFrQiXUG4zPS9 ErGvPIuMwiwjFu+POBm4udPdaizl1XVUWeI9OzpXjPvVUAp1LQT6shGbE1bcDN3GJ8/c Fbwg== X-Gm-Message-State: AKwxytfnSHEL+7HBlknTSYBn523HmayA870GNJSZizO/ReJ8NAH9vBIB FLgS/pVuUvimpnnpHPF4q2keOw== X-Received: by 10.28.86.132 with SMTP id k126mr7599266wmb.98.1516377336473; Fri, 19 Jan 2018 07:55:36 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:35 -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 v2 4/9] clk: meson: use the frac parameter width instead of a constant Date: Fri, 19 Jan 2018 16:55:24 +0100 Message-Id: <20180119155529.11532-5-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the fractional part width in the calculation instead of 12, which happens to be the witdh right now. This is safer in case the field width ever change in the future Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.3 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 087dfc532ba8..50923d004d96 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -81,7 +81,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, reg = readl(pll->base + p->reg_off); frac = PARM_GET(p->width, p->shift, reg); - rate += mul_u64_u32_shr(parent_rate, frac, 12); + rate += mul_u64_u32_shr(parent_rate, frac, p->width); rate *= 2; } From patchwork Fri Jan 19 15:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125183 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352379ljf; Fri, 19 Jan 2018 07:57:11 -0800 (PST) X-Google-Smtp-Source: ACJfBouAQTjsyS+xe+aMq17HA+h0EKgwOtl1f5Bluy/iNr0PNbOZ4eRIgPH0zIhMtZ8F2R5qZezQ X-Received: by 2002:a17:902:48c8:: with SMTP id u8-v6mr1779449plh.272.1516377431506; Fri, 19 Jan 2018 07:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377431; cv=none; d=google.com; s=arc-20160816; b=mj4po8Iaa6ptbEhfSqC1MCEeQD9eYXL0UeHBcLdeX/5nhkLrHVJ6MJyBfvoOJzuABg exGC0ZU8CKCKfLY9THT87pY4Tiq2kRhQ7SPi3o3AXcife5mMVTrZi32EFoIOpbLa+zDT T4bvbORHUyFcksc4Sp53g/vIOvhVNCTeqQFwgl4pjdBL/k8mOcHuhzYSoRkG9GbMpwLt DChqAnwHN3LJNX0QCRTIfMRvI5v+W2T3WCNOuun1yoESG3HJ87zRMfUziB/Z3HSsDqQm 2y3yt3m1kAv2nF+5vH+t7MqLAfJXH3B0xNAiLKQCqH0DYK2XVatnJaTWGBjEgvE52QSL vMCg== 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=bI4DgYc7fpUGm7XLj3iuDgsxinfuVyLuBA5IPYvWkK8=; b=r/lJjhPxCXzGSmTo/gBjOyH/jqctn3cMw4F8jBDPjqrTRWeKuHO+XhlAm5l9GgCpkE 8i34LmWkFzKRu6LbIdMV3UOtTSuPqMVbLYZxD31DHLCHStYMlA0Lcgvlxbl9zFAv2Rud lbW1c1ISmY+scRd8RZf/d5SRNieeQkWQUb3YMUZ0mbeHslPpIGfNJcGEOppI/k34mktj J9KK4CauO3sXkUU330NDy3mzl6b31Ri7HDMfoOy48KJnWItAEAk6rHl5aCLFO5e5roXP 74Rx15IgBrGgVA9v81bzWjgMI3NYhMyy/SCa/oK88Ob4XcS+cuS6zbOshcPsQoRCiJY1 FTPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=1nRkJbPO; 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 s15si8447989pgf.99.2018.01.19.07.57.11; Fri, 19 Jan 2018 07:57:11 -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=1nRkJbPO; 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 S932362AbeASP5I (ORCPT + 28 others); Fri, 19 Jan 2018 10:57:08 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37636 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755880AbeASPzj (ORCPT ); Fri, 19 Jan 2018 10:55:39 -0500 Received: by mail-wm0-f65.google.com with SMTP id v71so4484890wmv.2 for ; Fri, 19 Jan 2018 07:55:39 -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=bI4DgYc7fpUGm7XLj3iuDgsxinfuVyLuBA5IPYvWkK8=; b=1nRkJbPO5a/uEuYSPbkEW3cV1W5fHte4siSbA8PRR7c1xLqpU8iFg4n4nmLrmXeJnT 4h6xzU8lkoPfj6I3Sy/m4JVuc5bGhIw7i0QGoLEZDVej2fcWxs0MjVL0skY7WB7GhYIU EdkmzJ1Pc404Yjv2OcHSeodtNCXAQsQ3JZlAA1nrlfGw8UR84uat4Umv+EzsRmZ7hiM4 2kXhElk4cT1Hz1KzC6p87QsCzAtpbHe2VxnypAQ3QqyFWSrZdQTe+mIwDG9m10RBFmp4 N2a+BFKIMFfUBLVI4e34nLjKHn816RRwAJWZrMjkOe4Efk3GNgVubjtiKtu7Sl83+kmy rzYw== 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=bI4DgYc7fpUGm7XLj3iuDgsxinfuVyLuBA5IPYvWkK8=; b=RPdTvhHulMkaQgEVISaWvSkEYbkvVjlmZHXUv+MrJ/RbMI67iTT5e1hzYemm8+71eI vGpTyM6geKl+4U75v0hMwuJ39MDQus5XEPyDaoPVpTAAt+xgd4gxHu/4EV7jl2YNoM3P ydF3MEO7UFWtKsGUeQTuvFZVdMC/ORQIQUrRkKSfDG2cq2EC2hLlNlqRuzxERZKhlHiM jPCByj0RJAAKXedyNHy6XIqrTtytOUhStue3MXx6B80XQM6XWiZyV0g9UhMO5I3xPoAk 8nYw/FqLN/Yf9qb424Bx4OpgK2oXJKAs7llsk2qxZ4Lbd9slB44E1V/bl/uQgY17L9lF tORQ== X-Gm-Message-State: AKwxytfRnVCyADqZ976+u+xjiZ4s40/Cm9bbPv2ZHAms+dut2QfiQCf5 ovVmBp5qkbn41MZHhPZnwuvYXA== X-Received: by 10.28.169.200 with SMTP id s191mr8770576wme.9.1516377337609; Fri, 19 Jan 2018 07:55:37 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:36 -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 v2 5/9] clk: meson: add od3 to the pll driver Date: Fri, 19 Jan 2018 16:55:25 +0100 Message-Id: <20180119155529.11532-6-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some meson plls, such as the hdmi pll, are using a 3rd od parameter, which is yet another "power of 2" post divider. Add it to fix the calculation of the hdmi_pll rate Fixes: 738f66d3211d ("clk: gxbb: add AmLogic GXBB clk controller driver") Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 19 ++++++++++++++++--- drivers/clk/meson/clkc.h | 2 ++ drivers/clk/meson/gxbb.c | 5 +++++ 3 files changed, 23 insertions(+), 3 deletions(-) -- 2.14.3 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 50923d004d96..1595f02f610f 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -53,7 +53,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, struct meson_clk_pll *pll = to_meson_clk_pll(hw); struct parm *p; u64 rate; - u16 n, m, frac = 0, od, od2 = 0; + u16 n, m, frac = 0, od, od2 = 0, od3 = 0; u32 reg; p = &pll->n; @@ -74,7 +74,13 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, od2 = PARM_GET(p->width, p->shift, reg); } - rate = (u64)parent_rate * m; + p = &pll->od3; + if (p->width) { + reg = readl(pll->base + p->reg_off); + od3 = PARM_GET(p->width, p->shift, reg); + } + + rate = (u64)m * parent_rate; p = &pll->frac; if (p->width) { @@ -85,7 +91,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, rate *= 2; } - return div_u64(rate, n) >> od >> od2; + return div_u64(rate, n) >> od >> od2 >> od3; } static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, @@ -226,6 +232,13 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, writel(reg, pll->base + p->reg_off); } + p = &pll->od3; + if (p->width) { + reg = readl(pll->base + p->reg_off); + reg = PARM_SET(p->width, p->shift, reg, rate_set->od3); + writel(reg, pll->base + p->reg_off); + } + p = &pll->frac; if (p->width) { reg = readl(pll->base + p->reg_off); diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h index c2ff0520ce53..4acb35bda669 100644 --- a/drivers/clk/meson/clkc.h +++ b/drivers/clk/meson/clkc.h @@ -41,6 +41,7 @@ struct pll_rate_table { u16 n; u16 od; u16 od2; + u16 od3; u16 frac; }; @@ -92,6 +93,7 @@ struct meson_clk_pll { struct parm frac; struct parm od; struct parm od2; + struct parm od3; const struct pll_setup_params params; const struct pll_rate_table *rate_table; unsigned int rate_count; diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 2d851bad13fa..cf083a1906d1 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -238,6 +238,11 @@ static struct meson_clk_pll gxbb_hdmi_pll = { .shift = 22, .width = 2, }, + .od3 = { + .reg_off = HHI_HDMI_PLL_CNTL2, + .shift = 18, + .width = 2, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "hdmi_pll", From patchwork Fri Jan 19 15:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125182 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352306ljf; Fri, 19 Jan 2018 07:56:59 -0800 (PST) X-Google-Smtp-Source: ACJfBotujo0Pidx0hcgaGDpoMJUvE+3sX6WyN5ZfpTov0+MxNMdyB37XiIr50AOK4CMhvtmzLIQU X-Received: by 10.101.81.7 with SMTP id f7mr41783157pgq.425.1516377419441; Fri, 19 Jan 2018 07:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377419; cv=none; d=google.com; s=arc-20160816; b=vpHs9SOyBgMnk4iZZ0Rxd5+xXZw5S3DAKx72GQDtnyBfNchtC4uauV3mPHzXZsvifE eDop9V5vIkZHB3JGRVP/wghTukKI2dQOxUqE2fTblDNfgOHfonEoaEnu770PeyBbf1o2 d0aqujpfOYZwgcvH7kKD+wHZ0+w36JiZqhx8mH1C/SpOSa8+lBkckad1ETHUtCGPmrui h8grUYwdyOZsqqFEE4Y5H9bpeJPRwkvrH1yTgMaUkTq1sqPaLFj/zwe06ca6Y49/u1dq 5KGncg96UmQYl3Le5OZPB0GPclsRXt92FKkPcGVV0LS/W4w6jfE+sSGdWzwSRLMaL71I rZKg== 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=HQTgarqjlANMQukbmqKWWWvuUu+aJX6Noc9V1rcWPJM=; b=D9Jes9jrKQf1vVOaInXLG0j11GONAvxDNUWbWqUsYtsYWD4zGbX4jtJbtpJz/TvwFF 4Y/FhGdtI6t+oIHqanedwZuD2PWVjt6l2tMDGOgT6Eof2tkaSbeHvzKQ+KWkbjKjX7zg nO68qXoZAreyouoW0cCxOF7rVCngO0Vilg1eBYj2XPdk0N8yJir3cOKsKWKpomYDJUa/ kAziMulLHkhIpW/2Re47oZ+bKeagsnGjDaJ0LZQp+m0ljbHRAr2LrlIRo+WqaS6Nn/1W ljpe1oU2TCj8xlb44fm/UXwaOceB+SdltQ8gW2ZyLVnj4HiKnkIDMc1ovbk25cOZAqKx 2sfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=KVbgc74X; 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 s15si8447989pgf.99.2018.01.19.07.56.59; Fri, 19 Jan 2018 07:56:59 -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=KVbgc74X; 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 S1755787AbeASP4l (ORCPT + 28 others); Fri, 19 Jan 2018 10:56:41 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:38147 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755923AbeASPzj (ORCPT ); Fri, 19 Jan 2018 10:55:39 -0500 Received: by mail-wr0-f196.google.com with SMTP id x1so1986693wrb.5 for ; Fri, 19 Jan 2018 07:55:39 -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=HQTgarqjlANMQukbmqKWWWvuUu+aJX6Noc9V1rcWPJM=; b=KVbgc74XnaYiwx1Da38qRnu/R/JcjLW16WgFSSBDvZcFJ+pllHMvq1cYjY8oBfYrOa +Oih944tkmKKThlMHDGzAN8hu+gd3YnqAcec14EfoaqUMGDmr6AWwUlGcFntdxNnUVxw 97tX5kgANgMWwhRIMTdDlSbtqkOddEa4ITC909vevx0mE5+6EWRWE29StnUJsQBtG+ZQ KHif2w+C8qtsF5d2OyZdvhl48IUnUoFvRJyUx6/RxiXRpkH/oAtyhoxlnbFc7LYvdm18 oK5XtKAdzZ1+bhlsM4eZcbLxaBNI/9HSZuQ97Ni+JvhEp86dhnz+OcWULyVMWQXB5Ze1 J0Yw== 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=HQTgarqjlANMQukbmqKWWWvuUu+aJX6Noc9V1rcWPJM=; b=Dp94GchwWSxW04NWOlfWcnHnfOGfJzw38YnV86oNZ1mUGSvv7BdX/gxuNatIwZAEwe WwF08homGDrtvXI2jpty6ACNzQKKceJzmWoF8MNzWMtH3LpvYHHo646Xet78V+Y7OOWP rZaXPm7oMC37oMt6SkfnF/JHSFONcmhQXcV1fbLIeLOUcypJ+v8szTiLNEnuXKGVMU2a AOHRimdV1nFsEv5n5wL/BDwT0kUD01arQDk3o5PQoJbOZ0MfdjMP8lfBvukvfqCM4bOU lmxNfxkLS7zpa9anElKG0ubDvq8tesGR2Ifsz9D/ZviHiAABT+X8UiLXpOxbokKQkh00 S7uQ== X-Gm-Message-State: AKwxyte/OPVY7lwQJwLw/GBuoaRCcQr1jLkDluDnLyyxqUSwhcLUfWSq zRk4wIOEvhk4DIgeWahym/9fKg== X-Received: by 10.223.183.23 with SMTP id l23mr10195874wre.33.1516377338619; Fri, 19 Jan 2018 07:55:38 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:38 -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 v2 6/9] clk: meson: add the gxl hdmi pll Date: Fri, 19 Jan 2018 16:55:26 +0100 Message-Id: <20180119155529.11532-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The hdmi pll used in the gxl family is actually different from the gxbb one. The register layout is completely different, which explain why the hdmi pll rate has always been rubbish on the gxl family. Adding the correct register field is the first part of the fix to get a correct rate out the hdmi pll Fixes: 0d48fc558d01 ("clk: meson-gxbb: Add GXL/GXM GP0 Variant") Signed-off-by: Jerome Brunet --- drivers/clk/meson/gxbb.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) -- 2.14.3 diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index cf083a1906d1..f74ed52e2673 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -253,6 +253,52 @@ static struct meson_clk_pll gxbb_hdmi_pll = { }, }; +static struct meson_clk_pll gxl_hdmi_pll = { + .m = { + .reg_off = HHI_HDMI_PLL_CNTL, + .shift = 0, + .width = 9, + }, + .n = { + .reg_off = HHI_HDMI_PLL_CNTL, + .shift = 9, + .width = 5, + }, + .frac = { + /* + * On gxl, there is a register shift due to HHI_HDMI_PLL_CNTL1 + * which does not exist on gxbb, so we compute the register + * offset based on the PLL base to get it right + */ + .reg_off = HHI_HDMI_PLL_CNTL + 4, + .shift = 0, + .width = 12, + }, + .od = { + .reg_off = HHI_HDMI_PLL_CNTL + 8, + .shift = 21, + .width = 2, + }, + .od2 = { + .reg_off = HHI_HDMI_PLL_CNTL + 8, + .shift = 23, + .width = 2, + }, + .od3 = { + .reg_off = HHI_HDMI_PLL_CNTL + 8, + .shift = 19, + .width = 2, + }, + .lock = &meson_clk_lock, + .hw.init = &(struct clk_init_data){ + .name = "hdmi_pll", + .ops = &meson_clk_pll_ro_ops, + .parent_names = (const char *[]){ "xtal" }, + .num_parents = 1, + .flags = CLK_GET_RATE_NOCACHE, + }, +}; + static struct meson_clk_pll gxbb_sys_pll = { .m = { .reg_off = HHI_SYS_PLL_CNTL, @@ -1520,7 +1566,7 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = { static struct clk_hw_onecell_data gxl_hw_onecell_data = { .hws = { [CLKID_SYS_PLL] = &gxbb_sys_pll.hw, - [CLKID_HDMI_PLL] = &gxbb_hdmi_pll.hw, + [CLKID_HDMI_PLL] = &gxl_hdmi_pll.hw, [CLKID_FIXED_PLL] = &gxbb_fixed_pll.hw, [CLKID_FCLK_DIV2] = &gxbb_fclk_div2.hw, [CLKID_FCLK_DIV3] = &gxbb_fclk_div3.hw, @@ -1675,7 +1721,7 @@ static struct meson_clk_pll *const gxbb_clk_plls[] = { static struct meson_clk_pll *const gxl_clk_plls[] = { &gxbb_fixed_pll, - &gxbb_hdmi_pll, + &gxl_hdmi_pll, &gxbb_sys_pll, &gxl_gp0_pll, }; From patchwork Fri Jan 19 15:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125181 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352139ljf; Fri, 19 Jan 2018 07:56:34 -0800 (PST) X-Google-Smtp-Source: ACJfBosOqlh3wWC9gcxYdLn7tEYbKqVUHcnU+p7TMRtEtDXoyEq5uwYRmoqOSmo6ClRQ1rrp9tKh X-Received: by 10.98.133.193 with SMTP id m62mr34259073pfk.18.1516377394257; Fri, 19 Jan 2018 07:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377394; cv=none; d=google.com; s=arc-20160816; b=inZwAyeENksP4Jab5bvcMe/K3p5NiyQwBuCRwVXmyZw3zyejVIZ0rlQ23Vr58IQlo+ b70qaVCFUI82AdjF9hWN7xnFVnwj30VZOwx3Bjz3KIKmUvfZwu13L+8MMpBFp2UQ0lsv u7memzUv5i0jeXqb2I/R2Vb0Gahx7m8Ge+FfZJ3SnePU72HxolM5zZEsX0cWbN2jvqm2 9gWcYmB1EstCV4oIDXgGPvCx7z9PFi7gc8oWqv0cuTTtWQKHnexxzzzEesw6Vqjd7UjZ m3lXU0C5xgathkB8Te85UY3RqLbQ0HnmbU8K+cVY6VmBO8TNkm4FmaL2yLoDqTUdhLYA 0gYQ== 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=mmo13YY5nX1RYh/GLAaPQA5j7D1cc/50G4bNawPLCEA=; b=XaIwLtbA+5T8BC0kxsw0DFf49au27VjvXDgmdw+id50DuE5jo5T4yrhLpWhBffqTaj dPh9P+AzH9esfW8vNRb75Kg22AkbDAs064YTfFCkbYpfJKJR+X67O6emLHdiY7TpbesE xKZU19lheoF3gJBYpLmqALjD+3LymNeMAKz6spWa5hWk8DpJUL1Chz8UB1l0E+UUj0XJ aDPi7PsB9aWK95O290FravP/RmMectjuNvtg8WWDqpv3Lo8Jm6Wwrm4Pcs8gp4sKFwMA iHl25R1sKq0DhViEPmNhe8OROdQVBeKonl9eR+7kWliXPaz769ntRR4hZIw0AHlvNKGx qf9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=sgtnOfik; 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 s15si8447989pgf.99.2018.01.19.07.56.34; Fri, 19 Jan 2018 07:56:34 -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=sgtnOfik; 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 S1756077AbeASP4b (ORCPT + 28 others); Fri, 19 Jan 2018 10:56:31 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:46680 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755360AbeASPzk (ORCPT ); Fri, 19 Jan 2018 10:55:40 -0500 Received: by mail-wr0-f194.google.com with SMTP id g21so1969166wrb.13 for ; Fri, 19 Jan 2018 07:55:40 -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=mmo13YY5nX1RYh/GLAaPQA5j7D1cc/50G4bNawPLCEA=; b=sgtnOfikuO1w6K2ahckzLtKAqVz8R5gCk4vWfto/svtYfO7NG9ZF9gJp532LbnbJfr uBz2xTFw84LAcdsovc04M4k7FE4VmWO1Wja+LTyF0H2zC0SvshrwWT3yAe9Ne4TE+Obz H+pY08bZAjPGZbhGlBTi8uyXiOVmyWfjm+yyHVEC1O0/Jn+FrSnQLql310Sree6O4iNw xQF8X6AsB7EQ/7pXOxE1yYHYGiQWfFa3PYp8ftd87J4ti3yz1qDH8xEPRGo6vKTFjnJh Do9X9xhHmOuiw5mw7gkze4P6vLmYB2vUx9ZAMRV0to8/JZw0czQGfHAzQucm7zW+o6e1 Xlzw== 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=mmo13YY5nX1RYh/GLAaPQA5j7D1cc/50G4bNawPLCEA=; b=H5csYsHteSE1NHQNFHC/eWgT7dLGpDHNEHlFhMOb/6jZujY6MAFr8n6S+0V3Ng5ydK PF0A+PwvHPmACRpOlQ3yOJxOakqBfaKJC3gHO0G9CjVmfaexqJTkXKjIrtniGjnPyfQd EjRxbZwCCeOKOqiL0d05cC0yx5uPWn2O7Tgs9IH0ryohDBkI5sUwY4IZoIES3DFS4vmE SoGJQE/+BiJaZAQESM1xGkqi2IT7SeOcsrNxdPm+ACe4dQ5AhDoVCQBIW73bh3IqisfT ieTUUjoaEFOWBhop0YXnob6sJclhJs6jbHaAGc1yq5ctyUuj/XnKh/vWtTxjUvZypH8F al7w== X-Gm-Message-State: AKwxytfALsqHPT3lGhX5VT2GkCnY6Fvdj7O3YrYFUeCTXn9tyEYckUwK KIGQVDtJkiWTt7mDcxpKYsRSgg== X-Received: by 10.223.144.100 with SMTP id h91mr10425198wrh.147.1516377339542; Fri, 19 Jan 2018 07:55:39 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:39 -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 v2 7/9] clk: meson: fix rate calculation of plls with a fractional part Date: Fri, 19 Jan 2018 16:55:27 +0100 Message-Id: <20180119155529.11532-8-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-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 the pll has a fractional part. This is making the rate calculation of the 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 a fixed factor clock in front on the gxbb pll and remove this constant from the calculation to fix the problem 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 1595f02f610f..218c769c6d50 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -88,7 +88,6 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, frac = PARM_GET(p->width, p->shift, reg); rate += mul_u64_u32_shr(parent_rate, frac, p->width); - rate *= 2; } return div_u64(rate, n) >> od >> od2 >> od3; diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index f74ed52e2673..b773be1033f8 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 From patchwork Fri Jan 19 15:55:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125179 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp351965ljf; Fri, 19 Jan 2018 07:56:09 -0800 (PST) X-Google-Smtp-Source: ACJfBosazE4wplzh4WKG5rAcF6NeBiPEcTGAHElueknJYUzTY0+QAqUA6sAnOkeEttTe+tuJQjYT X-Received: by 10.98.102.135 with SMTP id s7mr37897071pfj.209.1516377369012; Fri, 19 Jan 2018 07:56:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377369; cv=none; d=google.com; s=arc-20160816; b=RuoOeS94YjzXBlxddAJJYuJLMXZoz1sx+zbfn0lknOA6ALhEE0B/vFE2HK4DOtl2rI dTyeReV6B2EULJohJeoGkVSu/vYvJzlhkYOhCPMnIovSFRzdLSu5MVPQZgHilMIh9dLy xPtscpYIUhs0Ap1Hh696cYjSmfGcjg1nC6WWB4lM08CAd8R4PE0UTjt8bMbMzM5qoPqi 4pYhsiJvjQaKmb2LsIB9bx/iaZrLXGBy7QYYNpy905xxwJZeW5KMUO0rPUXkhi9sLlRD sUOuk+L5mJX3yTLDxoLShGSamN9nP7VniFIPGJ7ZyCjIhjsy87CEGXFrMUCi2+TbDR9H wLPQ== 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=0b3DqrIbfgQYPyCEUTbkwVgyf1z15xogfUJr+FqrNpU=; b=JHgVUXd/Z/vc91j0JSnHJOCo06yN/hqucZWS2Kc6zdhA/7AZDd9lnNG6D4wD7l/Ra1 GVOFHyRQGFGkwI/xopGHEcfp1SswU0jfq5qjbjojJIdvcUHmMJUPo0XRmssRq2eGdauH KoYXNdZNGsk3WHaPdxvQmN/WJStAorXH44S5ZK3dQh5r01ZAXnuHCejJ5sgQF3sJskxg xW2OInUnaDe3EwKRf7npOb93voxWSKUC1/YzPN4x1dUJHt+gz0/ziVHTTVa3ZyENBsL6 vfnYX1gImg/aNDcam9QfI2cw+a6kuAo9QbLQZNhbjjBnRLUvOP4aYh2BUmhC0WNvcN4u ZcoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=fwDvNV8s; 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 x12-v6si919617pln.126.2018.01.19.07.56.08; Fri, 19 Jan 2018 07:56:09 -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=fwDvNV8s; 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 S1756018AbeASP4G (ORCPT + 28 others); Fri, 19 Jan 2018 10:56:06 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36403 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755852AbeASPzo (ORCPT ); Fri, 19 Jan 2018 10:55:44 -0500 Received: by mail-wm0-f68.google.com with SMTP id f3so4491455wmc.1 for ; Fri, 19 Jan 2018 07:55:43 -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=0b3DqrIbfgQYPyCEUTbkwVgyf1z15xogfUJr+FqrNpU=; b=fwDvNV8sjIlJ6zphOAzPFkcx1Q2YA4TqwwjvqlQoKYYZMrQUiUh8FbGTewe8dlTe5z gTPcunnIzF7rYky/J9tG/W9boovkhBdPc29I36QWWAf1clvh+QUv1uyS4My3wMGAg1OB +xJ98XVMdriSZ44XePtBch9VlIp6YTm/UY9AO9yHNulPd3D5Zez5tJiqGpk37MtkrCIE /tMKDDMnYS9qk89BqR74TIK4xsuANI/MpSJg23fBlV6sRZ2mwIEjPj/hAg/e+/LjqrCw uu3U+mtRd1kXDJi7Nb4KVTZmrU4bzGLM5zy+hcLVU5t+HhCvbOcrZnVePOu9DwbkLtCy fBTQ== 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=0b3DqrIbfgQYPyCEUTbkwVgyf1z15xogfUJr+FqrNpU=; b=tor8ORGCGj7qu57XA6hQllfuz0BjGlPbNcdM27mS16bNLFBFGOU5AwSW/awgw9EUEi ZKqLBzuhDP1bRZd3/jgM0yhAlVfYzHmGwVxGSX+ABpqITMg8hSgMx3tx8kRHljMQjIoC 9QjEpVwTSLPnpuyGJMPY3RHYzqePFVyGZ6qbjRaH1YY0+YcDuiDNhAOqoFW+y8+AKYee wWzEc/uCVHjwAnVJilCq91MRgv9sLFdWQlumvkqfvplBzpISb5HA0XbPUMKyWcPf/9yV PTusGL6oV8My1uWsLre/OWPsmgfc5DZD8hjuo4zHXnNCVQPMPKQYpVgBF8X4GiXpLae6 /nGQ== X-Gm-Message-State: AKwxytfMOjfXbw4ACV6QjH2D7SX9SqsJ/xafk5GdCkMn6qUWaWjoYND+ 1fWY1n+Jqgl7DMnyWyEUC5/3xQ== X-Received: by 10.28.206.12 with SMTP id e12mr8764072wmg.73.1516377340583; Fri, 19 Jan 2018 07:55:40 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55:40 -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 v2 8/9] clk: meson: gxbb: add the fractional part of the fixed_pll Date: Fri, 19 Jan 2018 16:55:28 +0100 Message-Id: <20180119155529.11532-9-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The fixed_pll of gxbb and gxl also has a fractional parameter. This has not been a problem so far because the fractional part is actually set to 0 on these platforms, so the rate remains correct when it is ignored. Still, it is better represent the pll the way it is, so add the frac parameter now Signed-off-by: Jerome Brunet --- drivers/clk/meson/gxbb.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.14.3 diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index b773be1033f8..17f44ac751b3 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -202,6 +202,11 @@ static struct meson_clk_pll gxbb_fixed_pll = { .shift = 16, .width = 2, }, + .frac = { + .reg_off = HHI_MPLL_CNTL2, + .shift = 0, + .width = 12, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "fixed_pll", From patchwork Fri Jan 19 15:55:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 125180 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp352048ljf; Fri, 19 Jan 2018 07:56:22 -0800 (PST) X-Google-Smtp-Source: ACJfBot2N5yWxFCCCycYiNs4vjkQ9GkGUuTbxaEpx3N2ViDXFBSTSNeWrPwBdnXaf3BIZyehVBse X-Received: by 10.99.103.198 with SMTP id b189mr17760376pgc.20.1516377382214; Fri, 19 Jan 2018 07:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377382; cv=none; d=google.com; s=arc-20160816; b=pHC1KOh4SDPjv++R10OocuosafVaf/x8bVUPqByw4G5Hj/6yUuX0HG8DKKtwUx4sB4 ga/Qm3jELs7aPPybkpe9OMF/CZhHQL5EhMlJIRILcEeKEow6EVotcGknRIBJvCNVZnW/ /UVDO4DblhuFUSJHdD3iNze3SB+kRjh+owRH0Z4/Dba4ADJwaN3n20C6J5z7a+MKlxsL Fdv+a4kvKAznem8hIK+wkdqxu9jcYqJzzxkTZi8GwrHXIgZ2ukpZz/epCh3jeKvgMM4l aQ7sVHXgpNCjk+5lxPgvK4Po7wrRtqaq8T7ZXbke5v+RH3kk0wCclQiKcbZGvGTMoeQ/ KVkQ== 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=KgnQBcE56NWdw22o9fdu3QwtERy/H2F+PybfghNo9cw=; b=qEA1BijbZxhhbDde3Qg9JGAttcIKv2gruIN8wXsnXWEpVYCqZnQvv+K+tFqoNbw2dn WFqsrn9OiscOtD36433bd7ISH/9KR/EfvbNuy0KzQ7i6lcWbZMuEy45UauYNlV57KT5J 6/Pebx1lGZH9tbXi8OsjHQ+vU2Q4BTKxmFUjCI4rhbVW/Z/+1nO/E9KTIO4cnbqMyajb Ljxj/qJdAbIjJs023n56IV4i+YaZS04BRb09qIl/UFt6Opkh0EHsVmCJ9Gf65YFrgQgU W8Kt4zRI0KAGW+KoovkE+2tOQUXfKZjzY7oWI5mpdx79YRgJitSgXUD6xDBCyCOWzXuP Witw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=vq9tFj5Y; 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 b188si8496146pgc.452.2018.01.19.07.56.21; Fri, 19 Jan 2018 07:56:22 -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=vq9tFj5Y; 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 S1756040AbeASP4U (ORCPT + 28 others); Fri, 19 Jan 2018 10:56:20 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35673 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755932AbeASPzn (ORCPT ); Fri, 19 Jan 2018 10:55:43 -0500 Received: by mail-wm0-f68.google.com with SMTP id r78so4497751wme.0 for ; Fri, 19 Jan 2018 07:55: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=KgnQBcE56NWdw22o9fdu3QwtERy/H2F+PybfghNo9cw=; b=vq9tFj5YzYwNqPcAdAB8WgYYzLxVg5HhhMlMamj5HtCY9Ndau/V02K9C5TL3JrtcdH 5ThGStOHlS4xcX5SRpr8LmKqu2WvAhpK6/m3iQnZZGEhrNiQoA2uvBm83MjVYcvvtO+0 rMiqJ1/vRUSzIiysbgINQrIo4i8HSKEQVVQmlKA7u2KjXAJbbqinep7L5qS3fEX1T0aM jMwOcMCokG7L0oazGnLPFGQqoWUQrD6EHMhrbNaqs77E5PhyknyCLUyCjoaVbuGeRIJD ClVCGiQkJlqKwQ1Tg4nD4Ani73J28iiBOwEXLfOe0Qx4AAXpkZAE76A86OrmamVO7TCS OA+w== 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=KgnQBcE56NWdw22o9fdu3QwtERy/H2F+PybfghNo9cw=; b=h8cE3DG/hCDw1zqmD/+xwjSX227ZjqSumCShcATHvvPjwtnwZ0tgeVs4SEcFyGkrVY u6ebGX+l5dOyy6nVtcihafd/DJSP0NS/OEcQpnDVVli0sYK2mEgpoUdFYnlEW2fpeund ntEZtAKR8WMpw8k4gqby/lhUxvLwEP+x6V5V7kqGNzu1cF1Or3xFIYfbQOP/965JX3kS 9tDGA/OZ9BD/0VLfyLhCM0ILfaB1cqcwOsWwFQzhqFuQImNh3HolKvc9suJv1k0k9njG jsmvAhvUNQwMHTmGf1LfrVs6aEytQ7tj2DGjKbcEzgtteAGWi/R36ccShRbidUXKhdEE t2Ug== X-Gm-Message-State: AKwxytcUeRzFQydm62qCf79x3vOPI1DsIp8GdOgz7MnLXSgr+mKtXVbq P06rmdru7kiLqlmBI7fWjVkX0A== X-Received: by 10.28.38.133 with SMTP id m127mr7908311wmm.40.1516377341514; Fri, 19 Jan 2018 07:55:41 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25883027wrb.34.2018.01.19.07.55.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:55: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 v2 9/9] clk: meson: axg: add the fractional part of the fixed_pll Date: Fri, 19 Jan 2018 16:55:29 +0100 Message-Id: <20180119155529.11532-10-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119155529.11532-1-jbrunet@baylibre.com> References: <20180119155529.11532-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The fixed_pll also has a fractional part. On axg s400 board, without this parameter, the calculated rate is off by ~8Mhz (0,4%). The fixed_pll being the root of the peripheral clock tree, this error is propagated to the rest of the clocks Adding the definition of the parameter fixes the problem Fixes: 78b4af312f91 ("clk: meson-axg: add clock controller drivers") Signed-off-by: Jerome Brunet --- drivers/clk/meson/axg.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.14.3 diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 56806c6bd9d5..953e119635a2 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -37,6 +37,11 @@ static struct meson_clk_pll axg_fixed_pll = { .shift = 16, .width = 2, }, + .frac = { + .reg_off = HHI_MPLL_CNTL2, + .shift = 0, + .width = 12, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "fixed_pll",