From patchwork Fri Apr 8 14:24:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Longchamp X-Patchwork-Id: 90360 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 55FDDB6F7A for ; Sat, 9 Apr 2011 00:27:58 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2248B280F9; Fri, 8 Apr 2011 16:26:36 +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 L+2nXeP3dANh; Fri, 8 Apr 2011 16:26:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4A923280FA; Fri, 8 Apr 2011 16:25:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1ECAD280E0 for ; Fri, 8 Apr 2011 16:24:42 +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 uCCLvJ7bpnrO for ; Fri, 8 Apr 2011 16:24:40 +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 mail.ch.keymile.com (mail.ch.keymile.com [193.17.201.103]) by theia.denx.de (Postfix) with SMTP id 02E94280AF for ; Fri, 8 Apr 2011 16:24:28 +0200 (CEST) Received: from SRVCHBER1212.ch.keymile.net ([172.31.32.9]) by eSafe SMTP Relay 1297237168; Fri, 08 Apr 2011 16:13:03 +0100 Received: from localhost.localdomain ([172.31.32.134]) by SRVCHBER1212.ch.keymile.net with Microsoft SMTPSVC(6.0.3790.4675); Fri, 8 Apr 2011 16:24:26 +0200 From: Valentin Longchamp To: u-boot@lists.denx.de Date: Fri, 8 Apr 2011 16:24:08 +0200 Message-Id: <6c7b05560c085450498f56f27c6a44d52f07f801.1302272395.git.valentin.longchamp@keymile.com> X-Mailer: git-send-email 1.7.0.5 In-Reply-To: In-Reply-To: References: References: X-OriginalArrivalTime: 08 Apr 2011 14:24:26.0568 (UTC) FILETIME=[AA28B480:01CBF5F8] X-ESAFE-STATUS: Mail allowed X-ESAFE-DETAILS: Cc: Valentin Longchamp , holger.brunck@keymile.com, hs@denx.de Subject: [U-Boot] [PATCH 18/30] i2c: add i2c deblock sequence before and after every mux config X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 From: Stefan Bigler To make sure that the mux can be configured a deblocking sequence is done before the mux configuration. After the mux switch the new leaf of, the i2c tree must be again deblocked. Signed-off-by: Stefan Bigler Acked-by: Heiko Schocher cc: Wolfgang Denk cc: Detlev Zundel cc: Prafulla Wadaskar cc: Valentin Longchamp cc: Holger Brunck Signed-off-by: Valentin Longchamp --- common/cmd_i2c.c | 12 ++++++++++++ include/i2c.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index c272b0d..d913e13 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -132,6 +132,14 @@ DECLARE_GLOBAL_DATA_PTR; #define DISP_LINE_LEN 16 +/* implement possible board specific board init */ +void __def_i2c_init_board(void) +{ + return; +} +void i2c_init_board(void) + __attribute__((weak, alias("__def_i2c_init_board"))); + /* TODO: Implement architecture-specific get/set functions */ unsigned int __def_i2c_get_bus_speed(void) { @@ -1541,6 +1549,8 @@ int i2x_mux_select_mux(int bus) mux = dev->mux; while (mux != NULL) { + /* do deblocking on each level of mux, before mux config */ + i2c_init_board(); if (i2c_write(mux->chip, 0, 0, &mux->channel, 1) != 0) { printf ("Error setting Mux: chip:%x channel: \ %x\n", mux->chip, mux->channel); @@ -1548,6 +1558,8 @@ int i2x_mux_select_mux(int bus) } mux = mux->next; } + /* do deblocking on each level of mux and after mux config */ + i2c_init_board(); return 0; } #endif /* CONFIG_I2C_MUX */ diff --git a/include/i2c.h b/include/i2c.h index cd23c8a..8ceb4c8 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -108,9 +108,7 @@ * repeatedly to change the speed and slave addresses. */ void i2c_init(int speed, int slaveaddr); -#ifdef CONFIG_SYS_I2C_INIT_BOARD void i2c_init_board(void); -#endif #ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT void i2c_board_late_init(void); #endif