From patchwork Wed Sep 11 11:17:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Longchamp X-Patchwork-Id: 274248 X-Patchwork-Delegate: yorksun@freescale.com 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 9B1A72C0167 for ; Wed, 11 Sep 2013 21:19:34 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F6604A0B8; Wed, 11 Sep 2013 13:19:24 +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 RQrCKCaj1qIE; Wed, 11 Sep 2013 13:19:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 402ED4A0D6; Wed, 11 Sep 2013 13:18:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E59EB4A098 for ; Wed, 11 Sep 2013 13:18:10 +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 2ZnDzj5jztnU for ; Wed, 11 Sep 2013 13:18:07 +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-de.keymile.com (mail-de.keymile.com [195.8.104.250]) by theia.denx.de (Postfix) with ESMTPS id 63F754A07B for ; Wed, 11 Sep 2013 13:17:55 +0200 (CEST) Received: from [10.9.1.54] (port=41346 helo=mailrelay.de.keymile.net) by mail-de.keymile.com with esmtp (Exim 4.76) (envelope-from ) id 1VJiQi-0008AY-26; Wed, 11 Sep 2013 13:17:52 +0200 Received: from chber1-10533x.keymile.net (chber1-10533x.keymile.net [172.31.40.3]) by mailrelay.de.keymile.net (8.12.2/8.12.2) with ESMTP id r8BBFT1a006908; Wed, 11 Sep 2013 13:15:33 +0200 (MEST) From: Valentin Longchamp To: Andy Fleming , Scott Wood , York Sun Date: Wed, 11 Sep 2013 13:17:38 +0200 Message-Id: <1378898265-10818-5-git-send-email-valentin.longchamp@keymile.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1378898265-10818-1-git-send-email-valentin.longchamp@keymile.com> References: <1378898265-10818-1-git-send-email-valentin.longchamp@keymile.com> Cc: U-Boot Mailing List , Holger Brunck , Valentin Longchamp Subject: [U-Boot] [PATCH v3 04/11] KM: define CONFIG_SYS_I2C_INIT_BOARD only for concerned board 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 must be defined for all the keymile boards that use the common i2c_abort function that is used to "reset" the I2C bus. These are currently km82xx and km_arm boards. The km83xx boards use other functions and thus do not need this. This patch removes the CONFIG_SYS_I2C_INIT_BOARD from keymile-common.h and defines it for km_arm.h and km82xx.h. Signed-off-by: Valentin Longchamp --- Changes in v3: - take the new I2C defines into account and use CONFIG_SYS_I2C_INIT_BOARD instead of an additional option and define it only for the I2C bitbang KM boards (km_arm and km82xx) and not for all KM boards. Changes in v2: - Introduce CONFIG_KM_I2C_ABORT #define to avoid #if !defined in common.c board/keymile/common/common.c | 25 ------------------------- include/configs/km/keymile-common.h | 2 -- include/configs/km/km_arm.h | 4 +--- include/configs/km82xx.h | 2 ++ 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 86b8110..cc71d89 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -24,10 +24,6 @@ #include "common.h" #include -#if !defined(CONFIG_MPC83xx) -static void i2c_write_start_seq(void); -#endif - DECLARE_GLOBAL_DATA_PTR; /* @@ -78,7 +74,6 @@ int set_km_env(void) } #if defined(CONFIG_SYS_I2C_INIT_BOARD) -#if !defined(CONFIG_MPC83xx) static void i2c_write_start_seq(void) { set_sda(1); @@ -101,21 +96,6 @@ static void i2c_write_start_seq(void) */ int i2c_make_abort(void) { - -#if defined(CONFIG_HARD_I2C) && !defined(MACH_TYPE_KM_KIRKWOOD) - immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; - i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c; - - /* - * disable I2C controller first, otherwhise it thinks we want to - * talk to the slave port... - */ - clrbits_8(&i2c->i2c_i2mod, 0x01); - - /* Set the PortPins to GPIO */ - setports(1); -#endif - int scl_state = 0; int sda_state = 0; int i = 0; @@ -148,13 +128,8 @@ int i2c_make_abort(void) set_sda(1); get_sda(); -#if defined(CONFIG_HARD_I2C) - /* Set the PortPins back to use for I2C */ - setports(0); -#endif return ret; } -#endif /** * i2c_init_board - reset i2c bus. When the board is powercycled during a diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index 7bb385d..b8ccb8f 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -62,8 +62,6 @@ #define CONFIG_LOADS_ECHO #define CONFIG_SYS_LOADS_BAUD_CHANGE -#define CONFIG_SYS_I2C_INIT_BOARD - /* Support the IVM EEprom */ #define CONFIG_SYS_IVM_EEPROM_ADR 0x50 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400 diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index 75b6250..36c2fba 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -176,10 +176,9 @@ #undef CONFIG_I2C_MVTWSI #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_INIT_BOARD #define CONFIG_KIRKWOOD_GPIO /* Enable GPIO Support */ -#if defined(CONFIG_SYS_I2C_SOFT) - #define CONFIG_SYS_NUM_I2C_BUSES 6 #define CONFIG_SYS_I2C_MAX_HOPS 1 #define CONFIG_SYS_I2C_BUSES { {0, {I2C_NULL_HOP} }, \ @@ -214,7 +213,6 @@ int get_scl(void); #define CONFIG_SYS_I2C_SOFT_SLAVE 0x0 #define CONFIG_SYS_I2C_SOFT_SPEED 100000 -#endif /* EEprom support 24C128, 24C256 valid for environment eeprom */ #define CONFIG_SYS_I2C_MULTI_EEPROMS diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h index b23cb96..ba13803 100644 --- a/include/configs/km82xx.h +++ b/include/configs/km82xx.h @@ -227,6 +227,7 @@ /* enable I2C and select the hardware/software driver */ #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ +#define CONFIG_SYS_I2C_INIT_BOARD #define CONFIG_SYS_NUM_I2C_BUSES 3 #define CONFIG_SYS_I2C_MAX_HOPS 1 #define CONFIG_SYS_I2C_SOFT_SPEED 50000 @@ -237,6 +238,7 @@ {0, {{I2C_MUX_PCA9542, 0x70, 1} } } } #define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/ +#define CONFIG_KM_I2C_ABORT /* * Software (bit-bang) I2C driver configuration