summaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-se/7343/setup.c
blob: 3412bb2973aecc28414b52cad17096edc5f15b28 (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
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>
#include <linux/serial_8250.h>
#include <linux/serial_reg.h>
#include <linux/usb/isp116x.h>
#include <linux/delay.h>
#include <asm/machvec.h>
#include <mach-se/mach/se7343.h>
#include <asm/heartbeat.h>
#include <asm/irq.h>
#include <asm/io.h>

static struct resource heartbeat_resource = {
	.start	= PA_LED,
	.end	= PA_LED,
	.flags	= IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
};

static struct platform_device heartbeat_device = {
	.name		= "heartbeat",
	.id		= -1,
	.num_resources	= 1,
	.resource	= &heartbeat_resource,
};

static struct mtd_partition nor_flash_partitions[] = {
	{
		.name		= "loader",
		.offset		= 0x00000000,
		.size		= 128 * 1024,
	},
	{
		.name		= "rootfs",
		.offset		= MTDPART_OFS_APPEND,
		.size		= 31 * 1024 * 1024,
	},
	{
		.name		= "data",
		.offset		= MTDPART_OFS_APPEND,
		.size		= MTDPART_SIZ_FULL,
	},
};

static struct physmap_flash_data nor_flash_data = {
	.width		= 2,
	.parts		= nor_flash_partitions,
	.nr_parts	= ARRAY_SIZE(nor_flash_partitions),
};

static struct resource nor_flash_resources[] = {
	[0]	= {
		.start	= 0x00000000,
		.end	= 0x01ffffff,
		.flags	= IORESOURCE_MEM,
	}
};

static struct platform_device nor_flash_device = {
	.name		= "physmap-flash",
	.dev		= {
		.platform_data	= &nor_flash_data,
	},
	.num_resources	= ARRAY_SIZE(nor_flash_resources),
	.resource	= nor_flash_resources,
};

#define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)

static struct plat_serial8250_port serial_platform_data[] = {
	[0] = {
		.iotype		= UPIO_MEM,
		.mapbase	= 0x16000000,
		.regshift	= 1,
		.flags		= ST16C2550C_FLAGS,
		.uartclk	= 7372800,
	},
	[1] = {
		.iotype		= UPIO_MEM,
		.mapbase	= 0x17000000,
		.regshift	= 1,
		.flags		= ST16C2550C_FLAGS,
		.uartclk	= 7372800,
	},
	{ },
};

static struct platform_device uart_device = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM,
	.dev			= {
		.platform_data	= serial_platform_data,
	},
};

static void isp116x_delay(struct device *dev, int delay)
{
	ndelay(delay);
}

static struct resource usb_resources[] = {
	[0] = {
		.start  = 0x11800000,
		.end    = 0x11800001,
		.flags  = IORESOURCE_MEM,
	},
	[1] = {
		.start  = 0x11800002,
		.end    = 0x11800003,
		.flags  = IORESOURCE_MEM,
	},
	[2] = {
		/* Filled in later */
		.flags  = IORESOURCE_IRQ,
	},
};

static struct isp116x_platform_data usb_platform_data = {
	.sel15Kres		= 1,
	.oc_enable		= 1,
	.int_act_high		= 0,
	.int_edge_triggered	= 0,
	.remote_wakeup_enable	= 0,
	.delay			= isp116x_delay,
};

static struct platform_device usb_device = {
	.name			= "isp116x-hcd",
	.id			= -1,
	.num_resources		= ARRAY_SIZE(usb_resources),
	.resource		= usb_resources,
	.dev			= {
		.platform_data	= &usb_platform_data,
	},

};

static struct platform_device *sh7343se_platform_devices[] __initdata = {
	&heartbeat_device,
	&nor_flash_device,
	&uart_device,
	&usb_device,
};

static int __init sh7343se_devices_setup(void)
{
	/* Wire-up dynamic vectors */
	serial_platform_data[0].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTA];
	serial_platform_data[1].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTB];

	usb_resources[2].start = usb_resources[2].end =
		se7343_fpga_irq[SE7343_FPGA_IRQ_USB];

	return platform_add_devices(sh7343se_platform_devices,
				    ARRAY_SIZE(sh7343se_platform_devices));
}
device_initcall(sh7343se_devices_setup);

/*
 * Initialize the board
 */
static void __init sh7343se_setup(char **cmdline_p)
{
	ctrl_outw(0xf900, FPGA_OUT);	/* FPGA */

	ctrl_outw(0x0002, PORT_PECR);	/* PORT E 1 = IRQ5 */
	ctrl_outw(0x0020, PORT_PSELD);

	printk(KERN_INFO "MS7343CP01 Setup...done\n");
}

/*
 * The Machine Vector
 */
static struct sh_machine_vector mv_7343se __initmv = {
	.mv_name = "SolutionEngine 7343",
	.mv_setup = sh7343se_setup,
	.mv_init_irq = init_7343se_IRQ,
};