From patchwork Tue Jun 19 06:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 9434 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 CD7BC23F28 for ; Tue, 19 Jun 2012 06:41:11 +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 9DBE2A189EF for ; Tue, 19 Jun 2012 06:41:11 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so4725214ghb.11 for ; Mon, 18 Jun 2012 23:41:11 -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=z2aNZXCKy0uwoCvnGQbWWeTmPCkaafu3nfrdqUtNfWg=; b=hCJxZ1abhaLqOPu1vI3mS8aCz5NA1KLEa6kOIsYIGVnfBLaMZkbJQ80/Y3nrFoA2h6 JVTyvwT2zAJaiJfbahYWusL6/sWaO/vrlax35l/5Rxez6+yoDH4aZ9x6oX5ht9LAPrip gEHzsjx72SNdxEwoGyBse4zsQ8F2Nn7ADD5gTn8/lMyfpZGPoSnh2c/6mpmOuS61rbog hpcTIE1lHzTbaLp0JKwrq2gEmeGRbmK11+2JCou/F3EBjrQgAn9i3f6AD+VsQQOVYq8l +Cdr9S3djdlRYq+qPZ1RcUB4LOH5+ghvCgy6wgyahTwoYv0dqB6oKSQDiTNKwrGJY+FE KpBg== Received: by 10.50.160.198 with SMTP id xm6mr182288igb.0.1340088071222; Mon, 18 Jun 2012 23:41:11 -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 v20csp109115ibb; Mon, 18 Jun 2012 23:41:10 -0700 (PDT) Received: by 10.68.201.195 with SMTP id kc3mr62096148pbc.33.1340088070528; Mon, 18 Jun 2012 23:41:10 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id ug10si1502889pbc.155.2012.06.18.23.41.10; Mon, 18 Jun 2012 23:41:10 -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 <0M5U00KZVQKLU100@mailout4.samsung.com>; Tue, 19 Jun 2012 15:41:09 +0900 (KST) X-AuditID: cbfee61a-b7f9f6d0000016a8-03-4fe01f0506c0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 38.16.05800.50F10EF4; Tue, 19 Jun 2012 15:41:09 +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 <0M5U00BUEQJL3P50@mmp2.samsung.com>; Tue, 19 Jun 2012 15:41:09 +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, dofmind@gmail.com Subject: [PATCH 7/8 V3] I2C: Add support for Multi channel Date: Tue, 19 Jun 2012 12:15:18 +0530 Message-id: <1340088319-10072-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1340088319-10072-1-git-send-email-rajeshwari.s@samsung.com> References: <1340088319-10072-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t9jQV1W+Qf+BnO6+Cwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlnLqwkaXgMWfF7SvODYxNHF2MnBwSAiYSU768Z4Sw xSQu3FvPBmILCUxnlNh50LeLkQvInsgkcf54HxNIgk3ASGLryWlgDSICEhK/+q+C2cwCUxgl dq0OBbGFBawkNu9/wQ5iswioSqz/sQVsKK+Ah8TDex/YIZYpSByb+pUVxOYU8JTY9GEhE8Ri D4k9L86zT2DkXcDIsIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/dxMj2PfPpHYwrmywOMQowMGo xMN7UO6BvxBrYllxZe4hRgkOZiUR3lX/7/sL8aYkVlalFuXHF5XmpBYfYpTmYFES522yvuAv JJCeWJKanZpakFoEk2Xi4JRqYJRZN6dBTvYh18ZYb4tz7M8spP9czP2T8sj2sfqy1klq14Vz RNadO20Y2fVEQFvg+v2eU4w+HM5yul21ra1r2kU+sByPySiS6Y1UedbIcc3vMoN2Q4mx2/m+ j7KmnmYtzA8se46kqXbeOhGlxO65wlSrbuX5/TeVDhfpiPnUFq5WNWTWUl6rxFKckWioxVxU nAgAUpzmcfkBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQlicfr1ZtitOBsODT8t7of7uuUlKxRpN7mF8W2JSj0amgvSxHQh6E0wG0MIWBWVM5sSLhAO This adds multiple i2c channel support for I2C. Signed-off-by: Alim Akhtar Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- Changes in V2: - None Changes in V3: - None 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 156b5a4..8254c2b 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -195,6 +195,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) {