diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 1918465aa2..e1b80f9be6 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c @@ -197,12 +197,8 @@ void* main(void) line = 0; printf("POWER-OFF"); -#if defined(COWON_D2) - lcd_enable(false); -#endif - - /* TODO: Power-off */ - while(1); + /* Power-off */ + power_off(); return 0; } diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c index d8a58570e4..2439676acc 100644 --- a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c @@ -16,9 +16,7 @@ * KIND, either express or implied. * ****************************************************************************/ -#include "config.h" #include "cpu.h" -#include #include "kernel.h" #include "system.h" #include "power.h" @@ -61,6 +59,22 @@ void charger_enable(bool on) void power_off(void) { + /* Disable interrupts on this core */ + set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS); + + /* Mask them on both cores */ + CPU_INT_CLR = -1; + COP_INT_CLR = -1; + + /* Shutdown: stop XIN oscillator */ + CLKCTRL &= ~(1 << 31); + + /* Halt everything and wait for device to power off */ + while (1) + { + CPU_CTL = PROC_SLEEP; + COP_CTL = PROC_SLEEP; + } } void ide_power_enable(bool on)