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 modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
18 #include <asm/bootinfo.h>
21 #include <adm5120_board.h>
22 #include <adm5120_platform.h>
23 #include <adm5120_irq.h>
25 #define CAS6XX_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
26 #define CAS7XX_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
27 #define NFS_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
29 static void switch_bank_gpio5(unsigned bank
)
33 gpio_set_value(ADM5120_GPIO_PIN5
, 0);
36 gpio_set_value(ADM5120_GPIO_PIN5
, 1);
41 static struct adm5120_pci_irq cas771_pci_irqs
[] __initdata
= {
42 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0
),
43 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1
),
44 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2
)
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 adm5120_gpiodev_resource
.start
&= ~CAS6XX_GPIO_DEV_MASK
;
113 /* TODO: setup mac address */
116 static void __init
cas7xx_setup(void)
118 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
119 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
121 /* setup data for flash0 device */
122 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
123 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas7xx_partitions
);
124 adm5120_flash0_data
.parts
= cas7xx_partitions
;
126 adm5120_gpiodev_resource
.start
&= ~CAS7XX_GPIO_DEV_MASK
;
128 /* TODO: setup mac address */
131 static void __init
nfs_setup(void)
133 gpio_request(ADM5120_GPIO_PIN5
, NULL
); /* for flash A20 line */
134 gpio_direction_output(ADM5120_GPIO_PIN5
, 0);
136 /* setup data for flash0 device */
137 adm5120_flash0_data
.switch_bank
= switch_bank_gpio5
;
138 adm5120_flash0_data
.nr_parts
= ARRAY_SIZE(cas6xx_partitions
);
139 adm5120_flash0_data
.parts
= cas6xx_partitions
;
141 adm5120_gpiodev_resource
.start
&= ~NFS_GPIO_DEV_MASK
;
143 /* TODO: setup mac address */
146 unsigned char nfs_vlans
[6] = { /* TODO: not tested */
147 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
150 /*--------------------------------------------------------------------------*/
152 ADM5120_BOARD_START(CAS630
, "Cellvision CAS-630/630W")
153 .board_setup
= cas6xx_setup
,
155 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
156 .devices
= cas6xx_devices
,
157 /* TODO: PCI IRQ map */
160 ADM5120_BOARD_START(CAS670
, "Cellvision CAS-670/670W")
161 .board_setup
= cas6xx_setup
,
163 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
164 .devices
= cas6xx_devices
,
165 /* TODO: PCI IRQ map */
168 ADM5120_BOARD_START(CAS700
, "Cellvision CAS-700/700W")
169 .board_setup
= cas7xx_setup
,
171 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
172 .devices
= cas7xx_devices
,
173 /* TODO: PCI IRQ map */
176 ADM5120_BOARD_START(CAS771
, "Cellvision CAS-771/771W")
177 .board_setup
= cas7xx_setup
,
179 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
180 .devices
= cas7xx_devices
,
181 .pci_nr_irqs
= ARRAY_SIZE(cas771_pci_irqs
),
182 .pci_irq_map
= cas771_pci_irqs
,
185 ADM5120_BOARD_START(CAS790
, "Cellvision CAS-790")
186 .board_setup
= cas7xx_setup
,
188 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
189 .devices
= cas7xx_devices
,
190 /* TODO: PCI IRQ map */
193 ADM5120_BOARD_START(CAS861
, "Cellvision CAS-861/861W")
194 .board_setup
= cas7xx_setup
,
196 .num_devices
= ARRAY_SIZE(cas7xx_devices
),
197 .devices
= cas7xx_devices
,
198 /* TODO: PCI IRQ map */
201 ADM5120_BOARD_START(NFS101U
, "Cellvision NFS-101U/101WU")
202 .board_setup
= nfs_setup
,
204 .eth_vlans
= nfs_vlans
,
205 .num_devices
= ARRAY_SIZE(cas6xx_devices
),
206 .devices
= cas6xx_devices
,
207 /* TODO: PCI IRQ map */