Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 14530) +++ apps/debug_menu.c (working copy) @@ -2116,7 +2116,15 @@ #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) extern volatile bool lcd_poweroff; +extern bool cpu_reset; +static bool dbg_restart(void) +{ + cpu_reset = 1; + sys_poweroff(); + return false; +} + static bool dbg_lcd_power_off(void) { lcd_setmargins(0, 0); @@ -2251,6 +2259,7 @@ }; static const struct the_menu_item menuitems[] = { #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) + { "Restart", dbg_restart }, { "LCD Power Off", dbg_lcd_power_off }, #endif #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \ Index: firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c =================================================================== --- firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c (revision 14530) +++ firmware/target/arm/s3c2440/gigabeat-fx/power-meg-fx.c (working copy) @@ -28,8 +28,38 @@ #ifndef SIMULATOR +void cpu_resume(void) +{ + /* restart kernel */ + /* at this point MMU is not initialized, so let CRT0 code do this stuff */ + /* in case of resume from sleep (GSTATUS3) */ + unsigned char* loadbuffer = (unsigned char*) (DRAM0+0x100); + int(*kernel_entry)(void) = (void*) loadbuffer; + kernel_entry(); /* restart kernel */ +} + +bool cpu_reset = 0; + +static void _cpu_reset(void) +{ + GSTATUS3 = GSTATUS4 = 0; /* set default linux loader address in "BIOS" */ + + WTCON = 0; /* disable watchdog, to be safe */ + /* put initial values into count and data */ + WTCNT = 0x100; + WTDAT = 0x100; + /* set the watchdog to go and reset... */ + WTCON = 0x2021;//(0x20<<8)|(1<<5)|(0<<3)|0x01; + /* now wait for reset to assert... */ +} + +//bool coldstart = true; void power_init(void) { + /* after cold start GSTATUS3 will point to Linux loader in BIOS */ + //coldstart = (GSTATUS3 == 0x10030); + GSTATUS2 = GSTATUS2; + GSTATUS3 = ((int)&cpu_resume)+DRAM0; /* Initialize IDE power pin */ GPGCON=( GPGCON&~(1<<23) ) | (1<<22); /* Make the pin an output */ GPGUP |= 1<<11; /* Disable pullup in SOC as we are now driving */ @@ -65,6 +95,8 @@ /* turn off backlight and wait for 1 second */ __backlight_off(); __button_backlight_off(); + if (cpu_reset) + _cpu_reset(); sleep(HZ); /* set SLEEP bit to on in CLKCON to turn off */ CLKCON |=(1<<3); @@ -92,4 +124,3 @@ } #endif /* SIMULATOR */ - Index: firmware/target/arm/crt0.S =================================================================== --- firmware/target/arm/crt0.S (revision 14530) +++ firmware/target/arm/crt0.S (working copy) @@ -35,6 +35,10 @@ #ifndef BOOTLOADER +#if CONFIG_CPU == S3C2440 + bl memory_init +#endif + #ifndef DEBUG /* Copy exception handler code to address 0 */ ldr r2, =_vectorsstart