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 <asm/mach-adm5120/adm5120_board.h>
33 #include <asm/mach-adm5120/adm5120_platform.h>
35 static void switch_bank_gpio5(unsigned bank)
39 gpio_set_value(ADM5120_GPIO_PIN5, 0);
42 gpio_set_value(ADM5120_GPIO_PIN5, 1);
47 static void wp54_reset(void)
49 gpio_set_value(ADM5120_GPIO_PIN3, 0);
52 static struct mtd_partition wp54g_wrt_partitions[] = {
57 .mask_flags = MTD_WRITEABLE,
60 .offset = MTDPART_OFS_APPEND,
64 .offset = MTDPART_OFS_APPEND,
69 static struct platform_device *np2xg_devices[] __initdata = {
70 &adm5120_flash0_device,
74 static struct platform_device *wp54_devices[] __initdata = {
75 &adm5120_flash0_device,
78 static void __init np2xg_setup(void)
80 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
81 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
83 /* setup data for flash0 device */
84 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
86 /* TODO: setup mac address */
89 static void __init wp54_setup(void)
91 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
92 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
94 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
95 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
98 /* setup data for flash0 device */
99 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
101 /* TODO: setup mac address */
104 static void __init wp54_wrt_setup(void)
106 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
107 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
109 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */
110 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
112 /* setup data for flash0 device */
113 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
114 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
115 adm5120_flash0_data.parts = wp54g_wrt_partitions;
117 /* TODO: setup mac address */
120 unsigned char np27g_vlans[6] __initdata = {
121 /* FIXME: untested */
122 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
125 unsigned char np28g_vlans[6] __initdata = {
126 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
129 unsigned char wp54_vlans[6] __initdata = {
130 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
133 static struct adm5120_board np27g_board __initdata = {
134 .mach_type = MACH_ADM5120_NP27G,
135 .name = "Compex NetPassage 27G",
136 .board_setup = np2xg_setup,
138 .eth_vlans = np27g_vlans,
139 .num_devices = ARRAY_SIZE(np2xg_devices),
140 .devices = np2xg_devices,
143 static struct adm5120_board np28g_board __initdata = {
144 .mach_type = MACH_ADM5120_NP28G,
145 .name = "Compex NetPassage 28G",
146 .board_setup = np2xg_setup,
148 .eth_vlans = np28g_vlans,
149 .num_devices = ARRAY_SIZE(np2xg_devices),
150 .devices = np2xg_devices,
153 static struct adm5120_board wp54ag_board __initdata = {
154 .mach_type = MACH_ADM5120_WP54AG,
155 .name = "Compex WP54AG",
156 .board_setup = wp54_setup,
157 .board_reset = wp54_reset,
159 .eth_vlans = wp54_vlans,
160 .num_devices = ARRAY_SIZE(wp54_devices),
161 .devices = wp54_devices,
164 static struct adm5120_board wp54g_board __initdata = {
165 .mach_type = MACH_ADM5120_WP54G,
166 .name = "Compex WP54G",
167 .board_setup = wp54_setup,
168 .board_reset = wp54_reset,
170 .eth_vlans = wp54_vlans,
171 .num_devices = ARRAY_SIZE(wp54_devices),
172 .devices = wp54_devices,
175 static struct adm5120_board wp54g_wrt_board __initdata = {
176 .mach_type = MACH_ADM5120_WP54G,
177 .name = "Compex WP54G-WRT",
178 .board_setup = wp54_wrt_setup,
179 .board_reset = wp54_reset,
181 .eth_vlans = wp54_vlans,
182 .num_devices = ARRAY_SIZE(wp54_devices),
183 .devices = wp54_devices,
186 static struct adm5120_board wpp54ag_board __initdata = {
187 .mach_type = MACH_ADM5120_WPP54AG,
188 .name = "Compex WPP54AG",
189 .board_setup = wp54_setup,
190 .board_reset = wp54_reset,
192 .eth_vlans = wp54_vlans,
193 .num_devices = ARRAY_SIZE(wp54_devices),
194 .devices = wp54_devices,
197 static struct adm5120_board wpp54g_board __initdata = {
198 .mach_type = MACH_ADM5120_WPP54G,
199 .name = "Compex WPP54G",
200 .board_setup = wp54_setup,
201 .board_reset = wp54_reset,
203 .eth_vlans = wp54_vlans,
204 .num_devices = ARRAY_SIZE(wp54_devices),
205 .devices = wp54_devices,
208 static int __init register_boards(void)
210 adm5120_board_register(&np27g_board);
211 adm5120_board_register(&np28g_board);
212 adm5120_board_register(&wp54ag_board);
213 adm5120_board_register(&wp54g_board);
214 adm5120_board_register(&wp54g_wrt_board);
215 adm5120_board_register(&wpp54ag_board);
216 adm5120_board_register(&wpp54g_board);
220 pure_initcall(register_boards);