Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / m68k / platform / 5206 / config.c
blob6fa3f800277afa22de9167ed91d005c264474a6c
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/5206/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2000-2001, Lineo Inc. (www.lineo.com)
8 */
10 /***************************************************************************/
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/io.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfuart.h>
21 /***************************************************************************/
23 static struct mcf_platform_uart m5206_uart_platform[] = {
25 .mapbase = MCF_MBAR + MCFUART_BASE1,
26 .irq = 73,
29 .mapbase = MCF_MBAR + MCFUART_BASE2,
30 .irq = 74,
32 { },
35 static struct platform_device m5206_uart = {
36 .name = "mcfuart",
37 .id = 0,
38 .dev.platform_data = m5206_uart_platform,
41 static struct platform_device *m5206_devices[] __initdata = {
42 &m5206_uart,
45 /***************************************************************************/
47 static void __init m5206_uart_init_line(int line, int irq)
49 if (line == 0) {
50 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
51 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
52 mcf_mapirq2imr(irq, MCFINTC_UART0);
53 } else if (line == 1) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
55 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
56 mcf_mapirq2imr(irq, MCFINTC_UART1);
60 static void __init m5206_uarts_init(void)
62 const int nrlines = ARRAY_SIZE(m5206_uart_platform);
63 int line;
65 for (line = 0; (line < nrlines); line++)
66 m5206_uart_init_line(line, m5206_uart_platform[line].irq);
69 /***************************************************************************/
71 static void __init m5206_timers_init(void)
73 /* Timer1 is always used as system timer */
74 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
75 MCF_MBAR + MCFSIM_TIMER1ICR);
76 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
78 #ifdef CONFIG_HIGHPROFILE
79 /* Timer2 is to be used as a high speed profile timer */
80 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
81 MCF_MBAR + MCFSIM_TIMER2ICR);
82 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
83 #endif
86 /***************************************************************************/
88 void m5206_cpu_reset(void)
90 local_irq_disable();
91 /* Set watchdog to soft reset, and enabled */
92 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
93 for (;;)
94 /* wait for watchdog to timeout */;
97 /***************************************************************************/
99 void __init config_BSP(char *commandp, int size)
101 #if defined(CONFIG_NETtel)
102 /* Copy command line from FLASH to local buffer... */
103 memcpy(commandp, (char *) 0xf0004000, size);
104 commandp[size-1] = 0;
105 #endif /* CONFIG_NETtel */
107 mach_reset = m5206_cpu_reset;
108 m5206_timers_init();
109 m5206_uarts_init();
111 /* Only support the external interrupts on their primary level */
112 mcf_mapirq2imr(25, MCFINTC_EINT1);
113 mcf_mapirq2imr(28, MCFINTC_EINT4);
114 mcf_mapirq2imr(31, MCFINTC_EINT7);
117 /***************************************************************************/
119 static int __init init_BSP(void)
121 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
122 return 0;
125 arch_initcall(init_BSP);
127 /***************************************************************************/