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 struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
37 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
40 static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = {
41 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
42 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0),
43 PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1),
44 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
47 static struct mtd_partition wp54g_wrt_partitions[] = {
52 .mask_flags = MTD_WRITEABLE,
55 .offset = MTDPART_OFS_APPEND,
59 .offset = MTDPART_OFS_APPEND,
64 static struct platform_device *np2xg_devices[] __initdata = {
65 &adm5120_flash0_device,
69 static struct platform_device *wp54_devices[] __initdata = {
70 &adm5120_flash0_device,
73 unsigned char np27g_vlans[6] __initdata = {
75 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
78 unsigned char np28g_vlans[6] __initdata = {
79 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
82 unsigned char wp54_vlans[6] __initdata = {
83 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
86 /*--------------------------------------------------------------------------*/
88 static void switch_bank_gpio5(unsigned bank)
92 gpio_set_value(ADM5120_GPIO_PIN5, 0);
95 gpio_set_value(ADM5120_GPIO_PIN5, 1);
100 static void wp54_reset(void)
102 gpio_set_value(ADM5120_GPIO_PIN3, 0);
105 static void __init np2xg_setup(void)
107 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
108 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
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_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);
125 /* setup data for flash0 device */
126 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
128 /* TODO: setup mac address */
131 static void __init wp54_wrt_setup(void)
133 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
134 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
136 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
137 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
139 /* setup data for flash0 device */
140 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
141 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
142 adm5120_flash0_data.parts = wp54g_wrt_partitions;
144 /* TODO: setup mac address */
147 /*--------------------------------------------------------------------------*/
149 ADM5120_BOARD_START(NP27G, "Compex NetPassage 27G")
150 .board_setup = np2xg_setup,
152 .eth_vlans = np27g_vlans,
153 .num_devices = ARRAY_SIZE(np2xg_devices),
154 .devices = np2xg_devices,
157 ADM5120_BOARD_START(NP28G, "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 ADM5120_BOARD_START(WP54AG, "Compex WP54AG")
168 .board_setup = wp54_setup,
169 .board_reset = wp54_reset,
171 .eth_vlans = wp54_vlans,
172 .num_devices = ARRAY_SIZE(wp54_devices),
173 .devices = wp54_devices,
174 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
175 .pci_irq_map = wp54_pci_irqs,
178 ADM5120_BOARD_START(WP54G, "Compex WP54G")
179 .board_setup = wp54_setup,
180 .board_reset = wp54_reset,
182 .eth_vlans = wp54_vlans,
183 .num_devices = ARRAY_SIZE(wp54_devices),
184 .devices = wp54_devices,
185 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
186 .pci_irq_map = wp54_pci_irqs,
189 ADM5120_BOARD_START(WP54G_WRT, "Compex WP54G-WRT")
190 .board_setup = wp54_wrt_setup,
191 .board_reset = wp54_reset,
193 .eth_vlans = wp54_vlans,
194 .num_devices = ARRAY_SIZE(wp54_devices),
195 .devices = wp54_devices,
196 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
197 .pci_irq_map = wp54_pci_irqs,
200 ADM5120_BOARD_START(WPP54AG, "Compex WPP54AG")
201 .board_setup = wp54_setup,
202 .board_reset = wp54_reset,
204 .eth_vlans = wp54_vlans,
205 .num_devices = ARRAY_SIZE(wp54_devices),
206 .devices = wp54_devices,
207 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
208 .pci_irq_map = wp54_pci_irqs,
211 ADM5120_BOARD_START(WPP54G, "Compex WPP54G")
212 .board_setup = wp54_setup,
213 .board_reset = wp54_reset,
215 .eth_vlans = wp54_vlans,
216 .num_devices = ARRAY_SIZE(wp54_devices),
217 .devices = wp54_devices,
218 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
219 .pci_irq_map = wp54_pci_irqs,