[adm5120] license cleanup
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / cellvision.c
1 /*
2 * $Id$
3 *
4 * Cellvision/SparkLAN boards
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
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.
12 *
13 */
14
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17
18 #include <asm/bootinfo.h>
19 #include <asm/gpio.h>
20
21 #include <adm5120_board.h>
22 #include <adm5120_platform.h>
23 #include <adm5120_irq.h>
24
25 static void switch_bank_gpio5(unsigned bank)
26 {
27 switch (bank) {
28 case 0:
29 gpio_set_value(ADM5120_GPIO_PIN5, 0);
30 break;
31 case 1:
32 gpio_set_value(ADM5120_GPIO_PIN5, 1);
33 break;
34 }
35 }
36
37 static struct adm5120_pci_irq cas771_pci_irqs[] __initdata = {
38 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
39 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1),
40 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
41 };
42
43 static struct mtd_partition cas6xx_partitions[] = {
44 {
45 .name = "admboot",
46 .offset = 0,
47 .size = 32*1024,
48 .mask_flags = MTD_WRITEABLE,
49 } , {
50 .name = "config",
51 .offset = MTDPART_OFS_APPEND,
52 .size = 32*1024,
53 } , {
54 .name = "nvfs1",
55 .offset = MTDPART_OFS_APPEND,
56 .size = 64*1024,
57 } , {
58 .name = "nvfs2",
59 .offset = MTDPART_OFS_APPEND,
60 .size = 64*1024,
61 } , {
62 .name = "firmware",
63 .offset = MTDPART_OFS_APPEND,
64 .size = MTDPART_SIZ_FULL,
65 }
66 };
67
68 static struct mtd_partition cas7xx_partitions[] = {
69 {
70 .name = "admboot",
71 .offset = 0,
72 .size = 32*1024,
73 .mask_flags = MTD_WRITEABLE,
74 } , {
75 .name = "config",
76 .offset = MTDPART_OFS_APPEND,
77 .size = 32*1024,
78 } , {
79 .name = "nvfs",
80 .offset = MTDPART_OFS_APPEND,
81 .size = 128*1024,
82 } , {
83 .name = "firmware",
84 .offset = MTDPART_OFS_APPEND,
85 .size = MTDPART_SIZ_FULL,
86 }
87 };
88
89 static struct platform_device *cas6xx_devices[] __initdata = {
90 &adm5120_flash0_device,
91 };
92
93 static struct platform_device *cas7xx_devices[] __initdata = {
94 &adm5120_flash0_device,
95 };
96
97 static void __init cas6xx_setup(void)
98 {
99 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
100 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
101
102 /* setup data for flash0 device */
103 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
104 adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
105 adm5120_flash0_data.parts = cas6xx_partitions;
106
107 /* TODO: setup mac address */
108 }
109
110 static void __init cas7xx_setup(void)
111 {
112 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
113 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
114
115 /* setup data for flash0 device */
116 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
117 adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
118 adm5120_flash0_data.parts = cas7xx_partitions;
119
120 /* TODO: setup mac address */
121 }
122
123 /*--------------------------------------------------------------------------*/
124
125 ADM5120_BOARD_START(CAS630, "Cellvision CAS-630/630W")
126 .board_setup = cas6xx_setup,
127 .eth_num_ports = 1,
128 .num_devices = ARRAY_SIZE(cas6xx_devices),
129 .devices = cas6xx_devices,
130 /* TODO: PCI IRQ map */
131 ADM5120_BOARD_END
132
133 ADM5120_BOARD_START(CAS670, "Cellvision CAS-670/670W")
134 .board_setup = cas6xx_setup,
135 .eth_num_ports = 1,
136 .num_devices = ARRAY_SIZE(cas6xx_devices),
137 .devices = cas6xx_devices,
138 /* TODO: PCI IRQ map */
139 ADM5120_BOARD_END
140
141 ADM5120_BOARD_START(CAS700, "Cellvision CAS-700/700W")
142 .board_setup = cas7xx_setup,
143 .eth_num_ports = 1,
144 .num_devices = ARRAY_SIZE(cas7xx_devices),
145 .devices = cas7xx_devices,
146 /* TODO: PCI IRQ map */
147 ADM5120_BOARD_END
148
149 ADM5120_BOARD_START(CAS771, "Cellvision CAS-771/771W")
150 .board_setup = cas7xx_setup,
151 .eth_num_ports = 1,
152 .num_devices = ARRAY_SIZE(cas7xx_devices),
153 .devices = cas7xx_devices,
154 .pci_nr_irqs = ARRAY_SIZE(cas771_pci_irqs),
155 .pci_irq_map = cas771_pci_irqs,
156 ADM5120_BOARD_END
157
158 ADM5120_BOARD_START(CAS790, "Cellvision CAS-790")
159 .board_setup = cas7xx_setup,
160 .eth_num_ports = 1,
161 .num_devices = ARRAY_SIZE(cas7xx_devices),
162 .devices = cas7xx_devices,
163 /* TODO: PCI IRQ map */
164 ADM5120_BOARD_END
165
166 ADM5120_BOARD_START(CAS861, "Cellvision CAS-861/861W")
167 .board_setup = cas7xx_setup,
168 .eth_num_ports = 1,
169 .num_devices = ARRAY_SIZE(cas7xx_devices),
170 .devices = cas7xx_devices,
171 /* TODO: PCI IRQ map */
172 ADM5120_BOARD_END