diff options
author | Manoj Chourasia <mchourasia@nvidia.com> | 2012-02-12 19:48:06 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-06-13 17:04:08 -0700 |
commit | 0ae1f6fa449f8d2becd04df6d7348b42ab67e594 (patch) | |
tree | 843d6388e5a54b32a950d6a88681ba2d96a443ba /drivers/net | |
parent | 1978979940fe486b957dac024d30a70ea817e1fd (diff) |
smsc95xx: Add module params to read MAC address
This patch adds support for mac_addr module param
mac_addr : MAC address which will be assigned to the
above device. example
mac_addr=0x0,0x2,0x2,0x3,0x3,0x4
If EEPROM read fails for MAC address for a smsc
interface and if the mac_addr module param is set
then driver will set that device MAC address provided
in mac_addr. This can be set for only one device
bug 719410, bug 921146
Change-Id: I6eb0363951d91fad857b76af8a4a097cd0fb7623
Signed-off-by: Manoj Chourasia <mchourasia@nvidia.com>
Reviewed-on: http://git-master/r/108237
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 7b4687974987..370846911800 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1,7 +1,7 @@ /*************************************************************************** * * Copyright (C) 2007-2008 SMSC - * + * Copyright (C) 2012 NVIDIA Corporation. * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -63,6 +63,11 @@ static int turbo_mode = true; module_param(turbo_mode, bool, 0644); MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); +static u8 mac_addr[6] = {0}; +static bool smsc_mac_addr_set; +module_param_array_named(mac_addr, mac_addr, byte, NULL, 0); +MODULE_PARM_DESC(mac_addr, "SMSC command line MAC address"); + static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data) { u32 *buf = kmalloc(4, GFP_KERNEL); @@ -612,6 +617,15 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) } } + /* try reading mac address from command line */ + if (is_valid_ether_addr(mac_addr) && !smsc_mac_addr_set) { + memcpy(dev->net->dev_addr, mac_addr, sizeof(mac_addr)); + smsc_mac_addr_set = true; + netif_dbg(dev, ifup, dev->net, + "MAC address read from command line"); + return; + } + /* no eeprom, or eeprom values are invalid. generate random MAC */ random_ether_addr(dev->net->dev_addr); netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n"); |