Commit 67fca028 authored by Daniel Mack's avatar Daniel Mack Committed by David S. Miller

ax88796: Add method to take MAC from platform data

Implement a way to provide the MAC address for ax88796 devices from
their platform data. Boards might decide to set the address
programmatically, taken from boot tags or other sources.
Signed-off-by: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47cb0355
...@@ -733,12 +733,19 @@ static int ax_init_dev(struct net_device *dev, int first_init) ...@@ -733,12 +733,19 @@ static int ax_init_dev(struct net_device *dev, int first_init)
/* load the mac-address from the device if this is the /* load the mac-address from the device if this is the
* first time we've initialised */ * first time we've initialised */
if (first_init && ax->plat->flags & AXFLG_MAC_FROMDEV) { if (first_init) {
if (ax->plat->flags & AXFLG_MAC_FROMDEV) {
ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
ei_local->mem + E8390_CMD); /* 0x61 */ ei_local->mem + E8390_CMD); /* 0x61 */
for (i = 0; i < ETHER_ADDR_LEN; i++)
dev->dev_addr[i] =
ei_inb(ioaddr + EN1_PHYS_SHIFT(i));
}
for (i = 0 ; i < ETHER_ADDR_LEN ; i++) if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
dev->dev_addr[i] = ei_inb(ioaddr + EN1_PHYS_SHIFT(i)); ax->plat->mac_addr)
memcpy(dev->dev_addr, ax->plat->mac_addr,
ETHER_ADDR_LEN);
} }
ax_reset_8390(dev); ax_reset_8390(dev);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define AXFLG_HAS_EEPROM (1<<0) #define AXFLG_HAS_EEPROM (1<<0)
#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ #define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */
#define AXFLG_MAC_FROMPLATFORM (1<<3) /* MAC given by platform data */
struct ax_plat_data { struct ax_plat_data {
unsigned int flags; unsigned int flags;
...@@ -23,6 +24,8 @@ struct ax_plat_data { ...@@ -23,6 +24,8 @@ struct ax_plat_data {
unsigned char rcr_val; /* default value for RCR */ unsigned char rcr_val; /* default value for RCR */
unsigned char gpoc_val; /* default value for GPOC */ unsigned char gpoc_val; /* default value for GPOC */
u32 *reg_offsets; /* register offsets */ u32 *reg_offsets; /* register offsets */
u8 *mac_addr; /* MAC addr (only used when
AXFLG_MAC_FROMPLATFORM is used */
}; };
#endif /* __NET_AX88796_PLAT_H */ #endif /* __NET_AX88796_PLAT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment