[U-Boot] [PATCH] Fix logic for selection of CONFIG_SYS_DEF_EEPROM_ADDR
Kyle Moffett
Kyle.D.Moffett at boeing.com
Fri Dec 16 03:15:41 CET 2011
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 <Kyle.D.Moffett at boeing.com>
Cc: Heiko Schocher <hs at denx.de>
---
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);
--
1.7.7.3
More information about the U-Boot
mailing list