diff options
author | Jernej Skrabec <jernej.skrabec@siol.net> | 2018-03-01 22:34:27 +0100 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@bootlin.com> | 2018-03-02 08:42:14 +0100 |
commit | 2d2b61c13a4b39c8ba6b9c1daa79d5891689864e (patch) | |
tree | edc1c7a176a8e6c88b3f4ec3fd4a8a16801042b3 /drivers/clk/sunxi-ng/ccu_nm.c | |
parent | clk: sunxi-ng: Use u64 for calculation of nkmp rate (diff) | |
download | linux-2d2b61c13a4b39c8ba6b9c1daa79d5891689864e.tar.xz linux-2d2b61c13a4b39c8ba6b9c1daa79d5891689864e.zip |
clk: sunxi-ng: Add check for minimal rate to NM PLLs
Some NM PLLs doesn't work well when their output clock rate is set below
certain rate.
Add support for that constrain.
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_nm.c')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu_nm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c index a16de092bf94..4e2073307f34 100644 --- a/drivers/clk/sunxi-ng/ccu_nm.c +++ b/drivers/clk/sunxi-ng/ccu_nm.c @@ -117,6 +117,13 @@ static long ccu_nm_round_rate(struct clk_hw *hw, unsigned long rate, if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV) rate *= nm->fixed_post_div; + if (rate < nm->min_rate) { + rate = nm->min_rate; + if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV) + rate /= nm->fixed_post_div; + return rate; + } + if (ccu_frac_helper_has_rate(&nm->common, &nm->frac, rate)) { if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV) rate /= nm->fixed_post_div; |