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
,
38 static struct platform_device m5249_uart
= {
41 .dev
.platform_data
= m5249_uart_platform
,
44 static struct platform_device
*m5249_devices
[] __initdata
= {
48 /***************************************************************************/
50 static void __init
m5249_uart_init_line(int line
, int irq
)
53 writel(MCFSIM_ICR_LEVEL6
| MCFSIM_ICR_PRI1
, MCF_MBAR
+ MCFSIM_UART1ICR
);
54 writeb(irq
, MCFUART_BASE1
+ MCFUART_UIVR
);
55 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1
);
56 } else if (line
== 1) {
57 writel(MCFSIM_ICR_LEVEL6
| MCFSIM_ICR_PRI2
, MCF_MBAR
+ MCFSIM_UART2ICR
);
58 writeb(irq
, MCFUART_BASE2
+ MCFUART_UIVR
);
59 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2
);
63 static void __init
m5249_uarts_init(void)
65 const int nrlines
= ARRAY_SIZE(m5249_uart_platform
);
68 for (line
= 0; (line
< nrlines
); line
++)
69 m5249_uart_init_line(line
, m5249_uart_platform
[line
].irq
);
73 /***************************************************************************/
75 void mcf_autovector(unsigned int vec
)
77 volatile unsigned char *mbar
;
79 if ((vec
>= 25) && (vec
<= 31)) {
80 mbar
= (volatile unsigned char *) MCF_MBAR
;
81 vec
= 0x1 << (vec
- 24);
82 *(mbar
+ MCFSIM_AVR
) |= vec
;
83 mcf_setimr(mcf_getimr() & ~vec
);
87 /***************************************************************************/
89 void mcf_settimericr(unsigned int timer
, unsigned int level
)
91 volatile unsigned char *icrp
;
92 unsigned int icr
, imr
;
96 case 2: icr
= MCFSIM_TIMER2ICR
; imr
= MCFSIM_IMR_TIMER2
; break;
97 default: icr
= MCFSIM_TIMER1ICR
; imr
= MCFSIM_IMR_TIMER1
; break;
100 icrp
= (volatile unsigned char *) (MCF_MBAR
+ icr
);
101 *icrp
= MCFSIM_ICR_AUTOVEC
| (level
<< 2) | MCFSIM_ICR_PRI3
;
102 mcf_setimr(mcf_getimr() & ~imr
);
106 /***************************************************************************/
108 void __init
config_BSP(char *commandp
, int size
)
110 mcf_setimr(MCFSIM_IMR_MASKALL
);
111 mach_reset
= coldfire_reset
;
114 /***************************************************************************/
116 static int __init
init_BSP(void)
119 platform_add_devices(m5249_devices
, ARRAY_SIZE(m5249_devices
));
123 arch_initcall(init_BSP
);
125 /***************************************************************************/