diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2006-09-20 21:46:03 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-25 05:34:02 -0400 |
commit | 0c92e830bd39f3e6cf7b151dffecafbdc623496c (patch) | |
tree | 56d9d48416a73cc78cd318880542d7571f5e84cb | |
parent | e60d07b6cd38a7afb85f2cf51aebcb3359b63819 (diff) |
[ARM] 3851/1: iop3xx: add io-data glantank support
Add support for the IO-Data GLAN Tank, from Martin Michlmayr.
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/configs/iop32x_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/glantank.c | 195 | ||||
-rw-r--r-- | arch/arm/mach-iop32x/irq.c | 3 | ||||
-rw-r--r-- | include/asm-arm/arch-iop32x/glantank.h | 13 | ||||
-rw-r--r-- | include/asm-arm/arch-iop32x/hardware.h | 1 |
7 files changed, 220 insertions, 1 deletions
diff --git a/arch/arm/configs/iop32x_defconfig b/arch/arm/configs/iop32x_defconfig index af3b40c0508a..0d67f66e78c2 100644 --- a/arch/arm/configs/iop32x_defconfig +++ b/arch/arm/configs/iop32x_defconfig | |||
@@ -126,6 +126,7 @@ CONFIG_ARCH_IOP32X=y | |||
126 | # | 126 | # |
127 | # IOP32x Platform Types | 127 | # IOP32x Platform Types |
128 | # | 128 | # |
129 | CONFIG_MACH_GLANTANK=y | ||
129 | CONFIG_ARCH_IQ80321=y | 130 | CONFIG_ARCH_IQ80321=y |
130 | CONFIG_ARCH_IQ31244=y | 131 | CONFIG_ARCH_IQ31244=y |
131 | CONFIG_MACH_N2100=y | 132 | CONFIG_MACH_N2100=y |
diff --git a/arch/arm/mach-iop32x/Kconfig b/arch/arm/mach-iop32x/Kconfig index 0a397a4a6ac9..c072d94070da 100644 --- a/arch/arm/mach-iop32x/Kconfig +++ b/arch/arm/mach-iop32x/Kconfig | |||
@@ -4,6 +4,13 @@ menu "IOP32x Implementation Options" | |||
4 | 4 | ||
5 | comment "IOP32x Platform Types" | 5 | comment "IOP32x Platform Types" |
6 | 6 | ||
7 | config MACH_GLANTANK | ||
8 | bool "Enable support for the IO-Data GLAN Tank" | ||
9 | help | ||
10 | Say Y here if you want to run your kernel on the GLAN Tank | ||
11 | NAS appliance or machines from IO-Data's HDL-Gxxx, HDL-GWxxx | ||
12 | and HDL-GZxxx series. | ||
13 | |||
7 | config ARCH_IQ80321 | 14 | config ARCH_IQ80321 |
8 | bool "Enable support for IQ80321" | 15 | bool "Enable support for IQ80321" |
9 | help | 16 | help |
diff --git a/arch/arm/mach-iop32x/Makefile b/arch/arm/mach-iop32x/Makefile index 9c62470cd4f5..7b05b37e1f94 100644 --- a/arch/arm/mach-iop32x/Makefile +++ b/arch/arm/mach-iop32x/Makefile | |||
@@ -7,6 +7,7 @@ obj-m := | |||
7 | obj-n := | 7 | obj-n := |
8 | obj- := | 8 | obj- := |
9 | 9 | ||
10 | obj-$(CONFIG_MACH_GLANTANK) += glantank.o | ||
10 | obj-$(CONFIG_ARCH_IQ80321) += iq80321.o | 11 | obj-$(CONFIG_ARCH_IQ80321) += iq80321.o |
11 | obj-$(CONFIG_ARCH_IQ31244) += iq31244.o | 12 | obj-$(CONFIG_ARCH_IQ31244) += iq31244.o |
12 | obj-$(CONFIG_MACH_N2100) += n2100.o | 13 | obj-$(CONFIG_MACH_N2100) += n2100.o |
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c new file mode 100644 index 000000000000..b9b765057dbe --- /dev/null +++ b/arch/arm/mach-iop32x/glantank.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-iop32x/glantank.c | ||
3 | * | ||
4 | * Board support code for the GLAN Tank. | ||
5 | * | ||
6 | * Copyright (C) 2006 Martin Michlmayr <tbm@cyrius.com> | ||
7 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/mm.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/pci.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/serial_8250.h> | ||
23 | #include <linux/mtd/physmap.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <asm/hardware.h> | ||
26 | #include <asm/io.h> | ||
27 | #include <asm/irq.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/map.h> | ||
30 | #include <asm/mach/pci.h> | ||
31 | #include <asm/mach/time.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | #include <asm/page.h> | ||
34 | |||
35 | /* | ||
36 | * GLAN Tank timer tick configuration. | ||
37 | */ | ||
38 | static void __init glantank_timer_init(void) | ||
39 | { | ||
40 | /* 33.333 MHz crystal. */ | ||
41 | iop3xx_init_time(200000000); | ||
42 | } | ||
43 | |||
44 | static struct sys_timer glantank_timer = { | ||
45 | .init = glantank_timer_init, | ||
46 | .offset = iop3xx_gettimeoffset, | ||
47 | }; | ||
48 | |||
49 | |||
50 | /* | ||
51 | * GLAN Tank I/O. | ||
52 | */ | ||
53 | static struct map_desc glantank_io_desc[] __initdata = { | ||
54 | { /* on-board devices */ | ||
55 | .virtual = GLANTANK_UART, | ||
56 | .pfn = __phys_to_pfn(GLANTANK_UART), | ||
57 | .length = 0x00100000, | ||
58 | .type = MT_DEVICE | ||
59 | }, | ||
60 | }; | ||
61 | |||
62 | void __init glantank_map_io(void) | ||
63 | { | ||
64 | iop3xx_map_io(); | ||
65 | iotable_init(glantank_io_desc, ARRAY_SIZE(glantank_io_desc)); | ||
66 | } | ||
67 | |||
68 | |||
69 | /* | ||
70 | * GLAN Tank PCI. | ||
71 | */ | ||
72 | #define INTA IRQ_IOP32X_XINT0 | ||
73 | #define INTB IRQ_IOP32X_XINT1 | ||
74 | #define INTC IRQ_IOP32X_XINT2 | ||
75 | #define INTD IRQ_IOP32X_XINT3 | ||
76 | |||
77 | static inline int __init | ||
78 | glantank_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
79 | { | ||
80 | static int pci_irq_table[][4] = { | ||
81 | /* | ||
82 | * PCI IDSEL/INTPIN->INTLINE | ||
83 | * A B C D | ||
84 | */ | ||
85 | {INTD, INTD, INTD, INTD}, /* UART (8250) */ | ||
86 | {INTA, INTA, INTA, INTA}, /* Ethernet (E1000) */ | ||
87 | {INTB, INTB, INTB, INTB}, /* IDE (AEC6280R) */ | ||
88 | {INTC, INTC, INTC, INTC}, /* USB (NEC) */ | ||
89 | }; | ||
90 | |||
91 | BUG_ON(pin < 1 || pin > 4); | ||
92 | |||
93 | return pci_irq_table[slot % 4][pin - 1]; | ||
94 | } | ||
95 | |||
96 | static struct hw_pci glantank_pci __initdata = { | ||
97 | .swizzle = pci_std_swizzle, | ||
98 | .nr_controllers = 1, | ||
99 | .setup = iop3xx_pci_setup, | ||
100 | .preinit = iop3xx_pci_preinit, | ||
101 | .scan = iop3xx_pci_scan_bus, | ||
102 | .map_irq = glantank_pci_map_irq, | ||
103 | }; | ||
104 | |||
105 | static int __init glantank_pci_init(void) | ||
106 | { | ||
107 | if (machine_is_glantank()) | ||
108 | pci_common_init(&glantank_pci); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | subsys_initcall(glantank_pci_init); | ||
114 | |||
115 | |||
116 | /* | ||
117 | * GLAN Tank machine initialization. | ||
118 | */ | ||
119 | static struct physmap_flash_data glantank_flash_data = { | ||
120 | .width = 1, | ||
121 | }; | ||
122 | |||
123 | static struct resource glantank_flash_resource = { | ||
124 | .start = 0xf0000000, | ||
125 | .end = 0xf007ffff, | ||
126 | .flags = IORESOURCE_MEM, | ||
127 | }; | ||
128 | |||
129 | static struct platform_device glantank_flash_device = { | ||
130 | .name = "physmap-flash", | ||
131 | .id = 0, | ||
132 | .dev = { | ||
133 | .platform_data = &glantank_flash_data, | ||
134 | }, | ||
135 | .num_resources = 1, | ||
136 | .resource = &glantank_flash_resource, | ||
137 | }; | ||
138 | |||
139 | static struct plat_serial8250_port glantank_serial_port[] = { | ||
140 | { | ||
141 | .mapbase = GLANTANK_UART, | ||
142 | .membase = (char *)GLANTANK_UART, | ||
143 | .irq = IRQ_IOP32X_XINT3, | ||
144 | .flags = UPF_SKIP_TEST, | ||
145 | .iotype = UPIO_MEM, | ||
146 | .regshift = 0, | ||
147 | .uartclk = 1843200, | ||
148 | }, | ||
149 | { }, | ||
150 | }; | ||
151 | |||
152 | static struct resource glantank_uart_resource = { | ||
153 | .start = GLANTANK_UART, | ||
154 | .end = GLANTANK_UART + 7, | ||
155 | .flags = IORESOURCE_MEM, | ||
156 | }; | ||
157 | |||
158 | static struct platform_device glantank_serial_device = { | ||
159 | .name = "serial8250", | ||
160 | .id = PLAT8250_DEV_PLATFORM, | ||
161 | .dev = { | ||
162 | .platform_data = glantank_serial_port, | ||
163 | }, | ||
164 | .num_resources = 1, | ||
165 | .resource = &glantank_uart_resource, | ||
166 | }; | ||
167 | |||
168 | static void glantank_power_off(void) | ||
169 | { | ||
170 | __raw_writeb(0x01, 0xfe8d0004); | ||
171 | |||
172 | while (1) | ||
173 | ; | ||
174 | } | ||
175 | |||
176 | static void __init glantank_init_machine(void) | ||
177 | { | ||
178 | platform_device_register(&iop3xx_i2c0_device); | ||
179 | platform_device_register(&iop3xx_i2c1_device); | ||
180 | platform_device_register(&glantank_flash_device); | ||
181 | platform_device_register(&glantank_serial_device); | ||
182 | |||
183 | pm_power_off = glantank_power_off; | ||
184 | } | ||
185 | |||
186 | MACHINE_START(GLANTANK, "GLAN Tank") | ||
187 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | ||
188 | .phys_io = GLANTANK_UART, | ||
189 | .io_pg_offst = ((GLANTANK_UART) >> 18) & 0xfffc, | ||
190 | .boot_params = 0xa0000100, | ||
191 | .map_io = glantank_map_io, | ||
192 | .init_irq = iop32x_init_irq, | ||
193 | .timer = &glantank_timer, | ||
194 | .init_machine = glantank_init_machine, | ||
195 | MACHINE_END | ||
diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c index 17fb94e6e29f..69d6302f40cf 100644 --- a/arch/arm/mach-iop32x/irq.c +++ b/arch/arm/mach-iop32x/irq.c | |||
@@ -62,7 +62,8 @@ void __init iop32x_init_irq(void) | |||
62 | 62 | ||
63 | intctl_write(0); | 63 | intctl_write(0); |
64 | intstr_write(0); | 64 | intstr_write(0); |
65 | if (machine_is_iq80321() || | 65 | if (machine_is_glantank() || |
66 | machine_is_iq80321() || | ||
66 | machine_is_iq31244() || | 67 | machine_is_iq31244() || |
67 | machine_is_n2100()) | 68 | machine_is_n2100()) |
68 | *IOP3XX_PCIIRSR = 0x0f; | 69 | *IOP3XX_PCIIRSR = 0x0f; |
diff --git a/include/asm-arm/arch-iop32x/glantank.h b/include/asm-arm/arch-iop32x/glantank.h new file mode 100644 index 000000000000..3b065618dd00 --- /dev/null +++ b/include/asm-arm/arch-iop32x/glantank.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * include/asm/arch-iop32x/glantank.h | ||
3 | * | ||
4 | * IO-Data GLAN Tank board registers | ||
5 | */ | ||
6 | |||
7 | #ifndef __GLANTANK_H | ||
8 | #define __GLANTANK_H | ||
9 | |||
10 | #define GLANTANK_UART 0xfe800000 /* UART */ | ||
11 | |||
12 | |||
13 | #endif | ||
diff --git a/include/asm-arm/arch-iop32x/hardware.h b/include/asm-arm/arch-iop32x/hardware.h index c6f58b91ddbc..6556ed5eee31 100644 --- a/include/asm-arm/arch-iop32x/hardware.h +++ b/include/asm-arm/arch-iop32x/hardware.h | |||
@@ -35,6 +35,7 @@ void iop32x_init_irq(void); | |||
35 | /* | 35 | /* |
36 | * Board specific bits | 36 | * Board specific bits |
37 | */ | 37 | */ |
38 | #include "glantank.h" | ||
38 | #include "iq80321.h" | 39 | #include "iq80321.h" |
39 | #include "iq31244.h" | 40 | #include "iq31244.h" |
40 | #include "n2100.h" | 41 | #include "n2100.h" |