From patchwork Tue Nov 20 12:19:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Wilczek X-Patchwork-Id: 200311 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 253342C008C for ; Tue, 20 Nov 2012 23:19:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 945204A087; Tue, 20 Nov 2012 13:19:39 +0100 (CET) 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 wVDtWlQCwbVy; Tue, 20 Nov 2012 13:19:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D67984A04F; Tue, 20 Nov 2012 13:19:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 884ED4A04F for ; Tue, 20 Nov 2012 13:19:36 +0100 (CET) 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 paQbxDRzI2Uc for ; Tue, 20 Nov 2012 13:19:34 +0100 (CET) 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 mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by theia.denx.de (Postfix) with ESMTP id A863A4A04E for ; Tue, 20 Nov 2012 13:19:32 +0100 (CET) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDS00JV4CWBT3Y0@mailout3.samsung.com> for u-boot@lists.denx.de; Tue, 20 Nov 2012 21:19:28 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-ec-50ab75503010 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7C.72.12699.0557BA05; Tue, 20 Nov 2012 21:19:28 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDS0002RCVY5R00@mmp2.samsung.com> for u-boot@lists.denx.de; Tue, 20 Nov 2012 21:19:28 +0900 (KST) From: Piotr Wilczek To: u-boot@lists.denx.de Date: Tue, 20 Nov 2012 13:19:02 +0100 Message-id: <1353413947-25976-2-git-send-email-p.wilczek@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1353413947-25976-1-git-send-email-p.wilczek@samsung.com> References: <1352967325-26426-1-git-send-email-p.wilczek@samsung.com> <1353413947-25976-1-git-send-email-p.wilczek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQd2A0tUBBku3aVi83dvJ7sDocfbO DsYAxigum5TUnMyy1CJ9uwSujANvXjAVbOSqeHTHoIHxMEcXIweHhICJxINj0l2MnECmmMSF e+vZuhi5OIQEpjNK7F1+iRHCWcwk8X76A3aQKjYBbYnlb94wgtgiAhISv/qvghUxCyxlkjh3 7z9YQljAWKJ7biMLiM0ioCrReOk3C8g2XgFXid9TayG2yUs8vd/HBmJzCrhJHOlshtrcyCjx 6FIb0wRG3gWMDKsYRVMLkguKk9JzjfSKE3OLS/PS9ZLzczcxgn3+THoH46oGi0OMAhyMSjy8 DxNWBQixJpYVV+YeYpTgYFYS4Y0vXB0gxJuSWFmVWpQfX1Sak1p8iFGag0VJnLfZIyVASCA9 sSQ1OzW1ILUIJsvEwSnVwKi0rsdu/46wEobSFbVZm+VtuL3/3zVYLdN+oKlwb0TRFdXClYU+ U3kStLLdWq9Pcua9WzhljrPQ+gvb5Q8WWutv6dIWuqsblivh1ZJwIyTU5vbiqX3HO+9e8lcL LtWr3CLptXC2/4UJp5Q7p0cmqvj8Ltzgu1E7yf/xhjjL38u+eU/8OCvznRJLcUaioRZzUXEi AMJAHYL1AQAA Cc: Stephen Warren , Piotr Wilczek , Kyungmin Park , Tom Rini , Heiko Schocher Subject: [U-Boot] [PATCH v2 1/6] exynos:clock: 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 patch adds i2c clock for Exynos4 Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park CC: Minkyu Kang --- Changes for v2: - none --- arch/arm/cpu/armv7/exynos/clock.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index 4f3b451..21e45d2 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -732,6 +732,21 @@ static unsigned long exynos5_get_i2c_clk(void) return aclk_66; } +static unsigned long exynos4_get_i2c_clk(void) +{ + struct exynos4_clock *clk = + (struct exynos4_clock *)samsung_get_base_clock(); + unsigned long sclk, aclk_100; + unsigned int ratio; + + sclk = get_pll_clk(APLL); + + ratio = (readl(&clk->div_top)) >> 4; + ratio &= 0xf; + aclk_100 = sclk / (ratio + 1); + return aclk_100; +} + unsigned long get_pll_clk(int pllreg) { if (cpu_is_exynos5()) @@ -752,6 +767,8 @@ unsigned long get_i2c_clk(void) { if (cpu_is_exynos5()) { return exynos5_get_i2c_clk(); + } else if (cpu_is_exynos4()) { + return exynos4_get_i2c_clk(); } else { debug("I2C clock is not set for this CPU\n"); return 0;