4 * Cellvision/SparkLAN boards
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 struct mtd_partition cas6xx_partitions
[] = {
52 .mask_flags
= MTD_WRITEABLE
,
55 .offset
= MTDPART_OFS_APPEND
,
59 .offset
= MTDPART_OFS_APPEND
,
63 .offset
= MTDPART_OFS_APPEND
,
67 .offset
= MTDPART_OFS_APPEND
,
68 .size
= MTDPART_SIZ_FULL
,
72 static struct mtd_partition cas7xx_partitions
[] = {
77 .mask_flags
= MTD_WRITEABLE
,
80 .offset
= MTDPART_OFS_APPEND
,
84 .offset
= MTDPART_OFS_APPEND
,
88 .offset
= MTDPART_OFS_APPEND
,
89 .size
= MTDPART_SIZ_FULL
,
93 static struct platform_device
*cas6xx_devices
[] __initdata
= {
94 &adm5120_flash0_device
,
97 static struct platform_device
*cas7xx_devices
[] __initdata
= {
98 &adm5120_flash0_device
,
101 static void __init
cas6xx_setup(void)
103 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
104 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
106 /* setup data for flash0 device */
107 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
108 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas6xx_partitions
);
109 adm5120_flash0_data
.parts
= cas6xx_partitions
;
111 /* TODO: setup mac address */
114 static void __init
cas7xx_setup(void)
116 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
117 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
119 /* setup data for flash0 device */
120 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
121 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas7xx_partitions
);
122 adm5120_flash0_data
.parts
= cas7xx_partitions
;
124 /* TODO: setup mac address */
127 static struct adm5120_board cas630_board __initdata
= {
128 .mach_type
= MACH_ADM5120_CAS630
,
129 .name
= "Cellvision CAS-630/630W",
130 .board_setup
= cas6xx_setup
,
132 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
133 .devices
= cas6xx_devices
,
136 static struct adm5120_board cas670_board __initdata
= {
137 .mach_type
= MACH_ADM5120_CAS670
,
138 .name
= "Cellvision CAS-670/670W",
139 .board_setup
= cas6xx_setup
,
141 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
142 .devices
= cas6xx_devices
,
145 static struct adm5120_board cas700_board __initdata
= {
146 .mach_type
= MACH_ADM5120_CAS700
,
147 .name
= "Cellvision CAS-700/700W",
148 .board_setup
= cas7xx_setup
,
150 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
151 .devices
= cas7xx_devices
,
154 static struct adm5120_board cas771_board __initdata
= {
155 .mach_type
= MACH_ADM5120_CAS771
,
156 .name
= "Cellvision CAS-771/771W",
157 .board_setup
= cas7xx_setup
,
159 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
160 .devices
= cas7xx_devices
,
163 static struct adm5120_board cas790_board __initdata
= {
164 .mach_type
= MACH_ADM5120_CAS790
,
165 .name
= "Cellvision CAS-790",
166 .board_setup
= cas7xx_setup
,
168 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
169 .devices
= cas7xx_devices
,
172 static struct adm5120_board cas861_board __initdata
= {
173 .mach_type
= MACH_ADM5120_CAS861
,
174 .name
= "Cellvision CAS-861/861W",
175 .board_setup
= cas7xx_setup
,
177 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
178 .devices
= cas7xx_devices
,
181 static int __init
register_boards(void)
183 adm5120_board_register(&cas630_board
);
184 adm5120_board_register(&cas670_board
);
185 adm5120_board_register(&cas700_board
);
186 adm5120_board_register(&cas771_board
);
187 adm5120_board_register(&cas790_board
);
188 adm5120_board_register(&cas861_board
);
192 pure_initcall(register_boards
);