aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiviu Dudau <Liviu.Dudau@arm.com>2015-02-25 18:44:02 +0000
committerAmit Daniel Kachhap <amit.kachhap@arm.com>2018-07-10 15:36:16 +0530
commitd891221ca2e2b3f7cc34ac960be66c2d7cbfac47 (patch)
tree1753c7a7c1e447fa6bd3edecf702763a069c7e3c
parentfb2ba8a2991addda32e51a1e9ff6805e91dc6880 (diff)
sky2: Add module parameter for passing the MAC address
For designs where EEPROMs are not connected to PCI Yukon2 chips we need to get the MAC address from the firmware. Add a module parameter called 'mac_address' for this. It will be used if no DT node can be found and the B2_MAC register holds an invalid value. Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--drivers/net/ethernet/marvell/sky2.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 697d9b374f5e..d3ee080601f8 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -101,6 +101,10 @@ static int legacy_pme = 0;
module_param(legacy_pme, int, 0);
MODULE_PARM_DESC(legacy_pme, "Legacy power management");
+/* Ugh! Let the firmware tell us the hardware address */
+static int mac_address[ETH_ALEN] = { 0, };
+module_param_array(mac_address, int, NULL, 0);
+
static const struct pci_device_id sky2_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */
{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
@@ -4819,13 +4823,21 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
/* try to get mac address in the following order:
* 1) from device tree data
* 2) from internal registers set by bootloader
+ * 3) from the command line parameter
*/
iap = of_get_mac_address(hw->pdev->dev.of_node);
if (iap)
memcpy(dev->dev_addr, iap, ETH_ALEN);
- else
+ else {
memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
ETH_ALEN);
+ if (!is_valid_ether_addr(&dev->dev_addr[0])) {
+ int i;
+
+ for (i = 0; i < ETH_ALEN; i++)
+ dev->dev_addr[i] = mac_address[i];
+ }
+ }
/* if the address is invalid, use a random value */
if (!is_valid_ether_addr(dev->dev_addr)) {