9
0
Fork 0

smc91111: fix odering of mac address read from EEPROM

On my little endian PXA270, the ethernet address is byte swapped:

correct ethernet address: 00:50:c2:80:a7:bd
broken  ethernet address: 50:00:80:c2:bd:a7

The correct value is what the sticker on the baoard and the linux driver
says. This patch fixes the problem by reading the ethaddr byte-wise from
the eeprom.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2010-02-01 11:31:02 +01:00 committed by Sascha Hauer
parent 7ca411ecd2
commit 4903636f98
1 changed files with 7 additions and 12 deletions

View File

@ -1166,22 +1166,17 @@ static int smc91c111_eth_rx(struct eth_device *edev)
static int smc91c111_get_ethaddr(struct eth_device *edev, unsigned char *m)
{
struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
unsigned address[3];
int valid = 0;
int i;
SMC_SELECT_BANK(priv, 1);
address[0] = SMC_inw(priv, ADDR0_REG);
address[1] = SMC_inw(priv, ADDR0_REG + 2);
address[2] = SMC_inw(priv, ADDR0_REG + 4);
if (address[0] + address[1] + address[2] == 0)
return -1; /* no eeprom, no mac */
for (i = 0; i < 6; ++i)
valid += m[i] = SMC_inb(priv, (ADDR0_REG + i));
m[0] = address[0] >> 8;
m[1] = address[0];
m[2] = address[1] >> 8;
m[3] = address[1];
m[4] = address[2] >> 8;
m[5] = address[2];
/* no eeprom, no mac */
if (!valid)
return -1;
return 0;
}