From patchwork Thu Jul 19 11:40:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10145 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 6066E23E3D for ; Thu, 19 Jul 2012 11:34:54 +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 2B355A18007 for ; Thu, 19 Jul 2012 11:34:54 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so2818189yhp.11 for ; Thu, 19 Jul 2012 04:34:54 -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=MVySK1g2VoJf29iinqsusZ/hwHQ8uMWlUQn0p4RZL2o=; b=n1gorcK7EdndlIgbPf+m/KzJunvbMOJGfq0n0fvHgDX648G8HLYfTyKgmAYvmdultE zLO7BLLC/tHChYQMzTo99NjWCtjoMWHLDElscXTO4eo+cIVAMVvAy0pSuF4TwzVxe98L +kCnX9l0FFHwRl208xbgq94PQBw81oqohHxJbDIJXTHfFD8VVlXk7VhEYIJXGdzzYQFt OkoQxeNORbGJ+3FJ180jaEucKrNqJkboc57c0jAtAm44et0UJvAHJDURhSMZtKNW+TOH dB181o0aJ33ze1Ox9aMX80xN4MxaUVMcdXoTIMjgtT1cvhphYNSTqFKdF5g1qQnX5Y/g mPrw== Received: by 10.50.46.232 with SMTP id y8mr982883igm.57.1342697693745; Thu, 19 Jul 2012 04:34:53 -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.153.7 with SMTP id i7csp9652ibw; Thu, 19 Jul 2012 04:34:53 -0700 (PDT) Received: by 10.68.221.72 with SMTP id qc8mr4679487pbc.63.1342697692939; Thu, 19 Jul 2012 04:34:52 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id pz9si3850679pbb.300.2012.07.19.04.34.52; Thu, 19 Jul 2012 04:34:52 -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 epcpsbgm2.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 <0M7E00J85O5XZU60@mailout2.samsung.com>; Thu, 19 Jul 2012 20:34:51 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-86-5007f0db3d5b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 65.B6.23690.BD0F7005; Thu, 19 Jul 2012 20:34:51 +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 <0M7E00GKSO532160@mmp2.samsung.com>; Thu, 19 Jul 2012 20:34:51 +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, jh80.chung@samsung.com Subject: [PATCH 7/8 V6] I2C: Add support for Multi channel Date: Thu, 19 Jul 2012 17:10:00 +0530 Message-id: <1342698001-27683-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1342698001-27683-1-git-send-email-rajeshwari.s@samsung.com> References: <1342698001-27683-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t9jQd3bH9gDDLq71Cwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBl3Ptzn7FgCnfFi+f7GRsYP3F0MXJySAiYSBzq38QK YYtJXLi3nq2LkYtDSGA6o8T2JfOgnIlMEqe37mcDqWITMJLYenIaI4gtIiAh8av/KiNIEbPA FkaJ468ughUJC1hJXJr7jgXEZhFQlZj8dxMziM0r4CGxcnMrO8Q6BYljU7+CreYU8JTo3XsP LC4EVHOkeTXjBEbeBYwMqxhFUwuSC4qT0nON9IoTc4tL89L1kvNzNzGCA+CZ9A7GVQ0WhxgF OBiVeHg79NkDhFgTy4orcw8xSnAwK4nwbrsPFOJNSaysSi3Kjy8qzUktPsQozcGiJM5r4v3V X0ggPbEkNTs1tSC1CCbLxMEp1cBof75km0+u0gH9XR3r4ldGeLo67jrTKNh2gJ/v1PpTPrpy KXXTfWu/y+vWdF/ytjiil8gg/Lvz2ubTF3JEahy119rUeTyb+/X3ifrbM9tqxfj3hHFp3H2h l7F0bX/jv28tx1dIVTYVMghzGPsZ/w9RKr/FZWV+Z12Ca5tn1Y3N20PW662raVRiKc5INNRi LipOBACXCoiR/AEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQnuTDOK1Ljoy666e3qWIyVl/96Ya4kvTzTKJf6TiMZ1b43BnY/sywBUlIQhjt66NgmGQHb9 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 Changes in V5: - Pinmux setting of all bus done during board init. Changes in V6: - 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 421c7dd..39a0365 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();