diff options
author | Greg Ungerer <gerg@uclinux.org> | 2011-03-21 23:39:27 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2011-03-25 00:05:13 -0400 |
commit | 66d857b08b8c3ed5c72c361f863cce77d2a978d7 (patch) | |
tree | 47222d86f4d78dc0da31baf64188bd2e4b38ac1e /arch/m68k/platform/5206 | |
parent | d39dd11c3e6a7af5c20bfac40594db36cf270f42 (diff) |
m68k: merge m68k and m68knommu arch directories
There is a lot of common code that could be shared between the m68k
and m68knommu arch branches. It makes sense to merge the two branches
into a single directory structure so that we can more easily share
that common code.
This is a brute force merge, based on a script from Stephen King
<sfking@fdwdc.com>, which was originally written by Arnd Bergmann
<arnd@arndb.de>.
> The script was inspired by the script Sam Ravnborg used to merge the
> includes from m68knommu. For those files common to both arches but
> differing in content, the m68k version of the file is renamed to
> <file>_mm.<ext> and the m68knommu version of the file is moved into the
> corresponding m68k directory and renamed <file>_no.<ext> and a small
> wrapper file <file>.<ext> is used to select between the two version. Files
> that are common to both but don't differ are removed from the m68knommu
> tree and files and directories that are unique to the m68knommu tree are
> moved to the m68k tree. Finally, the arch/m68knommu tree is removed.
>
> To select between the the versions of the files, the wrapper uses
>
> #ifdef CONFIG_MMU
> #include <file>_mm.<ext>
> #else
> #include <file>_no.<ext>
> #endif
On top of this file merge I have done a simplistic merge of m68k and
m68knommu Kconfig, which primarily attempts to keep existing options and
menus in place. Other than a handful of options being moved it produces
identical .config outputs on m68k and m68knommu targets I tested it on.
With this in place there is now quite a bit of scope for merge cleanups
in future patches.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/platform/5206')
-rw-r--r-- | arch/m68k/platform/5206/Makefile | 18 | ||||
-rw-r--r-- | arch/m68k/platform/5206/config.c | 121 | ||||
-rw-r--r-- | arch/m68k/platform/5206/gpio.c | 49 |
3 files changed, 188 insertions, 0 deletions
diff --git a/arch/m68k/platform/5206/Makefile b/arch/m68k/platform/5206/Makefile new file mode 100644 index 00000000000..b5db05625cf --- /dev/null +++ b/arch/m68k/platform/5206/Makefile | |||
@@ -0,0 +1,18 @@ | |||
1 | # | ||
2 | # Makefile for the m68knommu linux kernel. | ||
3 | # | ||
4 | |||
5 | # | ||
6 | # If you want to play with the HW breakpoints then you will | ||
7 | # need to add define this, which will give you a stack backtrace | ||
8 | # on the console port whenever a DBG interrupt occurs. You have to | ||
9 | # set up you HW breakpoints to trigger a DBG interrupt: | ||
10 | # | ||
11 | # ccflags-y := -DTRAP_DBG_INTERRUPT | ||
12 | # asflags-y := -DTRAP_DBG_INTERRUPT | ||
13 | # | ||
14 | |||
15 | asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 | ||
16 | |||
17 | obj-y := config.o gpio.o | ||
18 | |||
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c new file mode 100644 index 00000000000..9c335465e66 --- /dev/null +++ b/arch/m68k/platform/5206/config.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /***************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * linux/arch/m68knommu/platform/5206/config.c | ||
5 | * | ||
6 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) | ||
7 | * Copyright (C) 2000-2001, Lineo Inc. (www.lineo.com) | ||
8 | */ | ||
9 | |||
10 | /***************************************************************************/ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/param.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <asm/machdep.h> | ||
17 | #include <asm/coldfire.h> | ||
18 | #include <asm/mcfsim.h> | ||
19 | #include <asm/mcfuart.h> | ||
20 | |||
21 | /***************************************************************************/ | ||
22 | |||
23 | static struct mcf_platform_uart m5206_uart_platform[] = { | ||
24 | { | ||
25 | .mapbase = MCF_MBAR + MCFUART_BASE1, | ||
26 | .irq = 73, | ||
27 | }, | ||
28 | { | ||
29 | .mapbase = MCF_MBAR + MCFUART_BASE2, | ||
30 | .irq = 74, | ||
31 | }, | ||
32 | { }, | ||
33 | }; | ||
34 | |||
35 | static struct platform_device m5206_uart = { | ||
36 | .name = "mcfuart", | ||
37 | .id = 0, | ||
38 | .dev.platform_data = m5206_uart_platform, | ||
39 | }; | ||
40 | |||
41 | static struct platform_device *m5206_devices[] __initdata = { | ||
42 | &m5206_uart, | ||
43 | }; | ||
44 | |||
45 | /***************************************************************************/ | ||
46 | |||
47 | static void __init m5206_uart_init_line(int line, int irq) | ||
48 | { | ||
49 | if (line == 0) { | ||
50 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | ||
51 | writeb(irq, MCFUART_BASE1 + MCFUART_UIVR); | ||
52 | mcf_mapirq2imr(irq, MCFINTC_UART0); | ||
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_mapirq2imr(irq, MCFINTC_UART1); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | static void __init m5206_uarts_init(void) | ||
61 | { | ||
62 | const int nrlines = ARRAY_SIZE(m5206_uart_platform); | ||
63 | int line; | ||
64 | |||
65 | for (line = 0; (line < nrlines); line++) | ||
66 | m5206_uart_init_line(line, m5206_uart_platform[line].irq); | ||
67 | } | ||
68 | |||
69 | /***************************************************************************/ | ||
70 | |||
71 | static void __init m5206_timers_init(void) | ||
72 | { | ||
73 | /* Timer1 is always used as system timer */ | ||
74 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, | ||
75 | MCF_MBAR + MCFSIM_TIMER1ICR); | ||
76 | mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); | ||
77 | |||
78 | #ifdef CONFIG_HIGHPROFILE | ||
79 | /* Timer2 is to be used as a high speed profile timer */ | ||
80 | writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, | ||
81 | MCF_MBAR + MCFSIM_TIMER2ICR); | ||
82 | mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); | ||
83 | #endif | ||
84 | } | ||
85 | |||
86 | /***************************************************************************/ | ||
87 | |||
88 | void m5206_cpu_reset(void) | ||
89 | { | ||
90 | local_irq_disable(); | ||
91 | /* Set watchdog to soft reset, and enabled */ | ||
92 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
93 | for (;;) | ||
94 | /* wait for watchdog to timeout */; | ||
95 | } | ||
96 | |||
97 | /***************************************************************************/ | ||
98 | |||
99 | void __init config_BSP(char *commandp, int size) | ||
100 | { | ||
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); | ||
109 | } | ||
110 | |||
111 | /***************************************************************************/ | ||
112 | |||
113 | static int __init init_BSP(void) | ||
114 | { | ||
115 | platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices)); | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | arch_initcall(init_BSP); | ||
120 | |||
121 | /***************************************************************************/ | ||
diff --git a/arch/m68k/platform/5206/gpio.c b/arch/m68k/platform/5206/gpio.c new file mode 100644 index 00000000000..b9ab4a120f2 --- /dev/null +++ b/arch/m68k/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 | |||
23 | static 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 = (void __iomem *) MCFSIM_PADDR, | ||
36 | .podr = (void __iomem *) MCFSIM_PADAT, | ||
37 | .ppdr = (void __iomem *) MCFSIM_PADAT, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | static 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 | |||
49 | core_initcall(mcf_gpio_init); | ||