1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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>
26
27#include <asm/cpu.h>
28#include <asm/bootinfo.h>
29#include <asm/addrspace.h>
30#include <asm/time.h>
31#include <asm/bcache.h>
32#include <asm/irq.h>
33#include <asm/reboot.h>
34#include <asm/traps.h>
35
36#include <asm/emma/emma2rh.h>
37
38
39#define I2C_EMMA2RH "emma2rh-iic"
40
41static struct resource i2c_emma_resources_0[] = {
42 {
43 .name = NULL,
44 .start = EMMA2RH_IRQ_PIIC0,
45 .end = EMMA2RH_IRQ_PIIC0,
46 .flags = IORESOURCE_IRQ
47 }, {
48 .name = NULL,
49 .start = EMMA2RH_PIIC0_BASE,
50 .end = EMMA2RH_PIIC0_BASE + 0x1000,
51 .flags = 0
52 },
53};
54
55struct resource i2c_emma_resources_1[] = {
56 {
57 .name = NULL,
58 .start = EMMA2RH_IRQ_PIIC1,
59 .end = EMMA2RH_IRQ_PIIC1,
60 .flags = IORESOURCE_IRQ
61 }, {
62 .name = NULL,
63 .start = EMMA2RH_PIIC1_BASE,
64 .end = EMMA2RH_PIIC1_BASE + 0x1000,
65 .flags = 0
66 },
67};
68
69struct resource i2c_emma_resources_2[] = {
70 {
71 .name = NULL,
72 .start = EMMA2RH_IRQ_PIIC2,
73 .end = EMMA2RH_IRQ_PIIC2,
74 .flags = IORESOURCE_IRQ
75 }, {
76 .name = NULL,
77 .start = EMMA2RH_PIIC2_BASE,
78 .end = EMMA2RH_PIIC2_BASE + 0x1000,
79 .flags = 0
80 },
81};
82
83struct platform_device i2c_emma_devices[] = {
84 [0] = {
85 .name = I2C_EMMA2RH,
86 .id = 0,
87 .resource = i2c_emma_resources_0,
88 .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
89 },
90 [1] = {
91 .name = I2C_EMMA2RH,
92 .id = 1,
93 .resource = i2c_emma_resources_1,
94 .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
95 },
96 [2] = {
97 .name = I2C_EMMA2RH,
98 .id = 2,
99 .resource = i2c_emma_resources_2,
100 .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
101 },
102};
103
104#define EMMA2RH_SERIAL_CLOCK 18544000
105#define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
106
107static struct plat_serial8250_port platform_serial_ports[] = {
108 [0] = {
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,
113 .regshift = 4,
114 .iotype = UPIO_MEM,
115 .flags = EMMA2RH_SERIAL_FLAGS,
116 }, [1] = {
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,
121 .regshift = 4,
122 .iotype = UPIO_MEM,
123 .flags = EMMA2RH_SERIAL_FLAGS,
124 }, [2] = {
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,
129 .regshift = 4,
130 .iotype = UPIO_MEM,
131 .flags = EMMA2RH_SERIAL_FLAGS,
132 }, [3] = {
133 .flags = 0,
134 },
135};
136
137static struct platform_device serial_emma = {
138 .name = "serial8250",
139 .dev = {
140 .platform_data = &platform_serial_ports,
141 },
142};
143
144static struct mtd_partition markeins_parts[] = {
145 [0] = {
146 .name = "RootFS",
147 .offset = 0x00000000,
148 .size = 0x00c00000,
149 },
150 [1] = {
151 .name = "boot code area",
152 .offset = MTDPART_OFS_APPEND,
153 .size = 0x00100000,
154 },
155 [2] = {
156 .name = "kernel image",
157 .offset = MTDPART_OFS_APPEND,
158 .size = 0x00300000,
159 },
160 [3] = {
161 .name = "RootFS2",
162 .offset = MTDPART_OFS_APPEND,
163 .size = 0x00c00000,
164 },
165 [4] = {
166 .name = "boot code area2",
167 .offset = MTDPART_OFS_APPEND,
168 .size = 0x00100000,
169 },
170 [5] = {
171 .name = "kernel image2",
172 .offset = MTDPART_OFS_APPEND,
173 .size = MTDPART_SIZ_FULL,
174 },
175};
176
177static struct physmap_flash_data markeins_flash_data = {
178 .width = 2,
179 .nr_parts = ARRAY_SIZE(markeins_parts),
180 .parts = markeins_parts
181};
182
183static struct resource markeins_flash_resource = {
184 .start = 0x1e000000,
185 .end = 0x02000000,
186 .flags = IORESOURCE_MEM
187};
188
189static struct platform_device markeins_flash_device = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev = {
193 .platform_data = &markeins_flash_data,
194 },
195 .num_resources = 1,
196 .resource = &markeins_flash_resource,
197};
198
199static struct platform_device *devices[] = {
200 i2c_emma_devices,
201 i2c_emma_devices + 1,
202 i2c_emma_devices + 2,
203 &serial_emma,
204 &markeins_flash_device,
205};
206
207static int __init platform_devices_setup(void)
208{
209 return platform_add_devices(devices, ARRAY_SIZE(devices));
210}
211
212arch_initcall(platform_devices_setup);
213