From patchwork Tue Jun 19 07:30:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 9443 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 5C87B23F19 for ; Tue, 19 Jun 2012 07:26:30 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2CAEBA18310 for ; Tue, 19 Jun 2012 07:26:30 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so4759166ggn.11 for ; Tue, 19 Jun 2012 00:26:30 -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=9KVZrZssgAiFt/KaLLwZBQ1izabJ/r6ZME9RGekbu1s=; b=QS4kjnEz9qtZfjDzMWvCyB5ZgNszRRor8hs1HERFwk4AiWeISYwqNk8XNVUdD6FDUJ EdxSYGkSovc/JPeI/bLuJS9Fhn6q+GCeghxE8QLckUyeOm/yocorS9xEjmbiBoagEEkq X4GQnE03hebA6h/TnDoFWEAcBbsgwK69Ly11QALDMX0lcjxYoIQRX3Pxzf5744WRKbO9 YSuRxoRu9SgaX66EzJUfaD+XfBJon9mcAdP3C7o05F3dCTPioEJRwiFag+pI5TxoWtz9 0oqm+hgtc+tZE11F/mjsR34UBhDIrFZ0uYxUWdZ6JdOx5yafeURGbKslZPhMSdHlFEcH RHPA== Received: by 10.50.163.99 with SMTP id yh3mr184292igb.53.1340090789672; Tue, 19 Jun 2012 00:26:29 -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 v20csp110446ibb; Tue, 19 Jun 2012 00:26:29 -0700 (PDT) Received: by 10.68.191.201 with SMTP id ha9mr61527870pbc.75.1340090788540; Tue, 19 Jun 2012 00:26:28 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id sp1si28571030pbc.20.2012.06.19.00.26.28; Tue, 19 Jun 2012 00:26:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M5U002V6SNN0V10@mailout1.samsung.com>; Tue, 19 Jun 2012 16:26:13 +0900 (KST) X-AuditID: cbfee61a-b7f9f6d0000016a8-6c-4fe02995a700 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 13.E2.05800.59920EF4; Tue, 19 Jun 2012 16:26:13 +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 <0M5U00EHGSMYFC70@mmp1.samsung.com>; Tue, 19 Jun 2012 16:26:13 +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 V4] I2C: Add support for Multi channel Date: Tue, 19 Jun 2012 13:00:31 +0530 Message-id: <1340091032-26560-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1340091032-26560-1-git-send-email-rajeshwari.s@samsung.com> References: <1340091032-26560-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t9jAd2pmg/8DT7cVrJ4uP4mi8WUw19Y HJg87lzbwxbAGMVlk5Kak1mWWqRvl8CV8b3tGGtBP1fFp1/b2RsYJ3N0MXJwSAiYSPx9n9jF yAlkiklcuLeerYuRi0NIYBGjxI2z81hBEkICE5kkmubYgdhsAkYSW09OYwSxRQQkJH71XwWz mQWmMErsWh0KYgsLWEm83XwFLM4ioCrxdOk1sDm8Ah4SjRPPsUMsU5A4NvUrWJxTwFNi0v75 TBC7PCTufznHNIGRdwEjwypG0dSC5ILipPRcQ73ixNzi0rx0veT83E2MYN8/k9rBuLLB4hCj AAejEg/vQbkH/kKsiWXFlbmHGCU4mJVEeFf9v+8vxJuSWFmVWpQfX1Sak1p8iFGag0VJnLfJ +oK/kEB6YklqdmpqQWoRTJaJg1OqgVHQrfr8ND7J9nvs+lYMHsavn93lNenZxfaw+nzuhP6X zdbNd84Ix0tdbH/XKXNfebK5b/3Gr50HOdaV/vQKY0m4dkVB3PJZouq062LV0lNO1vA0za7u O9845VDQpgXn+47Yr1a4VNx9WPeV/wmDbU3z5I+yNSkefxyZKbvLf5r/rrNzHRf6PFBiKc5I NNRiLipOBADnLdX2+QEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQltQ1INic1jzw7iBLk6852JULl6RvVfyI1suSqsEy5BJm35IXA652Ib3W0LQUtqqeu2s74v 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 Changes in V4: - 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 0b31cd1..728889c 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) {