1 /***************************************************************************/
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)
10 /***************************************************************************/
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
17 #include <asm/machdep.h>
18 #include <asm/coldfire.h>
19 #include <asm/mcfsim.h>
20 #include <asm/mcfuart.h>
22 /***************************************************************************/
24 void coldfire_reset(void);
26 extern unsigned int mcf_timervector;
27 extern unsigned int mcf_profilevector;
28 extern unsigned int mcf_timerlevel;
30 /***************************************************************************/
33 * Some platforms need software versions of the GPIO data registers.
35 unsigned short ppdata;
36 unsigned char ledbank = 0xff;
38 /***************************************************************************/
40 static struct mcf_platform_uart m5272_uart_platform[] = {
42 .mapbase = MCF_MBAR + MCFUART_BASE1,
46 .mapbase = MCF_MBAR + MCFUART_BASE2,
52 static struct platform_device m5272_uart = {
55 .dev.platform_data = m5272_uart_platform,
58 static struct resource m5272_fec_resources[] = {
60 .start = MCF_MBAR + 0x840,
61 .end = MCF_MBAR + 0x840 + 0x1cf,
62 .flags = IORESOURCE_MEM,
67 .flags = IORESOURCE_IRQ,
72 .flags = IORESOURCE_IRQ,
77 .flags = IORESOURCE_IRQ,
81 static struct platform_device m5272_fec = {
84 .num_resources = ARRAY_SIZE(m5272_fec_resources),
85 .resource = m5272_fec_resources,
88 static struct platform_device *m5272_devices[] __initdata = {
93 /***************************************************************************/
95 static void __init m5272_uart_init_line(int line, int irq)
99 if ((line >= 0) && (line < 2)) {
100 v = (line) ? 0x0e000000 : 0xe0000000;
101 writel(v, MCF_MBAR + MCFSIM_ICR2);
103 /* Enable the output lines for the serial ports */
104 v = readl(MCF_MBAR + MCFSIM_PBCNT);
105 v = (v & ~0x000000ff) | 0x00000055;
106 writel(v, MCF_MBAR + MCFSIM_PBCNT);
108 v = readl(MCF_MBAR + MCFSIM_PDCNT);
109 v = (v & ~0x000003fc) | 0x000002a8;
110 writel(v, MCF_MBAR + MCFSIM_PDCNT);
114 static void __init m5272_uarts_init(void)
116 const int nrlines = ARRAY_SIZE(m5272_uart_platform);
119 for (line = 0; (line < nrlines); line++)
120 m5272_uart_init_line(line, m5272_uart_platform[line].irq);
123 /***************************************************************************/
125 static void __init m5272_fec_init(void)
129 /* Unmask FEC interrupts at ColdFire interrupt controller */
130 imr = readl(MCF_MBAR + MCFSIM_ICR3);
131 imr = (imr & ~0x00000fff) | 0x00000ddd;
132 writel(imr, MCF_MBAR + MCFSIM_ICR3);
134 imr = readl(MCF_MBAR + MCFSIM_ICR1);
135 imr = (imr & ~0x0f000000) | 0x0d000000;
136 writel(imr, MCF_MBAR + MCFSIM_ICR1);
139 /***************************************************************************/
141 void mcf_disableall(void)
143 volatile unsigned long *icrp;
145 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
146 icrp[0] = 0x88888888;
147 icrp[1] = 0x88888888;
148 icrp[2] = 0x88888888;
149 icrp[3] = 0x88888888;
152 /***************************************************************************/
154 void mcf_autovector(unsigned int vec)
156 /* Everything is auto-vectored on the 5272 */
159 /***************************************************************************/
161 void mcf_settimericr(int timer, int level)
163 volatile unsigned long *icrp;
165 if ((timer >= 1 ) && (timer <= 4)) {
166 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
167 *icrp = (0x8 | level) << ((4 - timer) * 4);
171 /***************************************************************************/
173 void __init config_BSP(char *commandp, int size)
175 #if defined (CONFIG_MOD5272)
176 volatile unsigned char *pivrp;
178 /* Set base of device vectors to be 64 */
179 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
185 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
186 /* Copy command line from FLASH to local buffer... */
187 memcpy(commandp, (char *) 0xf0004000, size);
188 commandp[size-1] = 0;
189 #elif defined(CONFIG_CANCam)
190 /* Copy command line from FLASH to local buffer... */
191 memcpy(commandp, (char *) 0xf0010000, size);
192 commandp[size-1] = 0;
195 mcf_timervector = 69;
196 mcf_profilevector = 70;
197 mach_reset = coldfire_reset;
200 /***************************************************************************/
202 static int __init init_BSP(void)
206 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
210 arch_initcall(init_BSP);
212 /***************************************************************************/