From patchwork Tue Jul 24 07:23:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10219 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 7BD7923E56 for ; Tue, 24 Jul 2012 07:18:36 +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 4B915A183D3 for ; Tue, 24 Jul 2012 07:18:36 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so6653535ggn.11 for ; Tue, 24 Jul 2012 00:18:36 -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=69PhtEqgTFFjIHstmrshhR04USHDnlLdx+wozyyVX9c=; b=CgY+mcipa7xGrH10/qF0nieqmkcB3GkcLKALRlLqmHaIQTEAWJfi3sy2oqBS8DPf5N sCMq0GqOwva/FIsZ6apF8GSr3+mJmWieifeAIv+bJNW+IRuAa/c5rtliGuMU8faZUf0G shKSOMV45sAX8jVH4UzMKZg5WpERn2SR9Vmg/7jkoFxywZh5wH1ocnSwSkTNWxKYF+93 QNrqkC19B5v+3vSphHjJYF1PzHR4fc9AmqxESiT96O/DaoAeWZm72jeOWPLdsOuazm8x 6PBKMB0N42Jvlni9X1G7sgl3Gi7JqgMcdXpUDVypozYhwPkXy2BNQOMAM/dFJn5WobOX 76Cg== Received: by 10.43.69.12 with SMTP id ya12mr13040656icb.50.1343114315783; Tue, 24 Jul 2012 00:18: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.153.7 with SMTP id i7csp67689ibw; Tue, 24 Jul 2012 00:18:35 -0700 (PDT) Received: by 10.68.217.226 with SMTP id pb2mr41961957pbc.105.1343114314980; Tue, 24 Jul 2012 00:18:34 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id pw3si26952722pbb.211.2012.07.24.00.18.34; Tue, 24 Jul 2012 00:18:34 -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 <0M7N00H0ULMIB9F0@mailout4.samsung.com>; Tue, 24 Jul 2012 16:18:19 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-80-500e4c3a2c75 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id FE.A3.19326.A3C4E005; Tue, 24 Jul 2012 16:18:18 +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 <0M7N0070ELLVCSJ1@mmp1.samsung.com>; Tue, 24 Jul 2012 16:18:18 +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 V7] I2C: Add support for Multi channel Date: Tue, 24 Jul 2012 12:53:54 +0530 Message-id: <1343114635-28169-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343114635-28169-1-git-send-email-rajeshwari.s@samsung.com> References: <1343114635-28169-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jAV0rH74Ag7UnjSwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBl/L01lbFgMXfF/0cb2RoYv3B0MXJySAiYSJzeMo0F whaTuHBvPVsXIxeHkMAiRon1xx8wQzgTmSTWrpzIDFLFJmAksfXkNEYQW0RAQuJX/1VGkCJm gS2MEsdfXWQDSQgLWEn8u3SVvYuRg4NFQFWidasHSJhXwEPi3aSXTBDbFCSOTf3KCmJzCnhK bLy+FSwuBFTz9M4p1gmMvAsYGVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn525iBPv/mdQOxpUN FocYBTgYlXh4M1t5A4RYE8uKK3MPMUpwMCuJ8PJ68AUI8aYkVlalFuXHF5XmpBYfYpTmYFES 5zX2/uovJJCeWJKanZpakFoEk2Xi4JRqYDx93eveoZv9QfzMW+MWXinNTl6z0zpvMa9Kk+4N Dc1OqTUWR74ISe2a1mEfZGMo3TXhsNON58+UJKcW3ZI6rzZrTwRvVsT/fwJrOI4q8v7JN14k ZHHPdUlfnr2rkEXDC+77bOE1j+PPvPrxZ8o6+XRR/63dX/WnM79ttTrJ29t8xY13pfykU0os xRmJhlrMRcWJAP6P+XP7AQAA X-TM-AS-MML: No X-Gm-Message-State: ALoCoQlqIebyuMuHRVc4wGDDJMioygco8GN5XnTj1IcVBry9UhPevLd9GNlosuI+T0tnu35HCCPv 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 Changes in V7: - 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 26c0755..9bc4c7f 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;