6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 #include <linux/kernel.h>
27 #include <linux/init.h>
29 #include <asm/bootinfo.h>
32 #include <adm5120_board.h>
33 #include <adm5120_platform.h>
34 #include <adm5120_irq.h>
36 static void switch_bank_gpio5(unsigned bank)
40 gpio_set_value(ADM5120_GPIO_PIN5, 0);
43 gpio_set_value(ADM5120_GPIO_PIN5, 1);
48 static void wp54_reset(void)
50 gpio_set_value(ADM5120_GPIO_PIN3, 0);
53 static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
54 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
57 static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = {
58 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
59 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0),
60 PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1),
61 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
64 static struct mtd_partition wp54g_wrt_partitions[] = {
69 .mask_flags = MTD_WRITEABLE,
72 .offset = MTDPART_OFS_APPEND,
76 .offset = MTDPART_OFS_APPEND,
81 static struct platform_device *np2xg_devices[] __initdata = {
82 &adm5120_flash0_device,
86 static struct platform_device *wp54_devices[] __initdata = {
87 &adm5120_flash0_device,
90 static void __init np2xg_setup(void)
92 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
93 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
95 /* setup data for flash0 device */
96 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
98 /* TODO: setup mac address */
101 static void __init wp54_setup(void)
103 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
104 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
106 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
107 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
110 /* setup data for flash0 device */
111 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
113 /* TODO: setup mac address */
116 static void __init wp54_wrt_setup(void)
118 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
119 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
121 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
122 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
124 /* setup data for flash0 device */
125 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
126 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
127 adm5120_flash0_data.parts = wp54g_wrt_partitions;
129 /* TODO: setup mac address */
132 unsigned char np27g_vlans[6] __initdata = {
133 /* FIXME: untested */
134 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
137 unsigned char np28g_vlans[6] __initdata = {
138 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
141 unsigned char wp54_vlans[6] __initdata = {
142 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
145 static struct adm5120_board np27g_board __initdata = {
146 .mach_type = MACH_ADM5120_NP27G,
147 .name = "Compex NetPassage 27G",
148 .board_setup = np2xg_setup,
150 .eth_vlans = np27g_vlans,
151 .num_devices = ARRAY_SIZE(np2xg_devices),
152 .devices = np2xg_devices,
155 static struct adm5120_board np28g_board __initdata = {
156 .mach_type = MACH_ADM5120_NP28G,
157 .name = "Compex NetPassage 28G",
158 .board_setup = np2xg_setup,
160 .eth_vlans = np28g_vlans,
161 .num_devices = ARRAY_SIZE(np2xg_devices),
162 .devices = np2xg_devices,
163 .pci_nr_irqs = ARRAY_SIZE(np28g_pci_irqs),
164 .pci_irq_map = np28g_pci_irqs,
167 static struct adm5120_board wp54ag_board __initdata = {
168 .mach_type = MACH_ADM5120_WP54AG,
169 .name = "Compex WP54AG",
170 .board_setup = wp54_setup,
171 .board_reset = wp54_reset,
173 .eth_vlans = wp54_vlans,
174 .num_devices = ARRAY_SIZE(wp54_devices),
175 .devices = wp54_devices,
176 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
177 .pci_irq_map = wp54_pci_irqs,
180 static struct adm5120_board wp54g_board __initdata = {
181 .mach_type = MACH_ADM5120_WP54G,
182 .name = "Compex WP54G",
183 .board_setup = wp54_setup,
184 .board_reset = wp54_reset,
186 .eth_vlans = wp54_vlans,
187 .num_devices = ARRAY_SIZE(wp54_devices),
188 .devices = wp54_devices,
189 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
190 .pci_irq_map = wp54_pci_irqs,
193 static struct adm5120_board wp54g_wrt_board __initdata = {
194 .mach_type = MACH_ADM5120_WP54G_WRT,
195 .name = "Compex WP54G-WRT",
196 .board_setup = wp54_wrt_setup,
197 .board_reset = wp54_reset,
199 .eth_vlans = wp54_vlans,
200 .num_devices = ARRAY_SIZE(wp54_devices),
201 .devices = wp54_devices,
202 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
203 .pci_irq_map = wp54_pci_irqs,
206 static struct adm5120_board wpp54ag_board __initdata = {
207 .mach_type = MACH_ADM5120_WPP54AG,
208 .name = "Compex WPP54AG",
209 .board_setup = wp54_setup,
210 .board_reset = wp54_reset,
212 .eth_vlans = wp54_vlans,
213 .num_devices = ARRAY_SIZE(wp54_devices),
214 .devices = wp54_devices,
215 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
216 .pci_irq_map = wp54_pci_irqs,
219 static struct adm5120_board wpp54g_board __initdata = {
220 .mach_type = MACH_ADM5120_WPP54G,
221 .name = "Compex WPP54G",
222 .board_setup = wp54_setup,
223 .board_reset = wp54_reset,
225 .eth_vlans = wp54_vlans,
226 .num_devices = ARRAY_SIZE(wp54_devices),
227 .devices = wp54_devices,
228 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
229 .pci_irq_map = wp54_pci_irqs,
232 static int __init register_boards(void)
234 adm5120_board_register(&np27g_board);
235 adm5120_board_register(&np28g_board);
236 adm5120_board_register(&wp54ag_board);
237 adm5120_board_register(&wp54g_board);
238 adm5120_board_register(&wp54g_wrt_board);
239 adm5120_board_register(&wpp54ag_board);
240 adm5120_board_register(&wpp54g_board);
244 pure_initcall(register_boards);