summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-02-24 22:44:16 +0000
committerwdenk <wdenk>2005-02-24 22:44:16 +0000
commit151ab83a936e66cf56971a0e0340609528474734 (patch)
tree0351989a9804330e02c7351c655d0102c6a00dcd /board
parentb9649854f6ffdeaad23daec21013552cef2e05f0 (diff)
downloadu-boot-imx-151ab83a936e66cf56971a0e0340609528474734.zip
u-boot-imx-151ab83a936e66cf56971a0e0340609528474734.tar.gz
u-boot-imx-151ab83a936e66cf56971a0e0340609528474734.tar.bz2
* 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
Diffstat (limited to 'board')
-rw-r--r--board/inka4x0/inka4x0.c15
-rw-r--r--board/trab/auto_update.c7
-rw-r--r--board/trab/cmd_trab.c56
-rw-r--r--board/trab/tsc2000.c49
4 files changed, 120 insertions, 7 deletions
diff --git a/board/inka4x0/inka4x0.c b/board/inka4x0/inka4x0.c
index a332510..08a1b7f 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 393e094..0399fe8 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 794c527..00eb385 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -26,6 +26,7 @@
#include <common.h>
#include <command.h>
#include <s3c2400.h>
+#include <rtc.h>
/*
* 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"
+ " <delay> 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 df2d87f..ca68682 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);
/*