X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2Ftrab%2Ftrab.c;h=828facd763e1db4b7aae667b333194c25a431300;hb=14d0a02a168b36e87665b8d7f42fa3e88263d26d;hp=1a4f5c517c86c9fa4409a1ff0da59c735a1f85cd;hpb=8bde7f776c77b343aca29b8c7b58464d915ac245;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/trab/trab.c b/board/trab/trab.c index 1a4f5c5..828facd 100644 --- a/board/trab/trab.c +++ b/board/trab/trab.c @@ -1,6 +1,6 @@ /* * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, + * Gary Jennejohn, DENX Software Engineering, * * See file CREDITS for list of people who contributed to this * project. @@ -24,13 +24,14 @@ /* #define DEBUG */ #include +#include #include -#include +#include #include -/* ------------------------------------------------------------------------- */ +DECLARE_GLOBAL_DATA_PTR; -#ifdef CFG_BRIGHTNESS +#ifdef CONFIG_SYS_BRIGHTNESS static void spi_init(void); static void wait_transmit_done(void); static void tsc2000_write(unsigned int page, unsigned int reg, @@ -52,12 +53,10 @@ extern int do_mdm_init; /* defined in common/main.c */ #define KBD_MDELAY 5000 static void udelay_no_timer (int usec) { - DECLARE_GLOBAL_DATA_PTR; - int i; int delay = usec * 3; - for (i = 0; i < delay; i ++) gd->bd->bi_arch_number = 145; + for (i = 0; i < delay; i ++) gd->bd->bi_arch_number = MACH_TYPE_TRAB; } #endif /* CONFIG_MODEM_SUPPORT */ @@ -70,9 +69,9 @@ int board_init () #if defined(CONFIG_VFD) extern int vfd_init_clocks(void); #endif - DECLARE_GLOBAL_DATA_PTR; - S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER(); - S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); + struct s3c24x0_clock_power * const clk_power = + s3c24x0_get_base_clock_power(); + struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); /* memory and cpu-speed are setup before relocation */ #ifdef CONFIG_TRAB_50MHZ @@ -92,7 +91,7 @@ int board_init () gpio->PBCON = 0xaaaaaaaa; gpio->PBUP = 0xffff; /* INPUT nCTS0 nRTS0 TXD[1] TXD[0] RXD[1] RXD[0] */ - /* 00, 10, 10, 10, 10, 10, 10 */ + /* 00, 10, 10, 10, 10, 10, 10 */ gpio->PFCON = (2<<0) | (2<<2) | (2<<4) | (2<<6) | (2<<8) | (2<<10); #ifdef CONFIG_HWFLOW /* do not pull up RXD0, RXD1, TXD0, TXD1, CTS0, RTS0 */ @@ -105,10 +104,11 @@ int board_init () gpio->PGUP = 0x0; gpio->OPENCR= 0x0; - /* arch number of SAMSUNG-Board */ - /* MACH_TYPE_SMDK2400 */ - /* XXX this isn't really correct, but keep it for now */ - gd->bd->bi_arch_number = 145; + /* suppress flicker of the VFDs */ + gpio->MISCCR = 0x40; + gpio->PFCON |= (2<<12); + + gd->bd->bi_arch_number = MACH_TYPE_TRAB; /* adress of boot parameters */ gd->bd->bi_boot_params = 0x0c000100; @@ -130,13 +130,16 @@ int board_init () } #endif /* CONFIG_MODEM_SUPPORT */ +#ifdef CONFIG_DRIVER_S3C24X0_I2C + /* Configure I/O ports PG5 und PG6 for I2C */ + gpio->PGCON = (gpio->PGCON & 0x003c00) | 0x003c00; +#endif /* CONFIG_DRIVER_S3C24X0_I2C */ + return 0; } int dram_init (void) { - DECLARE_GLOBAL_DATA_PTR; - gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; return 0; @@ -151,15 +154,36 @@ 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 */ + do_auto_update(); + } +#endif + for (i = 0; i < KEYBD_KEY_NUM; ++i) { keybd_env[i] = '0' + ((kbd_data >> i) & 1); } @@ -177,7 +201,7 @@ int misc_init_r (void) free (str); } -#ifdef CFG_BRIGHTNESS +#ifdef CONFIG_SYS_BRIGHTNESS tsc2000_set_brightness(); #endif return (0); @@ -188,7 +212,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; @@ -234,12 +258,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 @@ -281,10 +305,10 @@ static uchar *key_match (ulong kbd_data) #endif /* CONFIG_PREBOOT */ /* Read Keyboard status */ -int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong kbd_data = KBD_DATA; - uchar keybd_env[KEYBD_KEY_NUM + 1]; + char keybd_env[KEYBD_KEY_NUM + 1]; int i; puts ("Keys:"); @@ -298,10 +322,10 @@ int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } -cmd_tbl_t U_BOOT_CMD(kbd) = MK_CMD_ENTRY( - "kbd", 1, 1, do_kbd, - "kbd - read keyboard status\n", - NULL +U_BOOT_CMD( + kbd, 1, 1, do_kbd, + "read keyboard status", + "" ); #ifdef CONFIG_MODEM_SUPPORT @@ -311,30 +335,30 @@ static int key_pressed(void) } #endif /* CONFIG_MODEM_SUPPORT */ -#ifdef CFG_BRIGHTNESS +#ifdef CONFIG_SYS_BRIGHTNESS static inline void SET_CS_TOUCH(void) { - S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); + struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); gpio->PDDAT &= 0x5FF; } static inline void CLR_CS_TOUCH(void) { - S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); + struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); gpio->PDDAT |= 0x200; } static void spi_init(void) { - S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); - S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI(); + struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); + struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); int i; /* Configure I/O ports. */ - gpio->PDCON = (gpio->PDCON & 0xF3FFFF) | 0x040000; + gpio->PDCON = (gpio->PDCON & 0xF3FFFF) | 0x040000; gpio->PGCON = (gpio->PGCON & 0x0F3FFF) | 0x008000; gpio->PGCON = (gpio->PGCON & 0x0CFFFF) | 0x020000; gpio->PGCON = (gpio->PGCON & 0x03FFFF) | 0x080000; @@ -354,7 +378,7 @@ static void spi_init(void) static void wait_transmit_done(void) { - S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI(); + struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); while (!(spi->ch[0].SPSTA & 0x01)); /* wait until transfer is done */ } @@ -362,7 +386,7 @@ static void wait_transmit_done(void) static void tsc2000_write(unsigned int page, unsigned int reg, unsigned int data) { - S3C24X0_SPI * const spi = S3C24X0_GetBase_SPI(); + struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); unsigned int command; SET_CS_TOUCH(); @@ -384,17 +408,28 @@ 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(); tsc2000_write(1, 2, 0x0); /* Power up DAC */ - i = getenv_r("brightness", tmp, sizeof(tmp)); + i = getenv_f("brightness", tmp, sizeof(tmp)); br = (i > 0) ? (int) simple_strtoul (tmp, NULL, 10) - : CFG_BRIGHTNESS; + : CONFIG_SYS_BRIGHTNESS; tsc2000_write(0, 0xb, br & 0xff); } #endif + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_CS8900 + rc = cs8900_initialize(0, CONFIG_CS8900_BASE); +#endif + return rc; +} +#endif