diff options
author | stroese <stroese> | 2004-12-16 18:37:08 +0000 |
---|---|---|
committer | stroese <stroese> | 2004-12-16 18:37:08 +0000 |
commit | 31193c2cca272d8e661b28b9e8492949c9dd7309 (patch) | |
tree | 4c12d93afab3b28840529a5c09a01a302ef05fc9 /board/esd/hub405/hub405.c | |
parent | ab379df3535036ccce6a27303f8604a24b8b3276 (diff) | |
download | u-boot-imx-31193c2cca272d8e661b28b9e8492949c9dd7309.zip u-boot-imx-31193c2cca272d8e661b28b9e8492949c9dd7309.tar.gz u-boot-imx-31193c2cca272d8e661b28b9e8492949c9dd7309.tar.bz2 |
HUB405 board update
Diffstat (limited to 'board/esd/hub405/hub405.c')
-rw-r--r-- | board/esd/hub405/hub405.c | 84 |
1 files changed, 69 insertions, 15 deletions
diff --git a/board/esd/hub405/hub405.c b/board/esd/hub405/hub405.c index d8e3be2..d586ff9 100644 --- a/board/esd/hub405/hub405.c +++ b/board/esd/hub405/hub405.c @@ -26,7 +26,8 @@ #include <command.h> #include <malloc.h> -/* ------------------------------------------------------------------------- */ + +extern void lxt971_no_sleep(void); int board_early_init_f (void) @@ -60,8 +61,6 @@ int board_early_init_f (void) } -/* ------------------------------------------------------------------------- */ - int misc_init_f (void) { return 0; /* dummy implementation */ @@ -74,14 +73,10 @@ int misc_init_r (void) volatile unsigned char *duart1_mcr = (unsigned char *)((ulong)DUART1_BA + 4); volatile unsigned char *duart2_mcr = (unsigned char *)((ulong)DUART2_BA + 4); volatile unsigned char *duart3_mcr = (unsigned char *)((ulong)DUART3_BA + 4); - - /* - * Reset external DUARTs - */ - out32(GPIO0_OR, in32(GPIO0_OR) | CFG_DUART_RST); /* set reset to high */ - udelay(10); /* wait 10us */ - out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_DUART_RST); /* set reset to low */ - udelay(1000); /* wait 1ms */ + volatile unsigned char *led_reg = (unsigned char *)((ulong)DUART0_BA + 0x20); + unsigned long val; + int delay, flashcnt; + char *str; /* * Enable interrupts in exar duart mcr[3] @@ -91,12 +86,70 @@ int misc_init_r (void) *duart2_mcr = 0x08; *duart3_mcr = 0x08; + /* + * Set RS232/RS422 control (RS232 = high on GPIO) + */ + val = in32(GPIO0_OR); + val &= ~(CFG_UART2_RS232 | CFG_UART3_RS232 | CFG_UART4_RS232 | CFG_UART5_RS232); + + str = getenv("phys0"); + if (!str || (str && (str[0] == '0'))) + val |= CFG_UART2_RS232; + + str = getenv("phys1"); + if (!str || (str && (str[0] == '0'))) + val |= CFG_UART3_RS232; + + str = getenv("phys2"); + if (!str || (str && (str[0] == '0'))) + val |= CFG_UART4_RS232; + + str = getenv("phys3"); + if (!str || (str && (str[0] == '0'))) + val |= CFG_UART5_RS232; + + out32(GPIO0_OR, val); + /* * Set NAND-FLASH GPIO signals to default */ out32(GPIO0_OR, in32(GPIO0_OR) & ~(CFG_NAND_CLE | CFG_NAND_ALE)); out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND_CE); + /* + * check board type and setup AP power + */ + str = getenv("bd_type"); /* this is only set on non prototype hardware */ + if (str != NULL) { + if ((strcmp(str, "swch405") == 0) || (strcmp(str, "hub405") == 0)) { + unsigned char led_reg_default = 0; + str = getenv("ap_pwr"); + if (!str || (str && (str[0] == '1'))) + led_reg_default = 0x04 | 0x02 ; /* U2_LED | AP_PWR */ + + /* + * Flash LEDs on SWCH405 + */ + for (flashcnt = 0; flashcnt < 3; flashcnt++) { + *led_reg = led_reg_default; /* LED_A..D off */ + for (delay = 0; delay < 100; delay++) + udelay(1000); + *led_reg = led_reg_default | 0xf0; /* LED_A..D on */ + for (delay = 0; delay < 50; delay++) + udelay(1000); + } + *led_reg = led_reg_default; + } + } + + /* + * Reset external DUARTs + */ + out32(GPIO0_OR, in32(GPIO0_OR) | CFG_DUART_RST); /* set reset to high */ + udelay(10); /* wait 10us */ + out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_DUART_RST); /* set reset to low */ + udelay(1000); /* wait 1ms */ + return (0); } @@ -104,7 +157,6 @@ int misc_init_r (void) /* * Check Board Identity: */ - int checkboard (void) { unsigned char str[64]; @@ -120,10 +172,14 @@ int checkboard (void) putc ('\n'); + /* + * Disable sleep mode in LXT971 + */ + lxt971_no_sleep(); + return 0; } -/* ------------------------------------------------------------------------- */ long int initdram (int board_type) { @@ -140,7 +196,6 @@ long int initdram (int board_type) return (4*1024*1024 << ((val & 0x000e0000) >> 17)); } -/* ------------------------------------------------------------------------- */ int testdram (void) { @@ -150,7 +205,6 @@ int testdram (void) return (0); } -/* ------------------------------------------------------------------------- */ #if (CONFIG_COMMANDS & CFG_CMD_NAND) #include <linux/mtd/nand.h> |