netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm9000: Support MAC address setting through platform data.
@ 2008-07-23 15:41 Laurent Pinchart
  2008-07-25  9:05 ` Ben Dooks
  2008-08-07  6:24 ` Jeff Garzik
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2008-07-23 15:41 UTC (permalink / raw)
  To: netdev; +Cc: Ben Dooks

The dm9000 driver reads the chip's MAC address from the attached EEPROM. When
no EEPROM is present, or when the MAC address is invalid, it falls back to
reading the address from the chip.

This patch lets platform code set the desired MAC address through platform
data.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 drivers/net/dm9000.c   |    3 +++
 include/linux/dm9000.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 864295e..6bc8924 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -716,6 +716,11 @@ dm9000_probe(struct platform_device *pdev)
 	for (i = 0; i < 6; i += 2)
 		dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
 
+	if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
+		mac_src = "platform data";
+		memcpy(ndev->dev_addr, pdata->dev_addr, 6);
+	}
+
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		/* try reading from mac */
 		
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index a375046..4fb49a4 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -26,6 +26,7 @@
 
 struct dm9000_plat_data {
 	unsigned int	flags;
+	unsigned char	dev_addr[6];
 
 	/* allow replacement IO routines */
 
-- 
1.5.0

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-07  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 15:41 [PATCH] dm9000: Support MAC address setting through platform data Laurent Pinchart
2008-07-25  9:05 ` Ben Dooks
2008-07-25  9:23   ` Laurent Pinchart
2008-08-07  6:24 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).