From patchwork Fri May 18 12:12:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 8808 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 F1D3E23E49 for ; Fri, 18 May 2012 12:11:08 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id C2031A181F3 for ; Fri, 18 May 2012 12:11:08 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so3306452yhp.11 for ; Fri, 18 May 2012 05:11:08 -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=yZYCGFbpyqxpKq+jCSk04PPnvNO+EAeBpdTvtzYSp6U=; b=JkOSAg6hQ4Ay18+aMCoQZK97b7yL+AzGasgOqqFYV2iGPK5CbTy9p/FoU7ewpfTrin ak3T0e7UF0ipaNK1LtyZLLXDM9HxJHpKxfOjns7co0U1smILUJEUss6da7G9AKa7WSNl qZkaIU1nwZcM/zaom0DnUsYyAdBfazD7MkRBvRQdS4X1Eu5biK6ZgxfWwGd5jXXGm4ok E+PYYZsNsn2FnljTd9kPzDxc/Svjid65+5RkTtZZ1CE71bSbAH17ikGYDh3QGIiSevv3 WKyK91PIx83+ZlXAwcbso/V1S+EVH9p6pmKfirgZSJ+0UTYVLh3rnSicZ0MRMHa4G7pu E6EA== Received: by 10.50.195.234 with SMTP id ih10mr358589igc.0.1337343068226; Fri, 18 May 2012 05:11:08 -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.35.72 with SMTP id o8csp99997ibd; Fri, 18 May 2012 05:11:03 -0700 (PDT) Received: by 10.68.201.9 with SMTP id jw9mr37625036pbc.88.1337343060888; Fri, 18 May 2012 05:11:00 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id s4si15559354pbc.255.2012.05.18.05.11.00; Fri, 18 May 2012 05:11:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M4700FIEWGGGI00@mailout2.samsung.com>; Fri, 18 May 2012 21:10:59 +0900 (KST) X-AuditID: cbfee61a-b7be0ae000001293-7a-4fb63c539bb2 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id FA.0D.04755.35C36BF4; Fri, 18 May 2012 21:10:59 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M470045KWF74W10@mmp2.samsung.com>; Fri, 18 May 2012 21:10:59 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, clchiou@chromium.org, waihong@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, dianders@chromium.org, plagnioj@jcrosoft.com Subject: [PATCH 1/8] EXYNOS: CLK: Add i2c clock Date: Fri, 18 May 2012 17:42:26 +0530 Message-id: <1337343153-3019-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1337343153-3019-1-git-send-email-rajeshwari.s@samsung.com> References: <1337343153-3019-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: AAAAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQlD1/K4EAjHqt/+si4JbdMJZa3O7e0WvDSWRBARTAAM0O8cESA+dv0FXTITwG2nXf1ioLtp 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 --- 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..3b86b0c 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);