2 * Copyright(C) MontaVista Software Inc, 2006
4 * Author: dmitry pervushin <dpervushin@ru.mvista.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/ioport.h>
24 #include <linux/serial_8250.h>
25 #include <linux/mtd/physmap.h>
28 #include <asm/bootinfo.h>
29 #include <asm/addrspace.h>
31 #include <asm/bcache.h>
33 #include <asm/reboot.h>
34 #include <asm/traps.h>
36 #include <asm/emma/emma2rh.h>
39 #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
41 static struct resource i2c_emma_resources_0
[] = {
44 .start
= EMMA2RH_IRQ_PIIC0
,
45 .end
= EMMA2RH_IRQ_PIIC0
,
46 .flags
= IORESOURCE_IRQ
49 .start
= EMMA2RH_PIIC0_BASE
,
50 .end
= EMMA2RH_PIIC0_BASE
+ 0x1000,
55 struct resource i2c_emma_resources_1
[] = {
58 .start
= EMMA2RH_IRQ_PIIC1
,
59 .end
= EMMA2RH_IRQ_PIIC1
,
60 .flags
= IORESOURCE_IRQ
63 .start
= EMMA2RH_PIIC1_BASE
,
64 .end
= EMMA2RH_PIIC1_BASE
+ 0x1000,
69 struct resource i2c_emma_resources_2
[] = {
72 .start
= EMMA2RH_IRQ_PIIC2
,
73 .end
= EMMA2RH_IRQ_PIIC2
,
74 .flags
= IORESOURCE_IRQ
77 .start
= EMMA2RH_PIIC2_BASE
,
78 .end
= EMMA2RH_PIIC2_BASE
+ 0x1000,
83 struct platform_device i2c_emma_devices
[] = {
87 .resource
= i2c_emma_resources_0
,
88 .num_resources
= ARRAY_SIZE(i2c_emma_resources_0
),
93 .resource
= i2c_emma_resources_1
,
94 .num_resources
= ARRAY_SIZE(i2c_emma_resources_1
),
99 .resource
= i2c_emma_resources_2
,
100 .num_resources
= ARRAY_SIZE(i2c_emma_resources_2
),
104 #define EMMA2RH_SERIAL_CLOCK 18544000
105 #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
107 static struct plat_serial8250_port platform_serial_ports
[] = {
109 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR0_BASE
+ 3),
110 .mapbase
= EMMA2RH_PFUR0_BASE
+ 3,
111 .irq
= EMMA2RH_IRQ_PFUR0
,
112 .uartclk
= EMMA2RH_SERIAL_CLOCK
,
115 .flags
= EMMA2RH_SERIAL_FLAGS
,
117 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR1_BASE
+ 3),
118 .mapbase
= EMMA2RH_PFUR1_BASE
+ 3,
119 .irq
= EMMA2RH_IRQ_PFUR1
,
120 .uartclk
= EMMA2RH_SERIAL_CLOCK
,
123 .flags
= EMMA2RH_SERIAL_FLAGS
,
125 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR2_BASE
+ 3),
126 .mapbase
= 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 mtd_partition markeins_parts
[] = {
147 .offset
= 0x00000000,
151 .name
= "boot code area",
152 .offset
= MTDPART_OFS_APPEND
,
156 .name
= "kernel image",
157 .offset
= MTDPART_OFS_APPEND
,
162 .offset
= MTDPART_OFS_APPEND
,
166 .name
= "boot code area2",
167 .offset
= MTDPART_OFS_APPEND
,
171 .name
= "kernel image2",
172 .offset
= MTDPART_OFS_APPEND
,
173 .size
= MTDPART_SIZ_FULL
,
177 static struct physmap_flash_data markeins_flash_data
= {
179 .nr_parts
= ARRAY_SIZE(markeins_parts
),
180 .parts
= markeins_parts
183 static struct resource markeins_flash_resource
= {
186 .flags
= IORESOURCE_MEM
189 static struct platform_device markeins_flash_device
= {
190 .name
= "physmap-flash",
193 .platform_data
= &markeins_flash_data
,
196 .resource
= &markeins_flash_resource
,
199 static struct platform_device
*devices
[] = {
201 i2c_emma_devices
+ 1,
202 i2c_emma_devices
+ 2,
204 &markeins_flash_device
,
207 static int __init
platform_devices_setup(void)
209 return platform_add_devices(devices
, ARRAY_SIZE(devices
));
212 arch_initcall(platform_devices_setup
);