summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2010-02-01 11:31:02 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-02-01 16:27:35 +0100
commit4903636f98fd19ae343b0494bad7b9d3b0c3cdaf (patch)
tree88e2848d02c816f56fdccdffec1ea552d213161e /drivers
parent7ca411ecd2dc1c6bc47caad4b1e25a118bd7441b (diff)
downloadbarebox-4903636f98fd19ae343b0494bad7b9d3b0c3cdaf.tar.gz
barebox-4903636f98fd19ae343b0494bad7b9d3b0c3cdaf.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/smc91111.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 0df664aefc..9b41c67258 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -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 */
-
- 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];
+
+ for (i = 0; i < 6; ++i)
+ valid += m[i] = SMC_inb(priv, (ADDR0_REG + i));
+
+ /* no eeprom, no mac */
+ if (!valid)
+ return -1;
return 0;
}