1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/523x/config.c
6 * Sub-architcture dependant initialization code for the Freescale
9 * Copyright (C) 1999-2005, 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>
20 #include <asm/machdep.h>
21 #include <asm/coldfire.h>
22 #include <asm/mcfsim.h>
23 #include <asm/mcfuart.h>
25 /***************************************************************************/
27 void coldfire_reset(void);
29 /***************************************************************************/
31 static struct mcf_platform_uart m523x_uart_platform[] = {
33 .mapbase = MCF_MBAR + MCFUART_BASE1,
34 .irq = MCFINT_VECBASE + MCFINT_UART0,
37 .mapbase = MCF_MBAR + MCFUART_BASE2,
38 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
41 .mapbase = MCF_MBAR + MCFUART_BASE3,
42 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
47 static struct platform_device m523x_uart = {
50 .dev.platform_data = m523x_uart_platform,
53 static struct resource m523x_fec_resources[] = {
55 .start = MCF_MBAR + 0x1000,
56 .end = MCF_MBAR + 0x1000 + 0x7ff,
57 .flags = IORESOURCE_MEM,
62 .flags = IORESOURCE_IRQ,
67 .flags = IORESOURCE_IRQ,
72 .flags = IORESOURCE_IRQ,
76 static struct platform_device m523x_fec = {
79 .num_resources = ARRAY_SIZE(m523x_fec_resources),
80 .resource = m523x_fec_resources,
83 static struct platform_device *m523x_devices[] __initdata = {
88 /***************************************************************************/
90 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
92 static void __init m523x_uart_init_line(int line, int irq)
96 if ((line < 0) || (line > 2))
99 writeb(0x30+line, (INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line));
101 imr = readl(INTC0 + MCFINTC_IMRL);
102 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
103 writel(imr, INTC0 + MCFINTC_IMRL);
106 static void __init m523x_uarts_init(void)
108 const int nrlines = ARRAY_SIZE(m523x_uart_platform);
111 for (line = 0; (line < nrlines); line++)
112 m523x_uart_init_line(line, m523x_uart_platform[line].irq);
115 /***************************************************************************/
117 static void __init m523x_fec_init(void)
121 /* Unmask FEC interrupts at ColdFire interrupt controller */
122 writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23);
123 writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27);
124 writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29);
126 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
128 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
129 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
131 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
134 /***************************************************************************/
136 void mcf_disableall(void)
138 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
139 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL)) = 0xffffffff;
142 /***************************************************************************/
144 void mcf_autovector(unsigned int vec)
146 /* Everything is auto-vectored on the 523x */
149 /***************************************************************************/
151 void __init config_BSP(char *commandp, int size)
154 mach_reset = coldfire_reset;
159 /***************************************************************************/
161 static int __init init_BSP(void)
163 platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
167 arch_initcall(init_BSP);
169 /***************************************************************************/