From patchwork Thu Jun 7 06:09:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 9155 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 1B76223F0A for ; Thu, 7 Jun 2012 06:06:14 +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 DF93DA1823C for ; Thu, 7 Jun 2012 06:06:13 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so152632ghb.11 for ; Wed, 06 Jun 2012 23:06:13 -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=0ChKROvW2Z/10dyuctrCarso0nXqJ+NN5103UNThlb4=; b=jyqkdI974OdjyySMKQIeu1LR8Um+U0qhYfQwwBMQYmQhbiE2sXVMw023tjLsHzyf99 7bdTCh2vhpH/jQ+2TlyQytNydD9lmrQDqFDATqs/9fTXz6jhKOQzF1Q42+SfXN9FmqtQ XmQXInR3da+1MV76BlbJN0WziLevdXOYeiZJyQxYrd5McSBsP13m9QEXiZABZT3Mp3PP 1iZDyUqmVoZ53EBEnXwIpw/g1ZGVu7JzRO2oAMgsZV5zgJMNV0mjRUnptxEZUR/7oJCF MsqR/3gFFsX+eTppxXNMjEz/EE+hLEw/cEdpNbxrM8uz9jvvyH7trP9xICwt1iZo1AdB BJsw== Received: by 10.50.57.167 with SMTP id j7mr8700506igq.53.1339049173540; Wed, 06 Jun 2012 23:06:13 -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 v20csp124536ibb; Wed, 6 Jun 2012 23:06:13 -0700 (PDT) Received: by 10.68.130.35 with SMTP id ob3mr5838332pbb.40.1339049172678; Wed, 06 Jun 2012 23:06:12 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id to9si4112981pbc.158.2012.06.06.23.06.12; Wed, 06 Jun 2012 23:06:12 -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 <0M5800GPZGXUSJN0@mailout2.samsung.com>; Thu, 07 Jun 2012 15:06:11 +0900 (KST) X-AuditID: cbfee61b-b7fcc6d000003a7a-81-4fd044d319c6 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 82.B5.14970.3D440DF4; Thu, 07 Jun 2012 15:06:11 +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 <0M5800J8XGX3ZV30@mmp1.samsung.com>; Thu, 07 Jun 2012 15:06:11 +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 Subject: [PATCH 7/8 V2] I2C: Add support for Multi channel Date: Thu, 07 Jun 2012 11:39:53 +0530 Message-id: <1339049394-4816-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1339049394-4816-1-git-send-email-rajeshwari.s@samsung.com> References: <1339049394-4816-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jAd3LLhf8DRbvULB4uP4mi8WUw19Y HJg87lzbwxbAGMVlk5Kak1mWWqRvl8CV8ezHQfaC9ZwV35rXsjQwPmDvYuTkkBAwkTh4eAor hC0mceHeerYuRi4OIYFFjBKrP95ignAmMklM7lrLBlLFJmAksfXkNEYQW0RAQuJX/1Uwm1mg kVFix2pXEFtYwEri7JyTYHEWAVWJffv7mUFsXgF3iWsNv9ggtilIHJv6FWwzp4CHxJZvEPVC QDUf321mncDIu4CRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGsP+fSe9gXNVgcYhRgINR iYd3ofMFfyHWxLLiytxDjBIczEoivAJl5/2FeFMSK6tSi/Lji0pzUosPMUpzsCiJ8zZZA1UL pCeWpGanphakFsFkmTg4pRoY21P39pisMQ8QeOPD7rwhvG6RXc7Tn7PKVyQxpuV6GCbPjLdR CcuJ1yx+HR2WekelaKqg43SD8y6rD07Y6XGk83+fwXtZX86LEYHeV6Iu/7vVfmeO/q01yrWm R976eJvN2LCCWbZq/nH3RzeZn1ybXFD+5qiTYkrQ7rolbF55yndcWvzvHD6qxFKckWioxVxU nAgAQUtFKPsBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQnMUvdPNFGmK2cjciQ6LVe2JdR1ilGLpgTjjiq/zgjESdstKA0V9Fm0z6sHtrVylun9jSt8 This adds multiple i2c channel support for I2C. Signed-off-by: Alim Akhtar Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- 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 a71f147..7521cb8 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -191,6 +191,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) {