blob: 5172f994a1bef8b2c8ecabb4ac40b798c9a6ff24 [file] [log] [blame]
Nobuhiro Iwamatsuaa4a5db2006-12-29 01:50:35 +09001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * linux/arch/sh/boards/se/770x/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/init.h>
Paul Mundt3b4d9532007-02-13 15:42:28 +090010#include <linux/platform_device.h>
Paul Mundt2c7834a2006-09-27 18:17:31 +090011#include <asm/machvec.h>
Paul Mundt711fa802006-10-03 13:14:04 +090012#include <asm/se.h>
13#include <asm/io.h>
14#include <asm/smc37c93x.h>
Paul Mundt8786c952007-08-20 13:03:41 +090015#include <asm/heartbeat.h>
Paul Mundt2c7834a2006-09-27 18:17:31 +090016
Paul Mundt2c7834a2006-09-27 18:17:31 +090017void init_se_IRQ(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19/*
20 * Configure the Super I/O chip
21 */
22static void __init smsc_config(int index, int data)
23{
24 outb_p(index, INDEX_PORT);
25 outb_p(data, DATA_PORT);
26}
27
Paul Mundt2c7834a2006-09-27 18:17:31 +090028/* XXX: Another candidate for a more generic cchip machine vector */
29static void __init smsc_setup(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
31 outb_p(CONFIG_ENTER, CONFIG_PORT);
32 outb_p(CONFIG_ENTER, CONFIG_PORT);
33
34 /* FDC */
35 smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
36 smsc_config(ACTIVATE_INDEX, 0x01);
37 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
38
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 /* AUXIO (GPIO): to use IDE1 */
40 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
41 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
42 smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
43
44 /* COM1 */
45 smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
46 smsc_config(ACTIVATE_INDEX, 0x01);
47 smsc_config(IO_BASE_HI_INDEX, 0x03);
48 smsc_config(IO_BASE_LO_INDEX, 0xf8);
49 smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
50
51 /* COM2 */
52 smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
53 smsc_config(ACTIVATE_INDEX, 0x01);
54 smsc_config(IO_BASE_HI_INDEX, 0x02);
55 smsc_config(IO_BASE_LO_INDEX, 0xf8);
56 smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
57
58 /* RTC */
59 smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
60 smsc_config(ACTIVATE_INDEX, 0x01);
61 smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
62
63 /* XXX: PARPORT, KBD, and MOUSE will come here... */
64 outb_p(CONFIG_EXIT, CONFIG_PORT);
65}
66
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +090067
68static struct resource cf_ide_resources[] = {
69 [0] = {
70 .start = PA_MRSHPC_IO + 0x1f0,
71 .end = PA_MRSHPC_IO + 0x1f0 + 8,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
76 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
77 .flags = IORESOURCE_MEM,
78 },
79 [2] = {
Nobuhiro Iwamatsu2a8ff452007-04-26 11:51:00 +090080 .start = IRQ_CFCARD,
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +090081 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct platform_device cf_ide_device = {
86 .name = "pata_platform",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(cf_ide_resources),
89 .resource = cf_ide_resources,
90};
91
Paul Mundt3b4d9532007-02-13 15:42:28 +090092static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
93
Paul Mundt8786c952007-08-20 13:03:41 +090094static struct heartbeat_data heartbeat_data = {
95 .bit_pos = heartbeat_bit_pos,
96 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
97};
98
Paul Mundt3b4d9532007-02-13 15:42:28 +090099static struct resource heartbeat_resources[] = {
100 [0] = {
101 .start = PA_LED,
102 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
103 .flags = IORESOURCE_MEM,
104 },
105};
106
107static struct platform_device heartbeat_device = {
108 .name = "heartbeat",
109 .id = -1,
110 .dev = {
Paul Mundt8786c952007-08-20 13:03:41 +0900111 .platform_data = heartbeat_data,
Paul Mundt3b4d9532007-02-13 15:42:28 +0900112 },
113 .num_resources = ARRAY_SIZE(heartbeat_resources),
114 .resource = heartbeat_resources,
115};
116
117static struct platform_device *se_devices[] __initdata = {
118 &heartbeat_device,
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +0900119 &cf_ide_device,
Paul Mundt3b4d9532007-02-13 15:42:28 +0900120};
121
122static int __init se_devices_setup(void)
123{
124 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
125}
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900126device_initcall(se_devices_setup);
Paul Mundt3b4d9532007-02-13 15:42:28 +0900127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128/*
Paul Mundt2c7834a2006-09-27 18:17:31 +0900129 * The Machine Vector
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900131static struct sh_machine_vector mv_se __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +0900132 .mv_name = "SolutionEngine",
133 .mv_setup = smsc_setup,
134#if defined(CONFIG_CPU_SH4)
135 .mv_nr_irqs = 48,
136#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
137 .mv_nr_irqs = 32,
138#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
139 .mv_nr_irqs = 61,
140#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
141 .mv_nr_irqs = 86,
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900142#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
143 .mv_nr_irqs = 104,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900144#endif
145
146 .mv_inb = se_inb,
147 .mv_inw = se_inw,
148 .mv_inl = se_inl,
149 .mv_outb = se_outb,
150 .mv_outw = se_outw,
151 .mv_outl = se_outl,
152
153 .mv_inb_p = se_inb_p,
154 .mv_inw_p = se_inw,
155 .mv_inl_p = se_inl,
156 .mv_outb_p = se_outb_p,
157 .mv_outw_p = se_outw,
158 .mv_outl_p = se_outl,
159
160 .mv_insb = se_insb,
161 .mv_insw = se_insw,
162 .mv_insl = se_insl,
163 .mv_outsb = se_outsb,
164 .mv_outsw = se_outsw,
165 .mv_outsl = se_outsl,
166
167 .mv_init_irq = init_se_IRQ,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900168};