Changes for U-Boot 1.1.3:
 ======================================================================
 
+* Add support for ext2 filesystems and image timestamps to TQM5200 board
+
+* Add reset code for Coral-P on INKA4x0 board
+
+* Patch by Martin Krause, 28 Jun 2004:
+  Update for TRAB board.
+
+* Fix some missing "volatile"s in MPC5xxx FEC driver
+
 * Fix cirrus voltage detection (for CPC45)
 
 * Fix byteorder problem in usbboot and scsiboot commands.
 
 #
-# (C) Copyright 2000 - 2004
+# (C) Copyright 2000 - 2005
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
 
        *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
 }
 
+#define GPIO_PSC3_9     0x04000000UL
+
+int misc_init_f (void)
+{
+       /*
+        * Reset Coral-P graphics controller
+        */
+        *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9;
+        *(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC3_9;
+        *(vu_long *) MPC5XXX_WU_GPIO_DATA   |= GPIO_PSC3_9;
+        return 0;
+}
+
 #ifdef  CONFIG_PCI
 static struct pci_controller hose;
 
         pci_mpc5xxx_init(&hose);
 }
 #endif
-
-
 
        int off;
        uint32_t val;
 
+       /* special case for prepare.img */
+       if (idx == IDX_PREPARE) {
+               /* enable the power switch */
+               *CPLD_VFD_BK &= ~POWER_OFF;
+               return 0;
+       }
+
        hdr = (image_header_t *)LOAD_ADDR;
        /* write the time field into EEPROM */
        off = auee_off[idx].time;
 
 #include <common.h>
 #include <command.h>
 #include <s3c2400.h>
+#include <rtc.h>
 
 /*
  * TRAB board specific commands. Especially commands for burn-in and function
                        uchar *buffer, int len);
 int i2c_read_multiple (uchar chip, uint addr, int alen,
                        uchar *buffer, int len);
+int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 /* helper functions */
 static void adc_init (void);
        led_init ();
        global_vars_init ();
        test_function_table_init ();
