Commit b16b67ff by Manel Caro

fix load mac address function

Signed-off-by: Manel Caro's avatarManel Caro <mcaro@iseebcn.com>
parent 24aaaf8b
......@@ -192,6 +192,10 @@ struct igep_mf_setup igep0046_eeprom_config = {
.bmac1 = "678901"
};
const uchar igep_mac0 [6] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0xff };
static int igep_eeprom_valid = 0;
/* I2C MUX */
#ifdef CONFIG_SYS_I2C
static struct i2c_pads_info i2c_pad_info1 =
......@@ -354,6 +358,7 @@ static void setup_iomux_enet(void)
{
imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
}
static int reset_enet_phy(struct mii_dev *bus)
{
/* Reset Marvell Alaska PHY */
......@@ -369,24 +374,22 @@ int board_phy_config(struct phy_device *phydev)
return 0;
}
const uchar* get_mac_address (void)
{
if(igep_eeprom_valid)
return igep0046_eeprom_config.bmac0;
return igep_mac0;
}
int board_eth_init(bd_t *bis)
{
/*
uint8_t mac_addr[6];
mac_addr[0] = 0;
mac_addr[1] = 1;
mac_addr[2] = 2;
mac_addr[3] = 3;
mac_addr[4] = 4;
mac_addr[5] = 5;
eth_setenv_enetaddr("ethaddr",mac_addr);
*/
uint32_t base = IMX_FEC_BASE;
struct mii_dev *bus = NULL;
struct phy_device *phydev = NULL;
int ret;
eth_setenv_enetaddr("ethaddr", get_mac_address());
setup_iomux_enet();
//reset_enet_phy();
......@@ -438,6 +441,7 @@ int board_init(void)
{
u32 crc_value = 0;
u32 crc_save_value = 0;
#ifdef CONFIG_SYS_I2C
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
......@@ -467,8 +471,8 @@ int board_init(void)
printf("eeprom crc32 check loading mac from environment\n");
}else{
printf("crc32 OK! Loading mac\n");
eth_setenv_enetaddr("ethaddr", (uint8_t *) igep0046_eeprom_config.bmac0);
printf("crc32 OK! Loading mac\n");
igep_eeprom_valid = 1;
}
}
#endif
......@@ -480,6 +484,7 @@ int board_init(void)
#ifdef CONFIG_BASE0040
reset_usb_hub();
#endif
return 0;
}
......@@ -559,8 +564,6 @@ int board_late_init(void)
}
return 0;
return 0;
}
#ifdef CONFIG_POWER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment