debugfs: Modified default dir of debugfs for debugging UHCI.
[linux/fpc-iii.git] / arch / m68knommu / platform / 528x / config.c
bloba1d1a61c4fe667188fc1979df0630d7f5c7a547f
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/528x/config.c
6 * Sub-architcture dependant initialization code for the Motorola
7 * 5280 and 5282 CPUs.
9 * Copyright (C) 1999-2003, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
13 /***************************************************************************/
15 #include <linux/kernel.h>
16 #include <linux/param.h>
17 #include <linux/init.h>
18 #include <linux/interrupt.h>
19 #include <linux/platform_device.h>
20 #include <linux/spi/spi.h>
21 #include <linux/spi/flash.h>
22 #include <linux/io.h>
23 #include <asm/machdep.h>
24 #include <asm/coldfire.h>
25 #include <asm/mcfsim.h>
26 #include <asm/mcfuart.h>
28 #ifdef CONFIG_MTD_PARTITIONS
29 #include <linux/mtd/partitions.h>
30 #endif
32 /***************************************************************************/
34 static struct mcf_platform_uart m528x_uart_platform[] = {
36 .mapbase = MCF_MBAR + MCFUART_BASE1,
37 .irq = MCFINT_VECBASE + MCFINT_UART0,
40 .mapbase = MCF_MBAR + MCFUART_BASE2,
41 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
44 .mapbase = MCF_MBAR + MCFUART_BASE3,
45 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
47 { },
50 static struct platform_device m528x_uart = {
51 .name = "mcfuart",
52 .id = 0,
53 .dev.platform_data = m528x_uart_platform,
56 static struct resource m528x_fec_resources[] = {
58 .start = MCF_MBAR + 0x1000,
59 .end = MCF_MBAR + 0x1000 + 0x7ff,
60 .flags = IORESOURCE_MEM,
63 .start = 64 + 23,
64 .end = 64 + 23,
65 .flags = IORESOURCE_IRQ,
68 .start = 64 + 27,
69 .end = 64 + 27,
70 .flags = IORESOURCE_IRQ,
73 .start = 64 + 29,
74 .end = 64 + 29,
75 .flags = IORESOURCE_IRQ,
79 static struct platform_device m528x_fec = {
80 .name = "fec",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(m528x_fec_resources),
83 .resource = m528x_fec_resources,
87 static struct platform_device *m528x_devices[] __initdata = {
88 &m528x_uart,
89 &m528x_fec,
92 /***************************************************************************/
94 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
96 static void __init m528x_uart_init_line(int line, int irq)
98 u8 port;
99 u32 imr;
101 if ((line < 0) || (line > 2))
102 return;
104 /* level 6, line based priority */
105 writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
107 imr = readl(INTC0 + MCFINTC_IMRL);
108 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
109 writel(imr, INTC0 + MCFINTC_IMRL);
111 /* make sure PUAPAR is set for UART0 and UART1 */
112 if (line < 2) {
113 port = readb(MCF_MBAR + MCF5282_GPIO_PUAPAR);
114 port |= (0x03 << (line * 2));
115 writeb(port, MCF_MBAR + MCF5282_GPIO_PUAPAR);
119 static void __init m528x_uarts_init(void)
121 const int nrlines = ARRAY_SIZE(m528x_uart_platform);
122 int line;
124 for (line = 0; (line < nrlines); line++)
125 m528x_uart_init_line(line, m528x_uart_platform[line].irq);
128 /***************************************************************************/
130 static void __init m528x_fec_init(void)
132 u32 imr;
133 u16 v16;
135 /* Unmask FEC interrupts at ColdFire interrupt controller */
136 writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23);
137 writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27);
138 writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29);
140 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
141 imr &= ~0xf;
142 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
143 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
144 imr &= ~0xff800001;
145 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
147 /* Set multi-function pins to ethernet mode for fec0 */
148 v16 = readw(MCF_IPSBAR + 0x100056);
149 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056);
150 writeb(0xc0, MCF_IPSBAR + 0x100058);
153 /***************************************************************************/
155 void mcf_disableall(void)
157 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
158 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL)) = 0xffffffff;
161 /***************************************************************************/
163 void mcf_autovector(unsigned int vec)
165 /* Everything is auto-vectored on the 5272 */
168 /***************************************************************************/
170 static void m528x_cpu_reset(void)
172 local_irq_disable();
173 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
176 /***************************************************************************/
178 #ifdef CONFIG_WILDFIRE
179 void wildfire_halt(void)
181 writeb(0, 0x30000007);
182 writeb(0x2, 0x30000007);
184 #endif
186 #ifdef CONFIG_WILDFIREMOD
187 void wildfiremod_halt(void)
189 printk(KERN_INFO "WildFireMod hibernating...\n");
191 /* Set portE.5 to Digital IO */
192 MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2));
194 /* Make portE.5 an output */
195 MCF5282_GPIO_DDRE |= (1 << 5);
197 /* Now toggle portE.5 from low to high */
198 MCF5282_GPIO_PORTE &= ~(1 << 5);
199 MCF5282_GPIO_PORTE |= (1 << 5);
201 printk(KERN_EMERG "Failed to hibernate. Halting!\n");
203 #endif
205 void __init config_BSP(char *commandp, int size)
207 mcf_disableall();
209 #ifdef CONFIG_WILDFIRE
210 mach_halt = wildfire_halt;
211 #endif
212 #ifdef CONFIG_WILDFIREMOD
213 mach_halt = wildfiremod_halt;
214 #endif
217 /***************************************************************************/
219 static int __init init_BSP(void)
221 mach_reset = m528x_cpu_reset;
222 m528x_uarts_init();
223 m528x_fec_init();
224 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices));
225 return 0;
228 arch_initcall(init_BSP);
230 /***************************************************************************/