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 };
27
28 static struct resource heartbeat_resource = {
29 .start = PA_LED,
30 .end = PA_LED,
31 .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
32 };
33
34 static struct platform_device heartbeat_device = {
35 .name = "heartbeat",
36 .id = -1,
37 .dev = {
38 .platform_data = &heartbeat_data,
39 },
40 .num_resources = 1,
41 .resource = &heartbeat_resource,
42 };
43
44 static struct resource cf_ide_resources[] = {
45 [0] = {
46 .start = PA_MRSHPC_IO + 0x1f0,
47 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
48 .flags = IORESOURCE_IO,
49 },
50 [1] = {
51 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
52 .end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
53 .flags = IORESOURCE_IO,
54 },
55 [2] = {
56 .start = MRSHPC_IRQ0,
57 .flags = IORESOURCE_IRQ,
58 },
59 };
60
61 static struct platform_device cf_ide_device = {
62 .name = "pata_platform",
63 .id = -1,
64 .num_resources = ARRAY_SIZE(cf_ide_resources),
65 .resource = cf_ide_resources,
66 };
67
68 static struct platform_device *se7721_devices[] __initdata = {
69 &cf_ide_device,
70 &heartbeat_device
71 };
72
se7721_devices_setup(void)73 static int __init se7721_devices_setup(void)
74 {
75 mrshpc_setup_windows();
76 return platform_add_devices(se7721_devices, ARRAY_SIZE(se7721_devices));
77 }
78 device_initcall(se7721_devices_setup);
79
se7721_setup(char ** cmdline_p)80 static void __init se7721_setup(char **cmdline_p)
81 {
82 /* for USB */
83 __raw_writew(0x0000, 0xA405010C); /* PGCR */
84 __raw_writew(0x0000, 0xA405010E); /* PHCR */
85 __raw_writew(0x00AA, 0xA4050118); /* PPCR */
86 __raw_writew(0x0000, 0xA4050124); /* PSELA */
87 }
88
89 /*
90 * The Machine Vector
91 */
92 struct sh_machine_vector mv_se7721 __initmv = {
93 .mv_name = "Solution Engine 7721",
94 .mv_setup = se7721_setup,
95 .mv_nr_irqs = 109,
96 .mv_init_irq = init_se7721_IRQ,
97 };
98