From patchwork Thu Jul 5 11:59:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 9840 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 3567A23E23 for ; Thu, 5 Jul 2012 11:55:36 +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 04E57A18310 for ; Thu, 5 Jul 2012 11:55:35 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so7880500ghb.11 for ; Thu, 05 Jul 2012 04:55:35 -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=O2tikPowDWz5YGiBtUeIXvGXvfAFw7zbIz9z5i8dfio=; b=h2LtD7rWf1mVotWBBr8GeP2Ul1EDDunSS9+6+kKt2WWAa9zMXD+jpPUcI2g8XZ54Rf Fxel3A7QHRuRoOD8JFqz3s87Ec2lAEHRyzIdjccwojdndj+FL7ivsCD0EPINaJuyehK3 q3b+qefPvCRv36xAMbt5Qu91T6vZ55X7jGSwmaNBAVk7kzRXXNyC+0hM5yMJRFoT0E06 xdKb6RuI73pKvpA5PWn80dE6QONWzsHD73uOOPtzKvmI5hWePoK0WHJYKqHdzc2RgLo5 SlSqK4djJ9cvCYIisLdzpCDgQXNxMNG0z7PkuzhRls9KOmISfSzDG+f71MZ+2P3NEP2D a4Vw== Received: by 10.50.193.196 with SMTP id hq4mr13718877igc.57.1341489335331; Thu, 05 Jul 2012 04:55:35 -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 v20csp64379ibb; Thu, 5 Jul 2012 04:55:34 -0700 (PDT) Received: by 10.68.237.105 with SMTP id vb9mr27368124pbc.103.1341489334604; Thu, 05 Jul 2012 04:55:34 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id wh5si37472896pbc.308.2012.07.05.04.55.34; Thu, 05 Jul 2012 04:55:34 -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 epcpsbgm2.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 <0M6O001WMRS24L40@mailout1.samsung.com>; Thu, 05 Jul 2012 20:55:33 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-9b-4ff580b5fdb5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DB.C7.23690.5B085FF4; Thu, 05 Jul 2012 20:55:33 +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 <0M6O00E8SRRY5M50@mmp2.samsung.com>; Thu, 05 Jul 2012 20:55:33 +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, jy0922.shim@samsung.com Subject: [PATCH 6/7 V5] I2C: Add support for Multi channel Date: Thu, 05 Jul 2012 17:29:51 +0530 Message-id: <1341489592-24243-7-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1341489592-24243-1-git-send-email-rajeshwari.s@samsung.com> References: <1341489592-24243-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jQd2tDV/9DV6eELZ4uP4mi8WUw19Y HJg87lzbwxbAGMVlk5Kak1mWWqRvl8CV8fLJXPaCX1wV25dOYWpgfMDRxcjJISFgItH88wA7 hC0mceHeerYuRi4OIYHpjBJPNr9khHAmMkn0HjnJDFLFJmAksfXkNEYQW0RAQuJX/1WwImaB WYwSi7Y0soEkhAWsJA78XghmswioSjT/OQTWzCvgIdG+4SXUOgWJY1O/soLYnAKeEj/7nwHV cwBt85C4uFhmAiPvAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjB/n8mvYNxVYPFIUYB DkYlHl6B2q/+QqyJZcWVuYcYJTiYlUR4ezOAQrwpiZVVqUX58UWlOanFhxilOViUxHlNvIFS AumJJanZqakFqUUwWSYOTqkGxka2vHV3pT9N9oiqSbpSc8Az/9PWI4HP9C9XZKT4nXu3V79w 36t3S9fENajsK7v5jen8kguONlIHi03uCZ3cecBxQ0fYFhWJO4f7Vxzii7krcIxr9aJCvwVS Cx8KT5zsHzzh2IqejRLrr7g/np26+coGrvlrj4d+mO87Zd97/rWHOX8/aZcuDVmlxFKckWio xVxUnAgA+AdLhfsBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQkDm72yd0MMKxzLY0n5eAB1siRw6f6R2LaWJSmcutJZeUpYK16oKep1JJW2rxBXzQYsNF4P 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 Chnage in V5: - Pinmux setting of all bus done during board init. 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 bbd2ef8..8327027 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -158,6 +158,33 @@ static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd) writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); } +/* + * 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(); + i2c_ch_init(i2c, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + + return 0; +} + +unsigned int i2c_get_bus_num(void) +{ + return g_current_bus; +} +#endif + void i2c_init(int speed, int slaveadd) { struct s3c24x0_i2c *i2c = get_base_i2c();