Commit 6e6493c2 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Greg Kroah-Hartman

clk: sunxi: Support factor clocks with N factor starting not from 0

commit 9a5e6c7e upstream.

The PLLs on newer Allwinner SoC's, such as the A31 and A23, have a
N multiplier factor that starts from 1, not 0.

This patch adds an option to the factor clk driver's config data
structures to specify the base value of N.
Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28e75102
...@@ -70,7 +70,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, ...@@ -70,7 +70,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw,
p = FACTOR_GET(config->pshift, config->pwidth, reg); p = FACTOR_GET(config->pshift, config->pwidth, reg);
/* Calculate the rate */ /* Calculate the rate */
rate = (parent_rate * n * (k + 1) >> p) / (m + 1); rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1);
return rate; return rate;
} }
......
...@@ -15,6 +15,7 @@ struct clk_factors_config { ...@@ -15,6 +15,7 @@ struct clk_factors_config {
u8 mwidth; u8 mwidth;
u8 pshift; u8 pshift;
u8 pwidth; u8 pwidth;
u8 n_start;
}; };
struct clk *clk_register_factors(struct device *dev, const char *name, struct clk *clk_register_factors(struct device *dev, const char *name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment