afeb9260: fix macb device init
[oweals/u-boot.git] / board / trab / trab_fkt.c
index abb3b29c8c98f6c178bcc6e0e80156de1c5c48c1..53cdb5a31ecb3dd5a32465dcfed0ad49599dc9a1 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <common.h>
 #include <exports.h>
+#include <timestamp.h>
 #include <s3c2400.h>
 #include "tsc2000.h"
 #include "rs485.h"
@@ -148,14 +149,14 @@ static int rs485_receive_chars (char *data, int timeout);
 static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
                             unsigned int icnt);
 
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
 static int trab_eeprom_read (char **argv);
 static int trab_eeprom_write (char **argv);
 int i2c_write_multiple (uchar chip, uint addr, int alen, uchar *buffer,
                        int len);
 int i2c_read_multiple ( uchar chip, uint addr, int alen, uchar *buffer,
                        int len);
-#endif /* CFG_CMD_I2C */
+#endif
 
 /*
  * TRAB board specific commands. Especially commands for burn-in and function
@@ -293,10 +294,16 @@ int trab_fkt (int argc, char *argv[])
        return 1;
 }
 
+void hang (void)
+{
+       puts ("### ERROR ### Please RESET the board ###\n");
+       for (;;);
+}
+
 int do_info (void)
 {
        printf ("Stand-alone application for TRAB board function test\n");
-       printf ("Built: %s at %s\n", __DATE__ , __TIME__ );
+       printf ("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
 
        return 0;
 }
@@ -959,7 +966,7 @@ static int touch_check_pressed (void)
 
 static int touch_write_clibration_values (int calib_point, int x, int y)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
        int x_verify = 0;
        int y_verify = 0;
 
@@ -967,21 +974,21 @@ static int touch_write_clibration_values (int calib_point, int x, int y)
 
        if (calib_point == CALIB_TL) {
                if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-                              (char *)&x, 2)) {
+                              (unsigned char *)&x, 2)) {
                        return 1;
                }
                if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-                              (char *)&y, 2)) {
+                              (unsigned char *)&y, 2)) {
                        return 1;
                }
 
                /* verify written values */
                if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-                             (char *)&x_verify, 2)) {
+                             (unsigned char *)&x_verify, 2)) {
                        return 1;
                }
                if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-                              (char *)&y_verify, 2)) {
+                              (unsigned char *)&y_verify, 2)) {
                        return 1;
                }
                if ((y != y_verify) || (x != x_verify)) {
@@ -993,21 +1000,21 @@ static int touch_write_clibration_values (int calib_point, int x, int y)
        }
        else if (calib_point == CALIB_DR) {
                  if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-                              (char *)&x, 2)) {
+                              (unsigned char *)&x, 2)) {
                        return 1;
                  }
                if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-                              (char *)&y, 2)) {
+                              (unsigned char *)&y, 2)) {
                        return 1;
                }
 
                /* verify written values */
                if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-                                      (char *)&x_verify, 2)) {
+                                      (unsigned char *)&x_verify, 2)) {
                        return 1;
                }
                if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-                              (char *)&y_verify, 2)) {
+                              (unsigned char *)&y_verify, 2)) {
                        return 1;
                }
                if ((y != y_verify) || (x != x_verify)) {
@@ -1019,10 +1026,10 @@ static int touch_write_clibration_values (int calib_point, int x, int y)
        }
        return 1;
 #else
-       printf ("No I2C support enabled (CFG_CMD_I2C), could not write "
+       printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
                "to EEPROM\n");
        return (1);
-#endif /* CFG_CMD_I2C */
+#endif
 }
 
 
@@ -1105,12 +1112,12 @@ static int rs485_receive_chars (char *data, int timeout)
 
 int do_serial_number (char **argv)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
        unsigned int serial_number;
 
        if (strcmp (argv[2], "read") == 0) {
                if (i2c_read (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
-                             (char *)&serial_number, 4)) {
+                             (unsigned char *)&serial_number, 4)) {
                        printf ("could not read from eeprom\n");
                        return (1);
                }
@@ -1121,7 +1128,7 @@ int do_serial_number (char **argv)
        else if (strcmp (argv[2], "write") == 0) {
                serial_number = simple_strtoul(argv[3], NULL, 10);
                if (i2c_write (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
-                             (char *)&serial_number, 4)) {
+                             (unsigned char *)&serial_number, 4)) {
                        printf ("could not write to eeprom\n");
                        return (1);
                }
@@ -1130,18 +1137,18 @@ int do_serial_number (char **argv)
        printf ("%s: unknown command %s\n", __FUNCTION__, argv[2]);
        return (1);             /* unknown command, return error */
 #else
-       printf ("No I2C support enabled (CFG_CMD_I2C), could not write "
+       printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
                "to EEPROM\n");
        return (1);
-#endif /* CFG_CMD_I2C */
+#endif
 }
 
 
 int do_crc16 (void)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
        int crc;
-       char buf[EEPROM_MAX_CRC_BUF];
+       unsigned char buf[EEPROM_MAX_CRC_BUF];
 
        if (i2c_read (I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) {
                printf ("could not read from eeprom\n");
@@ -1153,17 +1160,17 @@ int do_crc16 (void)
        print_identifier ();
        printf ("crc16=%#04x\n", crc);
 
-       if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (char *)&crc,
+       if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc,
                       sizeof (crc))) {
                printf ("could not read from eeprom\n");
                return (1);
        }
        return (0);
 #else
-       printf ("No I2C support enabled (CFG_CMD_I2C), could not write "
+       printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
                "to EEPROM\n");
        return (1);
-#endif /* CFG_CMD_I2C */
+#endif
 }
 
 
@@ -1260,7 +1267,7 @@ int do_gain (char **argv)
 
 int do_eeprom (char **argv)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
        if (strcmp (argv[2], "read") == 0) {
                return (trab_eeprom_read (argv));
        }
@@ -1272,13 +1279,13 @@ int do_eeprom (char **argv)
        printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
        return (1);
 #else
-       printf ("No I2C support enabled (CFG_CMD_I2C), could not write "
+       printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
                "to EEPROM\n");
        return (1);
-#endif /* CFG_CMD_I2C */
+#endif
 }
 
-#if (CONFIG_COMMANDS & CFG_CMD_I2C)
+#if defined(CONFIG_CMD_I2C)
 static int trab_eeprom_read (char **argv)
 {
        int i;
@@ -1408,4 +1415,4 @@ int i2c_read_multiple ( uchar chip, uint addr, int alen,
        }
        return (0);
 }
-#endif /* CFG_CMD_I2C */
+#endif