diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c index 4537c4b43f..02f040aaa3 100644 --- a/bootloader/sansa_as3525.c +++ b/bootloader/sansa_as3525.c @@ -29,7 +29,6 @@ #include "lcd.h" #include "backlight-target.h" #include "button-target.h" -#include "ascodec-target.h" #include "common.h" #include "storage.h" #include "disk.h" @@ -53,7 +52,6 @@ void main(void) lcd_init(); show_logo(); - ascodec_init(); /* Required for backlight on e200v2 */ _backlight_on(); button_init_device(); diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 7af38ff9d1..a5f34d9b80 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c @@ -27,6 +27,7 @@ #include "dma-target.h" #include "clock-target.h" #include "fmradio_i2c.h" +#include "button-target.h" #define default_interrupt(name) \ extern __attribute__((weak,alias("UIRQ"))) void name (void) @@ -217,8 +218,14 @@ static void sdram_init(void) void system_init(void) { + unsigned int reset_loops = 640; + + CCU_SRC = 0x1fffff0 + & ~(1<<18); /* FIXME */ + while(reset_loops--) + CCU_SRL = CCU_SRL_MAGIC_NUMBER; + CCU_SRC = CCU_SRL = 0; -#ifdef BOOTLOADER /* TODO: makes this work in the main build */ CGU_PROC = 0; /* fclk 24 MHz */ CGU_PERI &= ~0x7f; /* pclk 24 MHz */ @@ -248,6 +255,7 @@ void system_init(void) "mcr p15, 0, r0, c1, c0 \n" : : : "r0" ); +#ifdef BOOTLOADER sdram_init(); #endif /* BOOTLOADER */ @@ -262,10 +270,11 @@ void system_init(void) dma_init(); + ascodec_init(); + #ifndef BOOTLOADER /* Disable fast hardware power-off, to use power button normally * We don't need the power button in the bootloader. */ - ascodec_init(); ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) & (1<<2)); #ifdef CONFIG_TUNER @@ -289,7 +298,7 @@ void system_reboot(void) void system_exception_wait(void) { - while (1); + while(!button_read_device()); } int system_memory_guard(int newmode)