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 platform_device *m5272_devices[] __initdata = {
62 /***************************************************************************/
64 static void __init m5272_uart_init_line(int line, int irq)
68 if ((line >= 0) && (line < 2)) {
69 v = (line) ? 0x0e000000 : 0xe0000000;
70 writel(v, MCF_MBAR + MCFSIM_ICR2);
72 /* Enable the output lines for the serial ports */
73 v = readl(MCF_MBAR + MCFSIM_PBCNT);
74 v = (v & ~0x000000ff) | 0x00000055;
75 writel(v, MCF_MBAR + MCFSIM_PBCNT);
77 v = readl(MCF_MBAR + MCFSIM_PDCNT);
78 v = (v & ~0x000003fc) | 0x000002a8;
79 writel(v, MCF_MBAR + MCFSIM_PDCNT);
83 static void __init m5272_uarts_init(void)
85 const int nrlines = ARRAY_SIZE(m5272_uart_platform);
88 for (line = 0; (line < nrlines); line++)
89 m5272_uart_init_line(line, m5272_uart_platform[line].irq);
92 /***************************************************************************/
94 void mcf_disableall(void)
96 volatile unsigned long *icrp;
98 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
100 icrp[1] = 0x88888888;
101 icrp[2] = 0x88888888;
102 icrp[3] = 0x88888888;
105 /***************************************************************************/
107 void mcf_autovector(unsigned int vec)
109 /* Everything is auto-vectored on the 5272 */
112 /***************************************************************************/
114 void mcf_settimericr(int timer, int level)
116 volatile unsigned long *icrp;
118 if ((timer >= 1 ) && (timer <= 4)) {
119 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
120 *icrp = (0x8 | level) << ((4 - timer) * 4);
124 /***************************************************************************/
126 int mcf_timerirqpending(int timer)
128 volatile unsigned long *icrp;
130 if ((timer >= 1 ) && (timer <= 4)) {
131 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
132 return (*icrp & (0x8 << ((4 - timer) * 4)));
137 /***************************************************************************/
139 void __init config_BSP(char *commandp, int size)
141 #if defined (CONFIG_MOD5272)
142 volatile unsigned char *pivrp;
144 /* Set base of device vectors to be 64 */
145 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
151 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
152 /* Copy command line from FLASH to local buffer... */
153 memcpy(commandp, (char *) 0xf0004000, size);
154 commandp[size-1] = 0;
155 #elif defined(CONFIG_MTD_KeyTechnology)
156 /* Copy command line from FLASH to local buffer... */
157 memcpy(commandp, (char *) 0xffe06000, size);
158 commandp[size-1] = 0;
159 #elif defined(CONFIG_CANCam)
160 /* Copy command line from FLASH to local buffer... */
161 memcpy(commandp, (char *) 0xf0010000, size);
162 commandp[size-1] = 0;
165 mcf_timervector = 69;
166 mcf_profilevector = 70;
167 mach_reset = coldfire_reset;
170 /***************************************************************************/
172 static int __init init_BSP(void)
175 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
179 arch_initcall(init_BSP);
181 /***************************************************************************/