diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2016-10-14 12:08:19 +0200 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-01-23 11:45:01 +0100 |
commit | 0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc (patch) | |
tree | 1ee8199653ceeccb7954da33a2b36d740f12269b /drivers/clk/sunxi-ng/ccu_mult.c | |
parent | c9520be3839063bbb50aabec531cc0d0b8595564 (diff) | |
download | linux-stable-0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc.tar.gz linux-stable-0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc.tar.bz2 linux-stable-0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc.zip |
clk: sunxi-ng: Implement multiplier maximum
Some multipliers have a maximum rate that is lower than what the register
width allows to. Add a field in the multiplier structure to allow CCU
driver to set that maximum.
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/clk/sunxi-ng/ccu_mult.c')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu_mult.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c index a52162195e07..8724c01171b1 100644 --- a/drivers/clk/sunxi-ng/ccu_mult.c +++ b/drivers/clk/sunxi-ng/ccu_mult.c @@ -41,7 +41,12 @@ static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux, struct _ccu_mult _cm; _cm.min = cm->mult.min; - _cm.max = 1 << cm->mult.width; + + if (cm->mult.max) + _cm.max = cm->mult.max; + else + _cm.max = (1 << cm->mult.width) + cm->mult.offset - 1; + ccu_mult_find_best(parent_rate, rate, &_cm); return parent_rate * _cm.mult; @@ -114,7 +119,12 @@ static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate, &parent_rate); _cm.min = cm->mult.min; - _cm.max = 1 << cm->mult.width; + + if (cm->mult.max) + _cm.max = cm->mult.max; + else + _cm.max = (1 << cm->mult.width) + cm->mult.offset - 1; + ccu_mult_find_best(parent_rate, rate, &_cm); spin_lock_irqsave(cm->common.lock, flags); |