1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5249/config.c
6 * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com)
9 /***************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfuart.h>
21 /***************************************************************************/
23 void coldfire_reset(void);
25 /***************************************************************************/
27 static struct mcf_platform_uart m5249_uart_platform[] = {
29 .mapbase = MCF_MBAR + MCFUART_BASE1,
33 .mapbase = MCF_MBAR + MCFUART_BASE2,
39 static struct platform_device m5249_uart = {
42 .dev.platform_data = m5249_uart_platform,
45 static struct platform_device *m5249_devices[] __initdata = {
49 /***************************************************************************/
51 static void __init m5249_uart_init_line(int line, int irq)
54 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
55 writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);
56 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
57 } else if (line == 1) {
58 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
59 writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);
60 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
64 static void __init m5249_uarts_init(void)
66 const int nrlines = ARRAY_SIZE(m5249_uart_platform);
69 for (line = 0; (line < nrlines); line++)
70 m5249_uart_init_line(line, m5249_uart_platform[line].irq);
74 /***************************************************************************/
76 void mcf_autovector(unsigned int vec)
78 volatile unsigned char *mbar;
80 if ((vec >= 25) && (vec <= 31)) {
81 mbar = (volatile unsigned char *) MCF_MBAR;
82 vec = 0x1 << (vec - 24);
83 *(mbar + MCFSIM_AVR) |= vec;
84 mcf_setimr(mcf_getimr() & ~vec);
88 /***************************************************************************/
90 void mcf_settimericr(unsigned int timer, unsigned int level)
92 volatile unsigned char *icrp;
93 unsigned int icr, imr;
97 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
98 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
101 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
102 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
103 mcf_setimr(mcf_getimr() & ~imr);
107 /***************************************************************************/
109 void __init config_BSP(char *commandp, int size)
111 mcf_setimr(MCFSIM_IMR_MASKALL);
112 mach_reset = coldfire_reset;
115 /***************************************************************************/
117 static int __init init_BSP(void)
120 platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices));
124 arch_initcall(init_BSP);
126 /***************************************************************************/