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;
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);
*/
bool dh_mac_is_in_env(const char *env);
+/*
+ * dh_get_mac_is_enabled - Test if ethernet MAC is enabled in DT
+ *
+ * @alias: alias for ethernet MAC device tree node
+ * Return: 0 if OK, other value on error
+ */
+int dh_get_mac_is_enabled(const char *alias);
+
/*
* dh_get_mac_from_eeprom - Get MAC address from eeprom and write it to enetaddr
*
if (dh_mac_is_in_env("ethaddr"))
return 0;
+ if (dh_get_mac_is_enabled("ethernet0"))
+ return 0;
+
if (!dh_imx_get_mac_from_fuse(enetaddr))
goto out;
if (dh_mac_is_in_env("ethaddr"))
return 0;
+ if (dh_get_mac_is_enabled("ethernet0"))
+ return 0;
+
if (!dh_imx_get_mac_from_fuse(enetaddr))
goto out;
if (dh_mac_is_in_env("eth1addr"))
return 0;
+ if (dh_get_mac_is_enabled("ethernet1"))
+ return 0;
+
if (!dh_imx_get_mac_from_fuse(enetaddr))
goto increment_out;
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);
if (dh_mac_is_in_env("eth1addr"))
return 0;
+ if (dh_get_mac_is_enabled("ethernet1"))
+ return 0;
+
if (dh_stm32_mac_is_in_ks8851())
return 0;