summaryrefslogtreecommitdiff
path: root/drivers/net/smc911x.h
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2009-09-29 10:21:29 -0400
committerTom Rix <Tom.Rix@windriver.com>2009-10-13 06:17:37 -0500
commit2a6cc97b91997ae485312ac91ffbcea6a89b663a (patch)
treef17675c5af12eb4dad8b93249bb3bdda59bfe322 /drivers/net/smc911x.h
parent0297ec7e2a4039b8a28346f52f3ccca4db1ddc62 (diff)
downloadu-boot-imx-2a6cc97b91997ae485312ac91ffbcea6a89b663a.zip
u-boot-imx-2a6cc97b91997ae485312ac91ffbcea6a89b663a.tar.gz
u-boot-imx-2a6cc97b91997ae485312ac91ffbcea6a89b663a.tar.bz2
SMC911X: Add chip auto detection
Refactor the smc911x driver to allow for detecting when the chip is missing. I.e. the detect_chip() function is called earlier and will abort gracefully when the Chip ID read returns all 1's. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Dirk Behme <dirk.behme@googlemail.com> Acked-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/smc911x.h')
-rw-r--r--drivers/net/smc911x.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 053e330..d5bca63 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -441,7 +441,10 @@ static int smc911x_detect_chip(struct eth_device *dev)
unsigned long val, i;
val = smc911x_reg_read(dev, BYTE_TEST);
- if (val != 0x87654321) {
+ if (val == 0xffffffff) {
+ /* Special case -- no chip present */
+ return -1;
+ } else if (val != 0x87654321) {
printf(DRIVERNAME ": Invalid chip endian 0x%08lx\n", val);
return -1;
}
@@ -455,7 +458,7 @@ static int smc911x_detect_chip(struct eth_device *dev)
return -1;
}
- printf(DRIVERNAME ": detected %s controller\n", chip_ids[i].name);
+ dev->priv = (void *)&chip_ids[i];
return 0;
}