blob: dc55d3a69665ee4e0c421d9cb566aba55b785a6c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Yoshinori Satof36af3fd2006-11-05 16:21:09 +09002/*
3 *
4 * linux/arch/sh/boards/se/7206/setup.c
5 *
6 * Copyright (C) 2006 Yoshinori Sato
Paul Mundtf11c9c22008-05-09 14:13:17 +09007 * Copyright (C) 2007 - 2008 Paul Mundt
Yoshinori Satof36af3fd2006-11-05 16:21:09 +09008 *
9 * Hitachi 7206 SolutionEngine Support.
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090010 */
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090011#include <linux/init.h>
12#include <linux/platform_device.h>
Paul Mundtf11c9c22008-05-09 14:13:17 +090013#include <linux/smc91x.h>
Paul Mundt939a24a2008-07-29 21:41:37 +090014#include <mach-se/mach/se7206.h>
Paul Mundt710ee0c2006-11-05 16:48:42 +090015#include <asm/io.h>
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090016#include <asm/machvec.h>
Paul Mundt8786c952007-08-20 13:03:41 +090017#include <asm/heartbeat.h>
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090018
19static struct resource smc91x_resources[] = {
20 [0] = {
Paul Mundtf11c9c22008-05-09 14:13:17 +090021 .name = "smc91x-regs",
22 .start = PA_SMSC + 0x300,
23 .end = PA_SMSC + 0x300 + 0x020 - 1,
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090024 .flags = IORESOURCE_MEM,
25 },
26 [1] = {
27 .start = 64,
28 .end = 64,
29 .flags = IORESOURCE_IRQ,
30 },
31};
32
Paul Mundtf11c9c22008-05-09 14:13:17 +090033static struct smc91x_platdata smc91x_info = {
34 .flags = SMC91X_USE_16BIT,
35};
36
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090037static struct platform_device smc91x_device = {
38 .name = "smc91x",
39 .id = -1,
Paul Mundtf11c9c22008-05-09 14:13:17 +090040 .dev = {
41 .dma_mask = NULL,
42 .coherent_dma_mask = 0xffffffff,
43 .platform_data = &smc91x_info,
44 },
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090045 .num_resources = ARRAY_SIZE(smc91x_resources),
46 .resource = smc91x_resources,
47};
48
Paul Mundt3b4d9532007-02-13 15:42:28 +090049static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
50
Paul Mundt8786c952007-08-20 13:03:41 +090051static struct heartbeat_data heartbeat_data = {
52 .bit_pos = heartbeat_bit_pos,
53 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
54};
55
Paul Mundta09d2832010-01-15 12:24:34 +090056static struct resource heartbeat_resource = {
57 .start = PA_LED,
58 .end = PA_LED,
59 .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
Paul Mundt3b4d9532007-02-13 15:42:28 +090060};
61
62static struct platform_device heartbeat_device = {
63 .name = "heartbeat",
64 .id = -1,
65 .dev = {
Paul Mundta1fd3062007-08-23 15:11:44 +090066 .platform_data = &heartbeat_data,
Paul Mundt3b4d9532007-02-13 15:42:28 +090067 },
Paul Mundta09d2832010-01-15 12:24:34 +090068 .num_resources = 1,
69 .resource = &heartbeat_resource,
Paul Mundt3b4d9532007-02-13 15:42:28 +090070};
71
72static struct platform_device *se7206_devices[] __initdata = {
73 &smc91x_device,
74 &heartbeat_device,
75};
76
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090077static int __init se7206_devices_setup(void)
78{
Paul Mundt3b4d9532007-02-13 15:42:28 +090079 return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices));
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090080}
Nobuhiro Iwamatsu95d210c2011-01-07 03:02:15 +000081device_initcall(se7206_devices_setup);
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090082
Paul Mundt16b25922010-11-01 12:18:48 -040083static int se7206_mode_pins(void)
84{
85 return MODE_PIN1 | MODE_PIN2;
86}
87
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090088/*
89 * The Machine Vector
90 */
91
Paul Mundt82f81f42007-05-15 15:19:34 +090092static struct sh_machine_vector mv_se __initmv = {
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090093 .mv_name = "SolutionEngine",
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090094 .mv_init_irq = init_se7206_IRQ,
Paul Mundt16b25922010-11-01 12:18:48 -040095 .mv_mode_pins = se7206_mode_pins,
Yoshinori Satof36af3fd2006-11-05 16:21:09 +090096};