aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-highlander
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/mach-highlander')
-rw-r--r--arch/sh/boards/mach-highlander/Kconfig24
-rw-r--r--arch/sh/boards/mach-highlander/Makefile11
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7780mp.c74
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7780rp.c67
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7785rp.c86
-rw-r--r--arch/sh/boards/mach-highlander/psw.c122
-rw-r--r--arch/sh/boards/mach-highlander/setup.c345
7 files changed, 729 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-highlander/Kconfig b/arch/sh/boards/mach-highlander/Kconfig
new file mode 100644
index 00000000000..fc8f28e04ba
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/Kconfig
@@ -0,0 +1,24 @@
1if SH_HIGHLANDER
2
3choice
4 prompt "Highlander options"
5 default SH_R7780MP
6
7config SH_R7780RP
8 bool "R7780RP-1 board support"
9 depends on CPU_SUBTYPE_SH7780
10
11config SH_R7780MP
12 bool "R7780MP board support"
13 depends on CPU_SUBTYPE_SH7780
14 help
15 Selecting this option will enable support for the mass-production
16 version of the R7780RP. If in doubt, say Y.
17
18config SH_R7785RP
19 bool "R7785RP board support"
20 depends on CPU_SUBTYPE_SH7785
21
22endchoice
23
24endif
diff --git a/arch/sh/boards/mach-highlander/Makefile b/arch/sh/boards/mach-highlander/Makefile
new file mode 100644
index 00000000000..20a10080b11
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the R7780RP-1 specific parts of the kernel
3#
4irqinit-$(CONFIG_SH_R7780MP) := irq-r7780mp.o
5irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
6irqinit-$(CONFIG_SH_R7780RP) := irq-r7780rp.o
7obj-y := setup.o $(irqinit-y)
8
9ifneq ($(CONFIG_SH_R7785RP),y)
10obj-$(CONFIG_PUSH_SWITCH) += psw.o
11endif
diff --git a/arch/sh/boards/mach-highlander/irq-r7780mp.c b/arch/sh/boards/mach-highlander/irq-r7780mp.c
new file mode 100644
index 00000000000..ae1cfcb2970
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/irq-r7780mp.c
@@ -0,0 +1,74 @@
1/*
2 * Renesas Solutions Highlander R7780MP Support.
3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 Paul Mundt
6 * Copyright (C) 2007 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16
17enum {
18 UNUSED = 0,
19
20 /* board specific interrupt sources */
21 CF, /* Compact Flash */
22 TP, /* Touch panel */
23 SCIF1, /* FPGA SCIF1 */
24 SCIF0, /* FPGA SCIF0 */
25 SMBUS, /* SMBUS */
26 RTC, /* RTC Alarm */
27 AX88796, /* Ethernet controller */
28 PSW, /* Push Switch */
29
30 /* external bus connector */
31 EXT1, EXT2, EXT4, EXT5, EXT6,
32};
33
34static struct intc_vect vectors[] __initdata = {
35 INTC_IRQ(CF, IRQ_CF),
36 INTC_IRQ(TP, IRQ_TP),
37 INTC_IRQ(SCIF1, IRQ_SCIF1),
38 INTC_IRQ(SCIF0, IRQ_SCIF0),
39 INTC_IRQ(SMBUS, IRQ_SMBUS),
40 INTC_IRQ(RTC, IRQ_RTC),
41 INTC_IRQ(AX88796, IRQ_AX88796),
42 INTC_IRQ(PSW, IRQ_PSW),
43
44 INTC_IRQ(EXT1, IRQ_EXT1), INTC_IRQ(EXT2, IRQ_EXT2),
45 INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
46 INTC_IRQ(EXT6, IRQ_EXT6),
47};
48
49static struct intc_mask_reg mask_registers[] __initdata = {
50 { 0xa4000000, 0, 16, /* IRLMSK */
51 { SCIF0, SCIF1, RTC, 0, CF, 0, TP, SMBUS,
52 0, EXT6, EXT5, EXT4, EXT2, EXT1, PSW, AX88796 } },
53};
54
55static unsigned char irl2irq[HL_NR_IRL] __initdata = {
56 0, IRQ_CF, IRQ_TP, IRQ_SCIF1,
57 IRQ_SCIF0, IRQ_SMBUS, IRQ_RTC, IRQ_EXT6,
58 IRQ_EXT5, IRQ_EXT4, IRQ_EXT2, IRQ_EXT1,
59 0, IRQ_AX88796, IRQ_PSW,
60};
61
62static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors,
63 NULL, mask_registers, NULL, NULL);
64
65unsigned char * __init highlander_plat_irq_setup(void)
66{
67 if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) {
68 printk(KERN_INFO "Using r7780mp interrupt controller.\n");
69 register_intc_controller(&intc_desc);
70 return irl2irq;
71 }
72
73 return NULL;
74}
diff --git a/arch/sh/boards/mach-highlander/irq-r7780rp.c b/arch/sh/boards/mach-highlander/irq-r7780rp.c
new file mode 100644
index 00000000000..9d3921fe27c
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/irq-r7780rp.c
@@ -0,0 +1,67 @@
1/*
2 * Renesas Solutions Highlander R7780RP-1 Support.
3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 Paul Mundt
6 * Copyright (C) 2008 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16
17enum {
18 UNUSED = 0,
19
20 /* board specific interrupt sources */
21
22 AX88796, /* Ethernet controller */
23 PSW, /* Push Switch */
24 CF, /* Compact Flash */
25
26 PCI_A,
27 PCI_B,
28 PCI_C,
29 PCI_D,
30};
31
32static struct intc_vect vectors[] __initdata = {
33 INTC_IRQ(PCI_A, 65), /* dirty: overwrite cpu vectors for pci */
34 INTC_IRQ(PCI_B, 66),
35 INTC_IRQ(PCI_C, 67),
36 INTC_IRQ(PCI_D, 68),
37 INTC_IRQ(CF, IRQ_CF),
38 INTC_IRQ(PSW, IRQ_PSW),
39 INTC_IRQ(AX88796, IRQ_AX88796),
40};
41
42static struct intc_mask_reg mask_registers[] __initdata = {
43 { 0xa5000000, 0, 16, /* IRLMSK */
44 { PCI_A, PCI_B, PCI_C, PCI_D, CF, 0, 0, 0,
45 0, 0, 0, 0, 0, 0, PSW, AX88796 } },
46};
47
48static unsigned char irl2irq[HL_NR_IRL] __initdata = {
49 65, 66, 67, 68,
50 IRQ_CF, 0, 0, 0,
51 0, 0, 0, 0,
52 IRQ_AX88796, IRQ_PSW
53};
54
55static DECLARE_INTC_DESC(intc_desc, "r7780rp", vectors,
56 NULL, mask_registers, NULL, NULL);
57
58unsigned char * __init highlander_plat_irq_setup(void)
59{
60 if (ctrl_inw(0xa5000600)) {
61 printk(KERN_INFO "Using r7780rp interrupt controller.\n");
62 register_intc_controller(&intc_desc);
63 return irl2irq;
64 }
65
66 return NULL;
67}
diff --git a/arch/sh/boards/mach-highlander/irq-r7785rp.c b/arch/sh/boards/mach-highlander/irq-r7785rp.c
new file mode 100644
index 00000000000..896c045aa39
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/irq-r7785rp.c
@@ -0,0 +1,86 @@
1/*
2 * Renesas Solutions Highlander R7785RP Support.
3 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2006 - 2008 Paul Mundt
6 * Copyright (C) 2007 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/r7780rp.h>
16
17enum {
18 UNUSED = 0,
19
20 /* FPGA specific interrupt sources */
21 CF, /* Compact Flash */
22 SMBUS, /* SMBUS */
23 TP, /* Touch panel */
24 RTC, /* RTC Alarm */
25 TH_ALERT, /* Temperature sensor */
26 AX88796, /* Ethernet controller */
27
28 /* external bus connector */
29 EXT0, EXT1, EXT2, EXT3, EXT4, EXT5, EXT6, EXT7,
30};
31
32static struct intc_vect vectors[] __initdata = {
33 INTC_IRQ(CF, IRQ_CF),
34 INTC_IRQ(SMBUS, IRQ_SMBUS),
35 INTC_IRQ(TP, IRQ_TP),
36 INTC_IRQ(RTC, IRQ_RTC),
37 INTC_IRQ(TH_ALERT, IRQ_TH_ALERT),
38
39 INTC_IRQ(EXT0, IRQ_EXT0), INTC_IRQ(EXT1, IRQ_EXT1),
40 INTC_IRQ(EXT2, IRQ_EXT2), INTC_IRQ(EXT3, IRQ_EXT3),
41
42 INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
43 INTC_IRQ(EXT6, IRQ_EXT6), INTC_IRQ(EXT7, IRQ_EXT7),
44
45 INTC_IRQ(AX88796, IRQ_AX88796),
46};
47
48static struct intc_mask_reg mask_registers[] __initdata = {
49 { 0xa4000010, 0, 16, /* IRLMCR1 */
50 { 0, 0, 0, 0, CF, AX88796, SMBUS, TP,
51 RTC, 0, TH_ALERT, 0, 0, 0, 0, 0 } },
52 { 0xa4000012, 0, 16, /* IRLMCR2 */
53 { 0, 0, 0, 0, 0, 0, 0, 0,
54 EXT7, EXT6, EXT5, EXT4, EXT3, EXT2, EXT1, EXT0 } },
55};
56
57static unsigned char irl2irq[HL_NR_IRL] __initdata = {
58 0, IRQ_CF, IRQ_EXT4, IRQ_EXT5,
59 IRQ_EXT6, IRQ_EXT7, IRQ_SMBUS, IRQ_TP,
60 IRQ_RTC, IRQ_TH_ALERT, IRQ_AX88796, IRQ_EXT0,
61 IRQ_EXT1, IRQ_EXT2, IRQ_EXT3,
62};
63
64static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
65 NULL, mask_registers, NULL, NULL);
66
67unsigned char * __init highlander_plat_irq_setup(void)
68{
69 if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000)
70 return NULL;
71
72 printk(KERN_INFO "Using r7785rp interrupt controller.\n");
73
74 ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */
75
76 /* Setup the FPGA IRL */
77 ctrl_outw(0x0000, PA_IRLPRA); /* FPGA IRLA */
78 ctrl_outw(0xe598, PA_IRLPRB); /* FPGA IRLB */
79 ctrl_outw(0x7060, PA_IRLPRC); /* FPGA IRLC */
80 ctrl_outw(0x0000, PA_IRLPRD); /* FPGA IRLD */
81 ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */
82 ctrl_outw(0xdcba, PA_IRLPRF); /* FPGA IRLF */
83
84 register_intc_controller(&intc_desc);
85 return irl2irq;
86}
diff --git a/arch/sh/boards/mach-highlander/psw.c b/arch/sh/boards/mach-highlander/psw.c
new file mode 100644
index 00000000000..be8d5477fc6
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/psw.c
@@ -0,0 +1,122 @@
1/*
2 * arch/sh/boards/renesas/r7780rp/psw.c
3 *
4 * push switch support for RDBRP-1/RDBREVRP-1 debug boards.
5 *
6 * Copyright (C) 2006 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/io.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <asm/r7780rp.h>
17#include <asm/push-switch.h>
18
19static irqreturn_t psw_irq_handler(int irq, void *arg)
20{
21 struct platform_device *pdev = arg;
22 struct push_switch *psw = platform_get_drvdata(pdev);
23 struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
24 unsigned int l, mask;
25 int ret = 0;
26
27 l = ctrl_inw(PA_DBSW);
28
29 /* Nothing to do if there's no state change */
30 if (psw->state) {
31 ret = 1;
32 goto out;
33 }
34
35 mask = l & 0x70;
36 /* Figure out who raised it */
37 if (mask & (1 << psw_info->bit)) {
38 psw->state = !!(mask & (1 << psw_info->bit));
39 if (psw->state) /* debounce */
40 mod_timer(&psw->debounce, jiffies + 50);
41
42 ret = 1;
43 }
44
45out:
46 /* Clear the switch IRQs */
47 l |= (0x7 << 12);
48 ctrl_outw(l, PA_DBSW);
49
50 return IRQ_RETVAL(ret);
51}
52
53static struct resource psw_resources[] = {
54 [0] = {
55 .start = IRQ_PSW,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct push_switch_platform_info s2_platform_data = {
61 .name = "s2",
62 .bit = 6,
63 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
64 IRQF_SHARED,
65 .irq_handler = psw_irq_handler,
66};
67
68static struct platform_device s2_switch_device = {
69 .name = "push-switch",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(psw_resources),
72 .resource = psw_resources,
73 .dev = {
74 .platform_data = &s2_platform_data,
75 },
76};
77
78static struct push_switch_platform_info s3_platform_data = {
79 .name = "s3",
80 .bit = 5,
81 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
82 IRQF_SHARED,
83 .irq_handler = psw_irq_handler,
84};
85
86static struct platform_device s3_switch_device = {
87 .name = "push-switch",
88 .id = 1,
89 .num_resources = ARRAY_SIZE(psw_resources),
90 .resource = psw_resources,
91 .dev = {
92 .platform_data = &s3_platform_data,
93 },
94};
95
96static struct push_switch_platform_info s4_platform_data = {
97 .name = "s4",
98 .bit = 4,
99 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
100 IRQF_SHARED,
101 .irq_handler = psw_irq_handler,
102};
103
104static struct platform_device s4_switch_device = {
105 .name = "push-switch",
106 .id = 2,
107 .num_resources = ARRAY_SIZE(psw_resources),
108 .resource = psw_resources,
109 .dev = {
110 .platform_data = &s4_platform_data,
111 },
112};
113
114static struct platform_device *psw_devices[] = {
115 &s2_switch_device, &s3_switch_device, &s4_switch_device,
116};
117
118static int __init psw_init(void)
119{
120 return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
121}
122module_init(psw_init);
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
new file mode 100644
index 00000000000..bc79afb6fc4
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -0,0 +1,345 @@
1/*
2 * arch/sh/boards/renesas/r7780rp/setup.c
3 *
4 * Renesas Solutions Highlander Support.
5 *
6 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
7 * Copyright (C) 2005 - 2008 Paul Mundt
8 *
9 * This contains support for the R7780RP-1, R7780MP, and R7785RP
10 * Highlander modules.
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
14 * for more details.
15 */
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/ata_platform.h>
19#include <linux/types.h>
20#include <linux/i2c.h>
21#include <net/ax88796.h>
22#include <asm/machvec.h>
23#include <asm/r7780rp.h>
24#include <asm/clock.h>
25#include <asm/heartbeat.h>
26#include <asm/io.h>
27#include <asm/io_trapped.h>
28
29static struct resource r8a66597_usb_host_resources[] = {
30 [0] = {
31 .name = "r8a66597_hcd",
32 .start = 0xA4200000,
33 .end = 0xA42000FF,
34 .flags = IORESOURCE_MEM,
35 },
36 [1] = {
37 .name = "r8a66597_hcd",
38 .start = IRQ_EXT1, /* irq number */
39 .end = IRQ_EXT1,
40 .flags = IORESOURCE_IRQ,
41 },
42};
43
44static struct platform_device r8a66597_usb_host_device = {
45 .name = "r8a66597_hcd",
46 .id = -1,
47 .dev = {
48 .dma_mask = NULL, /* don't use dma */
49 .coherent_dma_mask = 0xffffffff,
50 },
51 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
52 .resource = r8a66597_usb_host_resources,
53};
54
55static struct resource m66592_usb_peripheral_resources[] = {
56 [0] = {
57 .name = "m66592_udc",
58 .start = 0xb0000000,
59 .end = 0xb00000FF,
60 .flags = IORESOURCE_MEM,
61 },
62 [1] = {
63 .name = "m66592_udc",
64 .start = IRQ_EXT4, /* irq number */
65 .end = IRQ_EXT4,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70static struct platform_device m66592_usb_peripheral_device = {
71 .name = "m66592_udc",
72 .id = -1,
73 .dev = {
74 .dma_mask = NULL, /* don't use dma */
75 .coherent_dma_mask = 0xffffffff,
76 },
77 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
78 .resource = m66592_usb_peripheral_resources,
79};
80
81static struct resource cf_ide_resources[] = {
82 [0] = {
83 .start = PA_AREA5_IO + 0x1000,
84 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 [1] = {
88 .start = PA_AREA5_IO + 0x80c,
89 .end = PA_AREA5_IO + 0x80c + 0x16 - 1,
90 .flags = IORESOURCE_MEM,
91 },
92 [2] = {
93 .start = IRQ_CF,
94 .flags = IORESOURCE_IRQ,
95 },
96};
97
98static struct pata_platform_info pata_info = {
99 .ioport_shift = 1,
100};
101
102static struct platform_device cf_ide_device = {
103 .name = "pata_platform",
104 .id = -1,
105 .num_resources = ARRAY_SIZE(cf_ide_resources),
106 .resource = cf_ide_resources,
107 .dev = {
108 .platform_data = &pata_info,
109 },
110};
111
112static struct resource heartbeat_resources[] = {
113 [0] = {
114 .start = PA_OBLED,
115 .end = PA_OBLED,
116 .flags = IORESOURCE_MEM,
117 },
118};
119
120#ifndef CONFIG_SH_R7785RP
121static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
122
123static struct heartbeat_data heartbeat_data = {
124 .bit_pos = heartbeat_bit_pos,
125 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
126};
127#endif
128
129static struct platform_device heartbeat_device = {
130 .name = "heartbeat",
131 .id = -1,
132
133 /* R7785RP has a slightly more sensible FPGA.. */
134#ifndef CONFIG_SH_R7785RP
135 .dev = {
136 .platform_data = &heartbeat_data,
137 },
138#endif
139 .num_resources = ARRAY_SIZE(heartbeat_resources),
140 .resource = heartbeat_resources,
141};
142
143static struct ax_plat_data ax88796_platdata = {
144 .flags = AXFLG_HAS_93CX6,
145 .wordlength = 2,
146 .dcr_val = 0x1,
147 .rcr_val = 0x40,
148};
149
150static struct resource ax88796_resources[] = {
151 {
152#ifdef CONFIG_SH_R7780RP
153 .start = 0xa5800400,
154 .end = 0xa5800400 + (0x20 * 0x2) - 1,
155#else
156 .start = 0xa4100400,
157 .end = 0xa4100400 + (0x20 * 0x2) - 1,
158#endif
159 .flags = IORESOURCE_MEM,
160 },
161 {
162 .start = IRQ_AX88796,
163 .end = IRQ_AX88796,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device ax88796_device = {
169 .name = "ax88796",
170 .id = 0,
171
172 .dev = {
173 .platform_data = &ax88796_platdata,
174 },
175
176 .num_resources = ARRAY_SIZE(ax88796_resources),
177 .resource = ax88796_resources,
178};
179
180static struct resource smbus_resources[] = {
181 [0] = {
182 .start = PA_SMCR,
183 .end = PA_SMCR + 0x100 - 1,
184 .flags = IORESOURCE_MEM,
185 },
186 [1] = {
187 .start = IRQ_SMBUS,
188 .end = IRQ_SMBUS,
189 .flags = IORESOURCE_IRQ,
190 },
191};
192
193static struct platform_device smbus_device = {
194 .name = "i2c-highlander",
195 .id = 0,
196 .num_resources = ARRAY_SIZE(smbus_resources),
197 .resource = smbus_resources,
198};
199
200static struct i2c_board_info __initdata highlander_i2c_devices[] = {
201 {
202 I2C_BOARD_INFO("r2025sd", 0x32),
203 },
204};
205
206static struct platform_device *r7780rp_devices[] __initdata = {
207 &r8a66597_usb_host_device,
208 &m66592_usb_peripheral_device,
209 &heartbeat_device,
210 &smbus_device,
211#ifndef CONFIG_SH_R7780RP
212 &ax88796_device,
213#endif
214};
215
216/*
217 * The CF is connected using a 16-bit bus where 8-bit operations are
218 * unsupported. The linux ata driver is however using 8-bit operations, so
219 * insert a trapped io filter to convert 8-bit operations into 16-bit.
220 */
221static struct trapped_io cf_trapped_io = {
222 .resource = cf_ide_resources,
223 .num_resources = 2,
224 .minimum_bus_width = 16,
225};
226
227static int __init r7780rp_devices_setup(void)
228{
229 int ret = 0;
230
231#ifndef CONFIG_SH_R7780RP
232 if (register_trapped_io(&cf_trapped_io) == 0)
233 ret |= platform_device_register(&cf_ide_device);
234#endif
235
236 ret |= platform_add_devices(r7780rp_devices,
237 ARRAY_SIZE(r7780rp_devices));
238
239 ret |= i2c_register_board_info(0, highlander_i2c_devices,
240 ARRAY_SIZE(highlander_i2c_devices));
241
242 return ret;
243}
244device_initcall(r7780rp_devices_setup);
245
246/*
247 * Platform specific clocks
248 */
249static void ivdr_clk_enable(struct clk *clk)
250{
251 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
252}
253
254static void ivdr_clk_disable(struct clk *clk)
255{
256 ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
257}
258
259static struct clk_ops ivdr_clk_ops = {
260 .enable = ivdr_clk_enable,
261 .disable = ivdr_clk_disable,
262};
263
264static struct clk ivdr_clk = {
265 .name = "ivdr_clk",
266 .ops = &ivdr_clk_ops,
267};
268
269static struct clk *r7780rp_clocks[] = {
270 &ivdr_clk,
271};
272
273static void r7780rp_power_off(void)
274{
275 if (mach_is_r7780mp() || mach_is_r7785rp())
276 ctrl_outw(0x0001, PA_POFF);
277}
278
279/*
280 * Initialize the board
281 */
282static void __init highlander_setup(char **cmdline_p)
283{
284 u16 ver = ctrl_inw(PA_VERREG);
285 int i;
286
287 printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
288 mach_is_r7780rp() ? "R7780RP-1" :
289 mach_is_r7780mp() ? "R7780MP" :
290 "R7785RP");
291
292 printk(KERN_INFO "Board version: %d (revision %d), "
293 "FPGA version: %d (revision %d)\n",
294 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
295 (ver >> 4) & 0xf, ver & 0xf);
296
297 /*
298 * Enable the important clocks right away..
299 */
300 for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
301 struct clk *clk = r7780rp_clocks[i];
302
303 clk_register(clk);
304 clk_enable(clk);
305 }
306
307 ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
308
309 if (mach_is_r7780rp())
310 ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
311
312 ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */
313
314 pm_power_off = r7780rp_power_off;
315}
316
317static unsigned char irl2irq[HL_NR_IRL];
318
319static int highlander_irq_demux(int irq)
320{
321 if (irq >= HL_NR_IRL || !irl2irq[irq])
322 return irq;
323
324 return irl2irq[irq];
325}
326
327static void __init highlander_init_irq(void)
328{
329 unsigned char *ucp = highlander_plat_irq_setup();
330
331 if (ucp) {
332 plat_irq_setup_pins(IRQ_MODE_IRL3210);
333 memcpy(irl2irq, ucp, HL_NR_IRL);
334 }
335}
336
337/*
338 * The Machine Vector
339 */
340static struct sh_machine_vector mv_highlander __initmv = {
341 .mv_name = "Highlander",
342 .mv_setup = highlander_setup,
343 .mv_init_irq = highlander_init_irq,
344 .mv_irq_demux = highlander_irq_demux,
345};