summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ti/tlan.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2014-06-30 20:38:30 +0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 04:06:51 +0400
commit59be4ad6bb01fa80b6ad2cf15163ccb617f7d603 (patch)
tree73ebd5cedb349998a2ee6d47a4cb8815bcf0bc06 /drivers/net/ethernet/ti/tlan.c
parente36124d464d5ba74a171385ac1ba93acf4343de4 (diff)
downloadlinux-59be4ad6bb01fa80b6ad2cf15163ccb617f7d603.tar.xz
tlan: Fix MAC address byte order on OC-2325/OC-2326
Olicom OC-2325 and OC-2326 cards have the MAC address byte-swapped in EEPROM. Byte-swap the MAC address if it's located at offset 0xF8. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/tlan.c')
-rw-r--r--drivers/net/ethernet/ti/tlan.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index 00ec926084ea..cacc76da91a2 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -863,7 +863,7 @@ static int tlan_init(struct net_device *dev)
priv->rx_list_dma + sizeof(struct tlan_list)*TLAN_NUM_RX_LISTS;
err = 0;
- for (i = 0; i < 6 ; i++)
+ for (i = 0; i < ETH_ALEN; i++)
err |= tlan_ee_read_byte(dev,
(u8) priv->adapter->addr_ofs + i,
(u8 *) &dev->dev_addr[i]);
@@ -871,7 +871,14 @@ static int tlan_init(struct net_device *dev)
pr_err("%s: Error reading MAC from eeprom: %d\n",
dev->name, err);
}
- dev->addr_len = 6;
+ /* Olicom OC-2325/OC-2326 have the address byte-swapped */
+ if (priv->adapter->addr_ofs == 0xf8) {
+ for (i = 0; i < ETH_ALEN; i += 2) {
+ char tmp = dev->dev_addr[i];
+ dev->dev_addr[i] = dev->dev_addr[i + 1];
+ dev->dev_addr[i + 1] = tmp;
+ }
+ }
netif_carrier_off(dev);