]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - examples/smc91111_eeprom.c
Merge branch 'socrates' of /home/wd/git/u-boot/projects
[karo-tx-uboot.git] / examples / smc91111_eeprom.c
index 885f9336cd9e22211d80025a16253dff34876ff9..62347c7e325f09cb2e9eb338211f7225e5c44c39 100644 (file)
 
 #include <common.h>
 #include <exports.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
+
+#ifdef CONFIG_DRIVER_SMC91111
+
+#ifdef pFIO0_DIR
+# define pFIO_DIR    pFIO0_DIR
+# define pFIO_FLAG_S pFIO0_FLAG_S
+#endif
 
 #define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
 #define EEPROM         0x1;
 #define MAC            0x2;
-#define        UNKNOWN         0x4;
+#define        UNKNOWN         0x4;
 
 void dump_reg (void);
 void dump_eeprom (void);
@@ -59,17 +66,9 @@ 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;");
+       *pFIO_DIR = 0x01;
+       *pFIO_FLAG_S = 0x01;
+       SSYNC();
 
        if ((SMC_inw (BANK_SELECT) & 0xFF00) != 0x3300) {
                printf ("Can't find SMSC91111\n");
@@ -214,13 +213,11 @@ int smc91111_eeprom (int argc, char *argv[])
 
                        switch (what) {
                        case 1:
-                               printf ("Writing EEPROM register %02x with %04x\n",
-                                       reg, value);
+                               printf ("Writing EEPROM register %02x with %04x\n", reg, value);
                                write_eeprom_reg (value, reg);
                                break;
                        case 2:
-                               printf ("Writing MAC register bank %i,
-                                       reg %02x with %04x\n", reg >> 4, reg & 0xE, value);
+                               printf ("Writing MAC register bank %i, reg %02x with %04x\n", reg >> 4, reg & 0xE, value);
                                SMC_SELECT_BANK (reg >> 4);
                                SMC_outw (value, reg & 0xE);
                                break;
@@ -389,3 +386,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