diff options
author | Greg Ungerer <gerg@uclinux.org> | 2009-05-21 23:33:35 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2009-09-15 19:43:52 -0400 |
commit | 39f0fb6a3448cfc316e0d5295ed1b121db50037e (patch) | |
tree | 657db8073835e8d499708a898a36f1d3a1e39a32 | |
parent | f6a66276f5fdc018d2a9378c71de3bae13c588d7 (diff) |
m68knommu: map ColdFire interrupts to correct masking bits
The older simple ColdFire interrupt controller has no one-to-one mapping
of interrupt numbers to bits in the interrupt mask register. Create a
mapping array that each ColdFire CPU type can populate with its available
interrupts and the bits that each use in the interrupt mask register.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
-rw-r--r-- | arch/m68k/include/asm/mcfintc.h | 22 | ||||
-rw-r--r-- | arch/m68knommu/platform/5206/config.c | 13 | ||||
-rw-r--r-- | arch/m68knommu/platform/5206e/config.c | 13 | ||||
-rw-r--r-- | arch/m68knommu/platform/5249/config.c | 8 | ||||
-rw-r--r-- | arch/m68knommu/platform/5307/config.c | 14 | ||||
-rw-r--r-- | arch/m68knommu/platform/5407/config.c | 15 | ||||
-rw-r--r-- | arch/m68knommu/platform/coldfire/intc.c | 44 |
7 files changed, 90 insertions, 39 deletions
diff --git a/arch/m68k/include/asm/mcfintc.h b/arch/m68k/include/asm/mcfintc.h index 213aa6c68abb..4183320a3813 100644 --- a/arch/m68k/include/asm/mcfintc.h +++ b/arch/m68k/include/asm/mcfintc.h | |||
@@ -25,11 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Define the base address of the SIM within the MBAR address space. | ||
29 | */ | ||
30 | #define MCFSIM_BASE 0x0 /* Base address within SIM */ | ||
31 | |||
32 | /* | ||
33 | * Bit definitions for the ICR family of registers. | 28 | * Bit definitions for the ICR family of registers. |
34 | */ | 29 | */ |
35 | #define MCFSIM_ICR_AUTOVEC 0x80 /* Auto-vectored intr */ | 30 | #define MCFSIM_ICR_AUTOVEC 0x80 /* Auto-vectored intr */ |
@@ -48,7 +43,9 @@ | |||
48 | #define MCFSIM_ICR_PRI3 0x03 /* Priority 3 intr */ | 43 | #define MCFSIM_ICR_PRI3 0x03 /* Priority 3 intr */ |
49 | 44 | ||
50 | /* | 45 | /* |
51 | * IMR bit position definitions. | 46 | * IMR bit position definitions. Not all ColdFire parts with this interrupt |
47 | * controller actually support all of these interrupt sources. But the bit | ||
48 | * numbers are the same in all cores. | ||
52 | */ | 49 | */ |
53 | #define MCFINTC_EINT1 1 /* External int #1 */ | 50 | #define MCFINTC_EINT1 1 /* External int #1 */ |
54 | #define MCFINTC_EINT2 2 /* External int #2 */ | 51 | #define MCFINTC_EINT2 2 /* External int #2 */ |
@@ -70,6 +67,19 @@ | |||
70 | #define MCFINTC_QSPI 18 | 67 | #define MCFINTC_QSPI 18 |
71 | 68 | ||
72 | #ifndef __ASSEMBLER__ | 69 | #ifndef __ASSEMBLER__ |
70 | |||
71 | /* | ||
72 | * There is no one-is-one correspondance between the interrupt number (irq) | ||
73 | * and the bit fields on the mask register. So we create a per-cpu type | ||
74 | * mapping of irq to mask bit. The CPU platform code needs to register | ||
75 | * its supported irq's at init time, using this function. | ||
76 | */ | ||
77 | extern unsigned char mcf_irq2imr[]; | ||
78 | static inline void mcf_mapirq2imr(int irq, int imr) | ||
79 | { | ||
80 | mcf_irq2imr[irq] = imr; | ||
81 | } | ||
82 | |||
73 | void mcf_autovector(int irq); | 83 | void mcf_autovector(int irq); |
74 | void mcf_setimr(int index); | 84 | void mcf_setimr(int index); |
75 | void mcf_clrimr(int index); | 85 | void mcf_clrimr(int index); |
diff --git a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c index c1d24796ef2f..9c335465e66d 100644 --- a/arch/m68knommu/platform/5206/config.c +++ b/arch/m68knommu/platform/5206/config.c | |||
@@ -49,11 +49,11 @@ static void __init m5206_uart_init_line(int line, int irq) | |||
49 | if (line == 0) { | 49 | if (line == 0) { |
50 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 50 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
51 | writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); | 51 | writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); |
52 | mcf_clrimr(MCFINTC_UART0); | 52 | mcf_mapirq2imr(irq, MCFINTC_UART0); |
53 | } else if (line == 1) { | 53 | } else if (line == 1) { |
54 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); | 54 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); |
55 | writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); | 55 | writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); |
56 | mcf_clrimr(MCFINTC_UART1); | 56 | mcf_mapirq2imr(irq, MCFINTC_UART1); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
@@ -73,11 +73,13 @@ static void __init m5206_timers_init(void) | |||
73 | /* Timer1 is always used as system timer */ | 73 | /* Timer1 is always used as system timer */ |
74 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | 74 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, |
75 | MCF_MBAR + MCFSIM_TIMER1ICR); | 75 | MCF_MBAR + MCFSIM_TIMER1ICR); |
76 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
76 | 77 | ||
77 | #ifdef CONFIG_HIGHPROFILE | 78 | #ifdef CONFIG_HIGHPROFILE |
78 | /* Timer2 is to be used as a high speed profile timer */ | 79 | /* Timer2 is to be used as a high speed profile timer */ |
79 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | 80 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, |
80 | MCF_MBAR + MCFSIM_TIMER2ICR); | 81 | MCF_MBAR + MCFSIM_TIMER2ICR); |
82 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
81 | #endif | 83 | #endif |
82 | } | 84 | } |
83 | 85 | ||
@@ -98,13 +100,18 @@ void __init config_BSP(char *commandp, int size) | |||
98 | { | 100 | { |
99 | mach_reset = m5206_cpu_reset; | 101 | mach_reset = m5206_cpu_reset; |
100 | m5206_timers_init(); | 102 | m5206_timers_init(); |
103 | m5206_uarts_init(); | ||
104 | |||
105 | /* Only support the external interrupts on their primary level */ | ||
106 | mcf_mapirq2imr(25, MCFINTC_EINT1); | ||
107 | mcf_mapirq2imr(28, MCFINTC_EINT4); | ||
108 | mcf_mapirq2imr(31, MCFINTC_EINT7); | ||
101 | } | 109 | } |
102 | 110 | ||
103 | /***************************************************************************/ | 111 | /***************************************************************************/ |
104 | 112 | ||
105 | static int __init init_BSP(void) | 113 | static int __init init_BSP(void) |
106 | { | 114 | { |
107 | m5206_uarts_init(); | ||
108 | platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices)); | 115 | platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices)); |
109 | return 0; | 116 | return 0; |
110 | } | 117 | } |
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c index 363296af2ee5..0f41ba82a3b5 100644 --- a/arch/m68knommu/platform/5206e/config.c +++ b/arch/m68knommu/platform/5206e/config.c | |||
@@ -50,11 +50,11 @@ static void __init m5206e_uart_init_line(int line, int irq) | |||
50 | if (line == 0) { | 50 | if (line == 0) { |
51 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 51 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
52 | writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); | 52 | writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); |
53 | mcf_clrimr(MCFINTC_UART0); | 53 | mcf_mapirq2imr(irq, MCFINTC_UART0); |
54 | } else if (line == 1) { | 54 | } else if (line == 1) { |
55 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); | 55 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); |
56 | writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); | 56 | writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); |
57 | mcf_clrimr(MCFINTC_UART1); | 57 | mcf_mapirq2imr(irq, MCFINTC_UART1); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
@@ -74,11 +74,13 @@ static void __init m5206e_timers_init(void) | |||
74 | /* Timer1 is always used as system timer */ | 74 | /* Timer1 is always used as system timer */ |
75 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | 75 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, |
76 | MCF_MBAR + MCFSIM_TIMER1ICR); | 76 | MCF_MBAR + MCFSIM_TIMER1ICR); |
77 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
77 | 78 | ||
78 | #ifdef CONFIG_HIGHPROFILE | 79 | #ifdef CONFIG_HIGHPROFILE |
79 | /* Timer2 is to be used as a high speed profile timer */ | 80 | /* Timer2 is to be used as a high speed profile timer */ |
80 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | 81 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, |
81 | MCF_MBAR + MCFSIM_TIMER2ICR); | 82 | MCF_MBAR + MCFSIM_TIMER2ICR); |
83 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
82 | #endif | 84 | #endif |
83 | } | 85 | } |
84 | 86 | ||
@@ -105,13 +107,18 @@ void __init config_BSP(char *commandp, int size) | |||
105 | 107 | ||
106 | mach_reset = m5206e_cpu_reset; | 108 | mach_reset = m5206e_cpu_reset; |
107 | m5206e_timers_init(); | 109 | m5206e_timers_init(); |
110 | m5206e_uarts_init(); | ||
111 | |||
112 | /* Only support the external interrupts on their primary level */ | ||
113 | mcf_mapirq2imr(25, MCFINTC_EINT1); | ||
114 | mcf_mapirq2imr(28, MCFINTC_EINT4); | ||
115 | mcf_mapirq2imr(31, MCFINTC_EINT7); | ||
108 | } | 116 | } |
109 | 117 | ||
110 | /***************************************************************************/ | 118 | /***************************************************************************/ |
111 | 119 | ||
112 | static int __init init_BSP(void) | 120 | static int __init init_BSP(void) |
113 | { | 121 | { |
114 | m5206e_uarts_init(); | ||
115 | platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices)); | 122 | platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices)); |
116 | return 0; | 123 | return 0; |
117 | } | 124 | } |
diff --git a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c index 51202b1096cc..646f5ba462fc 100644 --- a/arch/m68knommu/platform/5249/config.c +++ b/arch/m68knommu/platform/5249/config.c | |||
@@ -48,11 +48,11 @@ static void __init m5249_uart_init_line(int line, int irq) | |||
48 | if (line == 0) { | 48 | if (line == 0) { |
49 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 49 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
50 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); | 50 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); |
51 | mcf_clrimr(MCFINTC_UART0); | 51 | mcf_mapirq2imr(irq, MCFINTC_UART0); |
52 | } else if (line == 1) { | 52 | } else if (line == 1) { |
53 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); | 53 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); |
54 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); | 54 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); |
55 | mcf_clrimr(MCFINTC_UART1); | 55 | mcf_mapirq2imr(irq, MCFINTC_UART1); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
@@ -72,11 +72,13 @@ static void __init m5249_timers_init(void) | |||
72 | /* Timer1 is always used as system timer */ | 72 | /* Timer1 is always used as system timer */ |
73 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | 73 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, |
74 | MCF_MBAR + MCFSIM_TIMER1ICR); | 74 | MCF_MBAR + MCFSIM_TIMER1ICR); |
75 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
75 | 76 | ||
76 | #ifdef CONFIG_HIGHPROFILE | 77 | #ifdef CONFIG_HIGHPROFILE |
77 | /* Timer2 is to be used as a high speed profile timer */ | 78 | /* Timer2 is to be used as a high speed profile timer */ |
78 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | 79 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, |
79 | MCF_MBAR + MCFSIM_TIMER2ICR); | 80 | MCF_MBAR + MCFSIM_TIMER2ICR); |
81 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
80 | #endif | 82 | #endif |
81 | } | 83 | } |
82 | 84 | ||
@@ -97,13 +99,13 @@ void __init config_BSP(char *commandp, int size) | |||
97 | { | 99 | { |
98 | mach_reset = m5249_cpu_reset; | 100 | mach_reset = m5249_cpu_reset; |
99 | m5249_timers_init(); | 101 | m5249_timers_init(); |
102 | m5249_uarts_init(); | ||
100 | } | 103 | } |
101 | 104 | ||
102 | /***************************************************************************/ | 105 | /***************************************************************************/ |
103 | 106 | ||
104 | static int __init init_BSP(void) | 107 | static int __init init_BSP(void) |
105 | { | 108 | { |
106 | m5249_uarts_init(); | ||
107 | platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices)); | 109 | platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices)); |
108 | return 0; | 110 | return 0; |
109 | } | 111 | } |
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c index b711597ac8e1..00900ac06a9c 100644 --- a/arch/m68knommu/platform/5307/config.c +++ b/arch/m68knommu/platform/5307/config.c | |||
@@ -58,11 +58,11 @@ static void __init m5307_uart_init_line(int line, int irq) | |||
58 | if (line == 0) { | 58 | if (line == 0) { |
59 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 59 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
60 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); | 60 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); |
61 | mcf_clrimr(MCFINTC_UART0); | 61 | mcf_mapirq2imr(irq, MCFINTC_UART0); |
62 | } else if (line == 1) { | 62 | } else if (line == 1) { |
63 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); | 63 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); |
64 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); | 64 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); |
65 | mcf_clrimr(MCFINTC_UART1); | 65 | mcf_mapirq2imr(irq, MCFINTC_UART1); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
@@ -82,11 +82,13 @@ static void __init m5307_timers_init(void) | |||
82 | /* Timer1 is always used as system timer */ | 82 | /* Timer1 is always used as system timer */ |
83 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | 83 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, |
84 | MCF_MBAR + MCFSIM_TIMER1ICR); | 84 | MCF_MBAR + MCFSIM_TIMER1ICR); |
85 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
85 | 86 | ||
86 | #ifdef CONFIG_HIGHPROFILE | 87 | #ifdef CONFIG_HIGHPROFILE |
87 | /* Timer2 is to be used as a high speed profile timer */ | 88 | /* Timer2 is to be used as a high speed profile timer */ |
88 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | 89 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, |
89 | MCF_MBAR + MCFSIM_TIMER2ICR); | 90 | MCF_MBAR + MCFSIM_TIMER2ICR); |
91 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
90 | #endif | 92 | #endif |
91 | } | 93 | } |
92 | 94 | ||
@@ -114,6 +116,13 @@ void __init config_BSP(char *commandp, int size) | |||
114 | 116 | ||
115 | mach_reset = m5307_cpu_reset; | 117 | mach_reset = m5307_cpu_reset; |
116 | m5307_timers_init(); | 118 | m5307_timers_init(); |
119 | m5307_uarts_init(); | ||
120 | |||
121 | /* Only support the external interrupts on their primary level */ | ||
122 | mcf_mapirq2imr(25, MCFINTC_EINT1); | ||
123 | mcf_mapirq2imr(27, MCFINTC_EINT3); | ||
124 | mcf_mapirq2imr(29, MCFINTC_EINT5); | ||
125 | mcf_mapirq2imr(31, MCFINTC_EINT7); | ||
117 | 126 | ||
118 | #ifdef CONFIG_BDM_DISABLE | 127 | #ifdef CONFIG_BDM_DISABLE |
119 | /* | 128 | /* |
@@ -129,7 +138,6 @@ void __init config_BSP(char *commandp, int size) | |||
129 | 138 | ||
130 | static int __init init_BSP(void) | 139 | static int __init init_BSP(void) |
131 | { | 140 | { |
132 | m5307_uarts_init(); | ||
133 | platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices)); | 141 | platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices)); |
134 | return 0; | 142 | return 0; |
135 | } | 143 | } |
diff --git a/arch/m68knommu/platform/5407/config.c b/arch/m68knommu/platform/5407/config.c index cc80029a4a00..70ea789a400c 100644 --- a/arch/m68knommu/platform/5407/config.c +++ b/arch/m68knommu/platform/5407/config.c | |||
@@ -49,12 +49,11 @@ static void __init m5407_uart_init_line(int line, int irq) | |||
49 | if (line == 0) { | 49 | if (line == 0) { |
50 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 50 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
51 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); | 51 | writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR); |
52 | mcf_clrimr(MCFINTC_UART0); | 52 | mcf_mapirq2imr(irq, MCFINTC_UART0); |
53 | } else if (line == 1) { | 53 | } else if (line == 1) { |
54 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); | 54 | writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); |
55 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); | 55 | writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR); |
56 | mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); | 56 | mcf_mapirq2imr(irq, MCFINTC_UART1); |
57 | mcf_clrimr(MCFINTC_UART1); | ||
58 | } | 57 | } |
59 | } | 58 | } |
60 | 59 | ||
@@ -74,11 +73,13 @@ static void __init m5407_timers_init(void) | |||
74 | /* Timer1 is always used as system timer */ | 73 | /* Timer1 is always used as system timer */ |
75 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | 74 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, |
76 | MCF_MBAR + MCFSIM_TIMER1ICR); | 75 | MCF_MBAR + MCFSIM_TIMER1ICR); |
76 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
77 | 77 | ||
78 | #ifdef CONFIG_HIGHPROFILE | 78 | #ifdef CONFIG_HIGHPROFILE |
79 | /* Timer2 is to be used as a high speed profile timer */ | 79 | /* Timer2 is to be used as a high speed profile timer */ |
80 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | 80 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, |
81 | MCF_MBAR + MCFSIM_TIMER2ICR); | 81 | MCF_MBAR + MCFSIM_TIMER2ICR); |
82 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
82 | #endif | 83 | #endif |
83 | } | 84 | } |
84 | 85 | ||
@@ -99,13 +100,19 @@ void __init config_BSP(char *commandp, int size) | |||
99 | { | 100 | { |
100 | mach_reset = m5407_cpu_reset; | 101 | mach_reset = m5407_cpu_reset; |
101 | m5407_timers_init(); | 102 | m5407_timers_init(); |
103 | m5407_uarts_init(); | ||
104 | |||
105 | /* Only support the external interrupts on their primary level */ | ||
106 | mcf_mapirq2imr(25, MCFINTC_EINT1); | ||
107 | mcf_mapirq2imr(27, MCFINTC_EINT3); | ||
108 | mcf_mapirq2imr(29, MCFINTC_EINT5); | ||
109 | mcf_mapirq2imr(31, MCFINTC_EINT7); | ||
102 | } | 110 | } |
103 | 111 | ||
104 | /***************************************************************************/ | 112 | /***************************************************************************/ |
105 | 113 | ||
106 | static int __init init_BSP(void) | 114 | static int __init init_BSP(void) |
107 | { | 115 | { |
108 | m5407_uarts_init(); | ||
109 | platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices)); | 116 | platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices)); |
110 | return 0; | 117 | return 0; |
111 | } | 118 | } |
diff --git a/arch/m68knommu/platform/coldfire/intc.c b/arch/m68knommu/platform/coldfire/intc.c index 14db26bf6e2f..a4560c86db71 100644 --- a/arch/m68knommu/platform/coldfire/intc.c +++ b/arch/m68knommu/platform/coldfire/intc.c | |||
@@ -19,9 +19,17 @@ | |||
19 | #include <asm/mcfsim.h> | 19 | #include <asm/mcfsim.h> |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * Define the vector numbers for the basic 7 interrupt sources. | 22 | * The mapping of irq number to a mask register bit is not one-to-one. |
23 | * These are often referred to as the "external" interrupts in | 23 | * The irq numbers are either based on "level" of interrupt or fixed |
24 | * the ColdFire documentation (for the early ColdFire cores at least). | 24 | * for an autovector-able interrupt. So we keep a local data structure |
25 | * that maps from irq to mask register. Not all interrupts will have | ||
26 | * an IMR bit. | ||
27 | */ | ||
28 | unsigned char mcf_irq2imr[NR_IRQS]; | ||
29 | |||
30 | /* | ||
31 | * Define the miniumun and maximum external interrupt numbers. | ||
32 | * This is also used as the "level" interrupt numbers. | ||
25 | */ | 33 | */ |
26 | #define EIRQ1 25 | 34 | #define EIRQ1 25 |
27 | #define EIRQ7 31 | 35 | #define EIRQ7 31 |
@@ -36,22 +44,22 @@ | |||
36 | 44 | ||
37 | void mcf_setimr(int index) | 45 | void mcf_setimr(int index) |
38 | { | 46 | { |
39 | u16 imr; | 47 | u16 imr; |
40 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); | 48 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); |
41 | __raw_writew(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); | 49 | __raw_writew(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); |
42 | } | 50 | } |
43 | 51 | ||
44 | void mcf_clrimr(int index) | 52 | void mcf_clrimr(int index) |
45 | { | 53 | { |
46 | u16 imr; | 54 | u16 imr; |
47 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); | 55 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); |
48 | __raw_writew(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); | 56 | __raw_writew(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); |
49 | } | 57 | } |
50 | 58 | ||
51 | void mcf_maskimr(unsigned int mask) | 59 | void mcf_maskimr(unsigned int mask) |
52 | { | 60 | { |
53 | u16 imr; | 61 | u16 imr; |
54 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); | 62 | imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); |
55 | imr |= mask; | 63 | imr |= mask; |
56 | __raw_writew(imr, MCF_MBAR + MCFSIM_IMR); | 64 | __raw_writew(imr, MCF_MBAR + MCFSIM_IMR); |
57 | } | 65 | } |
@@ -60,22 +68,22 @@ void mcf_maskimr(unsigned int mask) | |||
60 | 68 | ||
61 | void mcf_setimr(int index) | 69 | void mcf_setimr(int index) |
62 | { | 70 | { |
63 | u32 imr; | 71 | u32 imr; |
64 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); | 72 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); |
65 | __raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); | 73 | __raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); |
66 | } | 74 | } |
67 | 75 | ||
68 | void mcf_clrimr(int index) | 76 | void mcf_clrimr(int index) |
69 | { | 77 | { |
70 | u32 imr; | 78 | u32 imr; |
71 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); | 79 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); |
72 | __raw_writel(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); | 80 | __raw_writel(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); |
73 | } | 81 | } |
74 | 82 | ||
75 | void mcf_maskimr(unsigned int mask) | 83 | void mcf_maskimr(unsigned int mask) |
76 | { | 84 | { |
77 | u32 imr; | 85 | u32 imr; |
78 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); | 86 | imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); |
79 | imr |= mask; | 87 | imr |= mask; |
80 | __raw_writel(imr, MCF_MBAR + MCFSIM_IMR); | 88 | __raw_writel(imr, MCF_MBAR + MCFSIM_IMR); |
81 | } | 89 | } |
@@ -93,24 +101,26 @@ void mcf_maskimr(unsigned int mask) | |||
93 | */ | 101 | */ |
94 | void mcf_autovector(int irq) | 102 | void mcf_autovector(int irq) |
95 | { | 103 | { |
104 | #ifdef MCFSIM_AVR | ||
96 | if ((irq >= EIRQ1) && (irq <= EIRQ7)) { | 105 | if ((irq >= EIRQ1) && (irq <= EIRQ7)) { |
97 | u8 avec; | 106 | u8 avec; |
98 | avec = __raw_readb(MCF_MBAR + MCFSIM_AVR); | 107 | avec = __raw_readb(MCF_MBAR + MCFSIM_AVR); |
99 | avec |= (0x1 << (irq - EIRQ1 + 1)); | 108 | avec |= (0x1 << (irq - EIRQ1 + 1)); |
100 | __raw_writeb(avec, MCF_MBAR + MCFSIM_AVR); | 109 | __raw_writeb(avec, MCF_MBAR + MCFSIM_AVR); |
101 | } | 110 | } |
111 | #endif | ||
102 | } | 112 | } |
103 | 113 | ||
104 | static void intc_irq_mask(unsigned int irq) | 114 | static void intc_irq_mask(unsigned int irq) |
105 | { | 115 | { |
106 | if ((irq >= EIRQ1) && (irq <= EIRQ7)) | 116 | if (mcf_irq2imr[irq]) |
107 | mcf_setimr(irq - EIRQ1 + 1); | 117 | mcf_setimr(mcf_irq2imr[irq]); |
108 | } | 118 | } |
109 | 119 | ||
110 | static void intc_irq_unmask(unsigned int irq) | 120 | static void intc_irq_unmask(unsigned int irq) |
111 | { | 121 | { |
112 | if ((irq >= EIRQ1) && (irq <= EIRQ7)) | 122 | if (mcf_irq2imr[irq]) |
113 | mcf_clrimr(irq - EIRQ1 + 1); | 123 | mcf_clrimr(mcf_irq2imr[irq]); |
114 | } | 124 | } |
115 | 125 | ||
116 | static int intc_irq_set_type(unsigned int irq, unsigned int type) | 126 | static int intc_irq_set_type(unsigned int irq, unsigned int type) |