1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5206/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2000-2001, Lineo Inc. (www.lineo.com)
10 /***************************************************************************/
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfuart.h>
21 /***************************************************************************/
23 static struct mcf_platform_uart m5206_uart_platform[] = {
25 .mapbase = MCF_MBAR + MCFUART_BASE1,
29 .mapbase = MCF_MBAR + MCFUART_BASE2,
35 static struct platform_device m5206_uart = {
38 .dev.platform_data = m5206_uart_platform,
41 static struct platform_device *m5206_devices[] __initdata = {
45 /***************************************************************************/
47 static void __init m5206_uart_init_line(int line, int irq)
50 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
51 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
52 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
53 } else if (line == 1) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
55 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
56 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
60 static void __init m5206_uarts_init(void)
62 const int nrlines = ARRAY_SIZE(m5206_uart_platform);
65 for (line = 0; (line < nrlines); line++)
66 m5206_uart_init_line(line, m5206_uart_platform[line].irq);
69 /***************************************************************************/
71 void mcf_autovector(unsigned int vec)
73 volatile unsigned char *mbar;
76 if ((vec >= 25) && (vec <= 31)) {
78 mbar = (volatile unsigned char *) MCF_MBAR;
79 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
80 *(mbar + MCFSIM_ICR1 + vec) = icr;
81 vec = 0x1 << (vec + 1);
82 mcf_setimr(mcf_getimr() & ~vec);
86 /***************************************************************************/
88 void mcf_settimericr(unsigned int timer, unsigned int level)
90 volatile unsigned char *icrp;
91 unsigned int icr, imr;
95 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
96 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
99 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
100 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
101 mcf_setimr(mcf_getimr() & ~imr);
105 /***************************************************************************/
107 void m5206_cpu_reset(void)
110 /* Set watchdog to soft reset, and enabled */
111 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);
113 /* wait for watchdog to timeout */;
116 /***************************************************************************/
118 void __init config_BSP(char *commandp, int size)
120 mcf_setimr(MCFSIM_IMR_MASKALL);
121 mach_reset = m5206_cpu_reset;
124 /***************************************************************************/
126 static int __init init_BSP(void)
129 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
133 arch_initcall(init_BSP);
135 /***************************************************************************/