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