aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform/5206
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68knommu/platform/5206')
-rw-r--r--arch/m68knommu/platform/5206/Makefile2
-rw-r--r--arch/m68knommu/platform/5206/config.c56
-rw-r--r--arch/m68knommu/platform/5206/gpio.c49
3 files changed, 71 insertions, 36 deletions
diff --git a/arch/m68knommu/platform/5206/Makefile b/arch/m68knommu/platform/5206/Makefile
index a439d9ab3f27..113c33390064 100644
--- a/arch/m68knommu/platform/5206/Makefile
+++ b/arch/m68knommu/platform/5206/Makefile
@@ -14,5 +14,5 @@
14 14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16 16
17obj-y := config.o 17obj-y := config.o gpio.o
18 18
diff --git a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c
index f6f79874e9af..9c335465e66d 100644
--- a/arch/m68knommu/platform/5206/config.c
+++ b/arch/m68knommu/platform/5206/config.c
@@ -49,11 +49,11 @@ static void __init m5206_uart_init_line(int line, int irq)
49 if (line == 0) { 49 if (line == 0) {
50 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 50 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
51 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); 51 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
52 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1); 52 mcf_mapirq2imr(irq, MCFINTC_UART0);
53 } else if (line == 1) { 53 } else if (line == 1) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
55 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR); 55 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
56 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); 56 mcf_mapirq2imr(irq, MCFINTC_UART1);
57 } 57 }
58} 58}
59 59
@@ -68,38 +68,19 @@ static void __init m5206_uarts_init(void)
68 68
69/***************************************************************************/ 69/***************************************************************************/
70 70
71void mcf_autovector(unsigned int vec) 71static void __init m5206_timers_init(void)
72{ 72{
73 volatile unsigned char *mbar; 73 /* Timer1 is always used as system timer */
74 unsigned char icr; 74 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
75 75 MCF_MBAR + MCFSIM_TIMER1ICR);
76 if ((vec >= 25) && (vec <= 31)) { 76 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
77 vec -= 25; 77
78 mbar = (volatile unsigned char *) MCF_MBAR; 78#ifdef CONFIG_HIGHPROFILE
79 icr = MCFSIM_ICR_AUTOVEC | (vec << 3); 79 /* Timer2 is to be used as a high speed profile timer */
80 *(mbar + MCFSIM_ICR1 + vec) = icr; 80 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
81 vec = 0x1 << (vec + 1); 81 MCF_MBAR + MCFSIM_TIMER2ICR);
82 mcf_setimr(mcf_getimr() & ~vec); 82 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
83 } 83#endif
84}
85
86/***************************************************************************/
87
88void mcf_settimericr(unsigned int timer, unsigned int level)
89{
90 volatile unsigned char *icrp;
91 unsigned int icr, imr;
92
93 if (timer <= 2) {
94 switch (timer) {
95 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
96 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
97 }
98
99 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
100 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
101 mcf_setimr(mcf_getimr() & ~imr);
102 }
103} 84}
104 85
105/***************************************************************************/ 86/***************************************************************************/
@@ -117,15 +98,20 @@ void m5206_cpu_reset(void)
117 98
118void __init config_BSP(char *commandp, int size) 99void __init config_BSP(char *commandp, int size)
119{ 100{
120 mcf_setimr(MCFSIM_IMR_MASKALL);
121 mach_reset = m5206_cpu_reset; 101 mach_reset = m5206_cpu_reset;
102 m5206_timers_init();
103 m5206_uarts_init();
104
105 /* Only support the external interrupts on their primary level */
106 mcf_mapirq2imr(25, MCFINTC_EINT1);
107 mcf_mapirq2imr(28, MCFINTC_EINT4);
108 mcf_mapirq2imr(31, MCFINTC_EINT7);
122} 109}
123 110
124/***************************************************************************/ 111/***************************************************************************/
125 112
126static int __init init_BSP(void) 113static int __init init_BSP(void)
127{ 114{
128 m5206_uarts_init();
129 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices)); 115 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
130 return 0; 116 return 0;
131} 117}
diff --git a/arch/m68knommu/platform/5206/gpio.c b/arch/m68knommu/platform/5206/gpio.c
new file mode 100644
index 000000000000..60f779ce1651
--- /dev/null
+++ b/arch/m68knommu/platform/5206/gpio.c
@@ -0,0 +1,49 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PP",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 8,
34 },
35 .pddr = MCFSIM_PADDR,
36 .podr = MCFSIM_PADAT,
37 .ppdr = MCFSIM_PADAT,
38 },
39};
40
41static int __init mcf_gpio_init(void)
42{
43 unsigned i = 0;
44 while (i < ARRAY_SIZE(mcf_gpio_chips))
45 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
46 return 0;
47}
48
49core_initcall(mcf_gpio_init);