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 init_r7780rp_IRQ(void);
22 static struct resource m66596_usb_host_resources[] = {
26 .flags = IORESOURCE_MEM,
29 .start = 6, /* irq number */
31 .flags = IORESOURCE_IRQ,
35 static struct platform_device m66596_usb_host_device = {
39 .dma_mask = NULL, /* don't use dma */
40 .coherent_dma_mask = 0xffffffff,
42 .num_resources = ARRAY_SIZE(m66596_usb_host_resources),
43 .resource = m66596_usb_host_resources,
46 static struct resource cf_ide_resources[] = {
50 .flags = IORESOURCE_IO,
53 .start = 0x1f0 + 0x206,
54 .end = 0x1f0 + 8 + 0x206 + 8,
55 .flags = IORESOURCE_IO,
58 #ifdef CONFIG_SH_R7780MP
63 .flags = IORESOURCE_IRQ,
67 static struct platform_device cf_ide_device = {
68 .name = "pata_platform",
70 .num_resources = ARRAY_SIZE(cf_ide_resources),
71 .resource = cf_ide_resources,
74 static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
76 static struct resource heartbeat_resources[] = {
79 .end = PA_OBLED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
80 .flags = IORESOURCE_MEM,
84 static struct platform_device heartbeat_device = {
88 .platform_data = heartbeat_bit_pos,
90 .num_resources = ARRAY_SIZE(heartbeat_resources),
91 .resource = heartbeat_resources,
94 static struct platform_device *r7780rp_devices[] __initdata = {
95 &m66596_usb_host_device,
100 static int __init r7780rp_devices_setup(void)
102 return platform_add_devices(r7780rp_devices,
103 ARRAY_SIZE(r7780rp_devices));
107 * Platform specific clocks
109 static void ivdr_clk_enable(struct clk *clk)
111 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL);
114 static void ivdr_clk_disable(struct clk *clk)
116 ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL);
119 static struct clk_ops ivdr_clk_ops = {
120 .enable = ivdr_clk_enable,
121 .disable = ivdr_clk_disable,
124 static struct clk ivdr_clk = {
126 .ops = &ivdr_clk_ops,
129 static struct clk *r7780rp_clocks[] = {
133 static void r7780rp_power_off(void)
135 #ifdef CONFIG_SH_R7780MP
136 ctrl_outw(0x0001, PA_POFF);
141 * Initialize the board
143 static void __init r7780rp_setup(char **cmdline_p)
145 u16 ver = ctrl_inw(PA_VERREG);
148 device_initcall(r7780rp_devices_setup);
150 printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
152 printk(KERN_INFO "Board version: %d (revision %d), "
153 "FPGA version: %d (revision %d)\n",
154 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
155 (ver >> 4) & 0xf, ver & 0xf);
158 * Enable the important clocks right away..
160 for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
161 struct clk *clk = r7780rp_clocks[i];
167 ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
168 #ifndef CONFIG_SH_R7780MP
169 ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
171 ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */
173 pm_power_off = r7780rp_power_off;
179 struct sh_machine_vector mv_r7780rp __initmv = {
180 .mv_name = "Highlander R7780RP-1",
181 .mv_setup = r7780rp_setup,
185 .mv_inb = r7780rp_inb,
186 .mv_inw = r7780rp_inw,
187 .mv_inl = r7780rp_inl,
188 .mv_outb = r7780rp_outb,
189 .mv_outw = r7780rp_outw,
190 .mv_outl = r7780rp_outl,
192 .mv_inb_p = r7780rp_inb_p,
193 .mv_inw_p = r7780rp_inw,
194 .mv_inl_p = r7780rp_inl,
195 .mv_outb_p = r7780rp_outb_p,
196 .mv_outw_p = r7780rp_outw,
197 .mv_outl_p = r7780rp_outl,
199 .mv_insb = r7780rp_insb,
200 .mv_insw = r7780rp_insw,
201 .mv_insl = r7780rp_insl,
202 .mv_outsb = r7780rp_outsb,
203 .mv_outsw = r7780rp_outsw,
204 .mv_outsl = r7780rp_outsl,
206 .mv_ioport_map = r7780rp_ioport_map,
207 .mv_init_irq = init_r7780rp_IRQ,