sh: Fixup r7780rp pata_platform for devres conversion.
[linux-2.6/sactl.git] / arch / sh / boards / renesas / r7780rp / setup.c
blob0d74db9f179298fcd4c86e5333d39dcf76131082
1 /*
2 * arch/sh/boards/renesas/r7780rp/setup.c
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2005 - 2007 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
11 * for more details.
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/pata_platform.h>
16 #include <asm/machvec.h>
17 #include <asm/r7780rp.h>
18 #include <asm/clock.h>
19 #include <asm/io.h>
21 extern void init_r7780rp_IRQ(void);
23 static struct resource m66596_usb_host_resources[] = {
24 [0] = {
25 .start = 0xa4800000,
26 .end = 0xa4ffffff,
27 .flags = IORESOURCE_MEM,
29 [1] = {
30 .start = 6, /* irq number */
31 .end = 6,
32 .flags = IORESOURCE_IRQ,
36 static struct platform_device m66596_usb_host_device = {
37 .name = "m66596-hcd",
38 .id = 0,
39 .dev = {
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[] = {
48 [0] = {
49 .start = PA_AREA5_IO + 0x1000,
50 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
51 .flags = IORESOURCE_MEM,
53 [1] = {
54 .start = PA_AREA5_IO + 0x80c,
55 .end = PA_AREA5_IO + 0x80c + 0x16 - 1,
56 .flags = IORESOURCE_MEM,
58 [2] = {
59 #ifdef CONFIG_SH_R7780MP
60 .start = 1,
61 #else
62 .start = 4,
63 #endif
64 .flags = IORESOURCE_IRQ,
68 static struct pata_platform_info pata_info = {
69 .ioport_shift = 1,
72 static struct platform_device cf_ide_device = {
73 .name = "pata_platform",
74 .id = -1,
75 .num_resources = ARRAY_SIZE(cf_ide_resources),
76 .resource = cf_ide_resources,
77 .dev = {
78 .platform_data = &pata_info,
82 static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
84 static struct resource heartbeat_resources[] = {
85 [0] = {
86 .start = PA_OBLED,
87 .end = PA_OBLED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
88 .flags = IORESOURCE_MEM,
92 static struct platform_device heartbeat_device = {
93 .name = "heartbeat",
94 .id = -1,
95 .dev = {
96 .platform_data = heartbeat_bit_pos,
98 .num_resources = ARRAY_SIZE(heartbeat_resources),
99 .resource = heartbeat_resources,
102 static struct platform_device *r7780rp_devices[] __initdata = {
103 &m66596_usb_host_device,
104 &cf_ide_device,
105 &heartbeat_device,
108 static int __init r7780rp_devices_setup(void)
110 return platform_add_devices(r7780rp_devices,
111 ARRAY_SIZE(r7780rp_devices));
115 * Platform specific clocks
117 static void ivdr_clk_enable(struct clk *clk)
119 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL);
122 static void ivdr_clk_disable(struct clk *clk)
124 ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL);
127 static struct clk_ops ivdr_clk_ops = {
128 .enable = ivdr_clk_enable,
129 .disable = ivdr_clk_disable,
132 static struct clk ivdr_clk = {
133 .name = "ivdr_clk",
134 .ops = &ivdr_clk_ops,
137 static struct clk *r7780rp_clocks[] = {
138 &ivdr_clk,
141 static void r7780rp_power_off(void)
143 #ifdef CONFIG_SH_R7780MP
144 ctrl_outw(0x0001, PA_POFF);
145 #endif
149 * Initialize the board
151 static void __init r7780rp_setup(char **cmdline_p)
153 u16 ver = ctrl_inw(PA_VERREG);
154 int i;
156 device_initcall(r7780rp_devices_setup);
158 printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
160 printk(KERN_INFO "Board version: %d (revision %d), "
161 "FPGA version: %d (revision %d)\n",
162 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
163 (ver >> 4) & 0xf, ver & 0xf);
166 * Enable the important clocks right away..
168 for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
169 struct clk *clk = r7780rp_clocks[i];
171 clk_register(clk);
172 clk_enable(clk);
175 ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
176 #ifndef CONFIG_SH_R7780MP
177 ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
178 #endif
179 ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */
181 pm_power_off = r7780rp_power_off;
185 * The Machine Vector
187 struct sh_machine_vector mv_r7780rp __initmv = {
188 .mv_name = "Highlander R7780RP-1",
189 .mv_setup = r7780rp_setup,
191 .mv_nr_irqs = 109,
193 .mv_inb = r7780rp_inb,
194 .mv_inw = r7780rp_inw,
195 .mv_inl = r7780rp_inl,
196 .mv_outb = r7780rp_outb,
197 .mv_outw = r7780rp_outw,
198 .mv_outl = r7780rp_outl,
200 .mv_inb_p = r7780rp_inb_p,
201 .mv_inw_p = r7780rp_inw,
202 .mv_inl_p = r7780rp_inl,
203 .mv_outb_p = r7780rp_outb_p,
204 .mv_outw_p = r7780rp_outw,
205 .mv_outl_p = r7780rp_outl,
207 .mv_insb = r7780rp_insb,
208 .mv_insw = r7780rp_insw,
209 .mv_insl = r7780rp_insl,
210 .mv_outsb = r7780rp_outsb,
211 .mv_outsw = r7780rp_outsw,
212 .mv_outsl = r7780rp_outsl,
214 .mv_ioport_map = r7780rp_ioport_map,
215 .mv_init_irq = init_r7780rp_IRQ,
217 ALIAS_MV(r7780rp)