]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - examples/smc91111_eeprom.c
smc91111_eeprom: move board-specific init into SMC91111_EEPROM_INIT()
[karo-tx-uboot.git] / examples / smc91111_eeprom.c
index 98e3e86ffa555906b0eb34c2cd3fff40fb425767..39e530648d6d6baac39daf43b8622a3b9a0e8509 100644 (file)
 
 #include <common.h>
 #include <exports.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
+
+#ifdef CONFIG_DRIVER_SMC91111
+
+#ifndef SMC91111_EEPROM_INIT
+# define SMC91111_EEPROM_INIT()
+#endif
 
 #define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
-#define EEPROM         0x1;
-#define MAC            0x2;
-#define        UNKNOWN         0x4;
+#define EEPROM         0x1
+#define MAC            0x2
+#define UNKNOWN                0x4
 
 void dump_reg (void);
 void dump_eeprom (void);
@@ -59,17 +65,7 @@ int smc91111_eeprom (int argc, char *argv[])
                return (0);
        }
 
-       asm ("p2.h = 0xFFC0;");
-       asm ("p2.l = 0x0730;");
-       asm ("r0 = 0x01;");
-       asm ("w[p2] = r0;");
-       asm ("ssync;");
-
-       asm ("p2.h = 0xffc0;");
-       asm ("p2.l = 0x0708;");
-       asm ("r0 = 0x01;");
-       asm ("w[p2] = r0;");
-       asm ("ssync;");
+       SMC91111_EEPROM_INIT();
 
        if ((SMC_inw (BANK_SELECT) & 0xFF00) != 0x3300) {
                printf ("Can't find SMSC91111\n");
@@ -387,3 +383,13 @@ void dump_reg (void)
                printf ("\n");
        }
 }
+
+#else
+
+int smc91111_eeprom (int argc, char *argv[])
+{
+       printf("Not supported for this board\n");
+       return 1;
+}
+
+#endif