2 * arch/sh/boards/renesas/r7780rp/setup.c
4 * Renesas Solutions Highlander Support.
6 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
7 * Copyright (C) 2005 - 2007 Paul Mundt
9 * This contains support for the R7780RP-1, R7780MP, and R7785RP
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
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/pata_platform.h>
19 #include <asm/machvec.h>
20 #include <asm/r7780rp.h>
21 #include <asm/clock.h>
24 static struct resource cf_ide_resources[] = {
26 .start = PA_AREA5_IO + 0x1000,
27 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
28 .flags = IORESOURCE_MEM,
31 .start = PA_AREA5_IO + 0x80c,
32 .end = PA_AREA5_IO + 0x80c + 0x16 - 1,
33 .flags = IORESOURCE_MEM,
36 #ifdef CONFIG_SH_R7780RP
41 .flags = IORESOURCE_IRQ,
45 static struct pata_platform_info pata_info = {
49 static struct platform_device cf_ide_device = {
50 .name = "pata_platform",
52 .num_resources = ARRAY_SIZE(cf_ide_resources),
53 .resource = cf_ide_resources,
55 .platform_data = &pata_info,
59 static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
61 static struct resource heartbeat_resources[] = {
64 .end = PA_OBLED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
65 .flags = IORESOURCE_MEM,
69 static struct platform_device heartbeat_device = {
73 /* R7785RP has a slightly more sensible FPGA.. */
74 #ifndef CONFIG_SH_R7785RP
76 .platform_data = heartbeat_bit_pos,
79 .num_resources = ARRAY_SIZE(heartbeat_resources),
80 .resource = heartbeat_resources,
83 static struct platform_device *r7780rp_devices[] __initdata = {
88 static int __init r7780rp_devices_setup(void)
90 return platform_add_devices(r7780rp_devices,
91 ARRAY_SIZE(r7780rp_devices));
93 device_initcall(r7780rp_devices_setup);
96 * Platform specific clocks
98 static void ivdr_clk_enable(struct clk *clk)
100 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
103 static void ivdr_clk_disable(struct clk *clk)
105 ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
108 static struct clk_ops ivdr_clk_ops = {
109 .enable = ivdr_clk_enable,
110 .disable = ivdr_clk_disable,
113 static struct clk ivdr_clk = {
115 .ops = &ivdr_clk_ops,
118 static struct clk *r7780rp_clocks[] = {
122 static void r7780rp_power_off(void)
124 if (mach_is_r7780mp() || mach_is_r7785rp())
125 ctrl_outw(0x0001, PA_POFF);
129 * Initialize the board
131 static void __init highlander_setup(char **cmdline_p)
133 u16 ver = ctrl_inw(PA_VERREG);
136 printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
137 mach_is_r7780rp() ? "R7780RP-1" :
138 mach_is_r7780mp() ? "R7780MP" :
141 printk(KERN_INFO "Board version: %d (revision %d), "
142 "FPGA version: %d (revision %d)\n",
143 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
144 (ver >> 4) & 0xf, ver & 0xf);
147 * Enable the important clocks right away..
149 for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
150 struct clk *clk = r7780rp_clocks[i];
156 ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
158 if (mach_is_r7780rp())
159 ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
161 ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */
163 pm_power_off = r7780rp_power_off;
169 struct sh_machine_vector mv_highlander __initmv = {
170 .mv_name = "Highlander",
172 .mv_setup = highlander_setup,
173 .mv_init_irq = highlander_init_irq,