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