summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/drivers
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-22 16:35:29 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-22 16:35:29 +0000
commit4ae7cc9ab528f52c7656ed71341826b660e9df50 (patch)
tree72b20fe8f441dfc8296daa2ccd6b22b2fc413d03 /target/linux/ar71xx/files/drivers
parentb8eb82f5d313a3cedf348e33f475893107cd464f (diff)
[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.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 e22a7e6d3..247667dc8 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 d4eebda05..065f6033a 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) {