summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorRajeshwari Shinde <rajeshwari.s@samsung.com>2012-07-23 21:23:48 +0000
committerHeiko Schocher <hs@denx.de>2012-07-31 08:01:32 +0200
commit989feb8c52aa2ba5914b14ce04fd49e99a555f38 (patch)
tree89b1188acd80f030a9c105f0308fe66a2600c287 /arch/arm/cpu
parent9c06782863a9add2e75e940cf375ebb44a273212 (diff)
downloadu-boot-imx-989feb8c52aa2ba5914b14ce04fd49e99a555f38.zip
u-boot-imx-989feb8c52aa2ba5914b14ce04fd49e99a555f38.tar.gz
u-boot-imx-989feb8c52aa2ba5914b14ce04fd49e99a555f38.tar.bz2
EXYNOS: CLK: Add i2c clock
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>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/armv7/exynos/clock.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
index 330bd75..f7829b2 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -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())