[U-Boot] smc911x runtime detection (was: TI: OMAP3: Overo Tobi ethernet support)

Dirk Behme
2009-09-26T06:13:52Z

Olof Johansson wrote:
> Add setup for ethernet on Tobi, allowing kernel/ramdisk to be loaded
> over tftp.
>
> Based on the omap3 evm code. I added a new highlevel define for Tobi
> to avoid having it dependent on CMD_NET (which would seem backward in
> this case).

First: This is only a request for comment for possible future
improvement. It doesn't ask for any changes in this patch or is any
nack. Now to the content ;)

It seems that Steve found a way for runtime detection of smc911x
making CONFIG_OMAP3_OVERO_TOBI more or less obsolete (from [1]) :

-- cut --
--- git/include/configs/omap3_overo.h-orig 2009-09-17
13:06:08.000000000 -0700
+++ git/include/configs/omap3_overo.h 2009-09-17 13:06:49.000000000 -0700
@@ -29,7 +29,7 @@
#define CONFIG_OMAP34XX 1 /* which is a 34XX */
#define CONFIG_OMAP3430 1 /* which is in a 3430 */
#define CONFIG_OMAP3_OVERO 1 /* working with overo */
-//#define CONFIG_OMAP3_OVERO_TOBI 1 /* overo mounted on tobi */
+#define CONFIG_OMAP3_OVERO_TOBI 1 /* overo mounted on tobi */

#include <asm/arch/cpu.h> /* get chip and board defs */
#include <asm/arch/omap3.h>
--- git/drivers/net/smc911x.c-orig 2009-09-21 13:28:25.000000000 -0700
+++ git/drivers/net/smc911x.c 2009-09-21 13:29:53.000000000 -0700
@@ -253,6 +253,12 @@ int smc911x_initialize(u8 dev_num, int b

dev->iobase = base_addr;

+ /* test to see if chip is present (-1 if not) */
+ if (smc911x_reg_read(dev, MAC_CSR_CMD) == -1) {
+ free(dev);
+ return 0;
+ }
+
addrh = smc911x_get_mac_csr(dev, ADDRH);
addrl = smc911x_get_mac_csr(dev, ADDRL);
dev->enetaddr[0] = addrl;
-- cut --

But this needs some change in smc911x.c driver. Maybe someone likes to
comment (Ben?).

Best regards

Dirk

[1]
http://www.sakoman.net/cgi-bin/gitweb.cgi?p=openembedded.git;a=blob;f=recipes/u-boot/u-boot-omap3-git/smsc911x.patch;h=0d71b75727904cb59c88d523794c1d2699127cb2;hb=5965063dcfc396b3ef2f0891b54f05cf8f1ea08e