summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-sunxi/clock_sun6i.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
index b250553ca8..81c87f8aee 100644
--- a/arch/arm/mach-sunxi/clock_sun6i.c
+++ b/arch/arm/mach-sunxi/clock_sun6i.c
@@ -191,8 +191,7 @@ void clock_set_pll5(unsigned int clk, bool sigma_delta_enable)
{
struct sunxi_ccm_reg * const ccm =
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
- const int max_n = 32;
- int k = 1, m = 2;
+ int k = 3, m = 4;
#ifdef CONFIG_MACH_SUN8I_H3
clrsetbits_le32(&ccm->pll5_tuning_cfg, CCM_PLL5_TUN_LOCK_TIME_MASK |
@@ -204,11 +203,17 @@ void clock_set_pll5(unsigned int clk, bool sigma_delta_enable)
writel(CCM_PLL5_PATTERN, &ccm->pll5_pattern_cfg);
/* PLL5 rate = 24000000 * n * k / m */
- if (clk > 24000000 * k * max_n / m) {
- m = 1;
- if (clk > 24000000 * k * max_n / m)
- k = 2;
+ if (clk > 1152000000) {
+ k = 4;
+ m = 2;
+ } else if (clk > 768000000) {
+ k = 3;
+ m = 2;
+ } else if (clk > 576000000) {
+ k = 2;
+ m = 2;
}
+
writel(CCM_PLL5_CTRL_EN |
(sigma_delta_enable ? CCM_PLL5_CTRL_SIGMA_DELTA_EN : 0) |
CCM_PLL5_CTRL_UPD |