summaryrefslogtreecommitdiff
path: root/board/dhelectronics/common/dh_common.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-04-05 17:23:58 -0400
committerTom Rini <trini@konsulko.com>2024-04-05 17:23:58 -0400
commit9cba29b19f43f9450117e8bc89e7dda691ed5ab5 (patch)
tree548bda96c5a6e2756e6a4de3a297630fc5022f57 /board/dhelectronics/common/dh_common.c
parenteff62097f67639b6d935d07b23543aa82468bc5b (diff)
parentf6be41c83c17c09dddfb1e29a7ca391b5190634d (diff)
Merge tag 'u-boot-imx-master-20240405' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/20228 - Convert imx8mp-beacon and verdin-imx8mm/verdin-imx8mp to OF_UPSTREAM. - Enable PCIe NVMe support on imx8mp_beacon. - Fix Ethernet and board detection on mx6cuboxi. - Fix signature_block_hdr struct fields. - Fix imx9_probe_mu prototype and make it to get called in EVT_DM_POST_INIT_R. - Test whether ethernet node is enabled before reading MAC EEPROM on DHSOM SoMs.
Diffstat (limited to 'board/dhelectronics/common/dh_common.c')
-rw-r--r--board/dhelectronics/common/dh_common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/board/dhelectronics/common/dh_common.c b/board/dhelectronics/common/dh_common.c
index 67e3d59b1f3..34094a020b0 100644
--- a/board/dhelectronics/common/dh_common.c
+++ b/board/dhelectronics/common/dh_common.c
@@ -18,6 +18,19 @@ bool dh_mac_is_in_env(const char *env)
return eth_env_get_enetaddr(env, enetaddr);
}
+int dh_get_mac_is_enabled(const char *alias)
+{
+ ofnode node = ofnode_path(alias);
+
+ if (!ofnode_valid(node))
+ return -EINVAL;
+
+ if (!ofnode_is_enabled(node))
+ return -ENODEV;
+
+ return 0;
+}
+
int dh_get_mac_from_eeprom(unsigned char *enetaddr, const char *alias)
{
struct udevice *dev;
@@ -57,6 +70,9 @@ __weak int dh_setup_mac_address(void)
if (dh_mac_is_in_env("ethaddr"))
return 0;
+ if (dh_get_mac_is_enabled("ethernet0"))
+ return 0;
+
if (!dh_get_mac_from_eeprom(enetaddr, "eeprom0"))
return eth_env_set_enetaddr("ethaddr", enetaddr);