summaryrefslogtreecommitdiffstats
path: root/arch/mips/emma/markeins/platform.c
blob: fb9cda253ab0806f67ad6a0245c406e3d1608737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 *  arch/mips/emma2rh/markeins/platofrm.c
 *      This file sets up platform devices for EMMA2RH Mark-eins.
 *
 *  Copyright(C) MontaVista Software Inc, 2006
 *
 *  Author: dmitry pervushin <dpervushin@ru.mvista.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/ioport.h>
#include <linux/serial_8250.h>
#include <linux/mtd/physmap.h>

#include <asm/cpu.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
#include <asm/time.h>
#include <asm/bcache.h>
#include <asm/irq.h>
#include <asm/reboot.h>
#include <asm/traps.h>

#include <asm/emma2rh/emma2rh.h>


#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */

static struct resource i2c_emma_resources_0[] = {
	{
		.name	= NULL,
		.start	= EMMA2RH_IRQ_PIIC0,
		.end	= EMMA2RH_IRQ_PIIC0,
		.flags	= IORESOURCE_IRQ
	}, {
		.name	= NULL,
		.start	= EMMA2RH_PIIC0_BASE,
		.end	= EMMA2RH_PIIC0_BASE + 0x1000,
		.flags	= 0
	},
};

struct resource i2c_emma_resources_1[] = {
	{
		.name	= NULL,
		.start	= EMMA2RH_IRQ_PIIC1,
		.end	= EMMA2RH_IRQ_PIIC1,
		.flags	= IORESOURCE_IRQ
	}, {
		.name	= NULL,
		.start	= EMMA2RH_PIIC1_BASE,
		.end	= EMMA2RH_PIIC1_BASE + 0x1000,
		.flags	= 0
	},
};

struct resource i2c_emma_resources_2[] = {
	{
		.name	= NULL,
		.start	= EMMA2RH_IRQ_PIIC2,
		.end	= EMMA2RH_IRQ_PIIC2,
		.flags	= IORESOURCE_IRQ
	}, {
		.name	= NULL,
		.start	= EMMA2RH_PIIC2_BASE,
		.end	= EMMA2RH_PIIC2_BASE + 0x1000,
		.flags	= 0
	},
};

struct platform_device i2c_emma_devices[] = {
	[0] = {
		.name = I2C_EMMA2RH,
		.id = 0,
		.resource = i2c_emma_resources_0,
		.num_resources = ARRAY_SIZE(i2c_emma_resources_0),
	},
	[1] = {
		.name = I2C_EMMA2RH,
		.id = 1,
		.resource = i2c_emma_resources_1,
		.num_resources = ARRAY_SIZE(i2c_emma_resources_1),
	},
	[2] = {
		.name = I2C_EMMA2RH,
		.id = 2,
		.resource = i2c_emma_resources_2,
		.num_resources = ARRAY_SIZE(i2c_emma_resources_2),
	},
};

#define EMMA2RH_SERIAL_CLOCK 18544000
#define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST

static struct  plat_serial8250_port platform_serial_ports[] = {
	[0] = {
		.membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
		.irq = EMMA2RH_IRQ_PFUR0,
		.uartclk = EMMA2RH_SERIAL_CLOCK,
		.regshift = 4,
		.iotype = UPIO_MEM,
		.flags = EMMA2RH_SERIAL_FLAGS,
       }, [1] = {
		.membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
		.irq = EMMA2RH_IRQ_PFUR1,
		.uartclk = EMMA2RH_SERIAL_CLOCK,
		.regshift = 4,
		.iotype = UPIO_MEM,
		.flags = EMMA2RH_SERIAL_FLAGS,
       }, [2] = {
		.membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
		.irq = EMMA2RH_IRQ_PFUR2,
		.uartclk = EMMA2RH_SERIAL_CLOCK,
		.regshift = 4,
		.iotype = UPIO_MEM,
		.flags = EMMA2RH_SERIAL_FLAGS,
       }, [3] = {
		.flags = 0,
       },
};

static struct  platform_device serial_emma = {
	.name = "serial8250",
	.dev = {
		.platform_data = &platform_serial_ports,
	},
};

static struct platform_device *devices[] = {
	&i2c_emma_devices[0],
	&i2c_emma_devices[1],
	&i2c_emma_devices[2],
	&serial_emma,
};

static struct mtd_partition markeins_parts[] = {
	[0] = {
		.name = "RootFS",
		.offset = 0x00000000,
		.size = 0x00c00000,
	},
	[1] = {
		.name = "boot code area",
		.offset = MTDPART_OFS_APPEND,
		.size = 0x00100000,
	},
	[2] = {
		.name = "kernel image",
		.offset = MTDPART_OFS_APPEND,
		.size = 0x00300000,
	},
	[3] = {
		.name = "RootFS2",
		.offset = MTDPART_OFS_APPEND,
		.size = 0x00c00000,
	},
	[4] = {
		.name = "boot code area2",
		.offset = MTDPART_OFS_APPEND,
		.size = 0x00100000,
	},
	[5] = {
		.name = "kernel image2",
		.offset = MTDPART_OFS_APPEND,
		.size = MTDPART_SIZ_FULL,
	},
};

static int __init platform_devices_setup(void)
{
	physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
	return platform_add_devices(devices, ARRAY_SIZE(devices));
}

arch_initcall(platform_devices_setup);