summaryrefslogtreecommitdiffstats
path: root/drivers/clk/sunxi-ng/ccu_nk.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2016-10-14 12:08:19 +0200
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-01-23 11:45:01 +0100
commit0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc (patch)
tree1ee8199653ceeccb7954da33a2b36d740f12269b /drivers/clk/sunxi-ng/ccu_nk.c
parentc9520be3839063bbb50aabec531cc0d0b8595564 (diff)
downloadop-kernel-dev-0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc.zip
op-kernel-dev-0c3c8e135897eb8e896a0bb82a5aff6c9bc158cc.tar.gz
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_nk.c')
-rw-r--r--drivers/clk/sunxi-ng/ccu_nk.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_nk.c b/drivers/clk/sunxi-ng/ccu_nk.c
index 90117d3..b9e9b8a 100644
--- a/drivers/clk/sunxi-ng/ccu_nk.c
+++ b/drivers/clk/sunxi-ng/ccu_nk.c
@@ -103,9 +103,9 @@ static long ccu_nk_round_rate(struct clk_hw *hw, unsigned long rate,
rate *= nk->fixed_post_div;
_nk.min_n = nk->n.min;
- _nk.max_n = 1 << nk->n.width;
+ _nk.max_n = nk->n.max ?: 1 << nk->n.width;
_nk.min_k = nk->k.min;
- _nk.max_k = 1 << nk->k.width;
+ _nk.max_k = nk->k.max ?: 1 << nk->k.width;
ccu_nk_find_best(*parent_rate, rate, &_nk);
rate = *parent_rate * _nk.n * _nk.k;
@@ -128,9 +128,9 @@ static int ccu_nk_set_rate(struct clk_hw *hw, unsigned long rate,
rate = rate * nk->fixed_post_div;
_nk.min_n = nk->n.min;
- _nk.max_n = 1 << nk->n.width;
+ _nk.max_n = nk->n.max ?: 1 << nk->n.width;
_nk.min_k = nk->k.min;
- _nk.max_k = 1 << nk->k.width;
+ _nk.max_k = nk->k.max ?: 1 << nk->k.width;
ccu_nk_find_best(parent_rate, rate, &_nk);
OpenPOWER on IntegriCloud