2 * arch/sh/boards/renesas/r7780rp/setup.c
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2005, 2006 Paul Mundt
7 * Renesas Solutions Highlander R7780RP-1 Support.
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <asm/machvec.h>
16 #include <asm/r7780rp.h>
17 #include <asm/clock.h>
20 extern void heartbeat_r7780rp(void);
21 extern void init_r7780rp_IRQ(void);
23 static struct resource m66596_usb_host_resources[] = {
27 .flags = IORESOURCE_MEM,
30 .start = 6, /* irq number */
32 .flags = IORESOURCE_IRQ,
36 static struct platform_device m66596_usb_host_device = {
40 .dma_mask = NULL, /* don't use dma */
41 .coherent_dma_mask = 0xffffffff,
43 .num_resources = ARRAY_SIZE(m66596_usb_host_resources),
44 .resource = m66596_usb_host_resources,
47 static struct resource cf_ide_resources[] = {
51 .flags = IORESOURCE_IO,
54 .start = 0x1f0 + 0x206,
55 .end = 0x1f0 + 8 + 0x206 + 8,
56 .flags = IORESOURCE_IO,
59 #ifdef CONFIG_SH_R7780MP
64 .flags = IORESOURCE_IRQ,
68 static struct platform_device cf_ide_device = {
69 .name = "pata_platform",
71 .num_resources = ARRAY_SIZE(cf_ide_resources),
72 .resource = cf_ide_resources,
75 static struct platform_device *r7780rp_devices[] __initdata = {
76 &m66596_usb_host_device,
80 static int __init r7780rp_devices_setup(void)
82 return platform_add_devices(r7780rp_devices,
83 ARRAY_SIZE(r7780rp_devices));
87 * Platform specific clocks
89 static void ivdr_clk_enable(struct clk *clk)
91 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL);
94 static void ivdr_clk_disable(struct clk *clk)
96 ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL);
99 static struct clk_ops ivdr_clk_ops = {
100 .enable = ivdr_clk_enable,
101 .disable = ivdr_clk_disable,
104 static struct clk ivdr_clk = {
106 .ops = &ivdr_clk_ops,
109 static struct clk *r7780rp_clocks[] = {
113 static void r7780rp_power_off(void)
115 #ifdef CONFIG_SH_R7780MP
116 ctrl_outw(0x0001, PA_POFF);
121 * Initialize the board
123 static void __init r7780rp_setup(char **cmdline_p)
125 u16 ver = ctrl_inw(PA_VERREG);
128 device_initcall(r7780rp_devices_setup);
130 printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
132 printk(KERN_INFO "Board version: %d (revision %d), "
133 "FPGA version: %d (revision %d)\n",
134 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
135 (ver >> 4) & 0xf, ver & 0xf);
138 * Enable the important clocks right away..
140 for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
141 struct clk *clk = r7780rp_clocks[i];
147 ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
148 #ifndef CONFIG_SH_R7780MP
149 ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
151 ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x0100, PA_IVDRCTL); /* Si13112 */
153 pm_power_off = r7780rp_power_off;
159 struct sh_machine_vector mv_r7780rp __initmv = {
160 .mv_name = "Highlander R7780RP-1",
161 .mv_setup = r7780rp_setup,
165 .mv_inb = r7780rp_inb,
166 .mv_inw = r7780rp_inw,
167 .mv_inl = r7780rp_inl,
168 .mv_outb = r7780rp_outb,
169 .mv_outw = r7780rp_outw,
170 .mv_outl = r7780rp_outl,
172 .mv_inb_p = r7780rp_inb_p,
173 .mv_inw_p = r7780rp_inw,
174 .mv_inl_p = r7780rp_inl,
175 .mv_outb_p = r7780rp_outb_p,
176 .mv_outw_p = r7780rp_outw,
177 .mv_outl_p = r7780rp_outl,
179 .mv_insb = r7780rp_insb,
180 .mv_insw = r7780rp_insw,
181 .mv_insl = r7780rp_insl,
182 .mv_outsb = r7780rp_outsb,
183 .mv_outsw = r7780rp_outsw,
184 .mv_outsl = r7780rp_outsl,
186 .mv_ioport_map = r7780rp_ioport_map,
187 .mv_init_irq = init_r7780rp_IRQ,
188 #ifdef CONFIG_HEARTBEAT
189 .mv_heartbeat = heartbeat_r7780rp,