aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ks8695
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-09-07 23:17:07 -0400
committerOlof Johansson <olof@lixom.net>2012-09-07 23:17:07 -0400
commita4d3621e0d3ecf191961dc9214e4a378a7186780 (patch)
treef45bcda4cd1430cc2657b9763175075f52ac730d /arch/arm/mach-ks8695
parent78a0bc3de149fd162ff3ae4bd264531ef9ad565f (diff)
parenta7b8575423e0aa80e8bbc388036bc7d460b43bb4 (diff)
Merge branch 'ks8695/boards' into next/boards
* ks8695/boards: ARM: ks8695: add board support for the OpenGear boards based on the KS8695 ARM: ks8695: add board support for the SnapGear boards based on the KS8695
Diffstat (limited to 'arch/arm/mach-ks8695')
-rw-r--r--arch/arm/mach-ks8695/Kconfig61
-rw-r--r--arch/arm/mach-ks8695/Makefile8
-rw-r--r--arch/arm/mach-ks8695/board-og.c199
-rw-r--r--arch/arm/mach-ks8695/board-sg.c121
4 files changed, 389 insertions, 0 deletions
diff --git a/arch/arm/mach-ks8695/Kconfig b/arch/arm/mach-ks8695/Kconfig
index f5c39a8c2b00..a545976bdbd6 100644
--- a/arch/arm/mach-ks8695/Kconfig
+++ b/arch/arm/mach-ks8695/Kconfig
@@ -21,6 +21,67 @@ config MACH_ACS5K
21 say 'Y' here if you want your kernel to run on the Brivo 21 say 'Y' here if you want your kernel to run on the Brivo
22 Systems LLC, ACS-5000 Master board. 22 Systems LLC, ACS-5000 Master board.
23 23
24config MACH_LITE300
25 bool "SecureComputing SG300"
26 help
27 Say 'Y' here if you want your kernel to support the
28 SecureComputing / SnapGear SG300 VPN Internet Router.
29 See http://www.securecomputing.com for more details.
30
31config MACH_SG310
32 bool "McAfee SG310"
33 help
34 Say 'Y' here if you want your kernel to support the
35 McAfee / SnapGear SG310 VPN Internet Router.
36 See http://www.mcafee.com for more details.
37
38config MACH_SE4200
39 bool "SecureComputing SE4200"
40 help
41 Say 'Y' here if you want your kernel to support the
42 SecureComputing / SnapGear SE4200 Secure Wireless VPN
43 Internet Router.
44 See http://www.securecomputing.com for more details.
45
46config MACH_CM4002
47 bool "OpenGear CM4002"
48 help
49 Say 'Y' here if you want your kernel to support the OpenGear
50 CM4002 Secure Access Server. See http://www.opengear.com for
51 more details.
52
53config MACH_CM4008
54 bool "OpenGear CM4008"
55 select MIGHT_HAVE_PCI
56 help
57 Say 'Y' here if you want your kernel to support the OpenGear
58 CM4008 Console Server. See http://www.opengear.com for more
59 details.
60
61config MACH_CM41xx
62 bool "OpenGear CM41xx"
63 select MIGHT_HAVE_PCI
64 help
65 Say 'Y' here if you want your kernel to support the OpenGear
66 CM4016 or CM4048 Console Servers. See http://www.opengear.com for
67 more details.
68
69config MACH_IM4004
70 bool "OpenGear IM4004"
71 select MIGHT_HAVE_PCI
72 help
73 Say 'Y' here if you want your kernel to support the OpenGear
74 IM4004 Secure Access Server. See http://www.opengear.com for
75 more details.
76
77config MACH_IM42xx
78 bool "OpenGear IM42xx"
79 select MIGHT_HAVE_PCI
80 help
81 Say 'Y' here if you want your kernel to support the OpenGear
82 IM4216 or IM4248 Console Servers. See http://www.opengear.com for
83 more details.
84
24endmenu 85endmenu
25 86
26endif 87endif
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 853efd9133c6..50980e6b1c1f 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -18,3 +18,11 @@ obj-$(CONFIG_LEDS) += leds.o
18obj-$(CONFIG_MACH_KS8695) += board-micrel.o 18obj-$(CONFIG_MACH_KS8695) += board-micrel.o
19obj-$(CONFIG_MACH_DSM320) += board-dsm320.o 19obj-$(CONFIG_MACH_DSM320) += board-dsm320.o
20obj-$(CONFIG_MACH_ACS5K) += board-acs5k.o 20obj-$(CONFIG_MACH_ACS5K) += board-acs5k.o
21obj-$(CONFIG_MACH_LITE300) += board-sg.o
22obj-$(CONFIG_MACH_SG310) += board-sg.o
23obj-$(CONFIG_MACH_SE4200) += board-sg.o
24obj-$(CONFIG_MACH_CM4002) += board-og.o
25obj-$(CONFIG_MACH_CM4008) += board-og.o
26obj-$(CONFIG_MACH_CM41xx) += board-og.o
27obj-$(CONFIG_MACH_IM4004) += board-og.o
28obj-$(CONFIG_MACH_IM42xx) += board-og.o
diff --git a/arch/arm/mach-ks8695/board-og.c b/arch/arm/mach-ks8695/board-og.c
new file mode 100644
index 000000000000..1623ba461e47
--- /dev/null
+++ b/arch/arm/mach-ks8695/board-og.c
@@ -0,0 +1,199 @@
1/*
2 * board-og.c -- support for the OpenGear KS8695 based boards.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/interrupt.h>
12#include <linux/init.h>
13#include <linux/delay.h>
14#include <linux/platform_device.h>
15#include <linux/serial_8250.h>
16#include <linux/gpio.h>
17#include <linux/irq.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <mach/devices.h>
22#include <mach/regs-gpio.h>
23#include <mach/gpio-ks8695.h>
24#include "generic.h"
25
26static int og_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
27{
28 if (machine_is_im4004() && (slot == 8))
29 return KS8695_IRQ_EXTERN1;
30 return KS8695_IRQ_EXTERN0;
31}
32
33static struct ks8695_pci_cfg __initdata og_pci = {
34 .mode = KS8695_MODE_PCI,
35 .map_irq = og_pci_map_irq,
36};
37
38static void __init og_register_pci(void)
39{
40 /* Initialize the GPIO lines for interrupt mode */
41 ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW);
42
43 /* Cardbus Slot */
44 if (machine_is_im4004())
45 ks8695_gpio_interrupt(KS8695_GPIO_1, IRQ_TYPE_LEVEL_LOW);
46
47 ks8695_init_pci(&og_pci);
48}
49
50/*
51 * The PCI bus reset is driven by a dedicated GPIO line. Toggle it here
52 * and bring the PCI bus out of reset.
53 */
54static void __init og_pci_bus_reset(void)
55{
56 unsigned int rstline = 1;
57
58 /* Some boards use a different GPIO as the PCI reset line */
59 if (machine_is_im4004())
60 rstline = 2;
61 else if (machine_is_im42xx())
62 rstline = 0;
63
64 gpio_request(rstline, "PCI reset");
65 gpio_direction_output(rstline, 0);
66
67 /* Drive a reset on the PCI reset line */
68 gpio_set_value(rstline, 1);
69 gpio_set_value(rstline, 0);
70 mdelay(100);
71 gpio_set_value(rstline, 1);
72 mdelay(100);
73}
74
75/*
76 * Direct connect serial ports (non-PCI that is).
77 */
78#define S8250_PHYS 0x03800000
79#define S8250_VIRT 0xf4000000
80#define S8250_SIZE 0x00100000
81
82static struct __initdata map_desc og_io_desc[] = {
83 {
84 .virtual = S8250_VIRT,
85 .pfn = __phys_to_pfn(S8250_PHYS),
86 .length = S8250_SIZE,
87 .type = MT_DEVICE,
88 }
89};
90
91static struct resource og_uart_resources[] = {
92 {
93 .start = S8250_VIRT,
94 .end = S8250_VIRT + S8250_SIZE,
95 .flags = IORESOURCE_MEM
96 },
97};
98
99static struct plat_serial8250_port og_uart_data[] = {
100 {
101 .mapbase = S8250_VIRT,
102 .membase = (char *) S8250_VIRT,
103 .irq = 3,
104 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
105 .iotype = UPIO_MEM,
106 .regshift = 2,
107 .uartclk = 115200 * 16,
108 },
109 { },
110};
111
112static struct platform_device og_uart = {
113 .name = "serial8250",
114 .id = 0,
115 .dev.platform_data = og_uart_data,
116 .num_resources = 1,
117 .resource = og_uart_resources
118};
119
120static struct platform_device *og_devices[] __initdata = {
121 &og_uart
122};
123
124static void __init og_init(void)
125{
126 ks8695_register_gpios();
127
128 if (machine_is_cm4002()) {
129 ks8695_gpio_interrupt(KS8695_GPIO_1, IRQ_TYPE_LEVEL_HIGH);
130 iotable_init(og_io_desc, ARRAY_SIZE(og_io_desc));
131 platform_add_devices(og_devices, ARRAY_SIZE(og_devices));
132 } else {
133 og_pci_bus_reset();
134 og_register_pci();
135 }
136
137 ks8695_add_device_lan();
138 ks8695_add_device_wan();
139}
140
141#ifdef CONFIG_MACH_CM4002
142MACHINE_START(CM4002, "OpenGear/CM4002")
143 /* OpenGear Inc. */
144 .atag_offset = 0x100,
145 .map_io = ks8695_map_io,
146 .init_irq = ks8695_init_irq,
147 .init_machine = og_init,
148 .timer = &ks8695_timer,
149 .restart = ks8695_restart,
150MACHINE_END
151#endif
152
153#ifdef CONFIG_MACH_CM4008
154MACHINE_START(CM4008, "OpenGear/CM4008")
155 /* OpenGear Inc. */
156 .atag_offset = 0x100,
157 .map_io = ks8695_map_io,
158 .init_irq = ks8695_init_irq,
159 .init_machine = og_init,
160 .timer = &ks8695_timer,
161 .restart = ks8695_restart,
162MACHINE_END
163#endif
164
165#ifdef CONFIG_MACH_CM41xx
166MACHINE_START(CM41XX, "OpenGear/CM41xx")
167 /* OpenGear Inc. */
168 .atag_offset = 0x100,
169 .map_io = ks8695_map_io,
170 .init_irq = ks8695_init_irq,
171 .init_machine = og_init,
172 .timer = &ks8695_timer,
173 .restart = ks8695_restart,
174MACHINE_END
175#endif
176
177#ifdef CONFIG_MACH_IM4004
178MACHINE_START(IM4004, "OpenGear/IM4004")
179 /* OpenGear Inc. */
180 .atag_offset = 0x100,
181 .map_io = ks8695_map_io,
182 .init_irq = ks8695_init_irq,
183 .init_machine = og_init,
184 .timer = &ks8695_timer,
185 .restart = ks8695_restart,
186MACHINE_END
187#endif
188
189#ifdef CONFIG_MACH_IM42xx
190MACHINE_START(IM42XX, "OpenGear/IM42xx")
191 /* OpenGear Inc. */
192 .atag_offset = 0x100,
193 .map_io = ks8695_map_io,
194 .init_irq = ks8695_init_irq,
195 .init_machine = og_init,
196 .timer = &ks8695_timer,
197 .restart = ks8695_restart,
198MACHINE_END
199#endif
diff --git a/arch/arm/mach-ks8695/board-sg.c b/arch/arm/mach-ks8695/board-sg.c
new file mode 100644
index 000000000000..f35b98b5bf37
--- /dev/null
+++ b/arch/arm/mach-ks8695/board-sg.c
@@ -0,0 +1,121 @@
1/*
2 * board-sg.c -- support for the SnapGear KS8695 based boards
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/map.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mtd/partitions.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/devices.h>
20#include "generic.h"
21
22/*
23 * The SG310 machine type is fitted with a conventional 8MB Strataflash
24 * device. Define its partitioning.
25 */
26#define FL_BASE 0x02000000
27#define FL_SIZE SZ_8M
28
29static struct mtd_partition sg_mtd_partitions[] = {
30 [0] = {
31 .name = "SnapGear Boot Loader",
32 .size = SZ_128K,
33 },
34 [1] = {
35 .name = "SnapGear non-volatile configuration",
36 .size = SZ_512K,
37 .offset = SZ_256K,
38 },
39 [2] = {
40 .name = "SnapGear image",
41 .offset = SZ_512K + SZ_256K,
42 },
43 [3] = {
44 .name = "SnapGear StrataFlash",
45 },
46 [4] = {
47 .name = "SnapGear Boot Tags",
48 .size = SZ_128K,
49 .offset = SZ_128K,
50 },
51};
52
53static struct physmap_flash_data sg_mtd_pdata = {
54 .width = 1,
55 .nr_parts = ARRAY_SIZE(sg_mtd_partitions),
56 .parts = sg_mtd_partitions,
57};
58
59
60static struct resource sg_mtd_resource[] = {
61 [0] = {
62 .start = FL_BASE,
63 .end = FL_BASE + FL_SIZE - 1,
64 .flags = IORESOURCE_MEM,
65 },
66};
67
68static struct platform_device sg_mtd_device = {
69 .name = "physmap-flash",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(sg_mtd_resource),
72 .resource = sg_mtd_resource,
73 .dev = {
74 .platform_data = &sg_mtd_pdata,
75 },
76};
77
78static void __init sg_init(void)
79{
80 ks8695_add_device_lan();
81 ks8695_add_device_wan();
82
83 if (machine_is_sg310())
84 platform_device_register(&sg_mtd_device);
85}
86
87#ifdef CONFIG_MACH_LITE300
88MACHINE_START(LITE300, "SecureComputing/SG300")
89 /* SnapGear */
90 .atag_offset = 0x100,
91 .map_io = ks8695_map_io,
92 .init_irq = ks8695_init_irq,
93 .init_machine = sg_init,
94 .timer = &ks8695_timer,
95 .restart = ks8695_restart,
96MACHINE_END
97#endif
98
99#ifdef CONFIG_MACH_SG310
100MACHINE_START(SG310, "McAfee/SG310")
101 /* SnapGear */
102 .atag_offset = 0x100,
103 .map_io = ks8695_map_io,
104 .init_irq = ks8695_init_irq,
105 .init_machine = sg_init,
106 .timer = &ks8695_timer,
107 .restart = ks8695_restart,
108MACHINE_END
109#endif
110
111#ifdef CONFIG_MACH_SE4200
112MACHINE_START(SE4200, "SecureComputing/SE4200")
113 /* SnapGear */
114 .atag_offset = 0x100,
115 .map_io = ks8695_map_io,
116 .init_irq = ks8695_init_irq,
117 .init_machine = sg_init,
118 .timer = &ks8695_timer,
119 .restart = ks8695_restart,
120MACHINE_END
121#endif