Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580253

[PATCH 1/5] clk: sunxi-ng: mp: Adjust parent rate for pre-dividers

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Chen-Yu Tsai <wens@csie.org>
Newsgroups linux.kernel
Subject [PATCH 1/5] clk: sunxi-ng: mp: Adjust parent rate for pre-dividers
Date Tue, 14 Feb 2017 04:40:01 +0100
Message-ID <taC89-4CW-1@gated-at.bofh.it> (permalink)
References <taC89-4CW-3@gated-at.bofh.it>
X-Mailer git-send-email 2.11.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 45
Organization linux.* mail to news gateway
X-Original-Cc Chen-Yu Tsai <wens@csie.org>, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
X-Original-Date Tue, 14 Feb 2017 11:35:22 +0800
X-Original-Message-ID <20170214033526.16977-2-wens@csie.org>
X-Original-References <20170214033526.16977-1-wens@csie.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1580253

Show key headers only | View raw


The MP style clocks support an mux with pre-dividers. While the driver
correctly accounted for them in the .determine_rate callback, it did
not in the .recalc_rate and .set_rate callbacks.

This means when calculating the factors in the .set_rate callback, they
would be off by a factor of the active pre-divider. Same goes for
reading back the clock rate after it is set.

Fixes: 2ab836db5097 ("clk: sunxi-ng: Add M-P factor clock support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

Maybe we want to Cc stable for this one?

 drivers/clk/sunxi-ng/ccu_mp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
index 22c2ca7a2a22..b583f186a804 100644
--- a/drivers/clk/sunxi-ng/ccu_mp.c
+++ b/drivers/clk/sunxi-ng/ccu_mp.c
@@ -85,6 +85,10 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw,
 	unsigned int m, p;
 	u32 reg;
 
+	/* Adjust parent_rate according to pre-dividers */
+	ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
+						-1, &parent_rate);
+
 	reg = readl(cmp->common.base + cmp->common.reg);
 
 	m = reg >> cmp->m.shift;
@@ -117,6 +121,10 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate,
 	unsigned int m, p;
 	u32 reg;
 
+	/* Adjust parent_rate according to pre-dividers */
+	ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
+						-1, &parent_rate);
+
 	max_m = cmp->m.max ?: 1 << cmp->m.width;
 	max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1);
 
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] clk: sunxi-ng: mp: Adjust parent rate for pre-dividers Chen-Yu Tsai <wens@csie.org> - 2017-02-14 04:40 +0100
  Re: [PATCH 1/5] clk: sunxi-ng: mp: Adjust parent rate for  pre-dividers Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-14 10:40 +0100

csiph-web