aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/drivers/net
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-07-22 16:35:29 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-07-22 16:35:29 +0000
commit7564923517979268f311d5d45fa97b11ecdad7db (patch)
tree491bb39aedecd5829591fe3d4492070e50f549ab /target/linux/ar71xx/files/drivers/net
parent4e9e2cba408541afd1058d4a778eef1ffca23dc9 (diff)
downloadupstream-7564923517979268f311d5d45fa97b11ecdad7db.tar.gz
upstream-7564923517979268f311d5d45fa97b11ecdad7db.tar.bz2
upstream-7564923517979268f311d5d45fa97b11ecdad7db.zip
parse mac address on RouterBOARDs
SVN-Revision: 11910
Diffstat (limited to 'target/linux/ar71xx/files/drivers/net')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h3
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c15
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) {