From patchwork Tue Jun 19 06:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Birje X-Patchwork-Id: 165670 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DC9F4B7011 for ; Tue, 19 Jun 2012 16:42:19 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8ED09280F1; Tue, 19 Jun 2012 08:42:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eR5nPUMDSgmN; Tue, 19 Jun 2012 08:42:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 412BE280F4; Tue, 19 Jun 2012 08:41:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C5FFA280E3 for ; Tue, 19 Jun 2012 08:41:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HO6bbknBVxGw for ; Tue, 19 Jun 2012 08:41:26 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id 2D93D280AE for ; Tue, 19 Jun 2012 08:41:11 +0200 (CEST) Received: from epcpsbgm2.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 <0M5U009PSQKIPT40@mailout4.samsung.com> for u-boot@lists.denx.de; Tue, 19 Jun 2012 15:41:09 +0900 (KST) X-AuditID: cbfee61b-b7fcc6d000003a7a-1b-4fe01f05dd39 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 14.A1.14970.50F10EF4; Tue, 19 Jun 2012 15:41:09 +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 <0M5U00BUEQJL3P50@mmp2.samsung.com> for u-boot@lists.denx.de; Tue, 19 Jun 2012 15:41:09 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Date: Tue, 19 Jun 2012 12:15:18 +0530 Message-id: <1340088319-10072-8-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1340088319-10072-1-git-send-email-rajeshwari.s@samsung.com> References: <1340088319-10072-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQV1W+Qf+Bu9P8Vm83dvJ7sDocfbO DsYAxigum5TUnMyy1CJ9uwSujFMXNrIUPOasuH3FuYGxiaOLkZNDQsBEorm3lxXCFpO4cG89 WxcjF4eQwHRGiZ3Td7FDOKuYJB7fuMkGUsUmYCSx9eQ0RhBbREBC4lf/VTCbWWAKo8Su1aEg trCAlcTm/S/YQWwWAVWJ9T+2gPXyCnhIPLz3gR1im4LEsalfwTZzCnhKbPqwkAnEFgKq2fPi PPsERt4FjAyrGEVTC5ILipPSc430ihNzi0vz0vWS83M3MYJ9/kx6B+OqBotDjAIcjEo8vBkS D/yFWBPLiitzDzFKcDArifCu+n/fX4g3JbGyKrUoP76oNCe1+BCjNAeLkjhvk/UFfyGB9MSS 1OzU1ILUIpgsEwenVANjxVeuL6ZGLBzHa2Uajp9scXHNDJ+wROudTqK99SIF0R/1e/hZLYSt Cm44rJ/7XXdNUmtiyuebN9/byfvwKi5sqzttv/PgxsllHP4KF7ZuOfrr7pSavjeOeiznXzIt +mnYWr+ulre3RzNvfVuWwFeFg8vT4uccMlw68d3BB71nDh1gERX+bX9PiaU4I9FQi7moOBEA X7mk8PUBAAA= X-TM-AS-MML: No Cc: patches@linaro.org, alim.akhtar@samsung.com, hs@denx.de Subject: [U-Boot] [PATCH 7/8 V3] I2C: Add support for Multi channel X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 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 156b5a4..8254c2b 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -195,6 +195,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) {