]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
EXYNOS: CLK: Add i2c clock
authorRajeshwari Shinde <rajeshwari.s@samsung.com>
Mon, 23 Jul 2012 21:23:48 +0000 (21:23 +0000)
committerHeiko Schocher <hs@denx.de>
Tue, 31 Jul 2012 06:01:32 +0000 (08:01 +0200)
This adds i2c clock information for EXYNOS5.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
arch/arm/cpu/armv7/exynos/clock.c
arch/arm/include/asm/arch-exynos/clk.h

index 330bd75da9a87260dfdece6587f9f3669133a57d..f7829b2cc76a9ff4f7aaabe607028201335f947f 100644 (file)
@@ -578,6 +578,29 @@ void exynos4_set_mipi_clk(void)
        writel(cfg, &clk->div_lcd0);
 }
 
+/*
+ * I2C
+ *
+ * exynos5: obtaining the I2C clock
+ */
+static unsigned long exynos5_get_i2c_clk(void)
+{
+       struct exynos5_clock *clk =
+               (struct exynos5_clock *)samsung_get_base_clock();
+       unsigned long aclk_66, aclk_66_pre, sclk;
+       unsigned int ratio;
+
+       sclk = get_pll_clk(MPLL);
+
+       ratio = (readl(&clk->div_top1)) >> 24;
+       ratio &= 0x7;
+       aclk_66_pre = sclk / (ratio + 1);
+       ratio = readl(&clk->div_top0);
+       ratio &= 0x7;
+       aclk_66 = aclk_66_pre / (ratio + 1);
+       return aclk_66;
+}
+
 unsigned long get_pll_clk(int pllreg)
 {
        if (cpu_is_exynos5())
@@ -594,6 +617,16 @@ unsigned long get_arm_clk(void)
                return exynos4_get_arm_clk();
 }
 
+unsigned long get_i2c_clk(void)
+{
+       if (cpu_is_exynos5()) {
+               return exynos5_get_i2c_clk();
+       } else {
+               debug("I2C clock is not set for this CPU\n");
+               return 0;
+       }
+}
+
 unsigned long get_pwm_clk(void)
 {
        if (cpu_is_exynos5())
index 637fb4bd145384fd8cfdedb04577b54dfba242fa..72dc655ec1d3714d122d0079fdcafc3640f74b70 100644 (file)
@@ -30,6 +30,7 @@
 
 unsigned long get_pll_clk(int pllreg);
 unsigned long get_arm_clk(void);
+unsigned long get_i2c_clk(void);
 unsigned long get_pwm_clk(void);
 unsigned long get_uart_clk(int dev_index);
 void set_mmc_clk(int dev_index, unsigned int div);