"[PATCH] Fix leaks on /proc/{*/sched,sched_debug,timer_list,timer_stats}" and
[mmotm.git] / arch / m68knommu / platform / 5272 / config.c
blob59278c0887d04de431d46049924f920170328d6a
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/5272/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.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 /***************************************************************************/
24 * Some platforms need software versions of the GPIO data registers.
26 unsigned short ppdata;
27 unsigned char ledbank = 0xff;
29 /***************************************************************************/
31 static struct mcf_platform_uart m5272_uart_platform[] = {
33 .mapbase = MCF_MBAR + MCFUART_BASE1,
34 .irq = MCF_IRQ_UART1,
37 .mapbase = MCF_MBAR + MCFUART_BASE2,
38 .irq = MCF_IRQ_UART2,
40 { },
43 static struct platform_device m5272_uart = {
44 .name = "mcfuart",
45 .id = 0,
46 .dev.platform_data = m5272_uart_platform,
49 static struct resource m5272_fec_resources[] = {
51 .start = MCF_MBAR + 0x840,
52 .end = MCF_MBAR + 0x840 + 0x1cf,
53 .flags = IORESOURCE_MEM,
56 .start = MCF_IRQ_ERX,
57 .end = MCF_IRQ_ERX,
58 .flags = IORESOURCE_IRQ,
61 .start = MCF_IRQ_ETX,
62 .end = MCF_IRQ_ETX,
63 .flags = IORESOURCE_IRQ,
66 .start = MCF_IRQ_ENTC,
67 .end = MCF_IRQ_ENTC,
68 .flags = IORESOURCE_IRQ,
72 static struct platform_device m5272_fec = {
73 .name = "fec",
74 .id = 0,
75 .num_resources = ARRAY_SIZE(m5272_fec_resources),
76 .resource = m5272_fec_resources,
79 static struct platform_device *m5272_devices[] __initdata = {
80 &m5272_uart,
81 &m5272_fec,
84 /***************************************************************************/
86 static void __init m5272_uart_init_line(int line, int irq)
88 u32 v;
90 if ((line >= 0) && (line < 2)) {
91 /* Enable the output lines for the serial ports */
92 v = readl(MCF_MBAR + MCFSIM_PBCNT);
93 v = (v & ~0x000000ff) | 0x00000055;
94 writel(v, MCF_MBAR + MCFSIM_PBCNT);
96 v = readl(MCF_MBAR + MCFSIM_PDCNT);
97 v = (v & ~0x000003fc) | 0x000002a8;
98 writel(v, MCF_MBAR + MCFSIM_PDCNT);
102 static void __init m5272_uarts_init(void)
104 const int nrlines = ARRAY_SIZE(m5272_uart_platform);
105 int line;
107 for (line = 0; (line < nrlines); line++)
108 m5272_uart_init_line(line, m5272_uart_platform[line].irq);
111 /***************************************************************************/
113 static void m5272_cpu_reset(void)
115 local_irq_disable();
116 /* Set watchdog to reset, and enabled */
117 __raw_writew(0, MCF_MBAR + MCFSIM_WIRR);
118 __raw_writew(1, MCF_MBAR + MCFSIM_WRRR);
119 __raw_writew(0, MCF_MBAR + MCFSIM_WCR);
120 for (;;)
121 /* wait for watchdog to timeout */;
124 /***************************************************************************/
126 void __init config_BSP(char *commandp, int size)
128 #if defined (CONFIG_MOD5272)
129 volatile unsigned char *pivrp;
131 /* Set base of device vectors to be 64 */
132 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
133 *pivrp = 0x40;
134 #endif
136 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
137 /* Copy command line from FLASH to local buffer... */
138 memcpy(commandp, (char *) 0xf0004000, size);
139 commandp[size-1] = 0;
140 #elif defined(CONFIG_CANCam)
141 /* Copy command line from FLASH to local buffer... */
142 memcpy(commandp, (char *) 0xf0010000, size);
143 commandp[size-1] = 0;
144 #endif
146 mach_reset = m5272_cpu_reset;
149 /***************************************************************************/
151 static int __init init_BSP(void)
153 m5272_uarts_init();
154 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
155 return 0;
158 arch_initcall(init_BSP);
160 /***************************************************************************/