e3d05136056720b8f5d7b07c63c740f442eed422
[openwrt.git] / target / linux / adm5120-2.6 / files / arch / mips / adm5120 / platform.c
1 /*
2 * $Id$
3 *
4 * Generic ADM5120 platform devices
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
8 *
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.
13 *
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.
18 *
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.
23 *
24 */
25
26 #include <linux/init.h>
27 #include <linux/kernel.h>
28 #include <linux/list.h>
29 #include <linux/device.h>
30 #include <linux/platform_device.h>
31
32 #include <asm/bootinfo.h>
33 #include <asm/gpio.h>
34
35 #include <asm/mach-adm5120/adm5120_defs.h>
36 #include <asm/mach-adm5120/adm5120_info.h>
37 #include <asm/mach-adm5120/adm5120_irq.h>
38 #include <asm/mach-adm5120/adm5120_switch.h>
39 #include <asm/mach-adm5120/adm5120_platform.h>
40
41 static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
42 unsigned int mctrl);
43
44 #if 1
45 /*
46 * TODO:remove global adm5120_eth* variables when the switch driver will be
47 * converted into a real platform driver
48 */
49 unsigned int adm5120_eth_num_ports = 6;
50 EXPORT_SYMBOL_GPL(adm5120_eth_num_ports);
51
52 unsigned char adm5120_eth_macs[6][6] = {
53 {'\00', 'A', 'D', 'M', '\x51', '\x20' },
54 {'\00', 'A', 'D', 'M', '\x51', '\x21' },
55 {'\00', 'A', 'D', 'M', '\x51', '\x22' },
56 {'\00', 'A', 'D', 'M', '\x51', '\x23' },
57 {'\00', 'A', 'D', 'M', '\x51', '\x24' },
58 {'\00', 'A', 'D', 'M', '\x51', '\x25' }
59 };
60 EXPORT_SYMBOL_GPL(adm5120_eth_macs);
61
62 unsigned char adm5120_eth_vlans[6] = {
63 0x41, 0x42, 0x44, 0x48, 0x50, 0x60
64 };
65 EXPORT_SYMBOL_GPL(adm5120_eth_vlans);
66
67 #else
68 /* Built-in ethernet switch */
69 struct adm5120_switch_platform_data adm5120_switch_data;
70 struct platform_device adm5120_switch_device = {
71 .name = "adm5120-switch",
72 .id = -1,
73 .dev.platform_data = &adm5120_switch_data,
74 };
75 #endif
76
77 /* PCI Host Controller */
78 struct adm5120_pci_platform_data adm5120_pci_data;
79 struct platform_device adm5120_pci_device = {
80 .name = "adm5120-pci",
81 .id = -1,
82 .dev.platform_data = &adm5120_pci_data,
83 };
84
85 /* USB Host Controller */
86 struct resource adm5120_usbc_resources[] = {
87 [0] = {
88 .start = ADM5120_USBC_BASE,
89 .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1,
90 .flags = IORESOURCE_MEM,
91 },
92 [1] = {
93 .start = ADM5120_IRQ_USBC,
94 .end = ADM5120_IRQ_USBC,
95 .flags = IORESOURCE_IRQ,
96 },
97 };
98
99 struct platform_device adm5120_usbc_device = {
100 .name = "adm5120-usbc",
101 .id = -1,
102 .num_resources = ARRAY_SIZE(adm5120_usbc_resources),
103 .resource = adm5120_usbc_resources,
104 };
105
106 /* NOR flash 0 */
107 struct adm5120_flash_platform_data adm5120_flash0_data;
108 struct platform_device adm5120_flash0_device = {
109 .name = "adm5120-flash",
110 .id = 0,
111 .dev.platform_data = &adm5120_flash0_data,
112 };
113
114 /* NOR flash 1 */
115 struct adm5120_flash_platform_data adm5120_flash1_data;
116 struct platform_device adm5120_flash1_device = {
117 .name = "adm5120-flash",
118 .id = 1,
119 .dev.platform_data = &adm5120_flash1_data,
120 };
121
122 /* NAND flash */
123 struct resource adm5120_nand_resource[] = {
124 [0] = {
125 .start = ADM5120_SRAM1_BASE,
126 .end = ADM5120_SRAM1_BASE+ADM5120_MPMC_SIZE-1,
127 .flags = IORESOURCE_MEM,
128 },
129 };
130
131 struct adm5120_nand_platform_data adm5120_nand_data;
132
133 struct platform_device adm5120_nand_device = {
134 .name = "adm5120-nand",
135 .id = -1,
136 .dev.platform_data = &adm5120_nand_data,
137 .num_resources = ARRAY_SIZE(adm5120_nand_resource),
138 .resource = adm5120_nand_resource,
139 };
140
141 /* built-in UARTs */
142 struct amba_pl010_data adm5120_uart0_data = {
143 .set_mctrl = adm5120_uart_set_mctrl
144 };
145
146 struct amba_device adm5120_uart0_device = {
147 .dev = {
148 .bus_id = "APB:UART0",
149 .platform_data = &adm5120_uart0_data,
150 },
151 .res = {
152 .start = ADM5120_UART0_BASE,
153 .end = ADM5120_UART0_BASE + ADM5120_UART_SIZE - 1,
154 .flags = IORESOURCE_MEM,
155 },
156 .irq = { ADM5120_IRQ_UART0, -1 },
157 .periphid = 0x0041010,
158 };
159
160 struct amba_pl010_data adm5120_uart1_data = {
161 .set_mctrl = adm5120_uart_set_mctrl
162 };
163
164 struct amba_device adm5120_uart1_device = {
165 .dev = {
166 .bus_id = "APB:UART1",
167 .platform_data = &adm5120_uart1_data,
168 },
169 .res = {
170 .start = ADM5120_UART1_BASE,
171 .end = ADM5120_UART1_BASE + ADM5120_UART_SIZE - 1,
172 .flags = IORESOURCE_MEM,
173 },
174 .irq = { ADM5120_IRQ_UART1, -1 },
175 .periphid = 0x0041010,
176 };
177
178 static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
179 unsigned int mctrl)
180 {
181 }
This page took 0.042677 seconds and 3 git commands to generate.