aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2011-12-23 10:23:35 -0500
committerGreg Ungerer <gerg@uclinux.org>2012-03-04 18:43:08 -0500
commit55148f6f886a1b77dba1a5c3169208606827b9db (patch)
tree17e77390b22a390a6fe9897fe0f1b086319097ae /arch/m68k
parent0d2fe946474196e586e492d9e9b381e184c774ea (diff)
m68knommu: merge common ColdFire UART IRQ setup
Some ColdFire CPU UART hardware modules can configure the IRQ they use. Currently the same setup code is duplicated in the init code for each of these ColdFire CPUs. Merge all this code to a single instance. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/include/asm/mcfuart.h5
-rw-r--r--arch/m68k/platform/5206/config.c17
-rw-r--r--arch/m68k/platform/5249/config.c17
-rw-r--r--arch/m68k/platform/5307/config.c17
-rw-r--r--arch/m68k/platform/5407/config.c17
-rw-r--r--arch/m68k/platform/coldfire/device.c20
6 files changed, 24 insertions, 69 deletions
diff --git a/arch/m68k/include/asm/mcfuart.h b/arch/m68k/include/asm/mcfuart.h
index 2abedff0a69..2d3bc774b3c 100644
--- a/arch/m68k/include/asm/mcfuart.h
+++ b/arch/m68k/include/asm/mcfuart.h
@@ -41,7 +41,10 @@ struct mcf_platform_uart {
41#define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */ 41#define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */
42#define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */ 42#define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */
43#define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */ 43#define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */
44#else 44#endif
45#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
46 defined(CONFIG_M5249) || defined(CONFIG_M5307) || \
47 defined(CONFIG_M5407)
45#define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */ 48#define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */
46#endif 49#endif
47#define MCFUART_UIPR 0x34 /* Input Port (r) */ 50#define MCFUART_UIPR 0x34 /* Input Port (r) */
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c
index fdef300a152..aca6253191f 100644
--- a/arch/m68k/platform/5206/config.c
+++ b/arch/m68k/platform/5206/config.c
@@ -16,22 +16,6 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20
21/***************************************************************************/
22
23static void __init m5206_uarts_init(void)
24{
25 /* UART0 interrupt setup */
26 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
27 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
28 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
29
30 /* UART1 interrupt setup */
31 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
32 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
33 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
34}
35 19
36/***************************************************************************/ 20/***************************************************************************/
37 21
@@ -74,7 +58,6 @@ void __init config_BSP(char *commandp, int size)
74 mach_reset = m5206_cpu_reset; 58 mach_reset = m5206_cpu_reset;
75 mach_sched_init = hw_timer_init; 59 mach_sched_init = hw_timer_init;
76 m5206_timers_init(); 60 m5206_timers_init();
77 m5206_uarts_init();
78 61
79 /* Only support the external interrupts on their primary level */ 62 /* Only support the external interrupts on their primary level */
80 mcf_mapirq2imr(25, MCFINTC_EINT1); 63 mcf_mapirq2imr(25, MCFINTC_EINT1);
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c
index afcdbfc6eda..58dc2c9c186 100644
--- a/arch/m68k/platform/5249/config.c
+++ b/arch/m68k/platform/5249/config.c
@@ -17,7 +17,6 @@
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/coldfire.h> 18#include <asm/coldfire.h>
19#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
20#include <asm/mcfuart.h>
21#include <asm/mcfqspi.h> 20#include <asm/mcfqspi.h>
22 21
23/***************************************************************************/ 22/***************************************************************************/
@@ -215,21 +214,6 @@ static struct platform_device *m5249_devices[] __initdata = {
215 214
216/***************************************************************************/ 215/***************************************************************************/
217 216
218static void __init m5249_uarts_init(void)
219{
220 /* UART0 interrupt setup */
221 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
222 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
223 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
224
225 /* UART1 interrupt setup */
226 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
227 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
228 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
229}
230
231/***************************************************************************/
232
233#ifdef CONFIG_M5249C3 217#ifdef CONFIG_M5249C3
234 218
235static void __init m5249_smc91x_init(void) 219static void __init m5249_smc91x_init(void)
@@ -281,7 +265,6 @@ void __init config_BSP(char *commandp, int size)
281 mach_reset = m5249_cpu_reset; 265 mach_reset = m5249_cpu_reset;
282 mach_sched_init = hw_timer_init; 266 mach_sched_init = hw_timer_init;
283 m5249_timers_init(); 267 m5249_timers_init();
284 m5249_uarts_init();
285#ifdef CONFIG_M5249C3 268#ifdef CONFIG_M5249C3
286 m5249_smc91x_init(); 269 m5249_smc91x_init();
287#endif 270#endif
diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/5307/config.c
index 74852a3dadf..89722cdbd02 100644
--- a/arch/m68k/platform/5307/config.c
+++ b/arch/m68k/platform/5307/config.c
@@ -16,7 +16,6 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20#include <asm/mcfwdebug.h> 19#include <asm/mcfwdebug.h>
21 20
22/***************************************************************************/ 21/***************************************************************************/
@@ -29,21 +28,6 @@ unsigned char ledbank = 0xff;
29 28
30/***************************************************************************/ 29/***************************************************************************/
31 30
32static void __init m5307_uarts_init(void)
33{
34 /* UART0 interrupt setup */
35 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
36 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
37 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
38
39 /* UART1 interrupt setup */
40 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
41 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
42 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
43}
44
45/***************************************************************************/
46
47static void __init m5307_timers_init(void) 31static void __init m5307_timers_init(void)
48{ 32{
49 /* Timer1 is always used as system timer */ 33 /* Timer1 is always used as system timer */
@@ -84,7 +68,6 @@ void __init config_BSP(char *commandp, int size)
84 mach_reset = m5307_cpu_reset; 68 mach_reset = m5307_cpu_reset;
85 mach_sched_init = hw_timer_init; 69 mach_sched_init = hw_timer_init;
86 m5307_timers_init(); 70 m5307_timers_init();
87 m5307_uarts_init();
88 71
89 /* Only support the external interrupts on their primary level */ 72 /* Only support the external interrupts on their primary level */
90 mcf_mapirq2imr(25, MCFINTC_EINT1); 73 mcf_mapirq2imr(25, MCFINTC_EINT1);
diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/5407/config.c
index e66ef856371..e3b4cab0feb 100644
--- a/arch/m68k/platform/5407/config.c
+++ b/arch/m68k/platform/5407/config.c
@@ -16,22 +16,6 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfuart.h>
20
21/***************************************************************************/
22
23static void __init m5407_uarts_init(void)
24{
25 /* UART0 interrupt setup */
26 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
27 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
28 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
29
30 /* UART1 interrupt setup */
31 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
32 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
33 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
34}
35 19
36/***************************************************************************/ 20/***************************************************************************/
37 21
@@ -68,7 +52,6 @@ void __init config_BSP(char *commandp, int size)
68 mach_reset = m5407_cpu_reset; 52 mach_reset = m5407_cpu_reset;
69 mach_sched_init = hw_timer_init; 53 mach_sched_init = hw_timer_init;
70 m5407_timers_init(); 54 m5407_timers_init();
71 m5407_uarts_init();
72 55
73 /* Only support the external interrupts on their primary level */ 56 /* Only support the external interrupts on their primary level */
74 mcf_mapirq2imr(25, MCFINTC_EINT1); 57 mcf_mapirq2imr(25, MCFINTC_EINT1);
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index c9506907872..b9301920afb 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -50,8 +50,28 @@ static struct platform_device *mcf_devices[] __initdata = {
50 &mcf_uart, 50 &mcf_uart,
51}; 51};
52 52
53
54/*
55 * Some ColdFire UARTs let you set the IRQ line to use.
56 */
57static void __init mcf_uart_set_irq(void)
58{
59#ifdef MCFUART_UIVR
60 /* UART0 interrupt setup */
61 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
62 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
63 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
64
65 /* UART1 interrupt setup */
66 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
67 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
68 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
69#endif
70}
71
53static int __init mcf_init_devices(void) 72static int __init mcf_init_devices(void)
54{ 73{
74 mcf_uart_set_irq();
55 platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices)); 75 platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices));
56 return 0; 76 return 0;
57} 77}