summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-01-28 13:22:31 +0100
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-01-30 08:35:50 +0100
commit216abdcc3ae7b1dbe145f1e78cf727b6832db9b4 (patch)
tree6ee0cd7aa6b91cde8d80e0d7a0d5cf816ea54140
parentclk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers (diff)
downloadlinux-216abdcc3ae7b1dbe145f1e78cf727b6832db9b4.tar.xz
linux-216abdcc3ae7b1dbe145f1e78cf727b6832db9b4.zip
clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag
This patch adds support for the CLK_SET_RATE_NO_REPARENT flag to the mux determine_rate helper, based on examples from clk-composite and clk-mux. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r--drivers/clk/sunxi-ng/ccu_mux.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
index eb66adb28807..d0d69c7eb516 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.c
+++ b/drivers/clk/sunxi-ng/ccu_mux.c
@@ -70,6 +70,21 @@ int ccu_mux_helper_determine_rate(struct ccu_common *common,
struct clk_hw *best_parent, *hw = &common->hw;
unsigned int i;
+ if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
+ unsigned long adj_parent_rate;
+
+ best_parent = clk_hw_get_parent(hw);
+ best_parent_rate = clk_hw_get_rate(best_parent);
+
+ adj_parent_rate = best_parent_rate;
+ ccu_mux_helper_adjust_parent_for_prediv(common, cm, -1,
+ &adj_parent_rate);
+
+ best_rate = round(cm, adj_parent_rate, req->rate, data);
+
+ goto out;
+ }
+
for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
unsigned long tmp_rate, parent_rate, adj_parent_rate;
struct clk_hw *parent;