summaryrefslogtreecommitdiff
path: root/board/liebherr
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2018-05-11 16:51:14 +0200
committerStefano Babic <sbabic@denx.de>2018-06-18 15:44:21 +0200
commitc451713abf10db335cabe41099e8b28481a723b7 (patch)
tree43fc06a416b3cbbef878670ef980e7b087ea000e /board/liebherr
parentea4584d73d731c49cc838cae3955a2ef92d5eff7 (diff)
downloadu-boot-c451713abf10db335cabe41099e8b28481a723b7.tar.gz
u-boot-c451713abf10db335cabe41099e8b28481a723b7.tar.bz2
u-boot-c451713abf10db335cabe41099e8b28481a723b7.zip
display5: net: Add function to read ethaddr from iMX6 fuses
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'board/liebherr')
-rw-r--r--board/liebherr/display5/display5.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c
index 4bade476a5..a3deba216c 100644
--- a/board/liebherr/display5/display5.c
+++ b/board/liebherr/display5/display5.c
@@ -254,6 +254,25 @@ static void setup_iomux_enet(void)
gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/
}
+static int setup_mac_from_fuse(void)
+{
+ unsigned char enetaddr[6];
+ int ret;
+
+ ret = eth_env_get_enetaddr("ethaddr", enetaddr);
+ if (ret) /* ethaddr is already set */
+ return 0;
+
+ imx_get_mac_from_fuse(0, enetaddr);
+
+ if (is_valid_ethaddr(enetaddr)) {
+ eth_env_set_enetaddr("ethaddr", enetaddr);
+ return 0;
+ }
+
+ return 0;
+}
+
int board_eth_init(bd_t *bd)
{
struct phy_device *phydev;
@@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd)
if (ret)
return ret;
+ setup_mac_from_fuse();
+
bus = fec_get_miibus(IMX_FEC_BASE, -1);
if (!bus)
return -ENODEV;