From patchwork Tue Apr 28 03:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 238708 List-Id: U-Boot discussion From: peng.fan at nxp.com (Peng Fan) Date: Tue, 28 Apr 2020 11:02:28 +0800 Subject: [PATCH 8/8] eQos: Implement the read_rom_hwaddr callback In-Reply-To: <20200428030228.19964-1-peng.fan@nxp.com> References: <20200428030228.19964-1-peng.fan@nxp.com> Message-ID: <20200428030228.19964-9-peng.fan@nxp.com> From: Ye Li Implement the read_rom_hwaddr callback to load MAC address from fuse for imx8m platforms. Reviewed-by: Fugang Duan Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/net/dwc_eth_qos.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 85afaf124c..37b279af35 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -43,6 +43,9 @@ #include #include #include +#ifdef CONFIG_ARCH_IMX8M +#include +#endif /* Core registers */ @@ -1134,6 +1137,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); @@ -2047,6 +2060,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 = {