+       spi_init ();
 
        if (global_vars_write_to_eeprom () != 0) {
                printf ("%s: error writing global_vars to eeprom\n",
        }
 
        spi_init ();
-       tsc2000_reg_init ();
 
        contact_temp = tsc2000_contact_temp();
        printf ("%d degree C * 100\n", contact_temp) ;
 {
        int contact_temp;
 
-       spi_init ();
        contact_temp = tsc2000_contact_temp ();
 
        if ((contact_temp < MIN_CONTACT_TEMP)
        return (0);
 }
 
+int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       int contact_temp;
+       int delay = 0;
+#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+       struct rtc_time tm;
+#endif
+
+       if (argc > 2) {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       if (argc > 1) {
+               delay = simple_strtoul(argv[1], NULL, 10);
+       }
+
+       spi_init ();
+       while (1) {
+
+#if (CONFIG_COMMANDS & CFG_CMD_DATE)
+               rtc_get (&tm);
+               printf ("%4d-%02d-%02d %2d:%02d:%02d - ",
+                       tm.tm_year, tm.tm_mon, tm.tm_mday,
+                       tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
+
+               contact_temp = tsc2000_contact_temp();
+               printf ("%d\n", contact_temp) ;
+
+               if (delay != 0)
+                       /*
+                        * reset timer to avoid timestamp overflow problem
+                        * after about 68 minutes of udelay() time.
+                        */
+                       reset_timer_masked ();
+                       sdelay (delay);
+       }
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       tlog,   2,      1,      do_temp_log,
+       "tlog    - log contact temperature [1/100 C] to console (endlessly)\n",
+       "delay\n"
+       "    - contact temperature [1/100 C] is printed endlessly to console\n"
+       "      <delay> specifies the seconds to wait between two measurements\n"
+       "      For each measurment a timestamp is printeted\n"
+);
+
 #endif /* CFG_CMD_BSP */
 
 
 #include "Pt1000_temp_data.h"
 
+/* helper function */
+#define abs(value) (((value) < 0) ? ((value)*-1) : (value))
+
+/*
+ * Maximal allowed deviation between two immediate meassurments of an analog
+ * thermo channel. 1 DIGIT = 0.0276 °C. This is used to filter sporadic
+ * "jumps" in measurment.
+ */
+#define MAX_DEVIATION  18      /* unit: DIGITs of adc; 18 DIGIT = 0.5 °C */
+
 void spi_init(void)
 {
        S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
        long adc_pt1000, offset;
        long u_pt1000;
        long contact_temp;
-
+       long temp1, temp2;
 
        tsc2000_reg_init ();
        tsc2000_set_range (3);
 
-       adc_pt1000 = tsc2000_read_channel (14);
+       /*
+        * Because of sporadic "jumps" in the measured adc values every
+        * channel is read two times. If there is a significant difference
+        * between the two measurements, then print an error and do a third
+        * measurement, because it is very unlikely that a successive third
+        * measurement goes also wrong.
+        */
+       temp1 = tsc2000_read_channel (14);
+       temp2 = tsc2000_read_channel (14);
+       if (abs(temp2 - temp1) < MAX_DEVIATION)
+               adc_pt1000 = temp2;
+       else {
+               printf ("%s: read adc value (channel 14) exceeded max allowed "
+                       "deviation: %d * 0.0276 °C\n",
+                       __FUNCTION__, MAX_DEVIATION);
+               printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
+                       temp1, temp2);
+               adc_pt1000 = tsc2000_read_channel (14);
+               printf ("use (third read) adc value: adc_pt1000 = "
+                       "%ld DIGITs\n", adc_pt1000);
+       }
        debug ("read channel 14 (pt1000 adc value): %ld\n", adc_pt1000);
 
-       offset = tsc2000_read_channel (15);
+       temp1 = tsc2000_read_channel (15);
+       temp2 = tsc2000_read_channel (15);
+       if (abs(temp2 - temp1) < MAX_DEVIATION)
+               offset = temp2;
+       else {
+               printf ("%s: read adc value (channel 15) exceeded max allowed "
+                       "deviation: %d * 0.0276 °C\n",
+                       __FUNCTION__, MAX_DEVIATION);
+               printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
+                       temp1, temp2);
+               offset = tsc2000_read_channel (15);
+               printf ("use (third read) adc value: offset = %ld DIGITs\n",
+                       offset);
+       }
        debug ("read channel 15 (offset): %ld\n", offset);
 
        /*
 
 }
 
 /********************************************************************/
-static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd)
+static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, volatile FEC_RBD * pRbd)
 {
        /*
         * Reset buffer descriptor as empty
 /********************************************************************/
 static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec)
 {
-       FEC_TBD *pUsedTbd;
+       volatile FEC_TBD *pUsedTbd;
 
 #if (DEBUG & 0x1)
        printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n",
        /*
         * Initialize SmartDMA parameters stored in SRAM
         */
-       *(int *)FEC_TBD_BASE = (int)fec->tbdBase;
-       *(int *)FEC_RBD_BASE = (int)fec->rbdBase;
-       *(int *)FEC_TBD_NEXT = (int)fec->tbdBase;
-       *(int *)FEC_RBD_NEXT = (int)fec->rbdBase;
+       *(volatile int *)FEC_TBD_BASE = (int)fec->tbdBase;
+       *(volatile int *)FEC_RBD_BASE = (int)fec->rbdBase;
+       *(volatile int *)FEC_TBD_NEXT = (int)fec->tbdBase;
+       *(volatile int *)FEC_RBD_NEXT = (int)fec->rbdBase;
 
        /*
         * Enable FEC-Lite controller
         * 6-byte Ethernet addresses.
         */
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-       FEC_TBD *pTbd;
+       volatile FEC_TBD *pTbd;
 
 #if (DEBUG & 0x20)
        printf("tbd status: 0x%04x\n", fec->tbdBase[0].status);
         * This command pulls one frame from the card
         */
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-       FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
+       volatile FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
        unsigned long ievent;
        int frame_length, len = 0;
        NBUF *frame;
 
 
 /* IDE */
 #if defined (CONFIG_MINIFAP) || defined (CONFIG_STK52XX)
-#define ADD_IDE_CMD            CFG_CMD_IDE | CFG_CMD_FAT
+#define ADD_IDE_CMD            (CFG_CMD_IDE | CFG_CMD_FAT | CFG_CMD_EXT2)
 #else
 #define ADD_IDE_CMD            0
 #endif
  * Supported commands
  */
 #define CONFIG_COMMANDS               (CONFIG_CMD_DFL  | \
-                               CFG_CMD_EEPROM  | \
-                               CFG_CMD_I2C     | \
+                               ADD_IDE_CMD     | \
                                ADD_PCI_CMD     | \
                                ADD_USB_CMD     | \
-                               CFG_CMD_POST_DIAG | \
+                               CFG_CMD_ASKENV  | \
                                CFG_CMD_DATE    | \
-                               CFG_CMD_REGINFO | \
+                               CFG_CMD_DHCP    | \
+                               CFG_CMD_ECHO    | \
+                               CFG_CMD_EEPROM  | \
+                               CFG_CMD_I2C     | \
                                CFG_CMD_MII     | \
                                CFG_CMD_PING    | \
-                               ADD_IDE_CMD)
+                               CFG_CMD_POST_DIAG | \
+                               CFG_CMD_REGINFO )
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
 
