2 * arch/mips/emma2rh/markeins/platofrm.c
3 * This file sets up platform devices for EMMA2RH Mark-eins.
5 * Copyright(C) MontaVista Software Inc, 2006
7 * Author: dmitry pervushin <dpervushin@ru.mvista.com>
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.
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.
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
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>
31 #include <asm/bootinfo.h>
32 #include <asm/addrspace.h>
34 #include <asm/bcache.h>
36 #include <asm/reboot.h>
37 #include <asm/traps.h>
39 #include <asm/emma/emma2rh.h>
42 #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
44 static struct resource i2c_emma_resources_0[] = {
47 .start = EMMA2RH_IRQ_PIIC0,
48 .end = EMMA2RH_IRQ_PIIC0,
49 .flags = IORESOURCE_IRQ
52 .start = EMMA2RH_PIIC0_BASE,
53 .end = EMMA2RH_PIIC0_BASE + 0x1000,
58 struct resource i2c_emma_resources_1[] = {
61 .start = EMMA2RH_IRQ_PIIC1,
62 .end = EMMA2RH_IRQ_PIIC1,
63 .flags = IORESOURCE_IRQ
66 .start = EMMA2RH_PIIC1_BASE,
67 .end = EMMA2RH_PIIC1_BASE + 0x1000,
72 struct resource i2c_emma_resources_2[] = {
75 .start = EMMA2RH_IRQ_PIIC2,
76 .end = EMMA2RH_IRQ_PIIC2,
77 .flags = IORESOURCE_IRQ
80 .start = EMMA2RH_PIIC2_BASE,
81 .end = EMMA2RH_PIIC2_BASE + 0x1000,
86 struct platform_device i2c_emma_devices[] = {
90 .resource = i2c_emma_resources_0,
91 .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
96 .resource = i2c_emma_resources_1,
97 .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
102 .resource = i2c_emma_resources_2,
103 .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
107 #define EMMA2RH_SERIAL_CLOCK 18544000
108 #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
110 static struct plat_serial8250_port platform_serial_ports[] = {
112 .membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
113 .irq = EMMA2RH_IRQ_PFUR0,
114 .uartclk = EMMA2RH_SERIAL_CLOCK,
117 .flags = EMMA2RH_SERIAL_FLAGS,
119 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
120 .irq = EMMA2RH_IRQ_PFUR1,
121 .uartclk = EMMA2RH_SERIAL_CLOCK,
124 .flags = EMMA2RH_SERIAL_FLAGS,
126 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
127 .irq = EMMA2RH_IRQ_PFUR2,
128 .uartclk = EMMA2RH_SERIAL_CLOCK,
131 .flags = EMMA2RH_SERIAL_FLAGS,
137 static struct platform_device serial_emma = {
138 .name = "serial8250",
140 .platform_data = &platform_serial_ports,
144 static struct platform_device *devices[] = {
145 &i2c_emma_devices[0],
146 &i2c_emma_devices[1],
147 &i2c_emma_devices[2],
151 static struct mtd_partition markeins_parts[] = {
154 .offset = 0x00000000,
158 .name = "boot code area",
159 .offset = MTDPART_OFS_APPEND,
163 .name = "kernel image",
164 .offset = MTDPART_OFS_APPEND,
169 .offset = MTDPART_OFS_APPEND,
173 .name = "boot code area2",
174 .offset = MTDPART_OFS_APPEND,
178 .name = "kernel image2",
179 .offset = MTDPART_OFS_APPEND,
180 .size = MTDPART_SIZ_FULL,
184 static int __init platform_devices_setup(void)
186 physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
187 return platform_add_devices(devices, ARRAY_SIZE(devices));
190 arch_initcall(platform_devices_setup);