From: Stefan E. <se...@us...> - 2004-02-05 18:29:49
|
Update of /cvsroot/blob/blob/src/blob In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20035 Modified Files: dafit.c Log Message: Dafit autoboot handler. MSP processor reset. Index: dafit.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/dafit.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dafit.c 10 Nov 2003 20:59:35 -0000 1.6 +++ dafit.c 5 Feb 2004 18:27:13 -0000 1.7 @@ -45,6 +45,7 @@ #include <blob/time.h> #include <blob/partition.h> #include <blob/led.h> +#include <blob/autoboot.h> #include <blob/arch.h> #include <blob/proc/sa1111.h> @@ -66,12 +67,12 @@ #define SET(reg,bit) ((reg) |= (1<<(bit))) #define RST(reg,bit) ((reg) &= ~(1<<(bit))) -#define DAFIT_DEBUG 1 +#undef DAFIT_DEBUG 1 #if DAFIT_DEBUG -# define DBG( x, args... ) if ( dbg>=x ) printf( args ) +# define _DBG( x, args... ) if ( dbg>=x ) printf( args ) #else -# define DBG( x, args... ) +# define _DBG( x, args... ) #endif /********************************************************************** @@ -87,7 +88,7 @@ #if DAFIT_DEBUG static int dbg = 1; #else -static int sys3_dbg = 0; +static int dbg = 0; #endif /* flash descriptor for System3 flash. */ @@ -234,6 +235,7 @@ GPSR |= GPIO_GPIO13 | GPIO_GPIO15 | + GPIO_GPIO25 | GPIO_GPIO26; GPCR |= GPIO_GPIO7 | @@ -248,8 +250,7 @@ GPIO_GPIO21 | GPIO_GPIO22 | GPIO_GPIO23 | - GPIO_GPIO24 | - GPIO_GPIO25; + GPIO_GPIO24; /* activate SYSCLCK for keyboard controller */ RST( MEM(TUCR), 31 ); @@ -265,14 +266,34 @@ /* tweak blob config */ blob_status.boot_delay = 1; +} +__initlist(dafit_init_hardware, INIT_LEVEL_INITIAL_HARDWARE+5); + +/********************************************************************** + * dafit autoboot + * + * autoboot if we dont get "BlobStop" during the first 100 ms after we say + * "BlobStop". + */ +int dafit_check_autoboot( void *unused ) +{ + /* quick boot */ + char buffer[20] = {0}; + int ret = 1; + + printf( "BlobStop\n" ); + ret = SerialInputStringMs( buffer, 9, 100 ); /* 100 ms to */ + if ( ret == 8 && strncmp( buffer, "BlobStop", 8 ) == 0 ) { + ret = 0; /* stop autoboot */ + } + return ret; } -__initlist(dafit_init_hardware, INIT_LEVEL_OTHER_HARDWARE); /********************************************************************** - * dafit default partition table + * dafit other hw stuff */ -static void dafit_set_partition_table(void) +static void dafit_other_stuff(void) { /* the default partition table */ default_partition_table = dafit_default_partition_table; @@ -282,12 +303,21 @@ * parser figure out. */ flash_partition_table = (blob_partition_t*)0x00000000; -} -__initlist(dafit_set_partition_table, INIT_LEVEL_OTHER_STUFF); -/* FIXME: need to think if this is the correct init level, we might - * want to have this before the param list stuff starts running */ + msleep(50); + /* reset MSP */ + GPCR |= GPIO_GPIO25; + msleep(5); + GPSR |= GPIO_GPIO25; + + if ( (MEM(DAFIT_CTRL_IRQSR1) & (1<<5)) == 0 ) { + /* quick boot */ + blob_autoboot_fn = dafit_check_autoboot; + blob_autoboot_priv = NULL; + } +} +__initlist(dafit_other_stuff, INIT_LEVEL_OTHER_STUFF); /***************************************************************** * sysver - print system version @@ -353,10 +383,10 @@ printf( "setdbg: debug level set to %d\n", dbg ); return 0; } + static char setdbg_help[] = "setdbg level\n"; __commandlist(setdbg_cmd, "setdbg", setdbg_help); - #if defined(CONFIG_PCMCIA_SUPPORT) /***************************************************************** * pcmcia_init - initialize PCMCIA @@ -368,8 +398,6 @@ } #endif - - /***************************************************************** * misc utility funcs */ @@ -378,12 +406,6 @@ * manually reference flash and download commands until they * are in libblob. */ -#if 0 -extern int cf_test_module( int argc, char *argv[] ); -extern char cf_help[]; -__commandlist(cf_test_module, "cftest", cf_help); -#endif - #if 1 extern int fwrite_cmd(int argc, char *argv[]); extern char fwrite_help[]; @@ -397,5 +419,3 @@ extern int dlfile_cmd(int argc, char *argv[]); extern char dlfile_help[]; __commandlist(dlfile_cmd, "dlfile", dlfile_help); - - |