+#define        CONFIG_TIMESTAMP                /* display image timestamps */
+
 #if (TEXT_BASE == 0xFC000000)          /* Boot low */
 #   define CFG_LOWBOOT         1
 #endif
 
  * (easy to change)
  */
 
-#define CONFIG_MPC5xxx         1       /* This is an MPC5xxx CPU */
-#define CONFIG_MPC5200         1       /* (more precisely an MPC5200 CPU) */
-#define CONFIG_INKA4X0         1       /* INKA4x0 board */
+#define CONFIG_MPC5xxx         1       /* This is an MPC5xxx CPU               */
+#define CONFIG_MPC5200         1       /* (more precisely an MPC5200 CPU)      */
+#define CONFIG_INKA4X0         1       /* INKA4x0 board                        */
 
-#define CFG_MPC5XXX_CLKIN      33000000 /* ... running at 33.000000MHz */
+#define CFG_MPC5XXX_CLKIN      33000000 /* ... running at 33.000000MHz         */
 
-#define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH  */
-#define BOOTFLAG_WARM          0x02    /* Software reboot           */
+#define BOOTFLAG_COLD          0x01    /* Normal Power-On: Boot from FLASH     */
+#define BOOTFLAG_WARM          0x02    /* Software reboot                      */
 
-#define CFG_CACHELINE_SIZE     32      /* For MPC5xxx CPUs */
+#define CONFIG_MISC_INIT_F     1       /* Use misc_init_f()                    */
+
+#define CFG_CACHELINE_SIZE     32      /* For MPC5xxx CPUs                     */
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#  define CFG_CACHELINE_SHIFT  5       /* log base 2 of the above value */
+#  define CFG_CACHELINE_SHIFT  5       /* log base 2 of the above value        */
 #endif
 
 /*
  * Serial console configuration
  */
-#define CONFIG_PSC_CONSOLE     1       /* console is on PSC1 */
-#define CONFIG_BAUDRATE                115200  /* ... at 115200 bps */
+#define CONFIG_PSC_CONSOLE     1       /* console is on PSC1   */
+#define CONFIG_BAUDRATE                115200  /* ... at 115200 bps    */
 #define CFG_BAUDRATE_TABLE     { 9600, 19200, 38400, 57600, 115200, 230400 }
 
 /*
  *-----------------------------------------------------------------------
  */
 #define CONFIG_USB_OHCI
-#define CONFIG_USB_CLOCK        0x00015555
-#define CONFIG_USB_CONFIG       0x00001000
+#define CONFIG_USB_CLOCK       0x00015555
+#define CONFIG_USB_CONFIG      0x00001000
 
 #endif /* __CONFIG_H */
 
 #endif /* CFG_HUSH_PARSER */
 #endif /* CONFIG_FLASH_8MB */
 
-#if 0  /* disabled for development */
+#if 1  /* feel free to disable for development */
 #define        CONFIG_AUTOBOOT_KEYED           /* Enable password protection   */
 #define CONFIG_AUTOBOOT_PROMPT "\nEnter password - autoboot in %d sec...\n"
-#define CONFIG_AUTOBOOT_DELAY_STR      "system"        /* 1st password */
+#define CONFIG_AUTOBOOT_DELAY_STR      "R"     /* 1st "password"       */
 #endif
 
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)