1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/528x/config.c
6 * Sub-architcture dependant initialization code for the Motorola
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>
23 #include <asm/machdep.h>
24 #include <asm/coldfire.h>
25 #include <asm/mcfsim.h>
26 #include <asm/mcfuart.h>
27 #include <asm/mcfqspi.h>
29 /***************************************************************************/
31 void coldfire_reset(void);
33 /***************************************************************************/
35 static struct mcf_platform_uart m528x_uart_platform[] = {
37 .mapbase = MCF_MBAR + MCFUART_BASE1,
38 .irq = MCFINT_VECBASE + MCFINT_UART0,
41 .mapbase = MCF_MBAR + MCFUART_BASE2,
42 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
45 .mapbase = MCF_MBAR + MCFUART_BASE3,
46 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
51 static struct platform_device m528x_uart = {
54 .dev.platform_data = m528x_uart_platform,
57 static struct platform_device *m528x_devices[] __initdata = {
61 /***************************************************************************/
63 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
65 static void __init m528x_uart_init_line(int line, int irq)
70 if ((line < 0) || (line > 2))
73 /* level 6, line based priority */
74 writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
76 imr = readl(INTC0 + MCFINTC_IMRL);
77 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
78 writel(imr, INTC0 + MCFINTC_IMRL);
80 /* make sure PUAPAR is set for UART0 and UART1 */
82 port = readb(MCF_MBAR + MCF5282_GPIO_PUAPAR);
83 port |= (0x03 << (line * 2));
84 writeb(port, MCF_MBAR + MCF5282_GPIO_PUAPAR);
88 static void __init m528x_uarts_init(void)
90 const int nrlines = ARRAY_SIZE(m528x_uart_platform);
93 for (line = 0; (line < nrlines); line++)
94 m528x_uart_init_line(line, m528x_uart_platform[line].irq);
97 /***************************************************************************/
99 void mcf_disableall(void)
101 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
102 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL)) = 0xffffffff;
105 /***************************************************************************/
107 void mcf_autovector(unsigned int vec)
109 /* Everything is auto-vectored on the 5272 */
112 /***************************************************************************/
114 void __init config_BSP(char *commandp, int size)
117 mach_reset = coldfire_reset;
120 /***************************************************************************/
122 static int __init init_BSP(void)
125 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices));
129 arch_initcall(init_BSP);
131 /***************************************************************************/