diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2008-07-22 16:35:29 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2008-07-22 16:35:29 +0000 |
commit | 9abc8423dd78f63680408dd2b596ca54d455f4c5 (patch) | |
tree | 72b20fe8f441dfc8296daa2ccd6b22b2fc413d03 /target/linux/ar71xx/files/drivers | |
parent | d5bfda61098e5ddd05dc84bf1178e600877040b0 (diff) | |
download | upstream-9abc8423dd78f63680408dd2b596ca54d455f4c5.tar.gz upstream-9abc8423dd78f63680408dd2b596ca54d455f4c5.tar.bz2 upstream-9abc8423dd78f63680408dd2b596ca54d455f4c5.zip |
[ar71xx] parse mac address on RouterBOARDs
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11910 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/drivers')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h | 3 | ||||
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c | 15 |
2 files changed, 13 insertions, 5 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h index e22a7e6d3a..247667dc8e 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h @@ -18,6 +18,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> +#include <linux/random.h> #include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/platform_device.h> @@ -35,7 +36,7 @@ #define ETH_FCS_LEN 4 #define AG71XX_DRV_NAME "ag71xx" -#define AG71XX_DRV_VERSION "0.3.9" +#define AG71XX_DRV_VERSION "0.3.10" #define AG71XX_NAPI_TX 1 diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c index d4eebda054..065f6033ab 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c @@ -692,13 +692,14 @@ static void ag71xx_set_multicast_list(struct net_device *dev) static int __init ag71xx_probe(struct platform_device *pdev) { - static u8 default_mac[ETH_ALEN] = {0x00, 0xba, 0xdb, 0xad, 0xba, 0xd0}; struct net_device *dev; struct resource *res; struct ag71xx *ag; + struct ag71xx_platform_data *pdata; int err; - if (!pdev->dev.platform_data) { + pdata = pdev->dev.platform_data; + if (!pdata) { dev_err(&pdev->dev, "no platform data specified\n"); err = -ENXIO; goto err_out; @@ -765,8 +766,14 @@ static int __init ag71xx_probe(struct platform_device *pdev) netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); - memcpy(dev->dev_addr, default_mac, ETH_ALEN); - dev->dev_addr[5] += pdev->id & 0xff; + if (is_valid_ether_addr(pdata->mac_addr)) + memcpy(dev->dev_addr, pdata->mac_addr, ETH_ALEN); + else { + dev->dev_addr[0] = 0xde; + dev->dev_addr[1] = 0xad; + get_random_bytes(&dev->dev_addr[2], 3); + dev->dev_addr[5] = pdev->id & 0xff; + } err = register_netdev(dev); if (err) { |