From patchwork Fri Dec 16 02:15:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Moffett X-Patchwork-Id: 131771 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 6C0E01007D6 for ; Fri, 16 Dec 2011 13:16:31 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1503828444; Fri, 16 Dec 2011 03:16:30 +0100 (CET) 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 zMXn7Q0+SZQs; Fri, 16 Dec 2011 03:16:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 50F4B28445; Fri, 16 Dec 2011 03:16:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 30C5728444 for ; Fri, 16 Dec 2011 03:16:26 +0100 (CET) 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 Yp5PeDvO0TEO for ; Fri, 16 Dec 2011 03:16:25 +0100 (CET) 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 border.exmeritus.com (border.exmeritus.com [70.167.241.26]) by theia.denx.de (Postfix) with ESMTP id 816082843B for ; Fri, 16 Dec 2011 03:16:25 +0100 (CET) Received: from ysera.exmeritus.com (firewall2.exmeritus.com [10.13.38.2]) by border.exmeritus.com (Postfix) with ESMTP id B217AAC077; Thu, 15 Dec 2011 21:16:24 -0500 (EST) From: Kyle Moffett To: u-boot@lists.denx.de Date: Thu, 15 Dec 2011 21:15:41 -0500 Message-Id: <1324001741-15282-1-git-send-email-Kyle.D.Moffett@boeing.com> X-Mailer: git-send-email 1.7.7.3 Cc: Heiko Schocher Subject: [U-Boot] [PATCH] Fix logic for selection of CONFIG_SYS_DEF_EEPROM_ADDR 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 A board with CONFIG_SPI and CONFIG_ENV_EEPROM_IS_ON_I2C will get: #define CONFIG_SYS_DEF_EEPROM_ADDR 0 Instead of the expected: #define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR As a result, the "eeprom" command is unusable because it calls i2c_read() and i2c_write() but always uses an address of 0x00. This fixes the logic for that particular case, hopefully without breaking any other board configurations. Signed-off-by: Kyle Moffett Cc: Heiko Schocher --- include/common.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/common.h b/include/common.h index 5cfdd76..8a1b401 100644 --- a/include/common.h +++ b/include/common.h @@ -402,13 +402,13 @@ extern void pic_write (uchar reg, uchar val); * Set this up regardless of board * type, to prevent errors. */ -#if defined(CONFIG_SPI) || !defined(CONFIG_SYS_I2C_EEPROM_ADDR) +#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) +# define CONFIG_SYS_DEF_EEPROM_ADDR 0 +#elif !defined(CONFIG_SYS_I2C_EEPROM_ADDR) # define CONFIG_SYS_DEF_EEPROM_ADDR 0 #else -#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) # define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR #endif -#endif /* CONFIG_SPI || !defined(CONFIG_SYS_I2C_EEPROM_ADDR) */ #if defined(CONFIG_SPI) extern void spi_init_f (void);