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 r8a66597_usb_host_resources
[] = {
26 .name
= "r8a66597_hcd",
29 .flags
= IORESOURCE_MEM
,
32 .name
= "r8a66597_hcd",
33 .start
= 11, /* irq number */
35 .flags
= IORESOURCE_IRQ
,
39 static struct platform_device r8a66597_usb_host_device
= {
40 .name
= "r8a66597_hcd",
43 .dma_mask
= NULL
, /* don't use dma */
44 .coherent_dma_mask
= 0xffffffff,
46 .num_resources
= ARRAY_SIZE(r8a66597_usb_host_resources
),
47 .resource
= r8a66597_usb_host_resources
,
50 static struct resource m66592_usb_peripheral_resources
[] = {
55 .flags
= IORESOURCE_MEM
,
59 .start
= 9, /* irq number */
61 .flags
= IORESOURCE_IRQ
,
65 static struct platform_device m66592_usb_peripheral_device
= {
69 .dma_mask
= NULL
, /* don't use dma */
70 .coherent_dma_mask
= 0xffffffff,
72 .num_resources
= ARRAY_SIZE(m66592_usb_peripheral_resources
),
73 .resource
= m66592_usb_peripheral_resources
,
76 static struct resource cf_ide_resources
[] = {
78 .start
= PA_AREA5_IO
+ 0x1000,
79 .end
= PA_AREA5_IO
+ 0x1000 + 0x08 - 1,
80 .flags
= IORESOURCE_MEM
,
83 .start
= PA_AREA5_IO
+ 0x80c,
84 .end
= PA_AREA5_IO
+ 0x80c + 0x16 - 1,
85 .flags
= IORESOURCE_MEM
,
88 #ifdef CONFIG_SH_R7780RP
93 .flags
= IORESOURCE_IRQ
,
97 static struct pata_platform_info pata_info
= {
101 static struct platform_device cf_ide_device
= {
102 .name
= "pata_platform",
104 .num_resources
= ARRAY_SIZE(cf_ide_resources
),
105 .resource
= cf_ide_resources
,
107 .platform_data
= &pata_info
,
111 static unsigned char heartbeat_bit_pos
[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
113 static struct resource heartbeat_resources
[] = {
116 .end
= PA_OBLED
+ ARRAY_SIZE(heartbeat_bit_pos
) - 1,
117 .flags
= IORESOURCE_MEM
,
121 static struct platform_device heartbeat_device
= {
125 /* R7785RP has a slightly more sensible FPGA.. */
126 #ifndef CONFIG_SH_R7785RP
128 .platform_data
= heartbeat_bit_pos
,
131 .num_resources
= ARRAY_SIZE(heartbeat_resources
),
132 .resource
= heartbeat_resources
,
135 static struct platform_device
*r7780rp_devices
[] __initdata
= {
136 &r8a66597_usb_host_device
,
137 &m66592_usb_peripheral_device
,
142 static int __init
r7780rp_devices_setup(void)
144 return platform_add_devices(r7780rp_devices
,
145 ARRAY_SIZE(r7780rp_devices
));
147 device_initcall(r7780rp_devices_setup
);
150 * Platform specific clocks
152 static void ivdr_clk_enable(struct clk
*clk
)
154 ctrl_outw(ctrl_inw(PA_IVDRCTL
) | (1 << IVDR_CK_ON
), PA_IVDRCTL
);
157 static void ivdr_clk_disable(struct clk
*clk
)
159 ctrl_outw(ctrl_inw(PA_IVDRCTL
) & ~(1 << IVDR_CK_ON
), PA_IVDRCTL
);
162 static struct clk_ops ivdr_clk_ops
= {
163 .enable
= ivdr_clk_enable
,
164 .disable
= ivdr_clk_disable
,
167 static struct clk ivdr_clk
= {
169 .ops
= &ivdr_clk_ops
,
172 static struct clk
*r7780rp_clocks
[] = {
176 static void r7780rp_power_off(void)
178 if (mach_is_r7780mp() || mach_is_r7785rp())
179 ctrl_outw(0x0001, PA_POFF
);
183 * Initialize the board
185 static void __init
highlander_setup(char **cmdline_p
)
187 u16 ver
= ctrl_inw(PA_VERREG
);
190 printk(KERN_INFO
"Renesas Solutions Highlander %s support.\n",
191 mach_is_r7780rp() ? "R7780RP-1" :
192 mach_is_r7780mp() ? "R7780MP" :
195 printk(KERN_INFO
"Board version: %d (revision %d), "
196 "FPGA version: %d (revision %d)\n",
197 (ver
>> 12) & 0xf, (ver
>> 8) & 0xf,
198 (ver
>> 4) & 0xf, ver
& 0xf);
201 * Enable the important clocks right away..
203 for (i
= 0; i
< ARRAY_SIZE(r7780rp_clocks
); i
++) {
204 struct clk
*clk
= r7780rp_clocks
[i
];
210 ctrl_outw(0x0000, PA_OBLED
); /* Clear LED. */
212 if (mach_is_r7780rp())
213 ctrl_outw(0x0001, PA_SDPOW
); /* SD Power ON */
215 ctrl_outw(ctrl_inw(PA_IVDRCTL
) | 0x01, PA_IVDRCTL
); /* Si13112 */
217 pm_power_off
= r7780rp_power_off
;
223 static struct sh_machine_vector mv_highlander __initmv
= {
224 .mv_name
= "Highlander",
226 .mv_setup
= highlander_setup
,
227 .mv_init_irq
= highlander_init_irq
,