All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/7] dm: net: fec: Add .read_rom_hwaddr
Date: Wed,  9 Nov 2016 17:19:59 +0530	[thread overview]
Message-ID: <1478692203-4442-4-git-send-email-jagan@openedev.com> (raw)
In-Reply-To: <1478692203-4442-1-git-send-email-jagan@openedev.com>

From: Jagan Teki <jagan@amarulasolutions.com>

Add .read_rom_hwaddr on dm eth_ops.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/net/fec_mxc.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 367bc40..09433df 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -348,12 +348,6 @@ static void fec_rbd_clean(int last, struct fec_bd *prbd)
 	writew(0, &prbd->data_length);
 }
 
-static int fec_get_hwaddr(int dev_id, unsigned char *mac)
-{
-	imx_get_mac_from_fuse(dev_id, mac);
-	return !is_valid_ethaddr(mac);
-}
-
 static int _fec_set_hwaddr(struct fec_priv *fec, uchar *mac)
 {
 	writel(0, &fec->eth->iaddr1);
@@ -975,6 +969,12 @@ static int fec_init(struct eth_device *dev, bd_t *bd)
 	return _fec_init(fec, mac);
 }
 
+static int fec_get_hwaddr(int dev_id, unsigned char *mac)
+{
+	imx_get_mac_from_fuse(dev_id, mac);
+	return !is_valid_ethaddr(mac);
+}
+
 #ifdef CONFIG_PHYLIB
 int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 		struct mii_dev *bus, struct phy_device *phydev)
@@ -1128,6 +1128,16 @@ int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int))
 
 #else
 
+static int fec_read_rom_mac(struct udevice *dev)
+{
+	struct fec_priv *fec = dev_get_priv(dev);
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+
+	imx_get_mac_from_fuse(fec->dev_id, pdata->enetaddr);
+
+	return 0;
+}
+
 static int fec_set_hwaddr(struct udevice *dev)
 {
 	struct fec_priv *fec = dev_get_priv(dev);
@@ -1175,6 +1185,7 @@ static const struct eth_ops fecmxc_ops = {
 	.recv			= fec_recv,
 	.stop			= fec_halt,
 	.write_hwaddr		= fec_set_hwaddr,
+	.read_rom_hwaddr	= fec_read_rom_mac,
 };
 
 static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)
@@ -1204,7 +1215,6 @@ static int fecmxc_probe(struct udevice *dev)
 	struct fec_priv *priv = dev_get_priv(dev);
 	struct mii_dev *bus = NULL;
 	int dev_id = -1;
-	unsigned char ethaddr[6];
 	uint32_t start;
 	int ret;
 
@@ -1238,14 +1248,6 @@ static int fecmxc_probe(struct udevice *dev)
 	fec_reg_setup(priv);
 	priv->dev_id = (dev_id == -1) ? 0 : dev_id;
 
-	ret = fec_get_hwaddr(dev_id, ethaddr);
-	if (!ret) {
-		debug("got MAC%d address from fuse: %pM\n", dev_id, ethaddr);
-		memcpy(pdata->enetaddr, ethaddr, 6);
-		if (!getenv("ethaddr"))
-			eth_setenv_enetaddr("ethaddr", ethaddr);
-	}
-
 	return 0;
 
 err_timeout:
-- 
1.9.1

  parent reply	other threads:[~2016-11-09 11:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 11:49 [U-Boot] [PATCH v2 0/7] imx6: Add Engicam GEAM6UL/i.CoreM6 RQS board support Jagan Teki
2016-11-09 11:49 ` [U-Boot] [PATCH v2 1/7] arm: dts: Add devicetree for i.MX6UL Jagan Teki
2016-11-09 11:49 ` [U-Boot] [PATCH v2 2/7] arm: imx6ul: Add Engicam GEAM6UL Starter Kit initial support Jagan Teki
2016-11-09 11:49 ` Jagan Teki [this message]
2016-11-09 11:50 ` [U-Boot] [PATCH v2 4/7] net: fec: Zap local mac variable Jagan Teki
2016-11-09 11:50 ` [U-Boot] [PATCH v2 5/7] arm: imx6q: Add Engicam i.CoreM6 Quad/Dual RQS Starter Kit initial support Jagan Teki
2016-11-09 11:50 ` [U-Boot] [PATCH v2 6/7] arm: imx6q: Add Engicam i.CoreM6 Solo/Duallite " Jagan Teki
2016-11-09 11:50 ` [U-Boot] [PATCH v2 7/7] imx6: icorem6: Rename engicam icorem6 defconfig files Jagan Teki

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=1478692203-4442-4-git-send-email-jagan@openedev.com \
    --to=jagan@openedev.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.