6 * Copyright (C) 2007-2008 OpenWrt.org
7 * Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
18 #include <asm/bootinfo.h>
21 #include <adm5120_board.h>
22 #include <adm5120_platform.h>
23 #include <adm5120_irq.h>
25 static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
26 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
29 static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = {
30 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
31 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0),
32 PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1),
33 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
36 static struct mtd_partition wp54g_wrt_partitions[] = {
41 .mask_flags = MTD_WRITEABLE,
44 .offset = MTDPART_OFS_APPEND,
48 .offset = MTDPART_OFS_APPEND,
53 static struct platform_device *np2xg_devices[] __initdata = {
54 &adm5120_flash0_device,
58 static struct platform_device *wp54_devices[] __initdata = {
59 &adm5120_flash0_device,
60 &adm5120_buttons_device,
63 unsigned char np27g_vlans[6] __initdata = {
65 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
68 unsigned char np28g_vlans[6] __initdata = {
69 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
72 unsigned char wp54_vlans[6] __initdata = {
73 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
76 /*--------------------------------------------------------------------------*/
78 static void switch_bank_gpio5(unsigned bank)
82 gpio_set_value(ADM5120_GPIO_PIN5, 0);
85 gpio_set_value(ADM5120_GPIO_PIN5, 1);
90 static void wp54_reset(void)
92 gpio_set_value(ADM5120_GPIO_PIN3, 0);
95 static void np28g_reset(void)
97 gpio_set_value(ADM5120_GPIO_PIN4, 0);
100 static void __init np27g_setup(void)
102 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
103 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
105 /* setup data for flash0 device */
106 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
108 /* TODO: setup mac address */
111 static void __init np28g_setup(void)
113 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
114 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
116 gpio_request(ADM5120_GPIO_PIN4, NULL); /* for system reset */
117 gpio_direction_output(ADM5120_GPIO_PIN4, 1);
119 /* setup data for flash0 device */
120 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
122 /* TODO: setup mac address */
125 static void __init wp54_setup(void)
127 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
128 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
130 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
131 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
133 /* setup data for flash0 device */
134 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
136 adm5120_buttons_data.nbuttons = 1;
137 adm5120_buttons[0].desc = "reset button";
138 adm5120_buttons[0].gpio = ADM5120_GPIO_PIN2;
140 /* TODO: setup mac address */
143 static void __init wp54_wrt_setup(void)
147 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
148 adm5120_flash0_data.parts = wp54g_wrt_partitions;
150 /* TODO: setup mac address */
153 /*--------------------------------------------------------------------------*/
155 ADM5120_BOARD_START(NP27G, "Compex NetPassage 27G")
156 .board_setup = np27g_setup,
158 .eth_vlans = np27g_vlans,
159 .num_devices = ARRAY_SIZE(np2xg_devices),
160 .devices = np2xg_devices,
161 /* TODO: add PCI IRQ map */
164 ADM5120_BOARD_START(NP28G, "Compex NetPassage 28G")
165 .board_setup = np28g_setup,
166 .board_reset = np28g_reset,
168 .eth_vlans = np28g_vlans,
169 .num_devices = ARRAY_SIZE(np2xg_devices),
170 .devices = np2xg_devices,
171 .pci_nr_irqs = ARRAY_SIZE(np28g_pci_irqs),
172 .pci_irq_map = np28g_pci_irqs,
175 ADM5120_BOARD_START(WP54AG, "Compex WP54AG")
176 .board_setup = wp54_setup,
177 .board_reset = wp54_reset,
179 .eth_vlans = wp54_vlans,
180 .num_devices = ARRAY_SIZE(wp54_devices),
181 .devices = wp54_devices,
182 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
183 .pci_irq_map = wp54_pci_irqs,
186 ADM5120_BOARD_START(WP54G, "Compex WP54G")
187 .board_setup = wp54_setup,
188 .board_reset = wp54_reset,
190 .eth_vlans = wp54_vlans,
191 .num_devices = ARRAY_SIZE(wp54_devices),
192 .devices = wp54_devices,
193 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
194 .pci_irq_map = wp54_pci_irqs,
197 ADM5120_BOARD_START(WP54G_WRT, "Compex WP54G-WRT")
198 .board_setup = wp54_wrt_setup,
199 .board_reset = wp54_reset,
201 .eth_vlans = wp54_vlans,
202 .num_devices = ARRAY_SIZE(wp54_devices),
203 .devices = wp54_devices,
204 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
205 .pci_irq_map = wp54_pci_irqs,
208 ADM5120_BOARD_START(WPP54AG, "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 ADM5120_BOARD_START(WPP54G, "Compex WPP54G")
220 .board_setup = wp54_setup,
221 .board_reset = wp54_reset,
223 .eth_vlans = wp54_vlans,
224 .num_devices = ARRAY_SIZE(wp54_devices),
225 .devices = wp54_devices,
226 .pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
227 .pci_irq_map = wp54_pci_irqs,