cm-t35: print PCB revision information

Buffer the PCB revision to avoid multiple eeprom accesses
for the same data and print it as a part of board information.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Tom Rini <trini@ti.com>
This commit is contained in:
Nikita Kiryanov 2012-05-24 04:01:24 +00:00 committed by Albert ARIBAUD
parent 2ef6302f87
commit 8c318eb3a0
3 changed files with 41 additions and 3 deletions

View File

@ -99,6 +99,39 @@ int board_init(void)
return 0; return 0;
} }
static u32 cm_t3x_rev;
/*
* Routine: get_board_rev
* Description: read system revision
*/
u32 get_board_rev(void)
{
if (!cm_t3x_rev)
cm_t3x_rev = cm_t3x_eeprom_get_board_rev();
return cm_t3x_rev;
};
/*
* Routine: misc_init_r
* Description: display die ID
*/
int misc_init_r(void)
{
u32 board_rev = get_board_rev();
u32 rev_major = board_rev / 100;
u32 rev_minor = board_rev - (rev_major * 100);
if ((rev_minor / 10) * 10 == rev_minor)
rev_minor = rev_minor / 10;
printf("PCB: %u.%u\n", rev_major, rev_minor);
dieid_num_r();
return 0;
}
/* /*
* Routine: set_muxconf_regs * Routine: set_muxconf_regs
* Description: Setting up the configuration Mux registers specific to the * Description: Setting up the configuration Mux registers specific to the

View File

@ -99,10 +99,10 @@ int cm_t3x_eeprom_read_mac_addr(uchar *buf)
} }
/* /*
* Routine: get_board_rev * Routine: cm_t3x_eeprom_get_board_rev
* Description: read system revision * Description: read system revision from eeprom
*/ */
u32 get_board_rev(void) u32 cm_t3x_eeprom_get_board_rev(void)
{ {
u32 rev = 0; u32 rev = 0;
char str[5]; /* Legacy representation can contain at most 4 digits */ char str[5]; /* Legacy representation can contain at most 4 digits */

View File

@ -23,11 +23,16 @@
#ifdef CONFIG_DRIVER_OMAP34XX_I2C #ifdef CONFIG_DRIVER_OMAP34XX_I2C
int cm_t3x_eeprom_read_mac_addr(uchar *buf); int cm_t3x_eeprom_read_mac_addr(uchar *buf);
u32 cm_t3x_eeprom_get_board_rev(void);
#else #else
static inline int cm_t3x_eeprom_read_mac_addr(uchar *buf) static inline int cm_t3x_eeprom_read_mac_addr(uchar *buf)
{ {
return 1; return 1;
} }
static inline u32 cm_t3x_eeprom_get_board_rev(void)
{
return 0;
}
#endif #endif
#endif #endif