Commit bb52aff3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

natsemi: macsonic: use eth_hw_addr_set()



Byte by byte assignments.

Fixes build on m68k.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a962aed
Loading
Loading
Loading
Loading
+17 −10
Original line number Original line Diff line number Diff line
@@ -203,6 +203,7 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
	struct sonic_local *lp = netdev_priv(dev);
	struct sonic_local *lp = netdev_priv(dev);
	const int prom_addr = ONBOARD_SONIC_PROM_BASE;
	const int prom_addr = ONBOARD_SONIC_PROM_BASE;
	unsigned short val;
	unsigned short val;
	u8 addr[ETH_ALEN];


	/*
	/*
	 * On NuBus boards we can sometimes look in the ROM resources.
	 * On NuBus boards we can sometimes look in the ROM resources.
@@ -213,7 +214,8 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
		int i;
		int i;


		for (i = 0; i < 6; i++)
		for (i = 0; i < 6; i++)
			dev->dev_addr[i] = SONIC_READ_PROM(i);
			addr[i] = SONIC_READ_PROM(i);
		eth_hw_addr_set(dev, addr);
		if (!INVALID_MAC(dev->dev_addr))
		if (!INVALID_MAC(dev->dev_addr))
			return;
			return;


@@ -222,7 +224,8 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
		 * source has a rather long and detailed historical account of
		 * source has a rather long and detailed historical account of
		 * why this is so.
		 * why this is so.
		 */
		 */
		bit_reverse_addr(dev->dev_addr);
		bit_reverse_addr(addr);
		eth_hw_addr_set(dev, addr);
		if (!INVALID_MAC(dev->dev_addr))
		if (!INVALID_MAC(dev->dev_addr))
			return;
			return;


@@ -243,14 +246,15 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
	SONIC_WRITE(SONIC_CEP, 15);
	SONIC_WRITE(SONIC_CEP, 15);


	val = SONIC_READ(SONIC_CAP2);
	val = SONIC_READ(SONIC_CAP2);
	dev->dev_addr[5] = val >> 8;
	addr[5] = val >> 8;
	dev->dev_addr[4] = val & 0xff;
	addr[4] = val & 0xff;
	val = SONIC_READ(SONIC_CAP1);
	val = SONIC_READ(SONIC_CAP1);
	dev->dev_addr[3] = val >> 8;
	addr[3] = val >> 8;
	dev->dev_addr[2] = val & 0xff;
	addr[2] = val & 0xff;
	val = SONIC_READ(SONIC_CAP0);
	val = SONIC_READ(SONIC_CAP0);
	dev->dev_addr[1] = val >> 8;
	addr[1] = val >> 8;
	dev->dev_addr[0] = val & 0xff;
	addr[0] = val & 0xff;
	eth_hw_addr_set(dev, addr);


	if (!INVALID_MAC(dev->dev_addr))
	if (!INVALID_MAC(dev->dev_addr))
		return;
		return;
@@ -355,13 +359,16 @@ static int mac_onboard_sonic_probe(struct net_device *dev)
static int mac_sonic_nubus_ethernet_addr(struct net_device *dev,
static int mac_sonic_nubus_ethernet_addr(struct net_device *dev,
					 unsigned long prom_addr, int id)
					 unsigned long prom_addr, int id)
{
{
	u8 addr[ETH_ALEN];
	int i;
	int i;

	for(i = 0; i < 6; i++)
	for(i = 0; i < 6; i++)
		dev->dev_addr[i] = SONIC_READ_PROM(i);
		addr[i] = SONIC_READ_PROM(i);


	/* Some of the addresses are bit-reversed */
	/* Some of the addresses are bit-reversed */
	if (id != MACSONIC_DAYNA)
	if (id != MACSONIC_DAYNA)
		bit_reverse_addr(dev->dev_addr);
		bit_reverse_addr(addr);
	eth_hw_addr_set(dev, addr);


	return 0;
	return 0;
}
}