mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 17:33:01 +00:00
clk: sunxi-ng: use 1 as fallback for minimum multiplier
A zero multiplier does not make sense for clocks.
Use 1 as the minimum when a multiplier minimum isn't specified.
Fixes: 2beaa601c8
("clk: sunxi-ng: Implement minimum for multipliers")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
This commit is contained in:
parent
266061b763
commit
4162c5ce52
@ -102,9 +102,9 @@ static long ccu_nk_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
|
||||
rate *= nk->fixed_post_div;
|
||||
|
||||
_nk.min_n = nk->n.min;
|
||||
_nk.min_n = nk->n.min ?: 1;
|
||||
_nk.max_n = nk->n.max ?: 1 << nk->n.width;
|
||||
_nk.min_k = nk->k.min;
|
||||
_nk.min_k = nk->k.min ?: 1;
|
||||
_nk.max_k = nk->k.max ?: 1 << nk->k.width;
|
||||
|
||||
ccu_nk_find_best(*parent_rate, rate, &_nk);
|
||||
@ -127,9 +127,9 @@ static int ccu_nk_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
|
||||
rate = rate * nk->fixed_post_div;
|
||||
|
||||
_nk.min_n = nk->n.min;
|
||||
_nk.min_n = nk->n.min ?: 1;
|
||||
_nk.max_n = nk->n.max ?: 1 << nk->n.width;
|
||||
_nk.min_k = nk->k.min;
|
||||
_nk.min_k = nk->k.min ?: 1;
|
||||
_nk.max_k = nk->k.max ?: 1 << nk->k.width;
|
||||
|
||||
ccu_nk_find_best(parent_rate, rate, &_nk);
|
||||
|
@ -109,9 +109,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
|
||||
struct ccu_nkm *nkm = data;
|
||||
struct _ccu_nkm _nkm;
|
||||
|
||||
_nkm.min_n = nkm->n.min;
|
||||
_nkm.min_n = nkm->n.min ?: 1;
|
||||
_nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
|
||||
_nkm.min_k = nkm->k.min;
|
||||
_nkm.min_k = nkm->k.min ?: 1;
|
||||
_nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
|
||||
_nkm.min_m = 1;
|
||||
_nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
|
||||
@ -138,9 +138,9 @@ static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
_nkm.min_n = nkm->n.min;
|
||||
_nkm.min_n = nkm->n.min ?: 1;
|
||||
_nkm.max_n = nkm->n.max ?: 1 << nkm->n.width;
|
||||
_nkm.min_k = nkm->k.min;
|
||||
_nkm.min_k = nkm->k.min ?: 1;
|
||||
_nkm.max_k = nkm->k.max ?: 1 << nkm->k.width;
|
||||
_nkm.min_m = 1;
|
||||
_nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
|
||||
|
@ -116,9 +116,9 @@ static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
|
||||
struct _ccu_nkmp _nkmp;
|
||||
|
||||
_nkmp.min_n = nkmp->n.min;
|
||||
_nkmp.min_n = nkmp->n.min ?: 1;
|
||||
_nkmp.max_n = nkmp->n.max ?: 1 << nkmp->n.width;
|
||||
_nkmp.min_k = nkmp->k.min;
|
||||
_nkmp.min_k = nkmp->k.min ?: 1;
|
||||
_nkmp.max_k = nkmp->k.max ?: 1 << nkmp->k.width;
|
||||
_nkmp.min_m = 1;
|
||||
_nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width;
|
||||
|
@ -99,7 +99,7 @@ static long ccu_nm_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
struct ccu_nm *nm = hw_to_ccu_nm(hw);
|
||||
struct _ccu_nm _nm;
|
||||
|
||||
_nm.min_n = nm->n.min;
|
||||
_nm.min_n = nm->n.min ?: 1;
|
||||
_nm.max_n = nm->n.max ?: 1 << nm->n.width;
|
||||
_nm.min_m = 1;
|
||||
_nm.max_m = nm->m.max ?: 1 << nm->m.width;
|
||||
|
Loading…
Reference in New Issue
Block a user