aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smsc911x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smsc911x.c')
-rw-r--r--drivers/net/smsc911x.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 27d2d7c45519..6e175e5555a1 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1742,6 +1742,21 @@ static const struct net_device_ops smsc911x_netdev_ops = {
1742#endif 1742#endif
1743}; 1743};
1744 1744
1745/* copies the current mac address from hardware to dev->dev_addr */
1746static void __devinit smsc911x_read_mac_address(struct net_device *dev)
1747{
1748 struct smsc911x_data *pdata = netdev_priv(dev);
1749 u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH);
1750 u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL);
1751
1752 dev->dev_addr[0] = (u8)(mac_low32);
1753 dev->dev_addr[1] = (u8)(mac_low32 >> 8);
1754 dev->dev_addr[2] = (u8)(mac_low32 >> 16);
1755 dev->dev_addr[3] = (u8)(mac_low32 >> 24);
1756 dev->dev_addr[4] = (u8)(mac_high16);
1757 dev->dev_addr[5] = (u8)(mac_high16 >> 8);
1758}
1759
1745/* Initializing private device structures, only called from probe */ 1760/* Initializing private device structures, only called from probe */
1746static int __devinit smsc911x_init(struct net_device *dev) 1761static int __devinit smsc911x_init(struct net_device *dev)
1747{ 1762{
@@ -1829,6 +1844,12 @@ static int __devinit smsc911x_init(struct net_device *dev)
1829 SMSC_WARNING(PROBE, 1844 SMSC_WARNING(PROBE,
1830 "This driver is not intended for this chip revision"); 1845 "This driver is not intended for this chip revision");
1831 1846
1847 /* workaround for platforms without an eeprom, where the mac address
1848 * is stored elsewhere and set by the bootloader. This saves the
1849 * mac address before resetting the device */
1850 if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS)
1851 smsc911x_read_mac_address(dev);
1852
1832 /* Reset the LAN911x */ 1853 /* Reset the LAN911x */
1833 if (smsc911x_soft_reset(pdata)) 1854 if (smsc911x_soft_reset(pdata))
1834 return -ENODEV; 1855 return -ENODEV;
@@ -2009,14 +2030,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2009 } else { 2030 } else {
2010 /* Try reading mac address from device. if EEPROM is present 2031 /* Try reading mac address from device. if EEPROM is present
2011 * it will already have been set */ 2032 * it will already have been set */
2012 u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH); 2033 smsc911x_read_mac_address(dev);
2013 u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL);
2014 dev->dev_addr[0] = (u8)(mac_low32);
2015 dev->dev_addr[1] = (u8)(mac_low32 >> 8);
2016 dev->dev_addr[2] = (u8)(mac_low32 >> 16);
2017 dev->dev_addr[3] = (u8)(mac_low32 >> 24);
2018 dev->dev_addr[4] = (u8)(mac_high16);
2019 dev->dev_addr[5] = (u8)(mac_high16 >> 8);
2020 2034
2021 if (is_valid_ether_addr(dev->dev_addr)) { 2035 if (is_valid_ether_addr(dev->dev_addr)) {
2022 /* eeprom values are valid so use them */ 2036 /* eeprom values are valid so use them */