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 Shinde X-Patchwork-Id: 9152 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5087423F0A for ; Thu, 7 Jun 2012 06:05:49 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0AF29A18AA7 for ; Thu, 7 Jun 2012 06:05:48 +0000 (UTC) Received: by ghbz12 with SMTP id z12so152632ghb.11 for ; Wed, 06 Jun 2012 23:05:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=ke0OnkVVbwXjPsUySk2Azgg/nDQUX/2NSUX6XrehQks=; b=WkFStI7/hat0SBvq3HtUJcYgEygrSNZ8Djsokhh+6wdhA2qesIYucG76a948bhJReG yZ0b8h1J49N1OgjJN3zws+fcGkrykzmanEXXTAuOHd/+CRuz9BzrhQmXw/dK222L8wVp y1VRgb8uG16zxZEThZu8nJR5AMHC7i4do9Q53eiOHtSv1uyz+zrNV0bNOStYnqHsHQiy PZXsKVlRAdxy9ySiVReH/eZeBaCCdCRQzUlIOtv9ipEhVgEaGvL1rCKlkp4T/rDAHAlY 0Z4WH1w+tpWwGfFNaU+rx0iuKLESyg92qPUXZ6CO+VP7mS75cRgAmRKAKYinXyiB8xRL sf9A== Received: by 10.50.163.99 with SMTP id yh3mr463227igb.53.1339049148384; Wed, 06 Jun 2012 23:05:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp124520ibb; Wed, 6 Jun 2012 23:05:47 -0700 (PDT) Received: by 10.68.131.35 with SMTP id oj3mr4550943pbb.156.1339049147513; Wed, 06 Jun 2012 23:05:47 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id ov4si2177597pbc.353.2012.06.06.23.05.47; Wed, 06 Jun 2012 23:05:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M58004P6GX9EXM0@mailout4.samsung.com>; Thu, 07 Jun 2012 15:05:46 +0900 (KST) X-AuditID: cbfee61a-b7f9f6d0000016a8-58-4fd044ba3d60 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 23.06.05800.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>; Thu, 07 Jun 2012 15:05:46 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, alim.akhtar@samsung.com, sjg@chromium.org, hs@denx.de, mk7.kang@samsung.com, chander.kashyap@linaro.org Subject: [PATCH 1/8 V2] EXYNOS: CLK: Add i2c clock 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+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jAd1dLhf8DQ4dk7R4uP4mi8WUw19Y HJg87lzbwxbAGMVlk5Kak1mWWqRvl8CVsfblMbaCpUIV7SsWsTYwLuTvYuTkkBAwkXjSs4oJ whaTuHBvPVsXIxeHkMAiRomDj46xQjgTmSTOrJoLVsUmYCSx9eQ0RhBbREBC4lf/VTCbWaCR UWLHalcQWxio5vSGUywgNouAqkTHvqVsIDavgLvE4xeNrBDbFCSOTf0KZnMKeEhs+XYSbI4Q UM3Hd5tZJzDyLmBkWMUomlqQXFCclJ5rqFecmFtcmpeul5yfu4kR7P9nUjsYVzZYHGIU4GBU 4uHlcLzgL8SaWFZcmXuIUYKDWUmEV6DsvL8Qb0piZVVqUX58UWlOavEhRmkOFiVx3iZroGqB 9MSS1OzU1ILUIpgsEwenVANj606DmeV8XMqlxgwve4QTXrb+dTh0htGnQmHe/0Kjv9NOVnxx 3qu6fW/022KBWEajr+kcWnYMXw+UvHUW7tocZ3FFVuXyA4NEmbrfmcFHb7FWbLq40Dnp0KWo akMLnaLLs0L6zR2ni8rt+mkor390nc7rRQKe/spOR3x5e/m4J949+Oo+83IlluKMREMt5qLi RABhiYYA+wEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQmi0hBNzgXxnuV26AmfXC+mBOncLPDGdekedjQWnDjgktpfYqlUCmRnjr0jQTSY4og69AyY 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);