Commit ca879317 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethernet: tulip: remove direct netdev->dev_addr writes

Consify the casts of netdev->dev_addr.

Convert pointless to eth_hw_addr_set() where possible.

Use local buffers in a number of places.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a04436b2
...@@ -666,8 +666,8 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) ...@@ -666,8 +666,8 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
struct de_private *de = netdev_priv(dev); struct de_private *de = netdev_priv(dev);
u16 hash_table[32]; u16 hash_table[32];
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
const u16 *eaddrs;
int i; int i;
u16 *eaddrs;
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
__set_bit_le(255, hash_table); /* Broadcast entry */ __set_bit_le(255, hash_table); /* Broadcast entry */
...@@ -685,7 +685,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) ...@@ -685,7 +685,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
setup_frm = &de->setup_frame[13*6]; setup_frm = &de->setup_frame[13*6];
/* Fill the final entry with our physical address. */ /* Fill the final entry with our physical address. */
eaddrs = (u16 *)dev->dev_addr; eaddrs = (const u16 *)dev->dev_addr;
*setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0];
*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
...@@ -695,7 +695,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) ...@@ -695,7 +695,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
{ {
struct de_private *de = netdev_priv(dev); struct de_private *de = netdev_priv(dev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u16 *eaddrs; const u16 *eaddrs;
/* We have <= 14 addresses so we can use the wonderful /* We have <= 14 addresses so we can use the wonderful
16 address perfect filtering of the Tulip. */ 16 address perfect filtering of the Tulip. */
...@@ -710,7 +710,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) ...@@ -710,7 +710,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
setup_frm = &de->setup_frame[15*6]; setup_frm = &de->setup_frame[15*6];
/* Fill the final entry with our physical address. */ /* Fill the final entry with our physical address. */
eaddrs = (u16 *)dev->dev_addr; eaddrs = (const u16 *)dev->dev_addr;
*setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0];
*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
...@@ -1713,6 +1713,7 @@ static const struct ethtool_ops de_ethtool_ops = { ...@@ -1713,6 +1713,7 @@ static const struct ethtool_ops de_ethtool_ops = {
static void de21040_get_mac_address(struct de_private *de) static void de21040_get_mac_address(struct de_private *de)
{ {
u8 addr[ETH_ALEN];
unsigned i; unsigned i;
dw32 (ROMCmd, 0); /* Reset the pointer with a dummy write. */ dw32 (ROMCmd, 0); /* Reset the pointer with a dummy write. */
...@@ -1724,12 +1725,13 @@ static void de21040_get_mac_address(struct de_private *de) ...@@ -1724,12 +1725,13 @@ static void de21040_get_mac_address(struct de_private *de)
value = dr32(ROMCmd); value = dr32(ROMCmd);
rmb(); rmb();
} while (value < 0 && --boguscnt > 0); } while (value < 0 && --boguscnt > 0);
de->dev->dev_addr[i] = value; addr[i] = value;
udelay(1); udelay(1);
if (boguscnt <= 0) if (boguscnt <= 0)
pr_warn("timeout reading 21040 MAC address byte %u\n", pr_warn("timeout reading 21040 MAC address byte %u\n",
i); i);
} }
eth_hw_addr_set(de->dev, addr);
} }
static void de21040_get_media_info(struct de_private *de) static void de21040_get_media_info(struct de_private *de)
...@@ -1821,8 +1823,7 @@ static void de21041_get_srom_info(struct de_private *de) ...@@ -1821,8 +1823,7 @@ static void de21041_get_srom_info(struct de_private *de)
#endif #endif
/* store MAC address */ /* store MAC address */
for (i = 0; i < 6; i ++) eth_hw_addr_set(de->dev, &ee_data[i + sa_offset]);
de->dev->dev_addr[i] = ee_data[i + sa_offset];
/* get offset of controller 0 info leaf. ignore 2nd byte. */ /* get offset of controller 0 info leaf. ignore 2nd byte. */
ofs = ee_data[SROMC0InfoLeaf]; ofs = ee_data[SROMC0InfoLeaf];
......
...@@ -4031,6 +4031,7 @@ get_hw_addr(struct net_device *dev) ...@@ -4031,6 +4031,7 @@ get_hw_addr(struct net_device *dev)
int broken, i, k, tmp, status = 0; int broken, i, k, tmp, status = 0;
u_short j,chksum; u_short j,chksum;
struct de4x5_private *lp = netdev_priv(dev); struct de4x5_private *lp = netdev_priv(dev);
u8 addr[ETH_ALEN];
broken = de4x5_bad_srom(lp); broken = de4x5_bad_srom(lp);
...@@ -4042,28 +4043,30 @@ get_hw_addr(struct net_device *dev) ...@@ -4042,28 +4043,30 @@ get_hw_addr(struct net_device *dev)
if (lp->chipset == DC21040) { if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0); while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_char) tmp; k += (u_char) tmp;
dev->dev_addr[i++] = (u_char) tmp; addr[i++] = (u_char) tmp;
while ((tmp = inl(DE4X5_APROM)) < 0); while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_short) (tmp << 8); k += (u_short) (tmp << 8);
dev->dev_addr[i++] = (u_char) tmp; addr[i++] = (u_char) tmp;
} else if (!broken) { } else if (!broken) {
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++; addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
} else if ((broken == SMC) || (broken == ACCTON)) { } else if ((broken == SMC) || (broken == ACCTON)) {
dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++; addr[i] = *((u_char *)&lp->srom + i); i++;
dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++; addr[i] = *((u_char *)&lp->srom + i); i++;
} }
} else { } else {
k += (u_char) (tmp = inb(EISA_APROM)); k += (u_char) (tmp = inb(EISA_APROM));
dev->dev_addr[i++] = (u_char) tmp; addr[i++] = (u_char) tmp;
k += (u_short) ((tmp = inb(EISA_APROM)) << 8); k += (u_short) ((tmp = inb(EISA_APROM)) << 8);
dev->dev_addr[i++] = (u_char) tmp; addr[i++] = (u_char) tmp;
} }
if (k > 0xffff) k-=0xffff; if (k > 0xffff) k-=0xffff;
} }
if (k == 0xffff) k=0; if (k == 0xffff) k=0;
eth_hw_addr_set(dev, addr);
if (lp->bus == PCI) { if (lp->bus == PCI) {
if (lp->chipset == DC21040) { if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0); while ((tmp = inl(DE4X5_APROM)) < 0);
...@@ -4095,8 +4098,9 @@ get_hw_addr(struct net_device *dev) ...@@ -4095,8 +4098,9 @@ get_hw_addr(struct net_device *dev)
int x = dev->dev_addr[i]; int x = dev->dev_addr[i];
x = ((x & 0xf) << 4) + ((x & 0xf0) >> 4); x = ((x & 0xf) << 4) + ((x & 0xf0) >> 4);
x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2); x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2);
dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1); addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1);
} }
eth_hw_addr_set(dev, addr);
} }
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
...@@ -4158,12 +4162,9 @@ test_bad_enet(struct net_device *dev, int status) ...@@ -4158,12 +4162,9 @@ test_bad_enet(struct net_device *dev, int status)
if ((tmp == 0) || (tmp == 0x5fa)) { if ((tmp == 0) || (tmp == 0x5fa)) {
if ((lp->chipset == last.chipset) && if ((lp->chipset == last.chipset) &&
(lp->bus_num == last.bus) && (lp->bus_num > 0)) { (lp->bus_num == last.bus) && (lp->bus_num > 0)) {
for (i=0; i<ETH_ALEN; i++) dev->dev_addr[i] = last.addr[i]; eth_addr_inc(last.addr);
for (i=ETH_ALEN-1; i>2; --i) { eth_hw_addr_set(dev, last.addr);
dev->dev_addr[i] += 1;
if (dev->dev_addr[i] != 0) break;
}
for (i=0; i<ETH_ALEN; i++) last.addr[i] = dev->dev_addr[i];
if (!an_exception(lp)) { if (!an_exception(lp)) {
dev->irq = last.irq; dev->irq = last.irq;
} }
...@@ -5391,9 +5392,7 @@ de4x5_siocdevprivate(struct net_device *dev, struct ifreq *rq, void __user *data ...@@ -5391,9 +5392,7 @@ de4x5_siocdevprivate(struct net_device *dev, struct ifreq *rq, void __user *data
if (netif_queue_stopped(dev)) if (netif_queue_stopped(dev))
return -EBUSY; return -EBUSY;
netif_stop_queue(dev); netif_stop_queue(dev);
for (i=0; i<ETH_ALEN; i++) { eth_hw_addr_set(dev, tmp.addr);
dev->dev_addr[i] = tmp.addr[i];
}
build_setup_frame(dev, PHYS_ADDR_ONLY); build_setup_frame(dev, PHYS_ADDR_ONLY);
/* Set up the descriptor and give ownership to the card */ /* Set up the descriptor and give ownership to the card */
load_packet(dev, lp->setup_frame, TD_IC | PERFECT_F | TD_SET | load_packet(dev, lp->setup_frame, TD_IC | PERFECT_F | TD_SET |
......
...@@ -476,8 +476,7 @@ static int dmfe_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -476,8 +476,7 @@ static int dmfe_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
/* Set Node address */ /* Set Node address */
for (i = 0; i < 6; i++) eth_hw_addr_set(dev, &db->srom[20 + i]);
dev->dev_addr[i] = db->srom[20 + i];
err = register_netdev (dev); err = register_netdev (dev);
if (err) if (err)
...@@ -1436,9 +1435,9 @@ static void update_cr6(u32 cr6_data, void __iomem *ioaddr) ...@@ -1436,9 +1435,9 @@ static void update_cr6(u32 cr6_data, void __iomem *ioaddr)
static void dm9132_id_table(struct net_device *dev) static void dm9132_id_table(struct net_device *dev)
{ {
const u16 *addrptr = (const u16 *)dev->dev_addr;
struct dmfe_board_info *db = netdev_priv(dev); struct dmfe_board_info *db = netdev_priv(dev);
void __iomem *ioaddr = db->ioaddr + 0xc0; void __iomem *ioaddr = db->ioaddr + 0xc0;
u16 *addrptr = (u16 *)dev->dev_addr;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u16 i, hash_table[4]; u16 i, hash_table[4];
...@@ -1477,7 +1476,7 @@ static void send_filter_frame(struct net_device *dev) ...@@ -1477,7 +1476,7 @@ static void send_filter_frame(struct net_device *dev)
struct dmfe_board_info *db = netdev_priv(dev); struct dmfe_board_info *db = netdev_priv(dev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
struct tx_desc *txptr; struct tx_desc *txptr;
u16 * addrptr; const u16 * addrptr;
u32 * suptr; u32 * suptr;
int i; int i;
...@@ -1487,7 +1486,7 @@ static void send_filter_frame(struct net_device *dev) ...@@ -1487,7 +1486,7 @@ static void send_filter_frame(struct net_device *dev)
suptr = (u32 *) txptr->tx_buf_ptr; suptr = (u32 *) txptr->tx_buf_ptr;
/* Node address */ /* Node address */
addrptr = (u16 *) dev->dev_addr; addrptr = (const u16 *) dev->dev_addr;
*suptr++ = addrptr[0]; *suptr++ = addrptr[0];
*suptr++ = addrptr[1]; *suptr++ = addrptr[1];
*suptr++ = addrptr[2]; *suptr++ = addrptr[2];
......
...@@ -339,7 +339,7 @@ static void tulip_up(struct net_device *dev) ...@@ -339,7 +339,7 @@ static void tulip_up(struct net_device *dev)
} }
} else { } else {
/* This is set_rx_mode(), but without starting the transmitter. */ /* This is set_rx_mode(), but without starting the transmitter. */
u16 *eaddrs = (u16 *)dev->dev_addr; const u16 *eaddrs = (const u16 *)dev->dev_addr;
u16 *setup_frm = &tp->setup_frame[15*6]; u16 *setup_frm = &tp->setup_frame[15*6];
dma_addr_t mapping; dma_addr_t mapping;
...@@ -1001,8 +1001,8 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) ...@@ -1001,8 +1001,8 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
struct tulip_private *tp = netdev_priv(dev); struct tulip_private *tp = netdev_priv(dev);
u16 hash_table[32]; u16 hash_table[32];
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
const u16 *eaddrs;
int i; int i;
u16 *eaddrs;
memset(hash_table, 0, sizeof(hash_table)); memset(hash_table, 0, sizeof(hash_table));
__set_bit_le(255, hash_table); /* Broadcast entry */ __set_bit_le(255, hash_table); /* Broadcast entry */
...@@ -1019,7 +1019,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) ...@@ -1019,7 +1019,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
setup_frm = &tp->setup_frame[13*6]; setup_frm = &tp->setup_frame[13*6];
/* Fill the final entry with our physical address. */ /* Fill the final entry with our physical address. */
eaddrs = (u16 *)dev->dev_addr; eaddrs = (const u16 *)dev->dev_addr;
*setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0];
*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
...@@ -1029,7 +1029,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) ...@@ -1029,7 +1029,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
{ {
struct tulip_private *tp = netdev_priv(dev); struct tulip_private *tp = netdev_priv(dev);
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u16 *eaddrs; const u16 *eaddrs;
/* We have <= 14 addresses so we can use the wonderful /* We have <= 14 addresses so we can use the wonderful
16 address perfect filtering of the Tulip. */ 16 address perfect filtering of the Tulip. */
...@@ -1044,7 +1044,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) ...@@ -1044,7 +1044,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
setup_frm = &tp->setup_frame[15*6]; setup_frm = &tp->setup_frame[15*6];
/* Fill the final entry with our physical address. */ /* Fill the final entry with our physical address. */
eaddrs = (u16 *)dev->dev_addr; eaddrs = (const u16 *)dev->dev_addr;
*setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0]; *setup_frm++ = eaddrs[0];
*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
...@@ -1305,6 +1305,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1305,6 +1305,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
int chip_idx = ent->driver_data; int chip_idx = ent->driver_data;
const char *chip_name = tulip_tbl[chip_idx].chip_name; const char *chip_name = tulip_tbl[chip_idx].chip_name;
unsigned int eeprom_missing = 0; unsigned int eeprom_missing = 0;
u8 addr[ETH_ALEN] __aligned(2);
unsigned int force_csr0 = 0; unsigned int force_csr0 = 0;
board_idx++; board_idx++;
...@@ -1506,13 +1507,15 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1506,13 +1507,15 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
do { do {
value = ioread32(ioaddr + CSR9); value = ioread32(ioaddr + CSR9);
} while (value < 0 && --boguscnt > 0); } while (value < 0 && --boguscnt > 0);
put_unaligned_le16(value, ((__le16 *)dev->dev_addr) + i); put_unaligned_le16(value, ((__le16 *)addr) + i);
sum += value & 0xffff; sum += value & 0xffff;
} }
eth_hw_addr_set(dev, addr);
} else if (chip_idx == COMET) { } else if (chip_idx == COMET) {
/* No need to read the EEPROM. */ /* No need to read the EEPROM. */
put_unaligned_le32(ioread32(ioaddr + 0xA4), dev->dev_addr); put_unaligned_le32(ioread32(ioaddr + 0xA4), addr);
put_unaligned_le16(ioread32(ioaddr + 0xA8), dev->dev_addr + 4); put_unaligned_le16(ioread32(ioaddr + 0xA8), addr + 4);
eth_hw_addr_set(dev, addr);
for (i = 0; i < 6; i ++) for (i = 0; i < 6; i ++)
sum += dev->dev_addr[i]; sum += dev->dev_addr[i];
} else { } else {
...@@ -1575,20 +1578,23 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1575,20 +1578,23 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif #endif
for (i = 0; i < 6; i ++) { for (i = 0; i < 6; i ++) {
dev->dev_addr[i] = ee_data[i + sa_offset]; addr[i] = ee_data[i + sa_offset];
sum += ee_data[i + sa_offset]; sum += ee_data[i + sa_offset];
} }
eth_hw_addr_set(dev, addr);
} }
/* Lite-On boards have the address byte-swapped. */ /* Lite-On boards have the address byte-swapped. */
if ((dev->dev_addr[0] == 0xA0 || if ((dev->dev_addr[0] == 0xA0 ||
dev->dev_addr[0] == 0xC0 || dev->dev_addr[0] == 0xC0 ||
dev->dev_addr[0] == 0x02) && dev->dev_addr[0] == 0x02) &&
dev->dev_addr[1] == 0x00) dev->dev_addr[1] == 0x00) {
for (i = 0; i < 6; i+=2) { for (i = 0; i < 6; i+=2) {
char tmp = dev->dev_addr[i]; addr[i] = dev->dev_addr[i+1];
dev->dev_addr[i] = dev->dev_addr[i+1]; addr[i+1] = dev->dev_addr[i];
dev->dev_addr[i+1] = tmp;
} }
eth_hw_addr_set(dev, addr);
}
/* On the Zynx 315 Etherarray and other multiport boards only the /* On the Zynx 315 Etherarray and other multiport boards only the
first Tulip has an EEPROM. first Tulip has an EEPROM.
On Sparc systems the mac address is held in the OBP property On Sparc systems the mac address is held in the OBP property
...@@ -1604,8 +1610,9 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1604,8 +1610,9 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif #endif
eeprom_missing = 1; eeprom_missing = 1;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
dev->dev_addr[i] = last_phys_addr[i]; addr[i] = last_phys_addr[i];
dev->dev_addr[i] = last_phys_addr[i] + 1; addr[i] = last_phys_addr[i] + 1;
eth_hw_addr_set(dev, addr);
#if defined(CONFIG_SPARC) #if defined(CONFIG_SPARC)
addr = of_get_property(dp, "local-mac-address", &len); addr = of_get_property(dp, "local-mac-address", &len);
if (addr && len == ETH_ALEN) if (addr && len == ETH_ALEN)
......
...@@ -272,6 +272,7 @@ static int uli526x_init_one(struct pci_dev *pdev, ...@@ -272,6 +272,7 @@ static int uli526x_init_one(struct pci_dev *pdev,
struct uli526x_board_info *db; /* board information structure */ struct uli526x_board_info *db; /* board information structure */
struct net_device *dev; struct net_device *dev;
void __iomem *ioaddr; void __iomem *ioaddr;
u8 addr[ETH_ALEN];
int i, err; int i, err;
ULI526X_DBUG(0, "uli526x_init_one()", 0); ULI526X_DBUG(0, "uli526x_init_one()", 0);
...@@ -379,7 +380,7 @@ static int uli526x_init_one(struct pci_dev *pdev, ...@@ -379,7 +380,7 @@ static int uli526x_init_one(struct pci_dev *pdev,
uw32(DCR13, 0x1b0); //Select ID Table access port uw32(DCR13, 0x1b0); //Select ID Table access port
//Read MAC address from CR14 //Read MAC address from CR14
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = ur32(DCR14); addr[i] = ur32(DCR14);
//Read end //Read end
uw32(DCR13, 0); //Clear CR13 uw32(DCR13, 0); //Clear CR13
uw32(DCR0, 0); //Clear CR0 uw32(DCR0, 0); //Clear CR0
...@@ -388,8 +389,10 @@ static int uli526x_init_one(struct pci_dev *pdev, ...@@ -388,8 +389,10 @@ static int uli526x_init_one(struct pci_dev *pdev,
else /*Exist SROM*/ else /*Exist SROM*/
{ {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = db->srom[20 + i]; addr[i] = db->srom[20 + i];
} }
eth_hw_addr_set(dev, addr);
err = register_netdev (dev); err = register_netdev (dev);
if (err) if (err)
goto err_out_unmap; goto err_out_unmap;
...@@ -1343,7 +1346,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) ...@@ -1343,7 +1346,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
void __iomem *ioaddr = db->ioaddr; void __iomem *ioaddr = db->ioaddr;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
struct tx_desc *txptr; struct tx_desc *txptr;
u16 * addrptr; const u16 * addrptr;
u32 * suptr; u32 * suptr;
int i; int i;
...@@ -1353,7 +1356,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) ...@@ -1353,7 +1356,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
suptr = (u32 *) txptr->tx_buf_ptr; suptr = (u32 *) txptr->tx_buf_ptr;
/* Node address */ /* Node address */
addrptr = (u16 *) dev->dev_addr; addrptr = (const u16 *) dev->dev_addr;
*suptr++ = addrptr[0] << FLT_SHIFT; *suptr++ = addrptr[0] << FLT_SHIFT;
*suptr++ = addrptr[1] << FLT_SHIFT; *suptr++ = addrptr[1] << FLT_SHIFT;
*suptr++ = addrptr[2] << FLT_SHIFT; *suptr++ = addrptr[2] << FLT_SHIFT;
......
...@@ -1015,12 +1015,14 @@ static void read_mac_address(struct xircom_private *card) ...@@ -1015,12 +1015,14 @@ static void read_mac_address(struct xircom_private *card)
xw32(CSR10, i + 3); xw32(CSR10, i + 3);
data_count = xr32(CSR9); data_count = xr32(CSR9);
if ((tuple == 0x22) && (data_id == 0x04) && (data_count == 0x06)) { if ((tuple == 0x22) && (data_id == 0x04) && (data_count == 0x06)) {
u8 addr[ETH_ALEN];
int j; int j;
for (j = 0; j < 6; j++) { for (j = 0; j < 6; j++) {
xw32(CSR10, i + j + 4); xw32(CSR10, i + j + 4);
card->dev->dev_addr[j] = xr32(CSR9) & 0xff; addr[j] = xr32(CSR9) & 0xff;
} }
eth_hw_addr_set(card->dev, addr);
break; break;
} else if (link == 0) { } else if (link == 0) {
break; break;
......
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