* board_get_enetaddr -- Read the MAC Address in the I2C EEPROM
*-----------------------------------------------------------------------------
*/
-void board_get_enetaddr (uchar * enet)
+static void board_get_enetaddr(uchar *enet)
{
int i;
char buff[256], *cp;
enet[3] |= 0x80;
#endif
- printf ("MAC address = %02x:%02x:%02x:%02x:%02x:%02x\n",
- enet[0], enet[1], enet[2], enet[3], enet[4], enet[5]);
+ printf("MAC address = %pM\n", enet);
+}
+
+int misc_init_r(void)
+{
+ uchar enetaddr[6];
+
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+ return 0;
}
void rpxclassic_init (void)
return *((ulong *) packet->data);
}
-void board_get_enetaddr (uchar * addr)
+static void board_get_enetaddr(uchar *addr)
{
int i;
vpd_packet_t *packet;
addr[i] = packet->data[i];
}
+int misc_init_r(void)
+{
+ uchar enetaddr[6];
+
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+
+ return 0;
+}
+
/*
* Check Board Identity:
*/
* mgmt mac address.
*
************************************************************************/
-static int macaddr_idx = 0;
-void board_get_enetaddr (uchar * enet)
+void board_get_enetaddr(int macaddr_idx, uchar *enet)
{
int i;
unsigned short tmp;
tmp += 31;
memcpy(&enet[4], &tmp, 2);
- macaddr_idx++;
} else {
enet[0] = 0x02;
enet[1] = 0x00;
int sbcommon_secondary_present(void);
unsigned short sbcommon_get_serial_number(void);
void sbcommon_fans(void);
+void board_get_enetaddr(int macaddr_idx, uchar *enet);
#endif /* __SBCOMMON_H__ */
{
unsigned short sernum;
char envstr[255];
+ uchar enetaddr[6];
KAREF_FPGA_REGS_ST *karef_ps;
OFEM_FPGA_REGS_ST *ofem_ps;
printf("fakeled is set. use 'setenv fakeled ; setenv bootdelay 5 ; saveenv' to recover\n");
}
+#ifdef CONFIG_HAS_ETH0
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(0, enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH1
+ if (!eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ board_get_enetaddr(1, enetaddr);
+ eth_putenv_enetaddr("eth1addr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH2
+ if (!eth_getenv_enetaddr("eth2addr", enetaddr)) {
+ board_get_enetaddr(2, enetaddr);
+ eth_putenv_enetaddr("eth2addr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH3
+ if (!eth_getenv_enetaddr("eth3addr", enetaddr)) {
+ board_get_enetaddr(3, enetaddr);
+ eth_putenv_enetaddr("eth3addr", enetaddr);
+ }
+#endif
+
return (0);
}
{
unsigned short sernum;
char envstr[255];
+ uchar enetaddr[6];
unsigned char opto_rev;
OPTO_FPGA_REGS_ST *opto_ps;
}
}
+#ifdef CONFIG_HAS_ETH0
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(0, enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH1
+ if (!eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ board_get_enetaddr(1, enetaddr);
+ eth_putenv_enetaddr("eth1addr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH2
+ if (!eth_getenv_enetaddr("eth2addr", enetaddr)) {
+ board_get_enetaddr(2, enetaddr);
+ eth_putenv_enetaddr("eth2addr", enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH3
+ if (!eth_getenv_enetaddr("eth3addr", enetaddr)) {
+ board_get_enetaddr(3, enetaddr);
+ eth_putenv_enetaddr("eth3addr", enetaddr);
+ }
+#endif
+
return (0);
}
return 0;
}
-void board_get_enetaddr (uchar * addr)
+static void board_get_enetaddr(uchar *addr)
{
int i;
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
cpm->cp_rccr = rccrtmp;
}
+
+int misc_init_r(void)
+{
+ uchar enetaddr[6];
+
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+
+ return 0;
+}
return 0;
}
+extern void board_get_enetaddr(uchar *enetaddr);
+int misc_init_r(void)
+{
+ uchar enetaddr[6];
+
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(enetaddr);
+ eth_putenv_enetaddr("ethaddr", enetaddr);
+ }
+
+ return 0;
+}
#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET)
void init_ide_reset(void)
* board_get_enetaddr -- Read the MAC Addresses in the I2C EEPROM
*-----------------------------------------------------------------------------
*/
-static int enetaddr_num = 0;
-void board_get_enetaddr (uchar * enet)
+static int read_i2c;
+static void board_get_enetaddr(uchar *enet)
{
int i;
unsigned char buff[0x100], *cp;
+ if (read_i2c)
+ return;
+
/* Initialize I2C */
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
/* Read 256 bytes in EEPROM */
i2c_read (0x50, 0, 1, buff, 0x100);
- if (enetaddr_num == 0) {
- cp = &buff[0xF4];
- enetaddr_num = 1;
- }
- else
- cp = &buff[0xFA];
-
+ cp = &buff[0xF4];
for (i = 0; i < 6; i++,cp++)
enet[i] = *cp;
- printf ("MAC address = %02x:%02x:%02x:%02x:%02x:%02x\n",
- enet[0], enet[1], enet[2], enet[3], enet[4], enet[5]);
+ printf("MAC address = %pM\n", enet);
+ read_i2c = 1;
+}
+
+int misc_init_r(void)
+{
+ uchar enetaddr[6], i2c_enetaddr[6];
+
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ board_get_enetaddr(i2c_enetaddr);
+ eth_putenv_enetaddr("ethaddr", i2c_enetaddr);
+ }
+
+#ifdef CONFIG_HAS_ETH1
+ if (!eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ board_get_enetaddr(i2c_enetaddr);
+ eth_putenv_enetaddr("eth1addr", i2c_enetaddr);
+ }
+#endif
+
+#ifdef CONFIG_HAS_ETH2
+ if (!eth_getenv_enetaddr("eth2addr", enetaddr)) {
+ board_get_enetaddr(i2c_enetaddr);
+ eth_putenv_enetaddr("eth2addr", i2c_enetaddr);
+ }
+#endif
+#ifdef CONFIG_HAS_ETH3
+ if (!eth_getenv_enetaddr("eth3addr", enetaddr)) {
+ board_get_enetaddr(i2c_enetaddr);
+ eth_putenv_enetaddr("eth3addr", i2c_enetaddr);
+ }
+#endif
+
+ return 0;
}
void board_ether_init (void);
#endif
-#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
- defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K) || \
- defined(CONFIG_METROBOX) || defined(CONFIG_KAREF) || \
- defined(CONFIG_V38B)
-void board_get_enetaddr (uchar *addr);
-#endif
-
#ifdef CONFIG_HERMES
/* $(BOARD)/hermes.c */
void hermes_start_lxt980 (int speed);
/* using this define saves us updating another source file */
#define CONFIG_BOARD_EARLY_INIT_F 1
+#define CONFIG_MISC_INIT_R
#undef CONFIG_BOOTARGS
/* #define CONFIG_BOOTCOMMAND \
#undef CONFIG_8xx_TFTP_MODE
#endif
+#define CONFIG_MISC_INIT_R
+
#define CONFIG_DRAM_SPEED (CONFIG_8xx_BUSCLOCK) /* MHz */
#define CONFIG_BOOTCOMMAND "bootm FE020000" /* autoboot command */
#define CONFIG_BOOTARGS " "
#define CONFIG_SYS_DISCOVER_PHY 1
#define CONFIG_MII 1
#endif /* CONFIG_FEC_ENET */
+#define CONFIG_MISC_INIT_R
/* Video console (graphic: Epson SED13806 on ECCX board, no keyboard */
#if 1
#define CONFIG_440 1
#define CONFIG_440GX 1 /* 440 GX */
#define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_pre_init */
+#define CONFIG_MISC_INIT_R
#undef CONFIG_SYS_DRAM_TEST /* Disable-takes long time! */
#define CONFIG_SYS_CLK_FREQ 33333333 /* external freq to pll */
#define CONFIG_BOARD_EARLY_INIT_R 1 /* do board-specific init */
#define CONFIG_BOARD_EARLY_INIT_F 1 /* do board-specific init */
+#define CONFIG_MISC_INIT_R
#define CONFIG_SYS_XLB_PIPELINING 1 /* gives better performance */
#endif
s = getenv ("ethaddr");
-#if defined (CONFIG_MBX) || \
- defined (CONFIG_RPXCLASSIC) || \
- defined(CONFIG_IAD210) || \
- defined(CONFIG_V38B)
- if (s == NULL)
- board_get_enetaddr (bd->bi_enetaddr);
- else
-#endif
for (i = 0; i < 6; ++i) {
bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)
/* handle the 3rd ethernet address */
s = getenv ("eth2addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
- if (s == NULL)
- board_get_enetaddr(bd->bi_enet2addr);
- else
-#endif
for (i = 0; i < 6; ++i) {
bd->bi_enet2addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)
#ifdef CONFIG_HAS_ETH3
/* handle 4th ethernet address */
s = getenv("eth3addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
- if (s == NULL)
- board_get_enetaddr(bd->bi_enet3addr);
- else
-#endif
for (i = 0; i < 6; ++i) {
bd->bi_enet3addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)
#ifdef CONFIG_HAS_ETH4
/* handle 5th ethernet address */
s = getenv("eth4addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
- if (s == NULL)
- board_get_enetaddr(bd->bi_enet4addr);
- else
-#endif
for (i = 0; i < 6; ++i) {
bd->bi_enet4addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)
#ifdef CONFIG_HAS_ETH5
/* handle 6th ethernet address */
s = getenv("eth5addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
- if (s == NULL)
- board_get_enetaddr(bd->bi_enet5addr);
- else
-#endif
for (i = 0; i < 6; ++i) {
bd->bi_enet5addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
if (s)