aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/jazz/irq.c
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2007-08-25 05:01:50 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 18:46:00 -0400
commitea202c632a52c4a83f1bd82d8d06bc8e04f2689a (patch)
tree1815b69d45b99d8f20d0fb33ba7b34b8319f2507 /arch/mips/jazz/irq.c
parent1f21d2bde0046e959b53756f74d96dfd040a803b (diff)
[MIPS] JAZZ fixes
- restructured irq handling - switched vdma to use memory allocated via get_free_pages - setup platform devices for serial, jazz_esp and jazzsonic - fixed cmos rtc access Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/jazz/irq.c')
-rw-r--r--arch/mips/jazz/irq.c94
1 files changed, 27 insertions, 67 deletions
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 015cf4bb51dd..56235412cbb7 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -11,15 +11,17 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13 13
14#include <asm/irq_cpu.h>
14#include <asm/i8259.h> 15#include <asm/i8259.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/jazz.h> 17#include <asm/jazz.h>
18#include <asm/pgtable.h>
17 19
18static DEFINE_SPINLOCK(r4030_lock); 20static DEFINE_SPINLOCK(r4030_lock);
19 21
20static void enable_r4030_irq(unsigned int irq) 22static void enable_r4030_irq(unsigned int irq)
21{ 23{
22 unsigned int mask = 1 << (irq - JAZZ_PARALLEL_IRQ); 24 unsigned int mask = 1 << (irq - JAZZ_IRQ_START);
23 unsigned long flags; 25 unsigned long flags;
24 26
25 spin_lock_irqsave(&r4030_lock, flags); 27 spin_lock_irqsave(&r4030_lock, flags);
@@ -30,7 +32,7 @@ static void enable_r4030_irq(unsigned int irq)
30 32
31void disable_r4030_irq(unsigned int irq) 33void disable_r4030_irq(unsigned int irq)
32{ 34{
33 unsigned int mask = ~(1 << (irq - JAZZ_PARALLEL_IRQ)); 35 unsigned int mask = ~(1 << (irq - JAZZ_IRQ_START));
34 unsigned long flags; 36 unsigned long flags;
35 37
36 spin_lock_irqsave(&r4030_lock, flags); 38 spin_lock_irqsave(&r4030_lock, flags);
@@ -51,7 +53,7 @@ void __init init_r4030_ints(void)
51{ 53{
52 int i; 54 int i;
53 55
54 for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++) 56 for (i = JAZZ_IRQ_START; i <= JAZZ_IRQ_END; i++)
55 set_irq_chip_and_handler(i, &r4030_irq_type, handle_level_irq); 57 set_irq_chip_and_handler(i, &r4030_irq_type, handle_level_irq);
56 58
57 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0); 59 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0);
@@ -66,82 +68,40 @@ void __init init_r4030_ints(void)
66 */ 68 */
67void __init arch_init_irq(void) 69void __init arch_init_irq(void)
68{ 70{
71 /*
72 * this is a hack to get back the still needed wired mapping
73 * killed by init_mm()
74 */
75
76 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
77 add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
78 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
79 add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
80 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
81 add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
82
69 init_i8259_irqs(); /* Integrated i8259 */ 83 init_i8259_irqs(); /* Integrated i8259 */
84 mips_cpu_irq_init();
70 init_r4030_ints(); 85 init_r4030_ints();
71 86
72 change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1); 87 change_c0_status(ST0_IM, IE_IRQ2 | IE_IRQ1);
73}
74
75static void loc_call(unsigned int irq, unsigned int mask)
76{
77 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
78 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) & mask);
79 do_IRQ(irq);
80 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE,
81 r4030_read_reg16(JAZZ_IO_IRQ_ENABLE) | mask);
82}
83
84static void ll_local_dev(void)
85{
86 switch (r4030_read_reg32(JAZZ_IO_IRQ_SOURCE)) {
87 case 0:
88 panic("Unimplemented loc_no_irq handler");
89 break;
90 case 4:
91 loc_call(JAZZ_PARALLEL_IRQ, JAZZ_IE_PARALLEL);
92 break;
93 case 8:
94 loc_call(JAZZ_PARALLEL_IRQ, JAZZ_IE_FLOPPY);
95 break;
96 case 12:
97 panic("Unimplemented loc_sound handler");
98 break;
99 case 16:
100 panic("Unimplemented loc_video handler");
101 break;
102 case 20:
103 loc_call(JAZZ_ETHERNET_IRQ, JAZZ_IE_ETHERNET);
104 break;
105 case 24:
106 loc_call(JAZZ_SCSI_IRQ, JAZZ_IE_SCSI);
107 break;
108 case 28:
109 loc_call(JAZZ_KEYBOARD_IRQ, JAZZ_IE_KEYBOARD);
110 break;
111 case 32:
112 loc_call(JAZZ_MOUSE_IRQ, JAZZ_IE_MOUSE);
113 break;
114 case 36:
115 loc_call(JAZZ_SERIAL1_IRQ, JAZZ_IE_SERIAL1);
116 break;
117 case 40:
118 loc_call(JAZZ_SERIAL2_IRQ, JAZZ_IE_SERIAL2);
119 break;
120 }
121} 88}
122 89
123asmlinkage void plat_irq_dispatch(void) 90asmlinkage void plat_irq_dispatch(void)
124{ 91{
125 unsigned int pending = read_c0_cause() & read_c0_status(); 92 unsigned int pending = read_c0_cause() & read_c0_status();
93 unsigned int irq;
126 94
127 if (pending & IE_IRQ5) 95 if (pending & IE_IRQ4) {
128 write_c0_compare(0);
129 else if (pending & IE_IRQ4) {
130 r4030_read_reg32(JAZZ_TIMER_REGISTER); 96 r4030_read_reg32(JAZZ_TIMER_REGISTER);
131 do_IRQ(JAZZ_TIMER_IRQ); 97 do_IRQ(JAZZ_TIMER_IRQ);
132 } else if (pending & IE_IRQ3) 98 } else if (pending & IE_IRQ2)
133 panic("Unimplemented ISA NMI handler");
134 else if (pending & IE_IRQ2)
135 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK)); 99 do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK));
136 else if (pending & IE_IRQ1) { 100 else if (pending & IE_IRQ1) {
137 ll_local_dev(); 101 irq = *(volatile u8 *)JAZZ_IO_IRQ_SOURCE >> 2;
138 } else if (unlikely(pending & IE_IRQ0)) 102 if (likely(irq > 0))
139 panic("Unimplemented local_dma handler"); 103 do_IRQ(irq + JAZZ_IRQ_START - 1);
140 else if (pending & IE_SW1) { 104 else
141 clear_c0_cause(IE_SW1); 105 panic("Unimplemented loc_no_irq handler");
142 panic("Unimplemented sw1 handler");
143 } else if (pending & IE_SW0) {
144 clear_c0_cause(IE_SW0);
145 panic("Unimplemented sw0 handler");
146 } 106 }
147} 107}