be8292a949324d2c26ea1629219684b13799039c
[openwrt/svn-archive/archive.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 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
24 static void switch_bank_gpio3(unsigned bank)
25 {
26 switch (bank) {
27 case 0:
28 gpio_set_value(ADM5120_GPIO_PIN3, 0);
29 break;
30 case 1:
31 gpio_set_value(ADM5120_GPIO_PIN3, 1);
32 break;
33 }
34 }
35
36 static void switch_bank_gpio5(unsigned bank)
37 {
38 switch (bank) {
39 case 0:
40 gpio_set_value(ADM5120_GPIO_PIN5, 0);
41 break;
42 case 1:
43 gpio_set_value(ADM5120_GPIO_PIN5, 1);
44 break;
45 }
46 }
47
48 static struct mtd_partition easy_partitions[] = {
49 {
50 .name = "admboot",
51 .offset = 0,
52 .size = 64*1024,
53 .mask_flags = MTD_WRITEABLE,
54 } , {
55 .name = "boardcfg",
56 .offset = MTDPART_OFS_APPEND,
57 .size = 64*1024,
58 } , {
59 .name = "firmware",
60 .offset = MTDPART_OFS_APPEND,
61 .size = MTDPART_SIZ_FULL,
62 }
63 };
64
65 static struct platform_device *easy5120pata_devices[] __initdata = {
66 &adm5120_flash0_device,
67 /* TODO: add VINETIC2 device? */
68 };
69
70 static struct platform_device *easy5120rt_devices[] __initdata = {
71 &adm5120_flash0_device,
72 };
73
74 static struct platform_device *easy5120wvoip_devices[] __initdata = {
75 &adm5120_flash0_device,
76 /* TODO: add VINETIC2 device? */
77 };
78
79 static struct platform_device *easy83000_devices[] __initdata = {
80 &adm5120_flash0_device,
81 /* TODO: add VINAX device? */
82 };
83
84 static void __init easy_setup_pqfp(void)
85 {
86 gpio_request(ADM5120_GPIO_PIN3, NULL); /* for flash A20 line */
87 gpio_direction_output(ADM5120_GPIO_PIN3, 0);
88
89 /* setup data for flash0 device */
90 adm5120_flash0_data.switch_bank = switch_bank_gpio3;
91 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
92 adm5120_flash0_data.parts = easy_partitions;
93
94 /* TODO: setup mac addresses */
95 }
96
97 static void __init easy_setup_bga(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(easy_partitions);
105 adm5120_flash0_data.parts = easy_partitions;
106
107 /* TODO: setup mac addresses */
108 }
109
110 /*--------------------------------------------------------------------------*/
111
112 ADM5120_BOARD_START(EASY5120PATA, "Infineon EASY 5120P-ATA Reference Board")
113 .board_setup = easy_setup_pqfp,
114 .eth_num_ports = 6,
115 .num_devices = ARRAY_SIZE(easy5120pata_devices),
116 .devices = easy5120pata_devices,
117 ADM5120_BOARD_END
118
119 ADM5120_BOARD_START(EASY5120RT, "Infineon EASY 5120-RT Reference Board")
120 .board_setup = easy_setup_bga,
121 .eth_num_ports = 5,
122 .num_devices = ARRAY_SIZE(easy5120rt_devices),
123 .devices = easy5120rt_devices,
124 ADM5120_BOARD_END
125
126 ADM5120_BOARD_START(EASY5120WVOIP, "Infineon EASY 5120-WVoIP Reference Board")
127 .board_setup = easy_setup_bga,
128 .eth_num_ports = 6,
129 .num_devices = ARRAY_SIZE(easy5120wvoip_devices),
130 .devices = easy5120wvoip_devices,
131 ADM5120_BOARD_END
132
133 ADM5120_BOARD_START(EASY83000, "Infineon EASY 83000 Reference Board")
134 .board_setup = easy_setup_pqfp,
135 .eth_num_ports = 6,
136 .num_devices = ARRAY_SIZE(easy83000_devices),
137 .devices = easy83000_devices,
138 ADM5120_BOARD_END