c8680d6c4aada984f82466f83ae3be35f7f41baa
[openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / infineon.c
1 /*
2 * $Id$
3 *
4 * Infineon boards
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007,2008 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_defs.h>
22 #include <adm5120_irq.h>
23 #include <adm5120_board.h>
24 #include <adm5120_platform.h>
25 #include <adm5120_info.h>
26
27 #define EASY_PQFP_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN3)
28 #define EASY_BGA_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
29
30 static void switch_bank_gpio3(unsigned bank)
31 {
32 switch (bank) {
33 case 0:
34 gpio_set_value(ADM5120_GPIO_PIN3, 0);
35 break;
36 case 1:
37 gpio_set_value(ADM5120_GPIO_PIN3, 1);
38 break;
39 }
40 }
41
42 static void switch_bank_gpio5(unsigned bank)
43 {
44 switch (bank) {
45 case 0:
46 gpio_set_value(ADM5120_GPIO_PIN5, 0);
47 break;
48 case 1:
49 gpio_set_value(ADM5120_GPIO_PIN5, 1);
50 break;
51 }
52 }
53
54 static struct mtd_partition easy_partitions[] = {
55 {
56 .name = "admboot",
57 .offset = 0,
58 .size = 64*1024,
59 .mask_flags = MTD_WRITEABLE,
60 } , {
61 .name = "boardcfg",
62 .offset = MTDPART_OFS_APPEND,
63 .size = 64*1024,
64 } , {
65 .name = "firmware",
66 .offset = MTDPART_OFS_APPEND,
67 .size = MTDPART_SIZ_FULL,
68 }
69 };
70
71 static struct adm5120_pci_irq easy5120rt_pci_irqs[] __initdata = {
72 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
73 };
74
75 static struct platform_device *easy5120pata_devices[] __initdata = {
76 &adm5120_flash0_device,
77 /* TODO: add VINETIC2 device? */
78 };
79
80 static struct platform_device *easy5120rt_devices[] __initdata = {
81 &adm5120_flash0_device,
82 &adm5120_hcd_device,
83 };
84
85 static struct platform_device *easy5120wvoip_devices[] __initdata = {
86 &adm5120_flash0_device,
87 /* TODO: add VINETIC2 device? */
88 };
89
90 static struct platform_device *easy83000_devices[] __initdata = {
91 &adm5120_flash0_device,
92 /* TODO: add VINAX device? */
93 };
94
95 static void __init easy_setup_pqfp(void)
96 {
97 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for flash A20 line */
98 gpio_direction_output(ADM5120_GPIO_PIN3, 0);
99
100 /* setup data for flash0 device */
101 adm5120_flash0_data.switch_bank = switch_bank_gpio3;
102 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
103 adm5120_flash0_data.parts = easy_partitions;
104
105 adm5120_gpiodev_resource.start &= ~EASY_PQFP_GPIO_DEV_MASK;
106
107 /* TODO: setup mac addresses */
108 }
109
110 static void __init easy_setup_bga(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(easy_partitions);
118 adm5120_flash0_data.parts = easy_partitions;
119
120 adm5120_gpiodev_resource.start &= ~EASY_BGA_GPIO_DEV_MASK;
121
122 /* TODO: setup mac addresses */
123 }
124
125 unsigned char easy5120rt_vlans[6] = {
126 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
127 };
128
129 /*--------------------------------------------------------------------------*/
130
131 ADM5120_BOARD_START(EASY5120PATA, "Infineon EASY 5120P-ATA Reference Board")
132 .board_setup = easy_setup_pqfp,
133 .eth_num_ports = 6,
134 .num_devices = ARRAY_SIZE(easy5120pata_devices),
135 .devices = easy5120pata_devices,
136 ADM5120_BOARD_END
137
138 ADM5120_BOARD_START(EASY5120RT, "Infineon EASY 5120-RT Reference Board")
139 .board_setup = easy_setup_bga,
140 .eth_num_ports = 5,
141 .eth_vlans = easy5120rt_vlans,
142 .num_devices = ARRAY_SIZE(easy5120rt_devices),
143 .devices = easy5120rt_devices,
144 .pci_nr_irqs = ARRAY_SIZE(easy5120rt_pci_irqs),
145 .pci_irq_map = easy5120rt_pci_irqs,
146 ADM5120_BOARD_END
147
148 ADM5120_BOARD_START(EASY5120WVOIP, "Infineon EASY 5120-WVoIP Reference Board")
149 .board_setup = easy_setup_bga,
150 .eth_num_ports = 6,
151 .num_devices = ARRAY_SIZE(easy5120wvoip_devices),
152 .devices = easy5120wvoip_devices,
153 ADM5120_BOARD_END
154
155 ADM5120_BOARD_START(EASY83000, "Infineon EASY 83000 Reference Board")
156 .board_setup = easy_setup_pqfp,
157 .eth_num_ports = 6,
158 .num_devices = ARRAY_SIZE(easy83000_devices),
159 .devices = easy83000_devices,
160 ADM5120_BOARD_END
This page took 0.057086 seconds and 3 git commands to generate.