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_gpio3(unsigned bank
)
39 gpio_set_value(ADM5120_GPIO_PIN3
, 0);
42 gpio_set_value(ADM5120_GPIO_PIN3
, 1);
47 static void switch_bank_gpio5(unsigned bank
)
51 gpio_set_value(ADM5120_GPIO_PIN5
, 0);
54 gpio_set_value(ADM5120_GPIO_PIN5
, 1);
59 static struct mtd_partition easy_partitions
[] = {
64 .mask_flags
= MTD_WRITEABLE
,
67 .offset
= MTDPART_OFS_APPEND
,
71 .offset
= MTDPART_OFS_APPEND
,
72 .size
= MTDPART_SIZ_FULL
,
76 static struct platform_device
*easy5120pata_devices
[] __initdata
= {
77 &adm5120_flash0_device
,
78 /* TODO: add VINETIC2 device? */
81 static struct platform_device
*easy5120rt_devices
[] __initdata
= {
82 &adm5120_flash0_device
,
86 static struct platform_device
*easy5120wvoip_devices
[] __initdata
= {
87 &adm5120_flash0_device
,
88 /* TODO: add VINETIC2 device? */
91 static struct platform_device
*easy83000_devices
[] __initdata
= {
92 &adm5120_flash0_device
,
93 /* TODO: add VINAX device? */
96 static void __init
easy_setup_pqfp(void)
98 gpio_request(ADM5120_GPIO_PIN3
, NULL
); /* for flash A20 line */
99 gpio_direction_output(ADM5120_GPIO_PIN3
, 0);
101 /* setup data for flash0 device */
102 adm5120_flash0_data
.switch_bank
= switch_bank_gpio3
;
103 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(easy_partitions
);
104 adm5120_flash0_data
.parts
= easy_partitions
;
106 /* TODO: setup mac addresses */
109 static void __init
easy_setup_bga(void)
111 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
112 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
114 /* setup data for flash0 device */
115 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
116 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(easy_partitions
);
117 adm5120_flash0_data
.parts
= easy_partitions
;
119 /* TODO: setup mac addresses */
122 static struct adm5120_board easy5120pata_board __initdata
= {
123 .mach_type
= MACH_ADM5120_EASY5120PATA
,
124 .name
= "Infineon EASY 5120P-ATA Reference Board",
125 .board_setup
= easy_setup_pqfp
,
127 .num_devices
= ARRAY_SIZE(easy5120pata_devices
),
128 .devices
= easy5120pata_devices
,
131 static struct adm5120_board easy5120rt_board __initdata
= {
132 .mach_type
= MACH_ADM5120_EASY5120RT
,
133 .name
= "Infineon EASY 5120-RT Reference Board",
134 .board_setup
= easy_setup_bga
,
136 .num_devices
= ARRAY_SIZE(easy5120rt_devices
),
137 .devices
= easy5120rt_devices
,
140 static struct adm5120_board easy5120wvoip_board __initdata
= {
141 .mach_type
= MACH_ADM5120_EASY5120WVOIP
,
142 .name
= "Infineon EASY 5120-WVoIP Reference Board",
143 .board_setup
= easy_setup_bga
,
145 .num_devices
= ARRAY_SIZE(easy5120wvoip_devices
),
146 .devices
= easy5120wvoip_devices
,
149 static struct adm5120_board easy83000_board __initdata
= {
150 .mach_type
= MACH_ADM5120_EASY83000
,
151 .name
= "Infineon EASY 83000 Reference Board",
152 .board_setup
= easy_setup_pqfp
,
154 .num_devices
= ARRAY_SIZE(easy83000_devices
),
155 .devices
= easy83000_devices
,
158 static int __init
register_boards(void)
160 adm5120_board_register(&easy5120pata_board
);
161 adm5120_board_register(&easy5120rt_board
);
162 adm5120_board_register(&easy5120wvoip_board
);
163 adm5120_board_register(&easy83000_board
);
167 pure_initcall(register_boards
);