diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/as3525.h | 43 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 32 |
2 files changed, 60 insertions, 15 deletions
diff --git a/firmware/export/as3525.h b/firmware/export/as3525.h index 91d0155234..9bd4b19a20 100644 --- a/firmware/export/as3525.h +++ b/firmware/export/as3525.h | |||
@@ -195,7 +195,7 @@ CE lines | |||
195 | #define CGU_MEMSTICK (*(volatile unsigned long *)(CGU_BASE + 0x34)) | 195 | #define CGU_MEMSTICK (*(volatile unsigned long *)(CGU_BASE + 0x34)) |
196 | #define CGU_DBOP (*(volatile unsigned long *)(CGU_BASE + 0x38)) | 196 | #define CGU_DBOP (*(volatile unsigned long *)(CGU_BASE + 0x38)) |
197 | 197 | ||
198 | 198 | #define CGU_VIC_CLOCK_ENABLE ( 1 << 23 ) /* vic */ | |
199 | /* --- are disabled after reset --- */ | 199 | /* --- are disabled after reset --- */ |
200 | #define CGU_DMA_CLOCK_ENABLE ( 1 << 22 ) /* dma */ | 200 | #define CGU_DMA_CLOCK_ENABLE ( 1 << 22 ) /* dma */ |
201 | #define CGU_USB_CLOCK_ENABLE ( 1 << 21 ) /* usb */ | 201 | #define CGU_USB_CLOCK_ENABLE ( 1 << 21 ) /* usb */ |
@@ -347,4 +347,45 @@ interface */ | |||
347 | 347 | ||
348 | #define MPMC_PERIPH_ID2 (*(volatile unsigned long*)(MPMC_BASE+0xFE8)) | 348 | #define MPMC_PERIPH_ID2 (*(volatile unsigned long*)(MPMC_BASE+0xFE8)) |
349 | 349 | ||
350 | /* VIC controller (PL190) registers */ | ||
351 | |||
352 | #define VIC_IRQ_STATUS (*(volatile unsigned long*)(VIC_BASE+0x00)) | ||
353 | #define VIC_FIQ_STATUS (*(volatile unsigned long*)(VIC_BASE+0x04)) | ||
354 | #define VIC_RAW_INTR (*(volatile unsigned long*)(VIC_BASE+0x08)) | ||
355 | #define VIC_INT_SELECT (*(volatile unsigned long*)(VIC_BASE+0x0C)) | ||
356 | #define VIC_INT_ENABLE (*(volatile unsigned long*)(VIC_BASE+0x10)) | ||
357 | #define VIC_INT_EN_CLEAR (*(volatile unsigned long*)(VIC_BASE+0x14)) | ||
358 | #define VIC_SOFT_INT (*(volatile unsigned long*)(VIC_BASE+0x18)) | ||
359 | #define VIC_SOFT_INT_CLEAR (*(volatile unsigned long*)(VIC_BASE+0x1C)) | ||
360 | #define VIC_PROTECTION (*(volatile unsigned long*)(VIC_BASE+0x20)) | ||
361 | #define VIC_VECT_ADDR (*(volatile unsigned long*)(VIC_BASE+0x30)) | ||
362 | #define VIC_DEF_VECT_ADDR (*(volatile unsigned long*)(VIC_BASE+0x34)) | ||
363 | |||
364 | /* Interrupts */ | ||
365 | #define INTERRUPT_WATCHDOG (1<<0) | ||
366 | #define INTERRUPT_TIMER1 (1<<1) | ||
367 | #define INTERRUPT_TIMER2 (1<<2) | ||
368 | #define INTERRUPT_USB (1<<3) | ||
369 | #define INTERRUPT_DMAC (1<<4) | ||
370 | #define INTERRUPT_NAND (1<<5) | ||
371 | #define INTERRUPT_IDE (1<<6) | ||
372 | #define INTERRUPT_MCI0 (1<<1<<7) | ||
373 | #define INTERRUPT_MCI1 (1<<8) | ||
374 | #define INTERRUPT_AUDIO (1<<9) | ||
375 | #define INTERRUPT_SSP (1<<10) | ||
376 | #define INTERRUPT_I2C_MS (1<<11) | ||
377 | #define INTERRUPT_I2C_AUDIO (1<<12) | ||
378 | #define INTERRUPT_I2SIN (1<<13) | ||
379 | #define INTERRUPT_I2SOUT (1<<14) | ||
380 | #define INTERRUPT_UART (1<<15) | ||
381 | #define INTERRUPT_GPIOD (1<<16) | ||
382 | /* 17 reserved */ | ||
383 | #define INTERRUPT_CGU (1<<18) | ||
384 | #define INTERRUPT_MEMORY_STICK (1<<19) | ||
385 | #define INTERRUPT_DBOP (1<<20) | ||
386 | /* 21-28 reserved */ | ||
387 | #define INTERRUPT_GPIOA (1<<29) | ||
388 | #define INTERRUPT_GPIOB (1<<30) | ||
389 | #define INTERRUPT_GPIOC (1<<31) | ||
390 | |||
350 | #endif /*__AS3525_H__*/ | 391 | #endif /*__AS3525_H__*/ |
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index a28ffc473e..9944e60cc5 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -87,10 +87,12 @@ static const char * const irqname[] = | |||
87 | 87 | ||
88 | static void UIRQ(void) | 88 | static void UIRQ(void) |
89 | { | 89 | { |
90 | /* TODO | 90 | unsigned int irq_no = 0; |
91 | unsigned int offset = INTOFFSET; | 91 | int status = VIC_IRQ_STATUS; |
92 | panicf("Unhandled IRQ %02X: %s", offset, irqname[offset]); | 92 | while((status >>= 1)) |
93 | */ | 93 | irq_no++; |
94 | |||
95 | panicf("Unhandled IRQ %02X: %s", irq_no, irqname[irq_no]); | ||
94 | } | 96 | } |
95 | 97 | ||
96 | void irq_handler(void) | 98 | void irq_handler(void) |
@@ -102,16 +104,12 @@ void irq_handler(void) | |||
102 | asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ | 104 | asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ |
103 | "sub sp, sp, #8 \n"); /* Reserve stack */ | 105 | "sub sp, sp, #8 \n"); /* Reserve stack */ |
104 | 106 | ||
105 | /* TODO */ | 107 | unsigned int irq_no = 0; |
106 | #if 0 | 108 | int status = VIC_IRQ_STATUS; |
107 | int irq_no = INTOFFSET; /* Read clears the corresponding IRQ status */ | 109 | while((status >>= 1)) |
108 | #else | 110 | irq_no++; |
109 | int irq_no = 69; | 111 | |
110 | #endif | 112 | irqvector[irq_no](); |
111 | if ((irq_no & (1<<31)) == 0) /* Ensure invalid flag is not set */ | ||
112 | { | ||
113 | irqvector[irq_no](); | ||
114 | } | ||
115 | 113 | ||
116 | asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */ | 114 | asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */ |
117 | "ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */ | 115 | "ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */ |
@@ -228,6 +226,12 @@ void system_init(void) | |||
228 | sdram_init(); | 226 | sdram_init(); |
229 | 227 | ||
230 | CGU_PERI |= (5<<2)|0x01; /* pclk = PLLA / 6 = 64 MHz */ | 228 | CGU_PERI |= (5<<2)|0x01; /* pclk = PLLA / 6 = 64 MHz */ |
229 | |||
230 | #if 0 /* we don't use interrupts at the moment */ | ||
231 | /* enable VIC */ | ||
232 | CGU_PERI |= CGU_VIC_CLOCK_ENABLE; | ||
233 | VIC_INT_SELECT = 0; /* only IRQ, no FIQ */ | ||
234 | #endif | ||
231 | } | 235 | } |
232 | 236 | ||
233 | void system_reboot(void) | 237 | void system_reboot(void) |