net: smsc911x: allow platform_data to specify mac address
authorManuel Lauss <manuel.lauss@googlemail.com>
Tue, 13 Oct 2009 07:25:49 +0000 (07:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Oct 2009 18:48:32 +0000 (11:48 -0700)
Extend the driver to accept a MAC address specified in platform_data.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/smsc911x.c
include/linux/smsc911x.h

index ccdd196f5297952f993291819e1d65b5526402b0..6a9f51d1d9f29a772c491f94cba4c04e88e7385e 100644 (file)
@@ -2071,6 +2071,9 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
        if (is_valid_ether_addr(dev->dev_addr)) {
                smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
                SMSC_TRACE(PROBE, "MAC Address is specified by configuration");
+       } else if (is_valid_ether_addr(pdata->config.mac)) {
+               memcpy(dev->dev_addr, pdata->config.mac, 6);
+               SMSC_TRACE(PROBE, "MAC Address specified by platform data");
        } else {
                /* Try reading mac address from device. if EEPROM is present
                 * it will already have been set */
index 5241e4fb4ecad02ce47bdcfbf2c6efb6b7953e98..7144e8aa1e41a1fb6187260362296214df4f0c10 100644 (file)
@@ -30,6 +30,7 @@ struct smsc911x_platform_config {
        unsigned int irq_type;
        unsigned int flags;
        phy_interface_t phy_interface;
+       unsigned char mac[6];
 };
 
 /* Constants for platform_device irq polarity configuration */