forked from Minki/linux
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>
This commit is contained in:
parent
b16fb66915
commit
a8e5433cdc
@ -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;
|
||||
|
@ -35,6 +35,7 @@ struct ccu_nkmp {
|
||||
struct ccu_div_internal p;
|
||||
|
||||
unsigned int fixed_post_div;
|
||||
unsigned int max_rate;
|
||||
|
||||
struct ccu_common common;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user