All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [PATCH 8/8] eQos: Implement the read_rom_hwaddr callback
Date: Tue, 28 Apr 2020 11:02:28 +0800	[thread overview]
Message-ID: <20200428030228.19964-9-peng.fan@nxp.com> (raw)
In-Reply-To: <20200428030228.19964-1-peng.fan@nxp.com>

From: Ye Li <ye.li@nxp.com>

Implement the read_rom_hwaddr callback to load MAC address from fuse
for imx8m platforms.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 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 <asm/gpio.h>
 #include <asm/io.h>
 #include <eth_phy.h>
+#ifdef CONFIG_ARCH_IMX8M
+#include <asm/mach-imx/sys_proto.h>
+#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 = {
-- 
2.16.4

      parent reply	other threads:[~2020-04-28  3:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  3:02 [PATCH 0/8] net: several updates to support i.MX Peng Fan
2020-04-28  3:02 ` [PATCH 1/8] net: eth-uclass: add return value check Peng Fan
2020-04-28  3:02 ` [PATCH 2/8] net: Add eth phy generic driver for shared MDIO Peng Fan
2020-04-28  3:02 ` [PATCH 3/8] net: Update eQos driver and FEC driver to use eth phy interfaces Peng Fan
2020-04-28  3:02 ` [PATCH 4/8] net: phy: realtek: add rx delay support for RTL8211F Peng Fan
2020-04-28  3:02 ` [PATCH 5/8] net: dwc_eth_qos: add dwc eqos for imx support Peng Fan
2021-05-04 22:07   ` Daniil Stas
2020-04-28  3:02 ` [PATCH 6/8] net: eqos: implement callbaks to get interface and set txclk rate Peng Fan
2020-04-28  3:02 ` [PATCH 7/8] fec: Move imx_get_mac_from_fuse declare to imx file Peng Fan
2020-04-28  3:02 ` Peng Fan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428030228.19964-9-peng.fan@nxp.com \
    --to=peng.fan@nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.