From 151ab83a936e66cf56971a0e0340609528474734 Mon Sep 17 00:00:00 2001 From: wdenk Date: Thu, 24 Feb 2005 22:44:16 +0000 Subject: [PATCH] * 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 --- CHANGELOG | 9 +++++++ README | 2 +- board/inka4x0/inka4x0.c | 15 +++++++++-- board/trab/auto_update.c | 7 +++++ board/trab/cmd_trab.c | 56 +++++++++++++++++++++++++++++++++++++-- board/trab/tsc2000.c | 49 +++++++++++++++++++++++++++++++--- cpu/mpc5xxx/fec.c | 16 +++++------ include/configs/TQM5200.h | 17 +++++++----- include/configs/inka4x0.h | 26 +++++++++--------- include/configs/trab.h | 4 +-- 10 files changed, 165 insertions(+), 36 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 720ecaaedf..e655482e1f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,15 @@ 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. diff --git a/README b/README index 50e58dc534..a9c052c059 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ # -# (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 diff --git a/board/inka4x0/inka4x0.c b/board/inka4x0/inka4x0.c index a33251021f..08a1b7f00b 100644 --- a/board/inka4x0/inka4x0.c +++ b/board/inka4x0/inka4x0.c @@ -177,6 +177,19 @@ void flash_preinit(void) *(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; @@ -187,5 +200,3 @@ void pci_init_board(void) pci_mpc5xxx_init(&hose); } #endif - - diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c index 393e094d8a..0399fe86ac 100644 --- a/board/trab/auto_update.c +++ b/board/trab/auto_update.c @@ -416,6 +416,13 @@ au_update_eeprom(int idx) 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; diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c index 794c527186..00eb385fdf 100644 --- a/board/trab/cmd_trab.c +++ b/board/trab/cmd_trab.c @@ -26,6 +26,7 @@ #include #include #include +#include /* * TRAB board specific commands. Especially commands for burn-in and function @@ -117,6 +118,7 @@ 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); +int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* helper functions */ static void adc_init (void); @@ -173,6 +175,7 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) 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", @@ -334,7 +337,6 @@ int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } spi_init (); - tsc2000_reg_init (); contact_temp = tsc2000_contact_temp(); printf ("%d degree C * 100\n", contact_temp) ; @@ -577,7 +579,6 @@ static int test_contact_temp (void) { int contact_temp; - spi_init (); contact_temp = tsc2000_contact_temp (); if ((contact_temp < MIN_CONTACT_TEMP) @@ -840,4 +841,55 @@ static int dummy(void) 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" + " specifies the seconds to wait between two measurements\n" + " For each measurment a timestamp is printeted\n" +); + #endif /* CFG_CMD_BSP */ diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c index df2d87f5c2..ca6868212e 100644 --- a/board/trab/tsc2000.c +++ b/board/trab/tsc2000.c @@ -31,6 +31,16 @@ #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(); @@ -227,15 +237,48 @@ s32 tsc2000_contact_temp (void) 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); /* diff --git a/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c index 935fee8ca7..21632722d3 100644 --- a/cpu/mpc5xxx/fec.c +++ b/cpu/mpc5xxx/fec.c @@ -115,7 +115,7 @@ static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec) } /********************************************************************/ -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 @@ -141,7 +141,7 @@ static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd) /********************************************************************/ 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", @@ -354,10 +354,10 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis) /* * 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 @@ -688,7 +688,7 @@ static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data, * 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); @@ -779,7 +779,7 @@ static int mpc5xxx_fec_recv(struct eth_device *dev) * 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; diff --git a/include/configs/TQM5200.h b/include/configs/TQM5200.h index 595bd292b5..6be47877d0 100644 --- a/include/configs/TQM5200.h +++ b/include/configs/TQM5200.h @@ -132,7 +132,7 @@ /* 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 @@ -141,20 +141,25 @@ * 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 +#define CONFIG_TIMESTAMP /* display image timestamps */ + #if (TEXT_BASE == 0xFC000000) /* Boot low */ # define CFG_LOWBOOT 1 #endif diff --git a/include/configs/inka4x0.h b/include/configs/inka4x0.h index eb1256a5d8..da2e37d21b 100644 --- a/include/configs/inka4x0.h +++ b/include/configs/inka4x0.h @@ -29,25 +29,27 @@ * (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 } /* @@ -265,7 +267,7 @@ *----------------------------------------------------------------------- */ #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 */ diff --git a/include/configs/trab.h b/include/configs/trab.h index 55a6f69fca..59cd1d4ff7 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -290,10 +290,10 @@ #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) -- 2.25.1