1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/520x/config.c
6 * Copyright (C) 2005, Freescale (www.freescale.com)
7 * Copyright (C) 2005, Intec Automation (mike@steroidmicros.com)
8 * Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
12 /***************************************************************************/
14 #include <linux/kernel.h>
15 #include <linux/param.h>
16 #include <linux/init.h>
17 #include <linux/interrupt.h>
19 #include <asm/machdep.h>
20 #include <asm/coldfire.h>
21 #include <asm/mcfsim.h>
22 #include <asm/mcfuart.h>
24 /***************************************************************************/
26 void coldfire_reset(void);
28 /***************************************************************************/
30 static struct mcf_platform_uart m520x_uart_platform[] = {
32 .mapbase = MCF_MBAR + MCFUART_BASE1,
33 .irq = MCFINT_VECBASE + MCFINT_UART0,
36 .mapbase = MCF_MBAR + MCFUART_BASE2,
37 .irq = MCFINT_VECBASE + MCFINT_UART1,
40 .mapbase = MCF_MBAR + MCFUART_BASE3,
41 .irq = MCFINT_VECBASE + MCFINT_UART2,
46 static struct platform_device m520x_uart = {
49 .dev.platform_data = m520x_uart_platform,
52 static struct platform_device *m520x_devices[] __initdata = {
56 /***************************************************************************/
58 #define INTC0 (MCF_MBAR + MCFICM_INTC0)
60 static void __init m520x_uart_init_line(int line, int irq)
66 writeb(0x03, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
68 imr = readl(INTC0 + MCFINTC_IMRL);
69 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
70 writel(imr, INTC0 + MCFINTC_IMRL);
74 par = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
75 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 |
76 MCF_GPIO_PAR_UART_PAR_URXD0;
77 writew(par, MCF_IPSBAR + MCF_GPIO_PAR_UART);
80 par = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
81 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 |
82 MCF_GPIO_PAR_UART_PAR_URXD1;
83 writew(par, MCF_IPSBAR + MCF_GPIO_PAR_UART);
86 par2 = readb(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
88 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
89 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
90 writeb(par2, MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
95 static void __init m520x_uarts_init(void)
97 const int nrlines = ARRAY_SIZE(m520x_uart_platform);
100 for (line = 0; (line < nrlines); line++)
101 m520x_uart_init_line(line, m520x_uart_platform[line].irq);
104 /***************************************************************************/
107 * Program the vector to be an auto-vectored.
110 void mcf_autovector(unsigned int vec)
112 /* Everything is auto-vectored on the 520x devices */
115 /***************************************************************************/
117 void __init config_BSP(char *commandp, int size)
119 mach_reset = coldfire_reset;
123 /***************************************************************************/
125 static int __init init_BSP(void)
127 platform_add_devices(m520x_devices, ARRAY_SIZE(m520x_devices));
131 arch_initcall(init_BSP);
133 /***************************************************************************/