mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Reilly <marc@cpdesign.com.au>
To: barebox@lists.infradead.org
Subject: [PATCH 1/5] imx_fec: Allow driver clients to supply MAC address
Date: Mon, 16 Jul 2012 11:04:55 +1000	[thread overview]
Message-ID: <1342400699-6753-2-git-send-email-marc@cpdesign.com.au> (raw)
In-Reply-To: <1342400699-6753-1-git-send-email-marc@cpdesign.com.au>

This patch adds a handler to the fec platform data to get MAC address.
If a handler is not specified the driver uses the existing one.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 drivers/net/fec_imx.c |    6 +++++-
 include/fec.h         |    4 ++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 599a9b4..5084758 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -629,10 +629,14 @@ static int fec_probe(struct device_d *dev)
 	edev->send = fec_send;
 	edev->recv = fec_recv;
 	edev->halt = fec_halt;
-	edev->get_ethaddr = fec_get_hwaddr;
 	edev->set_ethaddr = fec_set_hwaddr;
 	edev->parent = dev;
 
+	if (pdata->get_hwaddr)
+		edev->get_ethaddr = pdata->get_hwaddr;
+	else
+		edev->get_ethaddr = fec_get_hwaddr;
+
 	fec->regs = dev_request_mem_region(dev, 0);
 
 	/* Reset chip. */
diff --git a/include/fec.h b/include/fec.h
index f56b023..5072bbf 100644
--- a/include/fec.h
+++ b/include/fec.h
@@ -36,6 +36,8 @@ typedef enum {
 	RGMII,
 } xceiver_type;
 
+struct eth_device;
+
 /*
  * Define the phy connected externally for FEC drivers
  * (like MPC52xx and i.MX27)
@@ -43,6 +45,8 @@ typedef enum {
 struct fec_platform_data {
         xceiver_type	xcv_type;
 	int		phy_addr;
+
+	int (*get_hwaddr)(struct eth_device *dev, unsigned char *mac);
 };
 
 #endif /* __INCLUDE_NETWORK_FEC_H */
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-07-16  1:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16  1:04 Various patches for imx35, fec, at24 driver and misc Marc Reilly
2012-07-16  1:04 ` Marc Reilly [this message]
2012-07-16  7:43   ` [PATCH 1/5] imx_fec: Allow driver clients to supply MAC address Sascha Hauer
2012-07-16  1:04 ` [PATCH 2/5] imx35: 6-bit divider helper Marc Reilly
2012-07-16  1:04 ` [PATCH 3/5] imx35: mmc clock has 6 bit divider, not 3_3 Marc Reilly
2012-07-16  1:04 ` [PATCH 4/5] at24: add I2C eeprom for 24cl02 Marc Reilly
2012-07-16  7:49   ` Sascha Hauer
2012-07-16  1:04 ` [PATCH 5/5] misc: new driver: isl22316 digital potentiometer Marc Reilly

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=1342400699-6753-2-git-send-email-marc@cpdesign.com.au \
    --to=marc@cpdesign.com.au \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox