summaryrefslogtreecommitdiff
path: root/board/freescale/mpc8323erdb
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-04-07 23:59:10 +0200
committerWolfgang Denk <wd@denx.de>2008-04-07 23:59:10 +0200
commite59af4b611408adcdfb5e19bc5194a7d1f8b4dc3 (patch)
treee700a523f54c5ed18bf15f832158f90a31517c85 /board/freescale/mpc8323erdb
parent23c5189e6c969255f8c91b30fdf1cf81b698329d (diff)
parent70431e8a7393b6b793f77957f95b999fc9a269b8 (diff)
Merge branch 'master' of git://www.denx.de/git/u-boot-mpc83xx
Conflicts: lib_ppc/board.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/freescale/mpc8323erdb')
-rw-r--r--board/freescale/mpc8323erdb/mpc8323erdb.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index 88d5e8fb40..afc0eee3b7 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -185,3 +185,37 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+#if defined(CFG_I2C_MAC_OFFSET)
+int mac_read_from_eeprom(void)
+{
+ uchar buf[28];
+ char str[18];
+ int i = 0;
+ unsigned int crc = 0;
+ unsigned char enetvar[32];
+
+ /* Read MAC addresses from EEPROM */
+ if (eeprom_read(CFG_I2C_EEPROM_ADDR, CFG_I2C_MAC_OFFSET, buf, 28)) {
+ printf("\nEEPROM @ 0x%02x read FAILED!!!\n",
+ CFG_I2C_EEPROM_ADDR);
+ } else {
+ if (crc32(crc, buf, 24) == *(unsigned int *)&buf[24]) {
+ printf("Reading MAC from EEPROM\n");
+ for (i = 0; i < 4; i++) {
+ if (memcmp(&buf[i * 6], "\0\0\0\0\0\0", 6)) {
+ sprintf(str,
+ "%02X:%02X:%02X:%02X:%02X:%02X",
+ buf[i * 6], buf[i * 6 + 1],
+ buf[i * 6 + 2], buf[i * 6 + 3],
+ buf[i * 6 + 4], buf[i * 6 + 5]);
+ sprintf((char *)enetvar,
+ i ? "eth%daddr" : "ethaddr", i);
+ setenv((char *)enetvar, str);
+ }
+ }
+ }
+ }
+ return 0;
+}
+#endif /* CONFIG_I2C_MAC_OFFSET */