summaryrefslogtreecommitdiffstats
path: root/board/cm_t35/eeprom.c
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2012-01-12 03:28:09 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-01-16 08:40:11 +0100
commite4e2bf5e4ccbe85f2fcfbb2880348228e81eb44e (patch)
tree9892feee12da510bb9b2358c82b3106580445c16 /board/cm_t35/eeprom.c
parent7d3c97d71ffe3d0cf8df00228ba18c79746fdf50 (diff)
downloadtalos-obmc-uboot-e4e2bf5e4ccbe85f2fcfbb2880348228e81eb44e.tar.gz
talos-obmc-uboot-e4e2bf5e4ccbe85f2fcfbb2880348228e81eb44e.zip
cm-t35: use the new EEPROM module to read the MAC address
Switch to the new EEPROM module and fix the problem of MAC address being read from the wrong offset due to lack of distinction between EEPROM layouts. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'board/cm_t35/eeprom.c')
-rw-r--r--board/cm_t35/eeprom.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
index b3d332f3ac..dfa171d233 100644
--- a/board/cm_t35/eeprom.c
+++ b/board/cm_t35/eeprom.c
@@ -29,6 +29,8 @@
#define BOARD_REV_OFFSET_LEGACY 6
#define BOARD_REV_SIZE 4
#define BOARD_REV_SIZE_LEGACY 2
+#define MAC_ADDR_OFFSET 4
+#define MAC_ADDR_OFFSET_LEGACY 0
#define LAYOUT_INVALID 0
#define LAYOUT_LEGACY 0xff
@@ -82,6 +84,22 @@ void get_board_serial(struct tag_serialnr *serialnr)
}
/*
+ * Routine: cm_t3x_eeprom_read_mac_addr
+ * Description: read mac address and store it in buf.
+ */
+int cm_t3x_eeprom_read_mac_addr(uchar *buf)
+{
+ uint offset;
+
+ if (eeprom_setup_layout())
+ return 0;
+
+ offset = (eeprom_layout != LAYOUT_LEGACY) ?
+ MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
+ return cm_t3x_eeprom_read(offset, buf, 6);
+}
+
+/*
* Routine: get_board_rev
* Description: read system revision
*/
OpenPOWER on IntegriCloud