summaryrefslogtreecommitdiff
path: root/board/trab
diff options
context:
space:
mode:
Diffstat (limited to 'board/trab')
-rw-r--r--board/trab/auto_update.c17
-rw-r--r--board/trab/cmd_trab.c17
-rw-r--r--board/trab/flash.c32
-rw-r--r--board/trab/memory.c8
-rw-r--r--board/trab/trab.c35
-rw-r--r--board/trab/trab_fkt.c24
-rw-r--r--board/trab/tsc2000.c2
-rw-r--r--board/trab/vfd.c30
8 files changed, 92 insertions, 73 deletions
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index 056e562..d2c8d44 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -57,9 +57,9 @@
* valid then run it.
* 2) if preinst.img is found load it into memory. If it is
* valid then run it. Update the EEPROM.
- * 3) if firmware.img is found load it into memory. If it is valid,
+ * 3) if firmw_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
- * 4) if kernel.img is found load it into memory. If it is valid,
+ * 4) if kernl_01.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
* 5) if app.img is found load it into memory. If it is valid,
* burn it into FLASH and update the EEPROM.
@@ -81,8 +81,8 @@
/* possible names of files on the USB stick. */
#define AU_PREPARE "prepare.img"
#define AU_PREINST "preinst.img"
-#define AU_FIRMWARE "firmware.img"
-#define AU_KERNEL "kernel.img"
+#define AU_FIRMWARE "firmw_01.img"
+#define AU_KERNEL "kernl_01.img"
#define AU_APP "app.img"
#define AU_DISK "disk.img"
#define AU_POSTINST "postinst.img"
@@ -222,7 +222,7 @@ au_check_cksum_valid(int idx, long nbytes)
/* check the data CRC */
checksum = ntohl(hdr->ih_dcrc);
- if (crc32 (0, (char *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
+ if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
!= checksum)
{
printf ("Image %s bad data checksum\n", aufile[idx]);
@@ -261,7 +261,7 @@ au_check_header_valid(int idx, long nbytes)
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if (crc32 (0, (char *)hdr, sizeof(*hdr)) != checksum) {
+ if (crc32 (0, (uchar *)hdr, sizeof(*hdr)) != checksum) {
printf ("Image %s bad header checksum\n", aufile[idx]);
return -1;
}
@@ -397,7 +397,7 @@ au_do_update(int idx, long sz)
}
/* check the dcrc of the copy */
- if (crc32 (0, (char *)(start + off), ntohl(hdr->ih_size)) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size)) != ntohl(hdr->ih_dcrc)) {
printf ("Image %s Bad Data Checksum After COPY\n", aufile[idx]);
return -1;
}
@@ -613,7 +613,8 @@ do_auto_update(void)
#define VFD_LOGO_WIDTH 112
#define VFD_LOGO_HEIGHT 72
/* must call transfer_pic directly */
- transfer_pic(3, env, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
+ transfer_pic(3, (unsigned char *)env,
+ VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
}
bitmap_first = 1;
}
diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
index 00eb385..b82c8ed 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -147,11 +147,11 @@ u8 status;
u16 pass_cycles;
u16 first_error_cycle;
u8 first_error_num;
-unsigned char first_error_name[16];
+char first_error_name[16];
u16 act_cycle;
typedef struct test_function_s {
- unsigned char *name;
+ char *name;
int (*pf)(void);
} test_function_t;
@@ -376,7 +376,7 @@ int do_burn_in_status (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return (1);
}
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
- 1, first_error_name,
+ 1, (unsigned char*)first_error_name,
sizeof (first_error_name))) {
return (1);
}
@@ -537,7 +537,7 @@ static int test_eeprom (void)
/* write test string 1, read back and verify */
if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
- EEPROM_TEST_STRING_1,
+ (unsigned char*)EEPROM_TEST_STRING_1,
sizeof (EEPROM_TEST_STRING_1))) {
return (1);
}
@@ -547,7 +547,7 @@ static int test_eeprom (void)
return (1);
}
- if (strcmp (temp, EEPROM_TEST_STRING_1) != 0) {
+ if (strcmp ((char *)temp, EEPROM_TEST_STRING_1) != 0) {
result = 1;
printf ("%s: error; read_str = \"%s\"\n", __FUNCTION__, temp);
}
@@ -555,7 +555,7 @@ static int test_eeprom (void)
/* write test string 2, read back and verify */
if (result == 0) {
if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
- EEPROM_TEST_STRING_2,
+ (unsigned char*)EEPROM_TEST_STRING_2,
sizeof (EEPROM_TEST_STRING_2))) {
return (1);
}
@@ -565,7 +565,7 @@ static int test_eeprom (void)
return (1);
}
- if (strcmp (temp, EEPROM_TEST_STRING_2) != 0) {
+ if (strcmp ((char *)temp, EEPROM_TEST_STRING_2) != 0) {
result = 1;
printf ("%s: error; read str = \"%s\"\n",
__FUNCTION__, temp);
@@ -729,6 +729,7 @@ static void led_blink (void)
/* blink LED. This function does not return! */
while (1) {
+ reset_timer_masked ();
led_set (1);
udelay (1000000 / LED_BLINK_FREQ / 2);
led_set (0);
@@ -776,7 +777,7 @@ static int global_vars_write_to_eeprom (void)
return (1);
}
if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
- 1, first_error_name,
+ 1, (unsigned char*) first_error_name,
sizeof(first_error_name))) {
return (1);
}
diff --git a/board/trab/flash.c b/board/trab/flash.c
index 8cdd824..3e8f105 100644
--- a/board/trab/flash.c
+++ b/board/trab/flash.c
@@ -281,10 +281,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
if (chip1 == ERR || chip2 == ERR) {
rc = ERR_PROG_ERROR;
+ printf ("Flash erase error\n");
goto outahere;
}
if (chip1 == TMO) {
rc = ERR_TIMOUT;
+ printf ("Flash erase timeout error\n");
goto outahere;
}
}
@@ -340,7 +342,9 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
#endif
iflag = disable_interrupts ();
- *addr = CMD_PROGRAM;
+ MEM_FLASH_ADDR1 = CMD_UNLOCK1;
+ MEM_FLASH_ADDR2 = CMD_UNLOCK2;
+ MEM_FLASH_ADDR1 = CMD_PROGRAM;
*addr = data;
/* arm simple, non interrupt dependent timer */
@@ -352,7 +356,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
result = *addr;
/* check timeout */
- if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
+ if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
chip1 = ERR | TMO;
break;
}
@@ -384,8 +388,13 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
*addr = CMD_READ_ARRAY;
- if (chip1 == ERR || chip2 == ERR || *addr != data)
+ if (chip1 == ERR || chip2 == ERR || *addr != data) {
rc = ERR_PROG_ERROR;
+ printf ("Flash program error\n");
+ debug ("chip1: %#x, chip2: %#x, addr: %#lx *addr: %#lx, "
+ "data: %#lx\n",
+ chip1, chip2, addr, *addr, data);
+ }
if (iflag)
enable_interrupts ();
@@ -408,10 +417,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
int l;
int i, rc;
- MEM_FLASH_ADDR1 = CMD_UNLOCK1;
- MEM_FLASH_ADDR2 = CMD_UNLOCK2;
- MEM_FLASH_ADDR1 = CMD_UNLOCK_BYPASS;
-
wp = (addr & ~3); /* get lower word aligned address */
/*
@@ -479,9 +484,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
Done:
- MEM_FLASH_ADDR = CMD_UNLOCK_BYPASS_RES1;
- MEM_FLASH_ADDR = CMD_UNLOCK_BYPASS_RES2;
-
return (rc);
}
@@ -515,7 +517,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
info->flash_id = FLASH_UNKNOWN;
info->sector_count = 0;
info->size = 0;
- addr[0] = 0x00FF00FF; /* restore read mode */
+ addr[0] = CMD_READ_ARRAY; /* restore read mode */
debug ("## flash_init: unknown manufacturer\n");
return (0); /* no or unknown flash */
}
@@ -530,7 +532,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
info->sector_count = 71;
info->size = 0x00800000;
- addr[0] = 0x00FF00FF; /* restore read mode */
+ addr[0] = CMD_READ_ARRAY; /* restore read mode */
break; /* => 8 MB */
case AMD_ID_LV640U:
@@ -538,7 +540,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
info->sector_count = 128;
info->size = 0x01000000;
- addr[0] = 0x00F000F0; /* restore read mode */
+ addr[0] = CMD_READ_ARRAY; /* restore read mode */
break; /* => 16 MB */
case MX_ID_LV320B:
@@ -546,13 +548,13 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
info->sector_count = 71;
info->size = 0x00800000;
- addr[0] = 0x00FF00FF; /* restore read mode */
+ addr[0] = CMD_READ_ARRAY; /* restore read mode */
break; /* => 8 MB */
default:
debug ("## flash_init: unknown flash chip\n");
info->flash_id = FLASH_UNKNOWN;
- addr[0] = 0x00FF00FF; /* restore read mode */
+ addr[0] = CMD_READ_ARRAY; /* restore read mode */
return (0); /* => no or unknown flash */
}
diff --git a/board/trab/memory.c b/board/trab/memory.c
index 4097892..58bd995 100644
--- a/board/trab/memory.c
+++ b/board/trab/memory.c
@@ -419,14 +419,14 @@ int memory_post_tests (unsigned long start, unsigned long size)
int ret = 0;
if (ret == 0)
- ret = memory_post_dataline ((long long *)start);
+ ret = memory_post_dataline ((unsigned long long *)start);
WATCHDOG_RESET ();
if (ret == 0)
- ret = memory_post_addrline ((long *)start, (long *)start, size);
+ ret = memory_post_addrline ((ulong *)start, (ulong *)start, size);
WATCHDOG_RESET ();
if (ret == 0)
- ret = memory_post_addrline ((long *)(start + size - 8),
- (long *)start, size);
+ ret = memory_post_addrline ((ulong *)(start + size - 8),
+ (ulong *)start, size);
WATCHDOG_RESET ();
if (ret == 0)
ret = memory_post_test1 (start, size, 0x00000000);
diff --git a/board/trab/trab.c b/board/trab/trab.c
index 868a899..26e52d2 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -152,15 +152,28 @@ int dram_init (void)
#define KBD_DATA (((*(volatile ulong *)0x04020000) >> 16) & 0xF)
-static uchar *key_match (ulong);
+static char *key_match (ulong);
int misc_init_r (void)
{
ulong kbd_data = KBD_DATA;
- uchar keybd_env[KEYBD_KEY_NUM + 1];
- uchar *str;
+ char *str;
+ char keybd_env[KEYBD_KEY_NUM + 1];
int i;
+#ifdef CONFIG_VERSION_VARIABLE
+ {
+ /* Set version variable. Please note, that this variable is
+ * also set in main_loop() later in the boot process. The
+ * version variable has to be set this early, because so it
+ * could be used in script files on an usb stick, which
+ * might be called during do_auto_update() */
+ extern char version_string[];
+
+ setenv ("ver", version_string);
+ }
+#endif /* CONFIG_VERSION_VARIABLE */
+
#ifdef CONFIG_AUTO_UPDATE
extern int do_auto_update(void);
/* this has priority over all else */
@@ -195,7 +208,7 @@ int misc_init_r (void)
static uchar kbd_magic_prefix[] = "key_magic";
static uchar kbd_command_prefix[] = "key_cmd";
-static int compare_magic (ulong kbd_data, uchar *str)
+static int compare_magic (ulong kbd_data, char *str)
{
uchar key_mask;
@@ -241,12 +254,12 @@ static int compare_magic (ulong kbd_data, uchar *str)
* Note: the string points to static environment data and must be
* saved before you call any function that modifies the environment.
*/
-static uchar *key_match (ulong kbd_data)
+static char *key_match (ulong kbd_data)
{
- uchar magic[sizeof (kbd_magic_prefix) + 1];
- uchar cmd_name[sizeof (kbd_command_prefix) + 1];
- uchar *suffix;
- uchar *kbd_magic_keys;
+ char magic[sizeof (kbd_magic_prefix) + 1];
+ char cmd_name[sizeof (kbd_command_prefix) + 1];
+ char *suffix;
+ char *kbd_magic_keys;
/*
* The following string defines the characters that can pe appended
@@ -291,7 +304,7 @@ static uchar *key_match (ulong kbd_data)
int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
ulong kbd_data = KBD_DATA;
- uchar keybd_env[KEYBD_KEY_NUM + 1];
+ char keybd_env[KEYBD_KEY_NUM + 1];
int i;
puts ("Keys:");
@@ -391,7 +404,7 @@ static void tsc2000_write(unsigned int page, unsigned int reg,
static void tsc2000_set_brightness(void)
{
- uchar tmp[10];
+ char tmp[10];
int i, br;
spi_init();
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index abb3b29..71be6e0 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -967,21 +967,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 +993,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)) {
@@ -1110,7 +1110,7 @@ int do_serial_number (char **argv)
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 +1121,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);
}
@@ -1141,7 +1141,7 @@ int do_crc16 (void)
{
#if (CONFIG_COMMANDS & CFG_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,7 +1153,7 @@ 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);
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index ca68682..382a85b 100644
--- a/board/trab/tsc2000.c
+++ b/board/trab/tsc2000.c
@@ -223,7 +223,7 @@ u16 tsc2000_read_channel (unsigned int channel)
u16 res;
tsc2000_set_mux(channel);
- udelay(3 * TSC2000_DELAY_BASE);
+ udelay(20 * TSC2000_DELAY_BASE);
tsc2000_write(TSC2000_REG_ADC, 0x2036);
adc_wait_conversion_done ();
diff --git a/board/trab/vfd.c b/board/trab/vfd.c
index cea8b0b..b6798fd 100644
--- a/board/trab/vfd.c
+++ b/board/trab/vfd.c
@@ -251,19 +251,17 @@ void create_vfd_table(void)
unsigned long adr = gd->fb_base;
unsigned int bit_nr = 0;
- if (vfd_table[x][y][color][display][entry]) {
-
- pixel = vfd_table[x][y][color][display][entry] + frame_buf_offs;
- /*
- * wrap arround if offset
- * (see manual S3C2400)
- */
- if (pixel>=FRAME_BUF_SIZE*8)
- pixel = pixel-(FRAME_BUF_SIZE*8);
- adr = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8);
- bit_nr = pixel%8;
- bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
- }
+ pixel = vfd_table[x][y][color][display][entry] + frame_buf_offs;
+ /*
+ * wrap arround if offset
+ * (see manual S3C2400)
+ */
+ if (pixel>=FRAME_BUF_SIZE*8)
+ pixel = pixel-(FRAME_BUF_SIZE*8);
+ adr = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8);
+ bit_nr = pixel%8;
+ bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
+
adr_vfd_table[x][y][color][display][entry] = adr;
bit_vfd_table[x][y][color][display][entry] = bit_nr;
}
@@ -358,6 +356,8 @@ void transfer_pic(int display, unsigned char *adr, int height, int width)
*/
int vfd_init_clocks (void)
{
+ int i;
+
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();
S3C24X0_LCD * const lcd = S3C24X0_GetBase_LCD();
@@ -367,7 +367,9 @@ int vfd_init_clocks (void)
*/
gpio->PCUP = (gpio->PCUP & 0xFFF0); /* activate GPC0...GPC3 pullups */
gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */
- udelay (10); /* allow signals to settle */
+ /* allow signals to settle */
+ for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */
+ __asm("NOP");
vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */
VFD_DISABLE; /* activate blank for the vfd */