Merge branch '2020-06-15-misc-bugfixes'
[oweals/u-boot.git] / drivers / net / dwc_eth_qos.c
index e4fc76cc06848d2ad82732499c8f73b3202fb838..3f4437069babb5669936e8d4ec75203ccdb1ede3 100644 (file)
@@ -31,6 +31,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <miiphy.h>
@@ -39,6 +40,7 @@
 #include <phy.h>
 #include <reset.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <eth_phy.h>
@@ -46,6 +48,8 @@
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/sys_proto.h>
 #endif
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* Core registers */
 
@@ -1145,6 +1149,16 @@ static int eqos_write_hwaddr(struct udevice *dev)
        return 0;
 }
 
+static int eqos_read_rom_hwaddr(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+#ifdef CONFIG_ARCH_IMX8M
+       imx_get_mac_from_fuse(dev->req_seq, pdata->enetaddr);
+#endif
+       return !is_valid_ethaddr(pdata->enetaddr);
+}
+
 static int eqos_start(struct udevice *dev)
 {
        struct eqos_priv *eqos = dev_get_priv(dev);
@@ -2066,6 +2080,7 @@ static const struct eth_ops eqos_ops = {
        .recv = eqos_recv,
        .free_pkt = eqos_free_pkt,
        .write_hwaddr = eqos_write_hwaddr,
+       .read_rom_hwaddr        = eqos_read_rom_hwaddr,
 };
 
 static struct eqos_ops eqos_tegra186_ops = {