From 55148f6f886a1b77dba1a5c3169208606827b9db Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Sat, 24 Dec 2011 01:23:35 +1000 Subject: 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 --- arch/m68k/platform/5206/config.c | 17 ----------------- arch/m68k/platform/5249/config.c | 17 ----------------- arch/m68k/platform/5307/config.c | 17 ----------------- arch/m68k/platform/5407/config.c | 17 ----------------- arch/m68k/platform/coldfire/device.c | 20 ++++++++++++++++++++ 5 files changed, 20 insertions(+), 68 deletions(-) (limited to 'arch/m68k/platform') diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c index fdef300a152c..aca6253191f7 100644 --- a/arch/m68k/platform/5206/config.c +++ b/arch/m68k/platform/5206/config.c @@ -16,22 +16,6 @@ #include #include #include -#include - -/***************************************************************************/ - -static void __init m5206_uarts_init(void) -{ - /* UART0 interrupt setup */ - writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); - writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); - - /* UART1 interrupt setup */ - writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); - writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); -} /***************************************************************************/ @@ -74,7 +58,6 @@ void __init config_BSP(char *commandp, int size) mach_reset = m5206_cpu_reset; mach_sched_init = hw_timer_init; m5206_timers_init(); - m5206_uarts_init(); /* Only support the external interrupts on their primary level */ mcf_mapirq2imr(25, MCFINTC_EINT1); diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c index afcdbfc6edaf..58dc2c9c186d 100644 --- a/arch/m68k/platform/5249/config.c +++ b/arch/m68k/platform/5249/config.c @@ -17,7 +17,6 @@ #include #include #include -#include #include /***************************************************************************/ @@ -215,21 +214,6 @@ static struct platform_device *m5249_devices[] __initdata = { /***************************************************************************/ -static void __init m5249_uarts_init(void) -{ - /* UART0 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); - writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); - - /* UART1 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); - writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); -} - -/***************************************************************************/ - #ifdef CONFIG_M5249C3 static void __init m5249_smc91x_init(void) @@ -281,7 +265,6 @@ void __init config_BSP(char *commandp, int size) mach_reset = m5249_cpu_reset; mach_sched_init = hw_timer_init; m5249_timers_init(); - m5249_uarts_init(); #ifdef CONFIG_M5249C3 m5249_smc91x_init(); #endif diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/5307/config.c index 74852a3dadf9..89722cdbd026 100644 --- a/arch/m68k/platform/5307/config.c +++ b/arch/m68k/platform/5307/config.c @@ -16,7 +16,6 @@ #include #include #include -#include #include /***************************************************************************/ @@ -29,21 +28,6 @@ unsigned char ledbank = 0xff; /***************************************************************************/ -static void __init m5307_uarts_init(void) -{ - /* UART0 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); - writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); - - /* UART1 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); - writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); -} - -/***************************************************************************/ - static void __init m5307_timers_init(void) { /* Timer1 is always used as system timer */ @@ -84,7 +68,6 @@ void __init config_BSP(char *commandp, int size) mach_reset = m5307_cpu_reset; mach_sched_init = hw_timer_init; m5307_timers_init(); - m5307_uarts_init(); /* Only support the external interrupts on their primary level */ mcf_mapirq2imr(25, MCFINTC_EINT1); diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/5407/config.c index e66ef8563717..e3b4cab0feb3 100644 --- a/arch/m68k/platform/5407/config.c +++ b/arch/m68k/platform/5407/config.c @@ -16,22 +16,6 @@ #include #include #include -#include - -/***************************************************************************/ - -static void __init m5407_uarts_init(void) -{ - /* UART0 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); - writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); - - /* UART1 interrupt setup */ - writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); - writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); - mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); -} /***************************************************************************/ @@ -68,7 +52,6 @@ void __init config_BSP(char *commandp, int size) mach_reset = m5407_cpu_reset; mach_sched_init = hw_timer_init; m5407_timers_init(); - m5407_uarts_init(); /* Only support the external interrupts on their primary level */ mcf_mapirq2imr(25, MCFINTC_EINT1); diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c index c9506907872f..b9301920afbf 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 = { &mcf_uart, }; + +/* + * Some ColdFire UARTs let you set the IRQ line to use. + */ +static void __init mcf_uart_set_irq(void) +{ +#ifdef MCFUART_UIVR + /* UART0 interrupt setup */ + writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); + writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); + mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); + + /* UART1 interrupt setup */ + writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); + writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); + mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); +#endif +} + static int __init mcf_init_devices(void) { + mcf_uart_set_irq(); platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices)); return 0; } -- cgit v1.2.3