From patchwork Fri May 18 12:12:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 8814 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 AD24823EB5 for ; Fri, 18 May 2012 12:16:41 +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 7D2B5A18085 for ; Fri, 18 May 2012 12:16:41 +0000 (UTC) Received: by yhpp61 with SMTP id p61so3312750yhp.11 for ; Fri, 18 May 2012 05:16:41 -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=nAAm1BjPWEIv3C9j8Ifi+rkaXzLYyro17+WLIuiNomg=; b=OTImXBaAzCZF31uIPL8wn8MROvmn8XIXHmZhJLZHrw2x0CcY1ok+aRHlwZcYNGc/4e GOhQpXFpiGgjyGZwHfxSP/EJQNpKSfQYnGYH6dtRY3hsiKTiKjoKOmkIE+pFFtGvxX3l sH9SO44M23wrAl9Qw3lNDygxefvmmT4YdLu+ME7iCXfbWT7jv0lXt/CpGgIcE/wHRmft xV15Qi3lQiMjmLn9qR6pBtOZupmOwqD+R4FoUpFjNvYA89UF0Iy1qta3WwDKxyeu/Ihf Oum4NrBk1F7UV+L0RPf0VhmeoCzTAZoYeUE+LlIUnI/PIPajTWHT07IXkJxrtuy22naT OX2g== Received: by 10.50.40.193 with SMTP id z1mr376898igk.0.1337343400850; Fri, 18 May 2012 05:16:40 -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 o8csp100319ibd; Fri, 18 May 2012 05:16:38 -0700 (PDT) Received: by 10.68.129.194 with SMTP id ny2mr38156568pbb.56.1337343397965; Fri, 18 May 2012 05:16:37 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id l3si15574746pbs.274.2012.05.18.05.16.37; Fri, 18 May 2012 05:16:37 -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 <0M4700FPBWN8GI00@mailout2.samsung.com>; Fri, 18 May 2012 21:16:36 +0900 (KST) X-AuditID: cbfee61a-b7be0ae000001293-60-4fb63da4fde3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id 63.2E.04755.4AD36BF4; Fri, 18 May 2012 21:16:36 +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:16:36 +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 7/8] I2C: Add support for Multi channel Date: Fri, 18 May 2012 17:42:32 +0530 Message-id: <1337343153-3019-8-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: ALoCoQmeTi1strM/d0VzEc4H/zSElj0+n5vQC4bYF8FmK/IxMMIFKHZtqUaQmxOcgRErPmiGR8YT This adds multiple i2c channel support for I2C. Signed-off-by: Alim Akhtar Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- drivers/i2c/s3c24x0_i2c.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 61b54a9..39875cd 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -189,6 +189,33 @@ static void i2c_bus_init(struct s3c24x0_i2c *i2c, unsigned int bus) i2c_ch_init(i2c, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); } +/* + * MULTI BUS I2C support + */ + +#ifdef CONFIG_I2C_MULTI_BUS +int i2c_set_bus_num(unsigned int bus) +{ + struct s3c24x0_i2c *i2c; + + if ((bus < 0) || (bus >= CONFIG_MAX_I2C_NUM)) { + debug("Bad bus: %d\n", bus); + return -1; + } + + g_current_bus = bus; + i2c = get_base_i2c(g_current_bus); + i2c_bus_init(i2c, g_current_bus); + + return 0; +} + +unsigned int i2c_get_bus_num(void) +{ + return g_current_bus; +} +#endif + #ifdef CONFIG_EXYNOS5 void i2c_init(int speed, int slaveadd) {