4 * Cellvision/SparkLAN boards
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 <adm5120_board.h>
33 #include <adm5120_platform.h>
34 #include <adm5120_irq.h>
36 static void switch_bank_gpio5(unsigned bank
)
40 gpio_set_value(ADM5120_GPIO_PIN5
, 0);
43 gpio_set_value(ADM5120_GPIO_PIN5
, 1);
48 static struct adm5120_pci_irq cas771_pci_irqs
[] __initdata
= {
49 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0
),
50 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1
),
51 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2
)
54 static struct mtd_partition cas6xx_partitions
[] = {
59 .mask_flags
= MTD_WRITEABLE
,
62 .offset
= MTDPART_OFS_APPEND
,
66 .offset
= MTDPART_OFS_APPEND
,
70 .offset
= MTDPART_OFS_APPEND
,
74 .offset
= MTDPART_OFS_APPEND
,
75 .size
= MTDPART_SIZ_FULL
,
79 static struct mtd_partition cas7xx_partitions
[] = {
84 .mask_flags
= MTD_WRITEABLE
,
87 .offset
= MTDPART_OFS_APPEND
,
91 .offset
= MTDPART_OFS_APPEND
,
95 .offset
= MTDPART_OFS_APPEND
,
96 .size
= MTDPART_SIZ_FULL
,
100 static struct platform_device
*cas6xx_devices
[] __initdata
= {
101 &adm5120_flash0_device
,
104 static struct platform_device
*cas7xx_devices
[] __initdata
= {
105 &adm5120_flash0_device
,
108 static void __init
cas6xx_setup(void)
110 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
111 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
113 /* setup data for flash0 device */
114 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
115 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas6xx_partitions
);
116 adm5120_flash0_data
.parts
= cas6xx_partitions
;
118 /* TODO: setup mac address */
121 static void __init
cas7xx_setup(void)
123 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
124 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
126 /* setup data for flash0 device */
127 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
128 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas7xx_partitions
);
129 adm5120_flash0_data
.parts
= cas7xx_partitions
;
131 /* TODO: setup mac address */
134 /*--------------------------------------------------------------------------*/
136 ADM5120_BOARD_START(CAS630
, "Cellvision CAS-630/630W")
137 .board_setup
= cas6xx_setup
,
139 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
140 .devices
= cas6xx_devices
,
141 /* TODO: PCI IRQ map */
144 ADM5120_BOARD_START(CAS670
, "Cellvision CAS-670/670W")
145 .board_setup
= cas6xx_setup
,
147 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
148 .devices
= cas6xx_devices
,
149 /* TODO: PCI IRQ map */
152 ADM5120_BOARD_START(CAS700
, "Cellvision CAS-700/700W")
153 .board_setup
= cas7xx_setup
,
155 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
156 .devices
= cas7xx_devices
,
157 /* TODO: PCI IRQ map */
160 ADM5120_BOARD_START(CAS771
, "Cellvision CAS-771/771W")
161 .board_setup
= cas7xx_setup
,
163 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
164 .devices
= cas7xx_devices
,
165 .pci_nr_irqs
= ARRAY_SIZE(cas771_pci_irqs
),
166 .pci_irq_map
= cas771_pci_irqs
,
169 ADM5120_BOARD_START(CAS790
, "Cellvision CAS-790")
170 .board_setup
= cas7xx_setup
,
172 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
173 .devices
= cas7xx_devices
,
174 /* TODO: PCI IRQ map */
177 ADM5120_BOARD_START(CAS861
, "Cellvision CAS-861/861W")
178 .board_setup
= cas7xx_setup
,
180 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
181 .devices
= cas7xx_devices
,
182 /* TODO: PCI IRQ map */