Merge branch 'master' of git://git.denx.de/u-boot-spi
[platform/kernel/u-boot.git] / arch / arm / cpu / armv7 / exynos / clock.c
index 5860c8f..e1c4246 100644 (file)
@@ -116,10 +116,8 @@ static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)
                /* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */
                fout = (m + k / 1024) * (freq / (p * (1 << s)));
        } else {
-               if (s < 1)
-                       s = 1;
-               /* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */
-               fout = m * (freq / (p * (1 << (s - 1))));
+               /* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */
+               fout = m * (freq / (p * (1 << s)));
        }
 
        return fout;
@@ -468,27 +466,6 @@ static unsigned long exynos4x12_get_pwm_clk(void)
        return pclk;
 }
 
-/* exynos5: return pwm clock frequency */
-static unsigned long exynos5_get_pwm_clk(void)
-{
-       struct exynos5_clock *clk =
-               (struct exynos5_clock *)samsung_get_base_clock();
-       unsigned long pclk, sclk;
-       unsigned int ratio;
-
-       /*
-        * CLK_DIV_PERIC3
-        * PWM_RATIO [3:0]
-        */
-       ratio = readl(&clk->div_peric3);
-       ratio = ratio & 0xf;
-       sclk = get_pll_clk(MPLL);
-
-       pclk = sclk / (ratio + 1);
-
-       return pclk;
-}
-
 /* exynos4: return uart clock frequency */
 static unsigned long exynos4_get_uart_clk(int dev_index)
 {
@@ -634,7 +611,7 @@ static unsigned long exynos4_get_mmc_clk(int dev_index)
                (struct exynos4_clock *)samsung_get_base_clock();
        unsigned long uclk, sclk;
        unsigned int sel, ratio, pre_ratio;
-       int shift;
+       int shift = 0;
 
        sel = readl(&clk->src_fsys);
        sel = (sel >> (dev_index << 2)) & 0xf;
@@ -683,7 +660,7 @@ static unsigned long exynos5_get_mmc_clk(int dev_index)
                (struct exynos5_clock *)samsung_get_base_clock();
        unsigned long uclk, sclk;
        unsigned int sel, ratio, pre_ratio;
-       int shift;
+       int shift = 0;
 
        sel = readl(&clk->src_fsys);
        sel = (sel >> (dev_index << 2)) & 0xf;
@@ -1354,7 +1331,7 @@ unsigned long get_i2c_clk(void)
 unsigned long get_pwm_clk(void)
 {
        if (cpu_is_exynos5())
-               return exynos5_get_pwm_clk();
+               return clock_get_periph_rate(PERIPH_ID_PWM0);
        else {
                if (proid_is_exynos4412())
                        return exynos4x12_get_pwm_clk();