am33xx evm: Add CONFIG_CMD_EEPROM and related
authorTom Rini <trini@ti.com>
Tue, 31 Jul 2012 16:37:08 +0000 (09:37 -0700)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 1 Sep 2012 12:58:13 +0000 (14:58 +0200)
am33xx boards have at least one eeprom and in the case of beaglebones
with capes, more.

Signed-off-by: Tom Rini <trini@ti.com>
arch/arm/cpu/armv7/am33xx/board.c
include/configs/am335x_evm.h

index a1fe10427590482deb50cef9c07f6c1edcaf5c76..0f16021c201f9832b0782367efc00a4c81c65382 100644 (file)
@@ -58,11 +58,6 @@ const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-/*
- * I2C Address of on-board EEPROM
- */
-#define I2C_BASE_BOARD_ADDR    0x50
-
 #define NO_OF_MAC_ADDR          3
 #define ETH_ALEN               6
 #define NAME_LEN               8
@@ -94,14 +89,14 @@ static inline int board_is_evm_sk(void)
 static int read_eeprom(void)
 {
        /* Check if baseboard eeprom is available */
-       if (i2c_probe(I2C_BASE_BOARD_ADDR)) {
+       if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
                puts("Could not probe the EEPROM; something fundamentally "
                        "wrong on the I2C bus.\n");
                return -ENODEV;
        }
 
        /* read the eeprom using i2c */
-       if (i2c_read(I2C_BASE_BOARD_ADDR, 0, 2, (uchar *)&header,
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)&header,
                                                        sizeof(header))) {
                puts("Could not read the EEPROM; something fundamentally"
                        " wrong on the I2C bus.\n");
@@ -113,8 +108,8 @@ static int read_eeprom(void)
                 * read the eeprom using i2c again,
                 * but use only a 1 byte address
                 */
-               if (i2c_read(I2C_BASE_BOARD_ADDR, 0, 1, (uchar *)&header,
-                                                       sizeof(header))) {
+               if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1,
+                                       (uchar *)&header, sizeof(header))) {
                        puts("Could not read the EEPROM; something "
                                "fundamentally wrong on the I2C bus.\n");
                        return -EIO;
index 46049b6ab9dbfe4024596e34bbe4b99102a2abb5..f210dce25298ea86a6b6cf537cf61843af2f7af8 100644 (file)
 #define CONFIG_SYS_I2C_SLAVE           1
 #define CONFIG_I2C_MULTI_BUS
 #define CONFIG_DRIVER_OMAP24XX_I2C
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_ADDR     0x50    /* Main EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
+#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 #define CONFIG_BAUDRATE                115200
 #define CONFIG_SYS_BAUDRATE_TABLE      { 110, 300, 600, 1200, 2400, \