Staging: hv: mousevsc: Cleanup alloc_input_device()
[zen-stable.git] / arch / m68k / platform / 54xx / config.c
blob78130984db956045c4e3371d138f8c7e70070344
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/54xx/config.c
6 * Copyright (C) 2010, Philippe De Muyter <phdm@macqel.be>
7 */
9 /***************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/io.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/m54xxsim.h>
19 #include <asm/mcfuart.h>
20 #include <asm/m54xxgpt.h>
22 /***************************************************************************/
24 static struct mcf_platform_uart m54xx_uart_platform[] = {
26 .mapbase = MCF_MBAR + MCFUART_BASE1,
27 .irq = 64 + 35,
30 .mapbase = MCF_MBAR + MCFUART_BASE2,
31 .irq = 64 + 34,
34 .mapbase = MCF_MBAR + MCFUART_BASE3,
35 .irq = 64 + 33,
38 .mapbase = MCF_MBAR + MCFUART_BASE4,
39 .irq = 64 + 32,
43 static struct platform_device m54xx_uart = {
44 .name = "mcfuart",
45 .id = 0,
46 .dev.platform_data = m54xx_uart_platform,
49 static struct platform_device *m54xx_devices[] __initdata = {
50 &m54xx_uart,
54 /***************************************************************************/
56 static void __init m54xx_uart_init_line(int line, int irq)
58 int rts_cts;
60 /* enable io pins */
61 switch (line) {
62 case 0:
63 rts_cts = 0; break;
64 case 1:
65 rts_cts = MCF_PAR_PSC_RTS_RTS; break;
66 case 2:
67 rts_cts = MCF_PAR_PSC_RTS_RTS | MCF_PAR_PSC_CTS_CTS; break;
68 case 3:
69 rts_cts = 0; break;
71 __raw_writeb(MCF_PAR_PSC_TXD | rts_cts | MCF_PAR_PSC_RXD,
72 MCF_MBAR + MCF_PAR_PSC(line));
75 static void __init m54xx_uarts_init(void)
77 const int nrlines = ARRAY_SIZE(m54xx_uart_platform);
78 int line;
80 for (line = 0; (line < nrlines); line++)
81 m54xx_uart_init_line(line, m54xx_uart_platform[line].irq);
84 /***************************************************************************/
86 static void mcf54xx_reset(void)
88 /* disable interrupts and enable the watchdog */
89 asm("movew #0x2700, %sr\n");
90 __raw_writel(0, MCF_MBAR + MCF_GPT_GMS0);
91 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_MBAR + MCF_GPT_GCIR0);
92 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
93 MCF_MBAR + MCF_GPT_GMS0);
96 /***************************************************************************/
98 void __init config_BSP(char *commandp, int size)
100 mach_reset = mcf54xx_reset;
101 m54xx_uarts_init();
104 /***************************************************************************/
106 static int __init init_BSP(void)
109 platform_add_devices(m54xx_devices, ARRAY_SIZE(m54xx_devices));
110 return 0;
113 arch_initcall(init_BSP);
115 /***************************************************************************/