xref: /openbmc/linux/arch/sh/boards/mach-se/7721/setup.c (revision ecba1060)
1 /*
2  * linux/arch/sh/boards/se/7721/setup.c
3  *
4  * Copyright (C) 2008 Renesas Solutions Corp.
5  *
6  * Hitachi UL SolutionEngine 7721 Support.
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  *
12  */
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <mach-se/mach/se7721.h>
16 #include <mach-se/mach/mrshpc.h>
17 #include <asm/machvec.h>
18 #include <asm/io.h>
19 #include <asm/heartbeat.h>
20 
21 static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
22 
23 static struct heartbeat_data heartbeat_data = {
24 	.bit_pos	= heartbeat_bit_pos,
25 	.nr_bits	= ARRAY_SIZE(heartbeat_bit_pos),
26 	.regsize	= 16,
27 };
28 
29 static struct resource heartbeat_resources[] = {
30 	[0] = {
31 		.start	= PA_LED,
32 		.end	= PA_LED,
33 		.flags	= IORESOURCE_MEM,
34 	},
35 };
36 
37 static struct platform_device heartbeat_device = {
38 	.name		= "heartbeat",
39 	.id		= -1,
40 	.dev	= {
41 		.platform_data	= &heartbeat_data,
42 	},
43 	.num_resources	= ARRAY_SIZE(heartbeat_resources),
44 	.resource	= heartbeat_resources,
45 };
46 
47 static struct resource cf_ide_resources[] = {
48 	[0] = {
49 		.start	= PA_MRSHPC_IO + 0x1f0,
50 		.end	= PA_MRSHPC_IO + 0x1f0 + 8 ,
51 		.flags	= IORESOURCE_IO,
52 	},
53 	[1] = {
54 		.start	= PA_MRSHPC_IO + 0x1f0 + 0x206,
55 		.end	= PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
56 		.flags	= IORESOURCE_IO,
57 	},
58 	[2] = {
59 		.start  = MRSHPC_IRQ0,
60 		.flags  = IORESOURCE_IRQ,
61 	},
62 };
63 
64 static struct platform_device cf_ide_device = {
65 	.name		= "pata_platform",
66 	.id		= -1,
67 	.num_resources	= ARRAY_SIZE(cf_ide_resources),
68 	.resource	= cf_ide_resources,
69 };
70 
71 static struct platform_device *se7721_devices[] __initdata = {
72 	&cf_ide_device,
73 	&heartbeat_device
74 };
75 
76 static int __init se7721_devices_setup(void)
77 {
78 	mrshpc_setup_windows();
79 	return platform_add_devices(se7721_devices, ARRAY_SIZE(se7721_devices));
80 }
81 device_initcall(se7721_devices_setup);
82 
83 static void __init se7721_setup(char **cmdline_p)
84 {
85 	/* for USB */
86 	ctrl_outw(0x0000, 0xA405010C);	/* PGCR */
87 	ctrl_outw(0x0000, 0xA405010E);	/* PHCR */
88 	ctrl_outw(0x00AA, 0xA4050118);	/* PPCR */
89 	ctrl_outw(0x0000, 0xA4050124);	/* PSELA */
90 }
91 
92 /*
93  * The Machine Vector
94  */
95 struct sh_machine_vector mv_se7721 __initmv = {
96 	.mv_name		= "Solution Engine 7721",
97 	.mv_setup		= se7721_setup,
98 	.mv_nr_irqs		= 109,
99 	.mv_init_irq		= init_se7721_IRQ,
100 };
101