blob: 9759d6ba7ffb4d8d967f30d0ee0d72fe00c886fb [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 Mundt939a24a2008-07-29 21:41:37 +090011#include <mach-se/mach/se.h>
Paul Mundt073da9c2008-12-17 14:41:54 +090012#include <mach-se/mach/mrshpc.h>
13#include <asm/machvec.h>
Paul Mundt711fa802006-10-03 13:14:04 +090014#include <asm/io.h>
15#include <asm/smc37c93x.h>
Paul Mundt8786c952007-08-20 13:03:41 +090016#include <asm/heartbeat.h>
Paul Mundt2c7834a2006-09-27 18:17:31 +090017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018/*
19 * Configure the Super I/O chip
20 */
21static void __init smsc_config(int index, int data)
22{
23 outb_p(index, INDEX_PORT);
24 outb_p(data, DATA_PORT);
25}
26
Paul Mundt2c7834a2006-09-27 18:17:31 +090027/* XXX: Another candidate for a more generic cchip machine vector */
28static void __init smsc_setup(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070029{
30 outb_p(CONFIG_ENTER, CONFIG_PORT);
31 outb_p(CONFIG_ENTER, CONFIG_PORT);
32
33 /* FDC */
34 smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
35 smsc_config(ACTIVATE_INDEX, 0x01);
36 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
37
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 /* AUXIO (GPIO): to use IDE1 */
39 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
40 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
41 smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
42
43 /* COM1 */
44 smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
45 smsc_config(ACTIVATE_INDEX, 0x01);
46 smsc_config(IO_BASE_HI_INDEX, 0x03);
47 smsc_config(IO_BASE_LO_INDEX, 0xf8);
48 smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
49
50 /* COM2 */
51 smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
52 smsc_config(ACTIVATE_INDEX, 0x01);
53 smsc_config(IO_BASE_HI_INDEX, 0x02);
54 smsc_config(IO_BASE_LO_INDEX, 0xf8);
55 smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
56
57 /* RTC */
58 smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
59 smsc_config(ACTIVATE_INDEX, 0x01);
60 smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
61
62 /* XXX: PARPORT, KBD, and MOUSE will come here... */
63 outb_p(CONFIG_EXIT, CONFIG_PORT);
64}
65
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +090066
67static struct resource cf_ide_resources[] = {
68 [0] = {
69 .start = PA_MRSHPC_IO + 0x1f0,
70 .end = PA_MRSHPC_IO + 0x1f0 + 8,
71 .flags = IORESOURCE_MEM,
72 },
73 [1] = {
74 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
Nobuhiro Iwamatsu787d9d72008-06-18 18:32:03 +090075 .end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +090076 .flags = IORESOURCE_MEM,
77 },
78 [2] = {
Nobuhiro Iwamatsu2a8ff452007-04-26 11:51:00 +090079 .start = IRQ_CFCARD,
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +090080 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device cf_ide_device = {
85 .name = "pata_platform",
86 .id = -1,
87 .num_resources = ARRAY_SIZE(cf_ide_resources),
88 .resource = cf_ide_resources,
89};
90
Paul Mundt3b4d9532007-02-13 15:42:28 +090091static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
92
Paul Mundt8786c952007-08-20 13:03:41 +090093static struct heartbeat_data heartbeat_data = {
94 .bit_pos = heartbeat_bit_pos,
95 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
96};
97
Paul Mundta09d2832010-01-15 12:24:34 +090098static struct resource heartbeat_resource = {
99 .start = PA_LED,
100 .end = PA_LED,
101 .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
Paul Mundt3b4d9532007-02-13 15:42:28 +0900102};
103
104static struct platform_device heartbeat_device = {
105 .name = "heartbeat",
106 .id = -1,
107 .dev = {
Paul Mundta1fd3062007-08-23 15:11:44 +0900108 .platform_data = &heartbeat_data,
Paul Mundt3b4d9532007-02-13 15:42:28 +0900109 },
Paul Mundta09d2832010-01-15 12:24:34 +0900110 .num_resources = 1,
111 .resource = &heartbeat_resource,
Paul Mundt3b4d9532007-02-13 15:42:28 +0900112};
113
Nobuhiro Iwamatsu48648412008-07-29 14:37:25 +0900114#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
115 defined(CONFIG_CPU_SUBTYPE_SH7712)
Nobuhiro Iwamatsuffb91ad2008-06-18 18:29:06 +0900116/* SH771X Ethernet driver */
117static struct resource sh_eth0_resources[] = {
118 [0] = {
119 .start = SH_ETH0_BASE,
120 .end = SH_ETH0_BASE + 0x1B8,
121 .flags = IORESOURCE_MEM,
122 },
123 [1] = {
124 .start = SH_ETH0_IRQ,
125 .end = SH_ETH0_IRQ,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device sh_eth0_device = {
131 .name = "sh-eth",
132 .id = 0,
133 .dev = {
134 .platform_data = PHY_ID,
135 },
136 .num_resources = ARRAY_SIZE(sh_eth0_resources),
137 .resource = sh_eth0_resources,
138};
139
140static struct resource sh_eth1_resources[] = {
141 [0] = {
142 .start = SH_ETH1_BASE,
143 .end = SH_ETH1_BASE + 0x1B8,
144 .flags = IORESOURCE_MEM,
145 },
146 [1] = {
147 .start = SH_ETH1_IRQ,
148 .end = SH_ETH1_IRQ,
149 .flags = IORESOURCE_IRQ,
150 },
151};
152
153static struct platform_device sh_eth1_device = {
154 .name = "sh-eth",
155 .id = 1,
156 .dev = {
157 .platform_data = PHY_ID,
158 },
159 .num_resources = ARRAY_SIZE(sh_eth1_resources),
160 .resource = sh_eth1_resources,
161};
Nobuhiro Iwamatsu48648412008-07-29 14:37:25 +0900162#endif
Nobuhiro Iwamatsuffb91ad2008-06-18 18:29:06 +0900163
Paul Mundt3b4d9532007-02-13 15:42:28 +0900164static struct platform_device *se_devices[] __initdata = {
165 &heartbeat_device,
Nobuhiro Iwamatsuf987fc82007-03-12 15:12:27 +0900166 &cf_ide_device,
Nobuhiro Iwamatsu48648412008-07-29 14:37:25 +0900167#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
168 defined(CONFIG_CPU_SUBTYPE_SH7712)
Nobuhiro Iwamatsuffb91ad2008-06-18 18:29:06 +0900169 &sh_eth0_device,
170 &sh_eth1_device,
Nobuhiro Iwamatsu48648412008-07-29 14:37:25 +0900171#endif
Paul Mundt3b4d9532007-02-13 15:42:28 +0900172};
173
174static int __init se_devices_setup(void)
175{
Paul Mundt073da9c2008-12-17 14:41:54 +0900176 mrshpc_setup_windows();
Paul Mundt3b4d9532007-02-13 15:42:28 +0900177 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
178}
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900179device_initcall(se_devices_setup);
Paul Mundt3b4d9532007-02-13 15:42:28 +0900180
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181/*
Paul Mundt2c7834a2006-09-27 18:17:31 +0900182 * The Machine Vector
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900184static struct sh_machine_vector mv_se __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +0900185 .mv_name = "SolutionEngine",
186 .mv_setup = smsc_setup,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900187 .mv_init_irq = init_se_IRQ,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900188};