[MIPS] Don't include obsolete <linux/config.h>.
[linux-2.6.git] / arch / mips / emma2rh / markeins / platform.c
1 /*
2  *  arch/mips/emma2rh/markeins/platofrm.c
3  *      This file sets up platform devices for EMMA2RH Mark-eins.
4  *
5  *  Copyright(C) MontaVista Software Inc, 2006
6  *
7  *  Author: dmitry pervushin <dpervushin@ru.mvista.com>
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (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 Free Software
21  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 #include <linux/init.h>
24 #include <linux/kernel.h>
25 #include <linux/types.h>
26 #include <linux/ioport.h>
27 #include <linux/serial_8250.h>
28 #include <linux/mtd/physmap.h>
29
30 #include <asm/cpu.h>
31 #include <asm/bootinfo.h>
32 #include <asm/addrspace.h>
33 #include <asm/time.h>
34 #include <asm/bcache.h>
35 #include <asm/irq.h>
36 #include <asm/reboot.h>
37 #include <asm/gdb-stub.h>
38 #include <asm/traps.h>
39 #include <asm/debug.h>
40
41 #include <asm/emma2rh/emma2rh.h>
42
43
44 #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
45
46 static struct resource i2c_emma_resources_0[] = {
47         { NULL, EMMA2RH_IRQ_PIIC0, EMMA2RH_IRQ_PIIC0, IORESOURCE_IRQ },
48         { NULL, KSEG1ADDR(EMMA2RH_PIIC0_BASE), KSEG1ADDR(EMMA2RH_PIIC0_BASE + 0x1000), 0 },
49 };
50
51 struct resource i2c_emma_resources_1[] = {
52         { NULL, EMMA2RH_IRQ_PIIC1, EMMA2RH_IRQ_PIIC1, IORESOURCE_IRQ },
53         { NULL, KSEG1ADDR(EMMA2RH_PIIC1_BASE), KSEG1ADDR(EMMA2RH_PIIC1_BASE + 0x1000), 0 },
54 };
55
56 struct resource i2c_emma_resources_2[] = {
57         { NULL, EMMA2RH_IRQ_PIIC2, EMMA2RH_IRQ_PIIC2, IORESOURCE_IRQ },
58         { NULL, KSEG1ADDR(EMMA2RH_PIIC2_BASE), KSEG1ADDR(EMMA2RH_PIIC2_BASE + 0x1000), 0 },
59 };
60
61 struct platform_device i2c_emma_devices[] = {
62         [0] = {
63                 .name = I2C_EMMA2RH,
64                 .id = 0,
65                 .resource = i2c_emma_resources_0,
66                 .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
67         },
68         [1] = {
69                 .name = I2C_EMMA2RH,
70                 .id = 1,
71                 .resource = i2c_emma_resources_1,
72                 .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
73         },
74         [2] = {
75                 .name = I2C_EMMA2RH,
76                 .id = 2,
77                 .resource = i2c_emma_resources_2,
78                 .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
79         },
80 };
81
82 #define EMMA2RH_SERIAL_CLOCK 18544000
83 #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
84
85 static struct  plat_serial8250_port platform_serial_ports[] = {
86        [0] = {
87          .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
88          .irq = EMMA2RH_IRQ_PFUR0,
89          .uartclk = EMMA2RH_SERIAL_CLOCK,
90          .regshift = 4,
91          .iotype = UPIO_MEM,
92          .flags = EMMA2RH_SERIAL_FLAGS,
93        },
94        [1] = {
95          .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
96          .irq = EMMA2RH_IRQ_PFUR1,
97          .uartclk = EMMA2RH_SERIAL_CLOCK,
98          .regshift = 4,
99          .iotype = UPIO_MEM,
100          .flags = EMMA2RH_SERIAL_FLAGS,
101        },
102        [2] = {
103          .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
104          .irq = EMMA2RH_IRQ_PFUR2,
105          .uartclk = EMMA2RH_SERIAL_CLOCK,
106          .regshift = 4,
107          .iotype = UPIO_MEM,
108          .flags = EMMA2RH_SERIAL_FLAGS,
109        },
110        [3] = {
111          .flags = 0,
112        },
113 };
114
115 static struct  platform_device serial_emma = {
116         .name = "serial8250",
117         .dev = {
118                 .platform_data = &platform_serial_ports,
119         },
120 };
121
122 static struct platform_device *devices[] = {
123         &i2c_emma_devices[0],
124         &i2c_emma_devices[1],
125         &i2c_emma_devices[2],
126         &serial_emma,
127 };
128
129 static struct mtd_partition markeins_parts[] = {
130         [0] = {
131                 .name = "RootFS",
132                 .offset = 0x00000000,
133                 .size = 0x00c00000,
134         },
135         [1] = {
136                 .name = "boot code area",
137                 .offset = MTDPART_OFS_APPEND,
138                 .size = 0x00100000,
139         },
140         [2] = {
141                 .name = "kernel image",
142                 .offset = MTDPART_OFS_APPEND,
143                 .size = 0x00300000,
144         },
145         [3] = {
146                 .name = "RootFS2",
147                 .offset = MTDPART_OFS_APPEND,
148                 .size = 0x00c00000,
149         },
150         [4] = {
151                 .name = "boot code area2",
152                 .offset = MTDPART_OFS_APPEND,
153                 .size = 0x00100000,
154         },
155         [5] = {
156                 .name = "kernel image2",
157                 .offset = MTDPART_OFS_APPEND,
158                 .size = MTDPART_SIZ_FULL,
159         },
160 };
161
162 static int __init platform_devices_setup(void)
163 {
164         physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
165         return platform_add_devices(devices, ARRAY_SIZE(devices));
166 }
167
168 arch_initcall(platform_devices_setup);
169