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>
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 @@
 	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 @@
 		return -1;
 	}
 
-	printf(DRIVERNAME ": detected %s controller\n", chip_ids[i].name);
+	dev->priv = (void *)&chip_ids[i];
 
 	return 0;
 }