Message ID | 1337868084-6637-5-git-send-email-grinberg@compulab.co.il |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
On Thu, May 24, 2012 at 05:01:24PM +0300, Igor Grinberg wrote: > From: Nikita Kiryanov <nikita@compulab.co.il> > > 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> Note that this doesn't apply directly to mainline as cm_t35 had been switched to the weak dieid-printing only misc_init_r. I've done the trivial fixup to make this work again and will signed-off-by in my pull request.
Hi Tom, On 05/24/12 21:11, Tom Rini wrote: > On Thu, May 24, 2012 at 05:01:24PM +0300, Igor Grinberg wrote: >> From: Nikita Kiryanov <nikita@compulab.co.il> >> >> 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> > > Note that this doesn't apply directly to mainline as cm_t35 had been > switched to the weak dieid-printing only misc_init_r. Yeah, I forgot about that patch... sorry... > I've done the > trivial fixup to make this work again and will signed-off-by in my pull > request. Thanks a lot!
diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c index d5bc581..60e0b06 100644 --- a/board/cm_t35/cm_t35.c +++ b/board/cm_t35/cm_t35.c @@ -101,12 +101,34 @@ int board_init(void) 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; diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c index 4986b23..b0af103 100644 --- a/board/cm_t35/eeprom.c +++ b/board/cm_t35/eeprom.c @@ -99,10 +99,10 @@ int cm_t3x_eeprom_read_mac_addr(uchar *buf) } /* - * Routine: get_board_rev - * Description: read system revision + * Routine: cm_t3x_eeprom_get_board_rev + * Description: read system revision from eeprom */ -u32 get_board_rev(void) +u32 cm_t3x_eeprom_get_board_rev(void) { u32 rev = 0; char str[5]; /* Legacy representation can contain at most 4 digits */ diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h index ec772c6..38824d1 100644 --- a/board/cm_t35/eeprom.h +++ b/board/cm_t35/eeprom.h @@ -23,11 +23,16 @@ #ifdef CONFIG_DRIVER_OMAP34XX_I2C int cm_t3x_eeprom_read_mac_addr(uchar *buf); +u32 cm_t3x_eeprom_get_board_rev(void); #else static inline int cm_t3x_eeprom_read_mac_addr(uchar *buf) { return 1; } +static inline u32 cm_t3x_eeprom_get_board_rev(void) +{ + return 0; +} #endif #endif