6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
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_direction_output(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 */
82 /* setup data for flash0 device */
83 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
85 /* TODO: setup mac address */
88 static void __init
wp54_setup(void)
90 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
91 gpio_request(ADM5120_GPIO_PIN3
, NULL
); /* for system reset */
93 /* setup data for flash0 device */
94 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
96 /* TODO: setup mac address */
99 static void __init
wp54_wrt_setup(void)
101 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
102 gpio_request(ADM5120_GPIO_PIN3
, NULL
); /* for system reset */
104 /* setup data for flash0 device */
105 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
106 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(wp54g_wrt_partitions
);
107 adm5120_flash0_data
.parts
= wp54g_wrt_partitions
;
109 /* TODO: setup mac address */
112 static struct adm5120_board np27g_board __initdata
= {
113 .mach_type
= MACH_ADM5120_NP27G
,
114 .name
= "Compex NetPassage 27G",
115 .board_setup
= np2xg_setup
,
117 .num_devices
= ARRAY_SIZE(np2xg_devices
),
118 .devices
= np2xg_devices
,
121 static struct adm5120_board np28g_board __initdata
= {
122 .mach_type
= MACH_ADM5120_NP28G
,
123 .name
= "Compex NetPassage 28G",
124 .board_setup
= np2xg_setup
,
126 .num_devices
= ARRAY_SIZE(np2xg_devices
),
127 .devices
= np2xg_devices
,
130 static struct adm5120_board wp54ag_board __initdata
= {
131 .mach_type
= MACH_ADM5120_WP54AG
,
132 .name
= "Compex WP54AG",
133 .board_setup
= wp54_setup
,
134 .board_reset
= wp54_reset
,
136 .num_devices
= ARRAY_SIZE(wp54_devices
),
137 .devices
= wp54_devices
,
140 static struct adm5120_board wp54g_board __initdata
= {
141 .mach_type
= MACH_ADM5120_WP54G
,
142 .name
= "Compex WP54G",
143 .board_setup
= wp54_setup
,
144 .board_reset
= wp54_reset
,
146 .num_devices
= ARRAY_SIZE(wp54_devices
),
147 .devices
= wp54_devices
,
150 static struct adm5120_board wp54g_wrt_board __initdata
= {
151 .mach_type
= MACH_ADM5120_WP54G
,
152 .name
= "Compex WP54G-WRT",
153 .board_setup
= wp54_wrt_setup
,
154 .board_reset
= wp54_reset
,
156 .num_devices
= ARRAY_SIZE(wp54_devices
),
157 .devices
= wp54_devices
,
160 static struct adm5120_board wpp54ag_board __initdata
= {
161 .mach_type
= MACH_ADM5120_WPP54AG
,
162 .name
= "Compex WPP54AG",
163 .board_setup
= wp54_setup
,
164 .board_reset
= wp54_reset
,
166 .num_devices
= ARRAY_SIZE(wp54_devices
),
167 .devices
= wp54_devices
,
170 static struct adm5120_board wpp54g_board __initdata
= {
171 .mach_type
= MACH_ADM5120_WPP54G
,
172 .name
= "Compex WPP54G",
173 .board_setup
= wp54_setup
,
174 .board_reset
= wp54_reset
,
176 .num_devices
= ARRAY_SIZE(wp54_devices
),
177 .devices
= wp54_devices
,
180 static int __init
register_boards(void)
182 adm5120_board_register(&np27g_board
);
183 adm5120_board_register(&np28g_board
);
184 adm5120_board_register(&wp54ag_board
);
185 adm5120_board_register(&wp54g_board
);
186 adm5120_board_register(&wp54g_wrt_board
);
187 adm5120_board_register(&wpp54ag_board
);
188 adm5120_board_register(&wpp54g_board
);
192 pure_initcall(register_boards
);