summaryrefslogtreecommitdiff
path: root/board/cm_t35
diff options
context:
space:
mode:
Diffstat (limited to 'board/cm_t35')
-rw-r--r--board/cm_t35/cm_t35.c33
-rw-r--r--board/cm_t35/eeprom.c26
-rw-r--r--board/cm_t35/eeprom.h5
3 files changed, 54 insertions, 10 deletions
diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 89e6b08e7..700c18494 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -99,6 +99,39 @@ 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;
+}
+
/*
* Routine: set_muxconf_regs
* Description: Setting up the configuration Mux registers specific to the
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
index dfa171d23..b0af103cd 100644
--- a/board/cm_t35/eeprom.c
+++ b/board/cm_t35/eeprom.c
@@ -27,8 +27,7 @@
#define BOARD_SERIAL_OFFSET_LEGACY 8
#define BOARD_REV_OFFSET 0
#define BOARD_REV_OFFSET_LEGACY 6
-#define BOARD_REV_SIZE 4
-#define BOARD_REV_SIZE_LEGACY 2
+#define BOARD_REV_SIZE 2
#define MAC_ADDR_OFFSET 4
#define MAC_ADDR_OFFSET_LEGACY 0
@@ -100,25 +99,32 @@ 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 */
uint offset = BOARD_REV_OFFSET_LEGACY;
- int len = BOARD_REV_SIZE_LEGACY;
if (eeprom_setup_layout())
return 0;
- if (eeprom_layout != LAYOUT_LEGACY) {
+ if (eeprom_layout != LAYOUT_LEGACY)
offset = BOARD_REV_OFFSET;
- len = BOARD_REV_SIZE;
- }
- if (cm_t3x_eeprom_read(offset, (uchar *)&rev, len))
+ if (cm_t3x_eeprom_read(offset, (uchar *)&rev, BOARD_REV_SIZE))
return 0;
+ /*
+ * Convert legacy syntactic representation to semantic
+ * representation. i.e. for rev 1.00: 0x100 --> 0x64
+ */
+ if (eeprom_layout == LAYOUT_LEGACY) {
+ sprintf(str, "%x", rev);
+ rev = simple_strtoul(str, NULL, 10);
+ }
+
return rev;
};
diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h
index ec772c671..38824d162 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