summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2018-01-26 13:43:50 +0100
committerManel Caro <mcaro@iseebcn.com>2018-01-26 13:43:50 +0100
commitb16b67ff2b8739763c400a32e135877c635dafec (patch)
treeee5a0837b91b0c8146a502ec78ad58de99493f93
parent24aaaf8b8cd998d21b4d2f04eba0e9ba7111d332 (diff)
downloadu-boot-imx-b16b67ff2b8739763c400a32e135877c635dafec.zip
u-boot-imx-b16b67ff2b8739763c400a32e135877c635dafec.tar.gz
u-boot-imx-b16b67ff2b8739763c400a32e135877c635dafec.tar.bz2
fix load mac address function
Signed-off-by: Manel Caro <mcaro@iseebcn.com>
-rw-r--r--board/isee/igep0046/igep0046.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/board/isee/igep0046/igep0046.c b/board/isee/igep0046/igep0046.c
index 6c82bde..bcd5646 100644
--- a/board/isee/igep0046/igep0046.c
+++ b/board/isee/igep0046/igep0046.c
@@ -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