1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5407/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2000, Lineo (www.lineo.com)
10 /***************************************************************************/
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
17 #include <asm/machdep.h>
18 #include <asm/coldfire.h>
19 #include <asm/mcfsim.h>
20 #include <asm/mcfuart.h>
22 /***************************************************************************/
24 void coldfire_reset(void);
26 extern unsigned int mcf_timervector
;
27 extern unsigned int mcf_profilevector
;
28 extern unsigned int mcf_timerlevel
;
30 /***************************************************************************/
32 static struct mcf_platform_uart m5407_uart_platform
[] = {
34 .mapbase
= MCF_MBAR
+ MCFUART_BASE1
,
38 .mapbase
= MCF_MBAR
+ MCFUART_BASE2
,
44 static struct platform_device m5407_uart
= {
47 .dev
.platform_data
= m5407_uart_platform
,
50 static struct platform_device
*m5407_devices
[] __initdata
= {
54 /***************************************************************************/
56 static void __init
m5407_uart_init_line(int line
, int irq
)
59 writel(MCFSIM_ICR_LEVEL6
| MCFSIM_ICR_PRI1
, MCF_MBAR
+ MCFSIM_UART1ICR
);
60 writeb(irq
, MCFUART_BASE1
+ MCFUART_UIVR
);
61 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1
);
62 } else if (line
== 1) {
63 writel(MCFSIM_ICR_LEVEL6
| MCFSIM_ICR_PRI2
, MCF_MBAR
+ MCFSIM_UART2ICR
);
64 writeb(irq
, MCFUART_BASE2
+ MCFUART_UIVR
);
65 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2
);
69 static void __init
m5407_uarts_init(void)
71 const int nrlines
= ARRAY_SIZE(m5407_uart_platform
);
74 for (line
= 0; (line
< nrlines
); line
++)
75 m5407_uart_init_line(line
, m5407_uart_platform
[line
].irq
);
78 /***************************************************************************/
80 void mcf_autovector(unsigned int vec
)
82 volatile unsigned char *mbar
;
84 if ((vec
>= 25) && (vec
<= 31)) {
85 mbar
= (volatile unsigned char *) MCF_MBAR
;
86 vec
= 0x1 << (vec
- 24);
87 *(mbar
+ MCFSIM_AVR
) |= vec
;
88 mcf_setimr(mcf_getimr() & ~vec
);
92 /***************************************************************************/
94 void mcf_settimericr(unsigned int timer
, unsigned int level
)
96 volatile unsigned char *icrp
;
97 unsigned int icr
, imr
;
101 case 2: icr
= MCFSIM_TIMER2ICR
; imr
= MCFSIM_IMR_TIMER2
; break;
102 default: icr
= MCFSIM_TIMER1ICR
; imr
= MCFSIM_IMR_TIMER1
; break;
105 icrp
= (volatile unsigned char *) (MCF_MBAR
+ icr
);
106 *icrp
= MCFSIM_ICR_AUTOVEC
| (level
<< 2) | MCFSIM_ICR_PRI3
;
107 mcf_setimr(mcf_getimr() & ~imr
);
111 /***************************************************************************/
113 void __init
config_BSP(char *commandp
, int size
)
115 mcf_setimr(MCFSIM_IMR_MASKALL
);
117 #if defined(CONFIG_CLEOPATRA)
118 /* Different timer setup - to prevent device clash */
119 mcf_timervector
= 30;
120 mcf_profilevector
= 31;
124 mach_reset
= coldfire_reset
;
127 /***************************************************************************/
129 static int __init
init_BSP(void)
132 platform_add_devices(m5407_devices
, ARRAY_SIZE(m5407_devices
));
136 arch_initcall(init_BSP
);
138 /***************************************************************************/