diff options
author | Jernej Skrabec <jernej.skrabec@siol.net> | 2018-08-09 19:52:16 +0300 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@bootlin.com> | 2018-08-27 10:18:10 +0300 |
commit | a8e5433cdc500290b52d26a05056e02c448a413c (patch) | |
tree | e905e1b8d5bf5f48890cf4e2495a9c999c521e23 /drivers/clk/sunxi-ng/ccu_nkmp.c | |
parent | b16fb66915fcfc6b1a7eb48225b6b30b69bb721b (diff) | |
download | linux-a8e5433cdc500290b52d26a05056e02c448a413c.tar.xz |
clk: sunxi-ng: nkmp: Add constraint for maximum rate
Some, if not most, NKMP PLLs can be set to higher rate that is really
supported by HW.
Implement support for maximum frequency constrain for NKMP PLLs.
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'drivers/clk/sunxi-ng/ccu_nkmp.c')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu_nkmp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c index ebd9436d2c7c..9b49adb20d07 100644 --- a/drivers/clk/sunxi-ng/ccu_nkmp.c +++ b/drivers/clk/sunxi-ng/ccu_nkmp.c @@ -137,6 +137,13 @@ static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate, if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) rate *= nkmp->fixed_post_div; + if (nkmp->max_rate && rate > nkmp->max_rate) { + rate = nkmp->max_rate; + if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV) + rate /= nkmp->fixed_post_div; + return rate; + } + _nkmp.min_n = nkmp->n.min ?: 1; _nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width; _nkmp.min_k = nkmp->k.min ?: 1; |