compulab: eeprom: select i2c bus when querying for board rev
authorNikita Kiryanov <nikita@compulab.co.il>
Sun, 6 Sep 2015 08:48:35 +0000 (11:48 +0300)
committerStefano Babic <sbabic@denx.de>
Sun, 13 Sep 2015 08:35:06 +0000 (10:35 +0200)
Add support for selecting which eeprom is queried for board revision by
extending cl_eeprom_get_board_rev() to accept an i2c bus number.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
board/compulab/cm_fx6/cm_fx6.c
board/compulab/cm_t35/cm_t35.c
board/compulab/common/eeprom.c
board/compulab/common/eeprom.h

index e3db9d5b9bd0228924416095285a8419bf33733a..cb741e8aef7cd2d259622f52318dc587621fe668 100644 (file)
@@ -689,7 +689,7 @@ int dram_init(void)
 
 u32 get_board_rev(void)
 {
-       return cl_eeprom_get_board_rev();
+       return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
 }
 
 static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = {
index 374edbcffc6a990462cc69bc29505eb59ef45df9..8f17b97fa3f712c25305ea1b1d36207332db5aa2 100644 (file)
@@ -104,7 +104,7 @@ int board_init(void)
  */
 u32 get_board_rev(void)
 {
-       return cl_eeprom_get_board_rev();
+       return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
 };
 
 int misc_init_r(void)
index 77bcea44b41cf5a5c653f1ffa2621c37ed5ea1ec..aaacd2e32e92be1aaf5278d7f1292410b5bbf54b 100644 (file)
@@ -121,7 +121,7 @@ static u32 board_rev;
  * Routine: cl_eeprom_get_board_rev
  * Description: read system revision from eeprom
  */
-u32 cl_eeprom_get_board_rev(void)
+u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 {
        char str[5]; /* Legacy representation can contain at most 4 digits */
        uint offset = BOARD_REV_OFFSET_LEGACY;
@@ -129,7 +129,7 @@ u32 cl_eeprom_get_board_rev(void)
        if (board_rev)
                return board_rev;
 
-       if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS))
+       if (cl_eeprom_setup(eeprom_bus))
                return 0;
 
        if (cl_eeprom_layout != LAYOUT_LEGACY)
index 50c6b0226fc0ee2a39102f40e92e7288c823ca87..e74c379217aa1d83d54b775581d51e62d0f941ba 100644 (file)
 
 #ifdef CONFIG_SYS_I2C
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
-u32 cl_eeprom_get_board_rev(void);
+u32 cl_eeprom_get_board_rev(uint eeprom_bus);
 #else
 static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
 {
        return 1;
 }
-static inline u32 cl_eeprom_get_board_rev(void)
+static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 {
        return 0;
 }