All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajeshwari Shinde <rajeshwari.s@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/7 V5] EXYNOS: CLK: Add i2c clock
Date: Thu, 05 Jul 2012 17:29:46 +0530	[thread overview]
Message-ID: <1341489592-24243-2-git-send-email-rajeshwari.s@samsung.com> (raw)
In-Reply-To: <1341489592-24243-1-git-send-email-rajeshwari.s@samsung.com>

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>
---
changes in V2:
        - Incorporated comments from Simon Glass which are removed extra
          braces around (readl(&clk->div_top1)) >> 24 and gave a tab space for
          return statement.
Changes in V3:
        - None
Changes in V4:
        - None
Changes in V5:
        - None.
 arch/arm/cpu/armv7/exynos/clock.c      |   33 ++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/clk.h |    1 +
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
index fc0ed5e..83ee25e 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -602,6 +602,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())
@@ -618,6 +641,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())
diff --git a/arch/arm/include/asm/arch-exynos/clk.h b/arch/arm/include/asm/arch-exynos/clk.h
index e99339a..5529025 100644
--- a/arch/arm/include/asm/arch-exynos/clk.h
+++ b/arch/arm/include/asm/arch-exynos/clk.h
@@ -31,6 +31,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);
-- 
1.7.4.4

  reply	other threads:[~2012-07-05 11:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 11:59 [U-Boot] [PATCH 0/7 V5] EXYNOS5: Enable I2C support Rajeshwari Shinde
2012-07-05 11:59 ` Rajeshwari Shinde [this message]
2012-07-18 17:16   ` [U-Boot] [PATCH 1/7 V5] EXYNOS: CLK: Add i2c clock Simon Glass
2012-07-19  6:01     ` Rajeshwari Birje
2012-07-19  7:20       ` Rajeshwari Birje
2012-07-19 20:20         ` Simon Glass
2012-07-05 11:59 ` [U-Boot] [PATCH 2/7 V5] EXYNOS: Add I2C base address Rajeshwari Shinde
2012-07-05 11:59 ` [U-Boot] [PATCH 3/7 V5] EXYNOS: PINMUX: Add pinmux support for I2C Rajeshwari Shinde
2012-07-05 11:59 ` [U-Boot] [PATCH 4/7 V5] I2C: Move struct s3c24x0_i2c to a common place Rajeshwari Shinde
2012-07-05 11:59 ` [U-Boot] [PATCH 5/7 V5] I2C: Modify the I2C driver for EXYNOS5 Rajeshwari Shinde
2012-07-18 20:06   ` Simon Glass
2012-07-19  6:03     ` Rajeshwari Birje
2012-07-05 11:59 ` [U-Boot] [PATCH 6/7 V5] I2C: Add support for Multi channel Rajeshwari Shinde
2012-07-05 11:59 ` [U-Boot] [PATCH 7/7 V5] CONFIG: SMDK5250: I2C: Enable I2C Rajeshwari Shinde
2012-07-18 20:09   ` Simon Glass
2012-07-19  6:02     ` Rajeshwari Birje

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341489592-24243-2-git-send-email-rajeshwari.s@samsung.com \
    --to=rajeshwari.s@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.