dm9000: Support MAC address setting through platform data.
authorLaurent Pinchart <laurentp@cse-semaphore.com>
Wed, 23 Jul 2008 15:41:52 +0000 (17:41 +0200)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 7 Aug 2008 06:22:54 +0000 (02:22 -0400)
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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/dm9000.c
include/linux/dm9000.h

index 0b0f1c407a7e87568c3f1f6f807208fe64ab4f46..f42c23f426522aff9f08ecb266925f22f82afc36 100644 (file)
@@ -1374,6 +1374,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 */
                
index fc82446b64255d7fe7c16ba9edb67c2d049b9bf4..c30879cf93bc7f522f25579d3e7fbbc59ae60e00 100644 (file)
@@ -27,6 +27,7 @@
 
 struct dm9000_plat_data {
        unsigned int    flags;
+       unsigned char   dev_addr[6];
 
        /* allow replacement IO routines */