[PATCH 1/5] imx_fec: Allow driver clients to supply MAC address

Marc Reilly marc at cpdesign.com.au
Sun Jul 15 21:04:55 EDT 2012


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 at 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




More information about the barebox mailing list