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>
19 #include <asm/machdep.h>
20 #include <asm/coldfire.h>
21 #include <asm/mcfsim.h>
22 #include <asm/mcfuart.h>
24 /***************************************************************************/
26 static struct mcf_platform_uart m523x_uart_platform
[] = {
28 .mapbase
= MCF_MBAR
+ MCFUART_BASE1
,
29 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
,
32 .mapbase
= MCF_MBAR
+ MCFUART_BASE2
,
33 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
+ 1,
36 .mapbase
= MCF_MBAR
+ MCFUART_BASE3
,
37 .irq
= MCFINT_VECBASE
+ MCFINT_UART0
+ 2,
42 static struct platform_device m523x_uart
= {
45 .dev
.platform_data
= m523x_uart_platform
,
48 static struct resource m523x_fec_resources
[] = {
50 .start
= MCF_MBAR
+ 0x1000,
51 .end
= MCF_MBAR
+ 0x1000 + 0x7ff,
52 .flags
= IORESOURCE_MEM
,
57 .flags
= IORESOURCE_IRQ
,
62 .flags
= IORESOURCE_IRQ
,
67 .flags
= IORESOURCE_IRQ
,
71 static struct platform_device m523x_fec
= {
74 .num_resources
= ARRAY_SIZE(m523x_fec_resources
),
75 .resource
= m523x_fec_resources
,
78 static struct platform_device
*m523x_devices
[] __initdata
= {
83 /***************************************************************************/
85 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
87 static void __init
m523x_uart_init_line(int line
, int irq
)
91 if ((line
< 0) || (line
> 2))
94 writeb(0x30+line
, (INTC0
+ MCFINTC_ICR0
+ MCFINT_UART0
+ line
));
96 imr
= readl(INTC0
+ MCFINTC_IMRL
);
97 imr
&= ~((1 << (irq
- MCFINT_VECBASE
)) | 1);
98 writel(imr
, INTC0
+ MCFINTC_IMRL
);
101 static void __init
m523x_uarts_init(void)
103 const int nrlines
= ARRAY_SIZE(m523x_uart_platform
);
106 for (line
= 0; (line
< nrlines
); line
++)
107 m523x_uart_init_line(line
, m523x_uart_platform
[line
].irq
);
110 /***************************************************************************/
112 static void __init
m523x_fec_init(void)
116 /* Unmask FEC interrupts at ColdFire interrupt controller */
117 writeb(0x28, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 23);
118 writeb(0x27, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 27);
119 writeb(0x26, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_ICR0
+ 29);
121 imr
= readl(MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRH
);
123 writel(imr
, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRH
);
124 imr
= readl(MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRL
);
126 writel(imr
, MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRL
);
129 /***************************************************************************/
131 void mcf_disableall(void)
133 *((volatile unsigned long *) (MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRH
)) = 0xffffffff;
134 *((volatile unsigned long *) (MCF_IPSBAR
+ MCFICM_INTC0
+ MCFINTC_IMRL
)) = 0xffffffff;
137 /***************************************************************************/
139 void mcf_autovector(unsigned int vec
)
141 /* Everything is auto-vectored on the 523x */
143 /***************************************************************************/
145 static void m523x_cpu_reset(void)
148 __raw_writeb(MCF_RCR_SWRESET
, MCF_IPSBAR
+ MCF_RCR
);
151 /***************************************************************************/
153 void __init
config_BSP(char *commandp
, int size
)
156 mach_reset
= m523x_cpu_reset
;
161 /***************************************************************************/
163 static int __init
init_BSP(void)
165 platform_add_devices(m523x_devices
, ARRAY_SIZE(m523x_devices
));
169 arch_initcall(init_BSP
);
171 /***************************************************************************/