Commit | Line | Data |
---|---|---|
5283ecb5 PM |
1 | /* |
2 | * arch/sh/boards/renesas/r7780rp/setup.c | |
3 | * | |
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | |
5 | * Copyright (C) 2005, 2006 Paul Mundt | |
6 | * | |
7 | * Renesas Solutions Highlander R7780RP-1 Support. | |
8 | * | |
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. | |
12 | */ | |
13 | #include <linux/init.h> | |
14 | #include <linux/platform_device.h> | |
15 | #include <asm/machvec.h> | |
16 | #include <asm/r7780rp/r7780rp.h> | |
17 | #include <asm/clock.h> | |
18 | #include <asm/io.h> | |
19 | ||
20 | extern void heartbeat_r7780rp(void); | |
21 | extern void init_r7780rp_IRQ(void); | |
22 | ||
23 | /* | |
24 | * The Machine Vector | |
25 | */ | |
26 | struct sh_machine_vector mv_r7780rp __initmv = { | |
27 | .mv_nr_irqs = 109, | |
28 | ||
29 | .mv_inb = r7780rp_inb, | |
30 | .mv_inw = r7780rp_inw, | |
31 | .mv_inl = r7780rp_inl, | |
32 | .mv_outb = r7780rp_outb, | |
33 | .mv_outw = r7780rp_outw, | |
34 | .mv_outl = r7780rp_outl, | |
35 | ||
36 | .mv_inb_p = r7780rp_inb_p, | |
37 | .mv_inw_p = r7780rp_inw, | |
38 | .mv_inl_p = r7780rp_inl, | |
39 | .mv_outb_p = r7780rp_outb_p, | |
40 | .mv_outw_p = r7780rp_outw, | |
41 | .mv_outl_p = r7780rp_outl, | |
42 | ||
43 | .mv_insb = r7780rp_insb, | |
44 | .mv_insw = r7780rp_insw, | |
45 | .mv_insl = r7780rp_insl, | |
46 | .mv_outsb = r7780rp_outsb, | |
47 | .mv_outsw = r7780rp_outsw, | |
48 | .mv_outsl = r7780rp_outsl, | |
49 | ||
50 | .mv_ioport_map = r7780rp_ioport_map, | |
51 | .mv_init_irq = init_r7780rp_IRQ, | |
52 | #ifdef CONFIG_HEARTBEAT | |
53 | .mv_heartbeat = heartbeat_r7780rp, | |
54 | #endif | |
55 | }; | |
56 | ALIAS_MV(r7780rp) | |
57 | ||
58 | static struct resource m66596_usb_host_resources[] = { | |
59 | [0] = { | |
60 | .start = 0xa4800000, | |
61 | .end = 0xa4ffffff, | |
62 | .flags = IORESOURCE_MEM, | |
63 | }, | |
64 | [1] = { | |
65 | .start = 6, /* irq number */ | |
66 | .end = 6, | |
67 | .flags = IORESOURCE_IRQ, | |
68 | }, | |
69 | }; | |
70 | ||
71 | static struct platform_device m66596_usb_host_device = { | |
72 | .name = "m66596-hcd", | |
73 | .id = 0, | |
74 | .dev = { | |
75 | .dma_mask = NULL, /* don't use dma */ | |
76 | .coherent_dma_mask = 0xffffffff, | |
77 | }, | |
78 | .num_resources = ARRAY_SIZE(m66596_usb_host_resources), | |
79 | .resource = m66596_usb_host_resources, | |
80 | }; | |
81 | ||
82 | static struct platform_device *r7780rp_devices[] __initdata = { | |
83 | &m66596_usb_host_device, | |
84 | }; | |
85 | ||
86 | static int __init r7780rp_devices_setup(void) | |
87 | { | |
88 | return platform_add_devices(r7780rp_devices, | |
89 | ARRAY_SIZE(r7780rp_devices)); | |
90 | } | |
91 | __initcall(r7780rp_devices_setup); | |
92 | ||
93 | /* | |
94 | * Platform specific clocks | |
95 | */ | |
96 | static void ivdr_clk_enable(struct clk *clk) | |
97 | { | |
98 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL); | |
99 | } | |
100 | ||
101 | static void ivdr_clk_disable(struct clk *clk) | |
102 | { | |
103 | ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL); | |
104 | } | |
105 | ||
106 | static struct clk_ops ivdr_clk_ops = { | |
107 | .enable = ivdr_clk_enable, | |
108 | .disable = ivdr_clk_disable, | |
109 | }; | |
110 | ||
111 | static struct clk ivdr_clk = { | |
112 | .name = "ivdr_clk", | |
113 | .ops = &ivdr_clk_ops, | |
114 | }; | |
115 | ||
116 | static struct clk *r7780rp_clocks[] = { | |
117 | &ivdr_clk, | |
118 | }; | |
119 | ||
120 | const char *get_system_type(void) | |
121 | { | |
122 | return "Highlander R7780RP-1"; | |
123 | } | |
124 | ||
125 | static void r7780rp_power_off(void) | |
126 | { | |
127 | #ifdef CONFIG_SH_R7780MP | |
128 | ctrl_outw(0x0001, PA_POFF); | |
129 | #endif | |
130 | } | |
131 | ||
132 | /* | |
133 | * Initialize the board | |
134 | */ | |
135 | void __init platform_setup(void) | |
136 | { | |
137 | u16 ver = ctrl_inw(PA_VERREG); | |
138 | int i; | |
139 | ||
140 | printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n"); | |
141 | ||
142 | printk(KERN_INFO "Board version: %d (revision %d), " | |
143 | "FPGA version: %d (revision %d)\n", | |
144 | (ver >> 12) & 0xf, (ver >> 8) & 0xf, | |
145 | (ver >> 4) & 0xf, ver & 0xf); | |
146 | ||
147 | /* | |
148 | * Enable the important clocks right away.. | |
149 | */ | |
150 | for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) { | |
151 | struct clk *clk = r7780rp_clocks[i]; | |
152 | ||
153 | clk_register(clk); | |
154 | clk_enable(clk); | |
155 | } | |
156 | ||
157 | ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */ | |
158 | #ifndef CONFIG_SH_R7780MP | |
159 | ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */ | |
160 | #endif | |
161 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x0100, PA_IVDRCTL); /* Si13112 */ | |
162 | ||
163 | pm_power_off = r7780rp_power_off; | |
164 | } |