xref: /openbmc/linux/arch/sh/boards/mach-se/7206/setup.c (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2da2014a2SPaul Mundt /*
3da2014a2SPaul Mundt  *
4da2014a2SPaul Mundt  * linux/arch/sh/boards/se/7206/setup.c
5da2014a2SPaul Mundt  *
6da2014a2SPaul Mundt  * Copyright (C) 2006  Yoshinori Sato
7da2014a2SPaul Mundt  * Copyright (C) 2007 - 2008  Paul Mundt
8da2014a2SPaul Mundt  *
9da2014a2SPaul Mundt  * Hitachi 7206 SolutionEngine Support.
10da2014a2SPaul Mundt  */
11da2014a2SPaul Mundt #include <linux/init.h>
12da2014a2SPaul Mundt #include <linux/platform_device.h>
13da2014a2SPaul Mundt #include <linux/smc91x.h>
14939a24a6SPaul Mundt #include <mach-se/mach/se7206.h>
15da2014a2SPaul Mundt #include <asm/io.h>
16da2014a2SPaul Mundt #include <asm/machvec.h>
17da2014a2SPaul Mundt #include <asm/heartbeat.h>
18da2014a2SPaul Mundt 
19da2014a2SPaul Mundt static struct resource smc91x_resources[] = {
20da2014a2SPaul Mundt 	[0] = {
21da2014a2SPaul Mundt 		.name		= "smc91x-regs",
22da2014a2SPaul Mundt 		.start		= PA_SMSC + 0x300,
23da2014a2SPaul Mundt 		.end		= PA_SMSC + 0x300 + 0x020 - 1,
24da2014a2SPaul Mundt 		.flags		= IORESOURCE_MEM,
25da2014a2SPaul Mundt 	},
26da2014a2SPaul Mundt 	[1] = {
27da2014a2SPaul Mundt 		.start		= 64,
28da2014a2SPaul Mundt 		.end		= 64,
29da2014a2SPaul Mundt 		.flags		= IORESOURCE_IRQ,
30da2014a2SPaul Mundt 	},
31da2014a2SPaul Mundt };
32da2014a2SPaul Mundt 
33da2014a2SPaul Mundt static struct smc91x_platdata smc91x_info = {
34da2014a2SPaul Mundt 	.flags	= SMC91X_USE_16BIT,
35da2014a2SPaul Mundt };
36da2014a2SPaul Mundt 
37da2014a2SPaul Mundt static struct platform_device smc91x_device = {
38da2014a2SPaul Mundt 	.name		= "smc91x",
39da2014a2SPaul Mundt 	.id		= -1,
40da2014a2SPaul Mundt 	.dev		= {
41da2014a2SPaul Mundt 		.dma_mask		= NULL,
42da2014a2SPaul Mundt 		.coherent_dma_mask	= 0xffffffff,
43da2014a2SPaul Mundt 		.platform_data		= &smc91x_info,
44da2014a2SPaul Mundt 	},
45da2014a2SPaul Mundt 	.num_resources	= ARRAY_SIZE(smc91x_resources),
46da2014a2SPaul Mundt 	.resource	= smc91x_resources,
47da2014a2SPaul Mundt };
48da2014a2SPaul Mundt 
49da2014a2SPaul Mundt static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
50da2014a2SPaul Mundt 
51da2014a2SPaul Mundt static struct heartbeat_data heartbeat_data = {
52da2014a2SPaul Mundt 	.bit_pos	= heartbeat_bit_pos,
53da2014a2SPaul Mundt 	.nr_bits	= ARRAY_SIZE(heartbeat_bit_pos),
54da2014a2SPaul Mundt };
55da2014a2SPaul Mundt 
56a09d2831SPaul Mundt static struct resource heartbeat_resource = {
57da2014a2SPaul Mundt 	.start	= PA_LED,
58da2014a2SPaul Mundt 	.end	= PA_LED,
59a09d2831SPaul Mundt 	.flags	= IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
60da2014a2SPaul Mundt };
61da2014a2SPaul Mundt 
62da2014a2SPaul Mundt static struct platform_device heartbeat_device = {
63da2014a2SPaul Mundt 	.name		= "heartbeat",
64da2014a2SPaul Mundt 	.id		= -1,
65da2014a2SPaul Mundt 	.dev	= {
66da2014a2SPaul Mundt 		.platform_data	= &heartbeat_data,
67da2014a2SPaul Mundt 	},
68a09d2831SPaul Mundt 	.num_resources	= 1,
69a09d2831SPaul Mundt 	.resource	= &heartbeat_resource,
70da2014a2SPaul Mundt };
71da2014a2SPaul Mundt 
72da2014a2SPaul Mundt static struct platform_device *se7206_devices[] __initdata = {
73da2014a2SPaul Mundt 	&smc91x_device,
74da2014a2SPaul Mundt 	&heartbeat_device,
75da2014a2SPaul Mundt };
76da2014a2SPaul Mundt 
se7206_devices_setup(void)77da2014a2SPaul Mundt static int __init se7206_devices_setup(void)
78da2014a2SPaul Mundt {
79da2014a2SPaul Mundt 	return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices));
80da2014a2SPaul Mundt }
8195d210ceSNobuhiro Iwamatsu device_initcall(se7206_devices_setup);
82da2014a2SPaul Mundt 
se7206_mode_pins(void)8316b25920SPaul Mundt static int se7206_mode_pins(void)
8416b25920SPaul Mundt {
8516b25920SPaul Mundt 	return MODE_PIN1 | MODE_PIN2;
8616b25920SPaul Mundt }
8716b25920SPaul Mundt 
88da2014a2SPaul Mundt /*
89da2014a2SPaul Mundt  * The Machine Vector
90da2014a2SPaul Mundt  */
91da2014a2SPaul Mundt 
92da2014a2SPaul Mundt static struct sh_machine_vector mv_se __initmv = {
93da2014a2SPaul Mundt 	.mv_name		= "SolutionEngine",
94da2014a2SPaul Mundt 	.mv_init_irq		= init_se7206_IRQ,
9516b25920SPaul Mundt 	.mv_mode_pins		= se7206_mode_pins,
96da2014a2SPaul Mundt };
97