diff options
Diffstat (limited to 'firmware/target/arm/as3525/system-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 544371e5a4..240cb63b7c 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "panic.h" | 25 | #include "panic.h" |
26 | #include "as3525-codec.h" | ||
26 | 27 | ||
27 | #define default_interrupt(name) \ | 28 | #define default_interrupt(name) \ |
28 | extern __attribute__((weak,alias("UIRQ"))) void name (void) | 29 | extern __attribute__((weak,alias("UIRQ"))) void name (void) |
@@ -123,6 +124,7 @@ void fiq_handler(void) | |||
123 | ); | 124 | ); |
124 | } | 125 | } |
125 | 126 | ||
127 | #ifdef BOOTLOADER | ||
126 | static void sdram_delay(void) | 128 | static void sdram_delay(void) |
127 | { | 129 | { |
128 | int delay = 1024; /* arbitrary */ | 130 | int delay = 1024; /* arbitrary */ |
@@ -192,9 +194,11 @@ static void sdram_init(void) | |||
192 | 194 | ||
193 | MPMC_DYNAMIC_CONFIG_0 |= (1<<19); /* buffer enable */ | 195 | MPMC_DYNAMIC_CONFIG_0 |= (1<<19); /* buffer enable */ |
194 | } | 196 | } |
197 | #endif | ||
195 | 198 | ||
196 | void system_init(void) | 199 | void system_init(void) |
197 | { | 200 | { |
201 | #ifdef BOOTLOADER | ||
198 | #if 0 /* the GPIO clock is already enabled by the dualboot function */ | 202 | #if 0 /* the GPIO clock is already enabled by the dualboot function */ |
199 | CGU_PERI |= CGU_GPIO_CLOCK_ENABLE; | 203 | CGU_PERI |= CGU_GPIO_CLOCK_ENABLE; |
200 | #endif | 204 | #endif |
@@ -235,6 +239,7 @@ void system_init(void) | |||
235 | /* enable VIC */ | 239 | /* enable VIC */ |
236 | CGU_PERI |= CGU_VIC_CLOCK_ENABLE; | 240 | CGU_PERI |= CGU_VIC_CLOCK_ENABLE; |
237 | VIC_INT_SELECT = 0; /* only IRQ, no FIQ */ | 241 | VIC_INT_SELECT = 0; /* only IRQ, no FIQ */ |
242 | #endif | ||
238 | } | 243 | } |
239 | 244 | ||
240 | void system_reboot(void) | 245 | void system_reboot(void) |
@@ -246,3 +251,15 @@ int system_memory_guard(int newmode) | |||
246 | (void)newmode; | 251 | (void)newmode; |
247 | return 0; | 252 | return 0; |
248 | } | 253 | } |
254 | |||
255 | void power_off(void) | ||
256 | { | ||
257 | int system; | ||
258 | system = as3525_codec_read(0x20); | ||
259 | system &= ~1; /* clear bit 0 of system register */ | ||
260 | as3525_codec_write(0x20, system); | ||
261 | |||
262 | /* TODO : turn off peripherals properly ? */ | ||
263 | |||
264 | while(1); | ||
265 | } | ||