d0fa1f0bc8ecb161a35cdf0d4c7a19cf55364e59
[openwrt/svn-archive/archive.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 #if 1
42 /*
43 * TODO:remove global adm5120_eth* variables when the switch driver will be
44 * converted into a real platform driver
45 */
46 unsigned int adm5120_eth_num_ports = 6;
47 unsigned char adm5120_eth_macs[6][6] = {
48 {'\00', 'A', 'D', 'M', '\x51', '\x20' },
49 {'\00', 'A', 'D', 'M', '\x51', '\x21' },
50 {'\00', 'A', 'D', 'M', '\x51', '\x22' },
51 {'\00', 'A', 'D', 'M', '\x51', '\x23' },
52 {'\00', 'A', 'D', 'M', '\x51', '\x24' },
53 {'\00', 'A', 'D', 'M', '\x51', '\x25' }
54 };
55
56 EXPORT_SYMBOL_GPL(adm5120_eth_num_ports);
57 EXPORT_SYMBOL_GPL(adm5120_eth_macs);
58 #else
59 /* Built-in ethernet switch */
60 struct adm5120_switch_platform_data adm5120_switch_data;
61 struct platform_device adm5120_switch_device = {
62 .name = "adm5120-switch",
63 .id = -1,
64 .dev.platform_data = &adm5120_switch_data,
65 };
66 #endif
67
68 /* PCI Host Controller */
69 struct adm5120_pci_platform_data adm5120_pci_data;
70 struct platform_device adm5120_pci_device = {
71 .name = "adm5120-pci",
72 .id = -1,
73 .dev.platform_data = &adm5120_pci_data,
74 };
75
76 /* USB Host Controller */
77 struct resource adm5120_usbc_resources[] = {
78 [0] = {
79 .start = ADM5120_USBC_BASE,
80 .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1,
81 .flags = IORESOURCE_MEM,
82 },
83 [1] = {
84 .start = ADM5120_IRQ_USBC,
85 .end = ADM5120_IRQ_USBC,
86 .flags = IORESOURCE_IRQ,
87 },
88 };
89
90 struct platform_device adm5120_usbc_device = {
91 .name = "adm5120-usbc",
92 .id = -1,
93 .num_resources = ARRAY_SIZE(adm5120_usbc_resources),
94 .resource = adm5120_usbc_resources,
95 };
96
97 /* NOR flash 0 */
98 struct adm5120_flash_platform_data adm5120_flash0_data;
99 struct platform_device adm5120_flash0_device = {
100 .name = "adm5120-flash",
101 .id = 0,
102 .dev.platform_data = &adm5120_flash0_data,
103 };
104
105 /* NOR flash 1 */
106 struct adm5120_flash_platform_data adm5120_flash1_data;
107 struct platform_device adm5120_flash1_device = {
108 .name = "adm5120-flash",
109 .id = 1,
110 .dev.platform_data = &adm5120_flash1_data,
111 };
112
113 /* NAND flash */
114 struct resource adm5120_nand_resource[] = {
115 [0] = {
116 .start = ADM5120_SRAM1_BASE,
117 .end = ADM5120_SRAM1_BASE+ADM5120_MPMC_SIZE-1,
118 .flags = IORESOURCE_MEM,
119 },
120 };
121
122 struct adm5120_nand_platform_data adm5120_nand_data;
123
124 struct platform_device adm5120_nand_device = {
125 .name = "adm5120-nand",
126 .id = -1,
127 .dev.platform_data = &adm5120_nand_data,
128 .num_resources = ARRAY_SIZE(adm5120_nand_resource),
129 .resource = adm5120_nand_resource,
130 };