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