From patchwork Thu Jun 7 06:09:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Birje X-Patchwork-Id: 163475 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5B561B72B1 for ; Thu, 7 Jun 2012 16:06:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF9A82813C; Thu, 7 Jun 2012 08:05:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5hNjb8knXBCp; Thu, 7 Jun 2012 08:05:57 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9EADC28133; Thu, 7 Jun 2012 08:05:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ECC5B2811B for ; Thu, 7 Jun 2012 08:05:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oKUVUeQ54LpL for ; Thu, 7 Jun 2012 08:05:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTP id DF6C228118 for ; Thu, 7 Jun 2012 08:05:48 +0200 (CEST) Received: from epcpsbgm2.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M58001D5GX5J8R0@mailout1.samsung.com> for u-boot@lists.denx.de; Thu, 07 Jun 2012 15:05:46 +0900 (KST) X-AuditID: cbfee61b-b7fcc6d000003a7a-f9-4fd044baccf2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 67.95.14970.AB440DF4; Thu, 07 Jun 2012 15:05:46 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M5800J8XGX3ZV30@mmp1.samsung.com> for u-boot@lists.denx.de; Thu, 07 Jun 2012 15:05:46 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Date: Thu, 07 Jun 2012 11:39:47 +0530 Message-id: <1339049394-4816-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1339049394-4816-1-git-send-email-rajeshwari.s@samsung.com> References: <1339049394-4816-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAd1dLhf8DdbfkrR4u7eT3YHR4+yd HYwBjFFcNimpOZllqUX6dglcGWtfHmMrWCpU0b5iEWsD40L+LkZODgkBE4k1Jx8wQdhiEhfu rWfrYuTiEBJYxCjx8fAVsISQwComiWt/tEFsNgEjia0npzGC2CICEhK/+q+C2cwCjYwSO1a7 gtjCQDWnN5xiAbFZBFQlOvYtZQOxeQXcJR6/aGSFWKYgcWzqVzCbU8BDYsu3k4wQu9wlPr7b zDqBkXcBI8MqRtHUguSC4qT0XCO94sTc4tK8dL3k/NxNjGCfP5PewbiqweIQowAHoxIP70Ln C/5CrIllxZW5hxglOJiVRHgFys77C/GmJFZWpRblxxeV5qQWH2KU5mBREudtsgaqFkhPLEnN Tk0tSC2CyTJxcEo1MKbV/v4u09y69s2pKxfPLiwXEhAq+pW8V1xx1+YSsRfOR/J/x9+S+Dwh Yc3p+8crunc5qNc9bjDYyih5raVwX+/NZf3ZHzgd54efjXn8pKh+U43crplbPdP8oztYI120 V1uolF3Q+DFBVMLSeELF9p43X73jnRmvWHMf9f63fYn0ErUa9tuiz5RYijMSDbWYi4oTAX19 rSP1AQAA X-TM-AS-MML: No Cc: patches@linaro.org, alim.akhtar@samsung.com, hs@denx.de Subject: [U-Boot] [PATCH 1/8 V2] EXYNOS: CLK: Add i2c clock X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This adds i2c clock information for EXYNOS5. Signed-off-by: Alim Akhtar Signed-off-by: Doug Anderson Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass Acked-by: Simon Glass --- 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. 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 330bd75..a80928b 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()) diff --git a/arch/arm/include/asm/arch-exynos/clk.h b/arch/arm/include/asm/arch-exynos/clk.h index 637fb4b..72dc655 100644 --- a/arch/arm/include/asm/arch-exynos/clk.h +++ b/arch/arm/include/asm/arch-exynos/clk.h @@ -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);