Commit 6e03db2ba17b5d32431b4c2012e6a41153318a90
Exists in
master
and in
38 other branches
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: ARM: OMAP3: fix build on !CONFIG_IOMMU_API
Showing 1 changed file Inline Diff
arch/arm/mach-omap2/devices.c
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-omap2/devices.c | 2 | * linux/arch/arm/mach-omap2/devices.c |
3 | * | 3 | * |
4 | * OMAP2 platform device setup/initialization | 4 | * OMAP2 platform device setup/initialization |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | #include <linux/gpio.h> | 11 | #include <linux/gpio.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | 20 | ||
21 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
22 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
23 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
24 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
25 | #include <asm/pmu.h> | 25 | #include <asm/pmu.h> |
26 | 26 | ||
27 | #include <plat/tc.h> | 27 | #include <plat/tc.h> |
28 | #include <plat/board.h> | 28 | #include <plat/board.h> |
29 | #include <plat/mcbsp.h> | 29 | #include <plat/mcbsp.h> |
30 | #include <plat/mmc.h> | 30 | #include <plat/mmc.h> |
31 | #include <plat/iommu.h> | ||
32 | #include <plat/dma.h> | 31 | #include <plat/dma.h> |
33 | #include <plat/omap_hwmod.h> | 32 | #include <plat/omap_hwmod.h> |
34 | #include <plat/omap_device.h> | 33 | #include <plat/omap_device.h> |
35 | #include <plat/omap4-keypad.h> | 34 | #include <plat/omap4-keypad.h> |
36 | 35 | ||
37 | #include "mux.h" | 36 | #include "mux.h" |
38 | #include "control.h" | 37 | #include "control.h" |
39 | #include "devices.h" | 38 | #include "devices.h" |
40 | 39 | ||
41 | #define L3_MODULES_MAX_LEN 12 | 40 | #define L3_MODULES_MAX_LEN 12 |
42 | #define L3_MODULES 3 | 41 | #define L3_MODULES 3 |
43 | 42 | ||
44 | static int __init omap3_l3_init(void) | 43 | static int __init omap3_l3_init(void) |
45 | { | 44 | { |
46 | int l; | 45 | int l; |
47 | struct omap_hwmod *oh; | 46 | struct omap_hwmod *oh; |
48 | struct platform_device *pdev; | 47 | struct platform_device *pdev; |
49 | char oh_name[L3_MODULES_MAX_LEN]; | 48 | char oh_name[L3_MODULES_MAX_LEN]; |
50 | 49 | ||
51 | /* | 50 | /* |
52 | * To avoid code running on other OMAPs in | 51 | * To avoid code running on other OMAPs in |
53 | * multi-omap builds | 52 | * multi-omap builds |
54 | */ | 53 | */ |
55 | if (!(cpu_is_omap34xx())) | 54 | if (!(cpu_is_omap34xx())) |
56 | return -ENODEV; | 55 | return -ENODEV; |
57 | 56 | ||
58 | l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); | 57 | l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); |
59 | 58 | ||
60 | oh = omap_hwmod_lookup(oh_name); | 59 | oh = omap_hwmod_lookup(oh_name); |
61 | 60 | ||
62 | if (!oh) | 61 | if (!oh) |
63 | pr_err("could not look up %s\n", oh_name); | 62 | pr_err("could not look up %s\n", oh_name); |
64 | 63 | ||
65 | pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, | 64 | pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, |
66 | NULL, 0, 0); | 65 | NULL, 0, 0); |
67 | 66 | ||
68 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); | 67 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
69 | 68 | ||
70 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; | 69 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; |
71 | } | 70 | } |
72 | postcore_initcall(omap3_l3_init); | 71 | postcore_initcall(omap3_l3_init); |
73 | 72 | ||
74 | static int __init omap4_l3_init(void) | 73 | static int __init omap4_l3_init(void) |
75 | { | 74 | { |
76 | int l, i; | 75 | int l, i; |
77 | struct omap_hwmod *oh[3]; | 76 | struct omap_hwmod *oh[3]; |
78 | struct platform_device *pdev; | 77 | struct platform_device *pdev; |
79 | char oh_name[L3_MODULES_MAX_LEN]; | 78 | char oh_name[L3_MODULES_MAX_LEN]; |
80 | 79 | ||
81 | /* If dtb is there, the devices will be created dynamically */ | 80 | /* If dtb is there, the devices will be created dynamically */ |
82 | if (of_have_populated_dt()) | 81 | if (of_have_populated_dt()) |
83 | return -ENODEV; | 82 | return -ENODEV; |
84 | 83 | ||
85 | /* | 84 | /* |
86 | * To avoid code running on other OMAPs in | 85 | * To avoid code running on other OMAPs in |
87 | * multi-omap builds | 86 | * multi-omap builds |
88 | */ | 87 | */ |
89 | if (!(cpu_is_omap44xx())) | 88 | if (!(cpu_is_omap44xx())) |
90 | return -ENODEV; | 89 | return -ENODEV; |
91 | 90 | ||
92 | for (i = 0; i < L3_MODULES; i++) { | 91 | for (i = 0; i < L3_MODULES; i++) { |
93 | l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1); | 92 | l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1); |
94 | 93 | ||
95 | oh[i] = omap_hwmod_lookup(oh_name); | 94 | oh[i] = omap_hwmod_lookup(oh_name); |
96 | if (!(oh[i])) | 95 | if (!(oh[i])) |
97 | pr_err("could not look up %s\n", oh_name); | 96 | pr_err("could not look up %s\n", oh_name); |
98 | } | 97 | } |
99 | 98 | ||
100 | pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, | 99 | pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, |
101 | 0, NULL, 0, 0); | 100 | 0, NULL, 0, 0); |
102 | 101 | ||
103 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); | 102 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
104 | 103 | ||
105 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; | 104 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; |
106 | } | 105 | } |
107 | postcore_initcall(omap4_l3_init); | 106 | postcore_initcall(omap4_l3_init); |
108 | 107 | ||
109 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) | 108 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) |
110 | 109 | ||
111 | static struct resource omap2cam_resources[] = { | 110 | static struct resource omap2cam_resources[] = { |
112 | { | 111 | { |
113 | .start = OMAP24XX_CAMERA_BASE, | 112 | .start = OMAP24XX_CAMERA_BASE, |
114 | .end = OMAP24XX_CAMERA_BASE + 0xfff, | 113 | .end = OMAP24XX_CAMERA_BASE + 0xfff, |
115 | .flags = IORESOURCE_MEM, | 114 | .flags = IORESOURCE_MEM, |
116 | }, | 115 | }, |
117 | { | 116 | { |
118 | .start = INT_24XX_CAM_IRQ, | 117 | .start = INT_24XX_CAM_IRQ, |
119 | .flags = IORESOURCE_IRQ, | 118 | .flags = IORESOURCE_IRQ, |
120 | } | 119 | } |
121 | }; | 120 | }; |
122 | 121 | ||
123 | static struct platform_device omap2cam_device = { | 122 | static struct platform_device omap2cam_device = { |
124 | .name = "omap24xxcam", | 123 | .name = "omap24xxcam", |
125 | .id = -1, | 124 | .id = -1, |
126 | .num_resources = ARRAY_SIZE(omap2cam_resources), | 125 | .num_resources = ARRAY_SIZE(omap2cam_resources), |
127 | .resource = omap2cam_resources, | 126 | .resource = omap2cam_resources, |
128 | }; | 127 | }; |
129 | #endif | 128 | #endif |
130 | 129 | ||
130 | #if defined(CONFIG_IOMMU_API) | ||
131 | |||
132 | #include <plat/iommu.h> | ||
133 | |||
131 | static struct resource omap3isp_resources[] = { | 134 | static struct resource omap3isp_resources[] = { |
132 | { | 135 | { |
133 | .start = OMAP3430_ISP_BASE, | 136 | .start = OMAP3430_ISP_BASE, |
134 | .end = OMAP3430_ISP_END, | 137 | .end = OMAP3430_ISP_END, |
135 | .flags = IORESOURCE_MEM, | 138 | .flags = IORESOURCE_MEM, |
136 | }, | 139 | }, |
137 | { | 140 | { |
138 | .start = OMAP3430_ISP_CCP2_BASE, | 141 | .start = OMAP3430_ISP_CCP2_BASE, |
139 | .end = OMAP3430_ISP_CCP2_END, | 142 | .end = OMAP3430_ISP_CCP2_END, |
140 | .flags = IORESOURCE_MEM, | 143 | .flags = IORESOURCE_MEM, |
141 | }, | 144 | }, |
142 | { | 145 | { |
143 | .start = OMAP3430_ISP_CCDC_BASE, | 146 | .start = OMAP3430_ISP_CCDC_BASE, |
144 | .end = OMAP3430_ISP_CCDC_END, | 147 | .end = OMAP3430_ISP_CCDC_END, |
145 | .flags = IORESOURCE_MEM, | 148 | .flags = IORESOURCE_MEM, |
146 | }, | 149 | }, |
147 | { | 150 | { |
148 | .start = OMAP3430_ISP_HIST_BASE, | 151 | .start = OMAP3430_ISP_HIST_BASE, |
149 | .end = OMAP3430_ISP_HIST_END, | 152 | .end = OMAP3430_ISP_HIST_END, |
150 | .flags = IORESOURCE_MEM, | 153 | .flags = IORESOURCE_MEM, |
151 | }, | 154 | }, |
152 | { | 155 | { |
153 | .start = OMAP3430_ISP_H3A_BASE, | 156 | .start = OMAP3430_ISP_H3A_BASE, |
154 | .end = OMAP3430_ISP_H3A_END, | 157 | .end = OMAP3430_ISP_H3A_END, |
155 | .flags = IORESOURCE_MEM, | 158 | .flags = IORESOURCE_MEM, |
156 | }, | 159 | }, |
157 | { | 160 | { |
158 | .start = OMAP3430_ISP_PREV_BASE, | 161 | .start = OMAP3430_ISP_PREV_BASE, |
159 | .end = OMAP3430_ISP_PREV_END, | 162 | .end = OMAP3430_ISP_PREV_END, |
160 | .flags = IORESOURCE_MEM, | 163 | .flags = IORESOURCE_MEM, |
161 | }, | 164 | }, |
162 | { | 165 | { |
163 | .start = OMAP3430_ISP_RESZ_BASE, | 166 | .start = OMAP3430_ISP_RESZ_BASE, |
164 | .end = OMAP3430_ISP_RESZ_END, | 167 | .end = OMAP3430_ISP_RESZ_END, |
165 | .flags = IORESOURCE_MEM, | 168 | .flags = IORESOURCE_MEM, |
166 | }, | 169 | }, |
167 | { | 170 | { |
168 | .start = OMAP3430_ISP_SBL_BASE, | 171 | .start = OMAP3430_ISP_SBL_BASE, |
169 | .end = OMAP3430_ISP_SBL_END, | 172 | .end = OMAP3430_ISP_SBL_END, |
170 | .flags = IORESOURCE_MEM, | 173 | .flags = IORESOURCE_MEM, |
171 | }, | 174 | }, |
172 | { | 175 | { |
173 | .start = OMAP3430_ISP_CSI2A_REGS1_BASE, | 176 | .start = OMAP3430_ISP_CSI2A_REGS1_BASE, |
174 | .end = OMAP3430_ISP_CSI2A_REGS1_END, | 177 | .end = OMAP3430_ISP_CSI2A_REGS1_END, |
175 | .flags = IORESOURCE_MEM, | 178 | .flags = IORESOURCE_MEM, |
176 | }, | 179 | }, |
177 | { | 180 | { |
178 | .start = OMAP3430_ISP_CSIPHY2_BASE, | 181 | .start = OMAP3430_ISP_CSIPHY2_BASE, |
179 | .end = OMAP3430_ISP_CSIPHY2_END, | 182 | .end = OMAP3430_ISP_CSIPHY2_END, |
180 | .flags = IORESOURCE_MEM, | 183 | .flags = IORESOURCE_MEM, |
181 | }, | 184 | }, |
182 | { | 185 | { |
183 | .start = OMAP3630_ISP_CSI2A_REGS2_BASE, | 186 | .start = OMAP3630_ISP_CSI2A_REGS2_BASE, |
184 | .end = OMAP3630_ISP_CSI2A_REGS2_END, | 187 | .end = OMAP3630_ISP_CSI2A_REGS2_END, |
185 | .flags = IORESOURCE_MEM, | 188 | .flags = IORESOURCE_MEM, |
186 | }, | 189 | }, |
187 | { | 190 | { |
188 | .start = OMAP3630_ISP_CSI2C_REGS1_BASE, | 191 | .start = OMAP3630_ISP_CSI2C_REGS1_BASE, |
189 | .end = OMAP3630_ISP_CSI2C_REGS1_END, | 192 | .end = OMAP3630_ISP_CSI2C_REGS1_END, |
190 | .flags = IORESOURCE_MEM, | 193 | .flags = IORESOURCE_MEM, |
191 | }, | 194 | }, |
192 | { | 195 | { |
193 | .start = OMAP3630_ISP_CSIPHY1_BASE, | 196 | .start = OMAP3630_ISP_CSIPHY1_BASE, |
194 | .end = OMAP3630_ISP_CSIPHY1_END, | 197 | .end = OMAP3630_ISP_CSIPHY1_END, |
195 | .flags = IORESOURCE_MEM, | 198 | .flags = IORESOURCE_MEM, |
196 | }, | 199 | }, |
197 | { | 200 | { |
198 | .start = OMAP3630_ISP_CSI2C_REGS2_BASE, | 201 | .start = OMAP3630_ISP_CSI2C_REGS2_BASE, |
199 | .end = OMAP3630_ISP_CSI2C_REGS2_END, | 202 | .end = OMAP3630_ISP_CSI2C_REGS2_END, |
200 | .flags = IORESOURCE_MEM, | 203 | .flags = IORESOURCE_MEM, |
201 | }, | 204 | }, |
202 | { | 205 | { |
203 | .start = INT_34XX_CAM_IRQ, | 206 | .start = INT_34XX_CAM_IRQ, |
204 | .flags = IORESOURCE_IRQ, | 207 | .flags = IORESOURCE_IRQ, |
205 | } | 208 | } |
206 | }; | 209 | }; |
207 | 210 | ||
208 | static struct platform_device omap3isp_device = { | 211 | static struct platform_device omap3isp_device = { |
209 | .name = "omap3isp", | 212 | .name = "omap3isp", |
210 | .id = -1, | 213 | .id = -1, |
211 | .num_resources = ARRAY_SIZE(omap3isp_resources), | 214 | .num_resources = ARRAY_SIZE(omap3isp_resources), |
212 | .resource = omap3isp_resources, | 215 | .resource = omap3isp_resources, |
213 | }; | 216 | }; |
214 | 217 | ||
215 | static struct omap_iommu_arch_data omap3_isp_iommu = { | 218 | static struct omap_iommu_arch_data omap3_isp_iommu = { |
216 | .name = "isp", | 219 | .name = "isp", |
217 | }; | 220 | }; |
218 | 221 | ||
219 | int omap3_init_camera(struct isp_platform_data *pdata) | 222 | int omap3_init_camera(struct isp_platform_data *pdata) |
220 | { | 223 | { |
221 | omap3isp_device.dev.platform_data = pdata; | 224 | omap3isp_device.dev.platform_data = pdata; |
222 | omap3isp_device.dev.archdata.iommu = &omap3_isp_iommu; | 225 | omap3isp_device.dev.archdata.iommu = &omap3_isp_iommu; |
223 | 226 | ||
224 | return platform_device_register(&omap3isp_device); | 227 | return platform_device_register(&omap3isp_device); |
225 | } | 228 | } |
229 | |||
230 | #else /* !CONFIG_IOMMU_API */ | ||
231 | |||
232 | int omap3_init_camera(struct isp_platform_data *pdata) | ||
233 | { | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | #endif | ||
226 | 238 | ||
227 | static inline void omap_init_camera(void) | 239 | static inline void omap_init_camera(void) |
228 | { | 240 | { |
229 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) | 241 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) |
230 | if (cpu_is_omap24xx()) | 242 | if (cpu_is_omap24xx()) |
231 | platform_device_register(&omap2cam_device); | 243 | platform_device_register(&omap2cam_device); |
232 | #endif | 244 | #endif |
233 | } | 245 | } |
234 | 246 | ||
235 | int __init omap4_keyboard_init(struct omap4_keypad_platform_data | 247 | int __init omap4_keyboard_init(struct omap4_keypad_platform_data |
236 | *sdp4430_keypad_data, struct omap_board_data *bdata) | 248 | *sdp4430_keypad_data, struct omap_board_data *bdata) |
237 | { | 249 | { |
238 | struct platform_device *pdev; | 250 | struct platform_device *pdev; |
239 | struct omap_hwmod *oh; | 251 | struct omap_hwmod *oh; |
240 | struct omap4_keypad_platform_data *keypad_data; | 252 | struct omap4_keypad_platform_data *keypad_data; |
241 | unsigned int id = -1; | 253 | unsigned int id = -1; |
242 | char *oh_name = "kbd"; | 254 | char *oh_name = "kbd"; |
243 | char *name = "omap4-keypad"; | 255 | char *name = "omap4-keypad"; |
244 | 256 | ||
245 | oh = omap_hwmod_lookup(oh_name); | 257 | oh = omap_hwmod_lookup(oh_name); |
246 | if (!oh) { | 258 | if (!oh) { |
247 | pr_err("Could not look up %s\n", oh_name); | 259 | pr_err("Could not look up %s\n", oh_name); |
248 | return -ENODEV; | 260 | return -ENODEV; |
249 | } | 261 | } |
250 | 262 | ||
251 | keypad_data = sdp4430_keypad_data; | 263 | keypad_data = sdp4430_keypad_data; |
252 | 264 | ||
253 | pdev = omap_device_build(name, id, oh, keypad_data, | 265 | pdev = omap_device_build(name, id, oh, keypad_data, |
254 | sizeof(struct omap4_keypad_platform_data), NULL, 0, 0); | 266 | sizeof(struct omap4_keypad_platform_data), NULL, 0, 0); |
255 | 267 | ||
256 | if (IS_ERR(pdev)) { | 268 | if (IS_ERR(pdev)) { |
257 | WARN(1, "Can't build omap_device for %s:%s.\n", | 269 | WARN(1, "Can't build omap_device for %s:%s.\n", |
258 | name, oh->name); | 270 | name, oh->name); |
259 | return PTR_ERR(pdev); | 271 | return PTR_ERR(pdev); |
260 | } | 272 | } |
261 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); | 273 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); |
262 | 274 | ||
263 | return 0; | 275 | return 0; |
264 | } | 276 | } |
265 | 277 | ||
266 | #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) | 278 | #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) |
267 | static inline void omap_init_mbox(void) | 279 | static inline void omap_init_mbox(void) |
268 | { | 280 | { |
269 | struct omap_hwmod *oh; | 281 | struct omap_hwmod *oh; |
270 | struct platform_device *pdev; | 282 | struct platform_device *pdev; |
271 | 283 | ||
272 | oh = omap_hwmod_lookup("mailbox"); | 284 | oh = omap_hwmod_lookup("mailbox"); |
273 | if (!oh) { | 285 | if (!oh) { |
274 | pr_err("%s: unable to find hwmod\n", __func__); | 286 | pr_err("%s: unable to find hwmod\n", __func__); |
275 | return; | 287 | return; |
276 | } | 288 | } |
277 | 289 | ||
278 | pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0); | 290 | pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0); |
279 | WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", | 291 | WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", |
280 | __func__, PTR_ERR(pdev)); | 292 | __func__, PTR_ERR(pdev)); |
281 | } | 293 | } |
282 | #else | 294 | #else |
283 | static inline void omap_init_mbox(void) { } | 295 | static inline void omap_init_mbox(void) { } |
284 | #endif /* CONFIG_OMAP_MBOX_FWK */ | 296 | #endif /* CONFIG_OMAP_MBOX_FWK */ |
285 | 297 | ||
286 | static inline void omap_init_sti(void) {} | 298 | static inline void omap_init_sti(void) {} |
287 | 299 | ||
288 | #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) | 300 | #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) |
289 | 301 | ||
290 | static struct platform_device omap_pcm = { | 302 | static struct platform_device omap_pcm = { |
291 | .name = "omap-pcm-audio", | 303 | .name = "omap-pcm-audio", |
292 | .id = -1, | 304 | .id = -1, |
293 | }; | 305 | }; |
294 | 306 | ||
295 | /* | 307 | /* |
296 | * OMAP2420 has 2 McBSP ports | 308 | * OMAP2420 has 2 McBSP ports |
297 | * OMAP2430 has 5 McBSP ports | 309 | * OMAP2430 has 5 McBSP ports |
298 | * OMAP3 has 5 McBSP ports | 310 | * OMAP3 has 5 McBSP ports |
299 | * OMAP4 has 4 McBSP ports | 311 | * OMAP4 has 4 McBSP ports |
300 | */ | 312 | */ |
301 | OMAP_MCBSP_PLATFORM_DEVICE(1); | 313 | OMAP_MCBSP_PLATFORM_DEVICE(1); |
302 | OMAP_MCBSP_PLATFORM_DEVICE(2); | 314 | OMAP_MCBSP_PLATFORM_DEVICE(2); |
303 | OMAP_MCBSP_PLATFORM_DEVICE(3); | 315 | OMAP_MCBSP_PLATFORM_DEVICE(3); |
304 | OMAP_MCBSP_PLATFORM_DEVICE(4); | 316 | OMAP_MCBSP_PLATFORM_DEVICE(4); |
305 | OMAP_MCBSP_PLATFORM_DEVICE(5); | 317 | OMAP_MCBSP_PLATFORM_DEVICE(5); |
306 | 318 | ||
307 | static void omap_init_audio(void) | 319 | static void omap_init_audio(void) |
308 | { | 320 | { |
309 | platform_device_register(&omap_mcbsp1); | 321 | platform_device_register(&omap_mcbsp1); |
310 | platform_device_register(&omap_mcbsp2); | 322 | platform_device_register(&omap_mcbsp2); |
311 | if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) { | 323 | if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) { |
312 | platform_device_register(&omap_mcbsp3); | 324 | platform_device_register(&omap_mcbsp3); |
313 | platform_device_register(&omap_mcbsp4); | 325 | platform_device_register(&omap_mcbsp4); |
314 | } | 326 | } |
315 | if (cpu_is_omap243x() || cpu_is_omap34xx()) | 327 | if (cpu_is_omap243x() || cpu_is_omap34xx()) |
316 | platform_device_register(&omap_mcbsp5); | 328 | platform_device_register(&omap_mcbsp5); |
317 | 329 | ||
318 | platform_device_register(&omap_pcm); | 330 | platform_device_register(&omap_pcm); |
319 | } | 331 | } |
320 | 332 | ||
321 | #else | 333 | #else |
322 | static inline void omap_init_audio(void) {} | 334 | static inline void omap_init_audio(void) {} |
323 | #endif | 335 | #endif |
324 | 336 | ||
325 | #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ | 337 | #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ |
326 | defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) | 338 | defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) |
327 | 339 | ||
328 | static void omap_init_mcpdm(void) | 340 | static void omap_init_mcpdm(void) |
329 | { | 341 | { |
330 | struct omap_hwmod *oh; | 342 | struct omap_hwmod *oh; |
331 | struct platform_device *pdev; | 343 | struct platform_device *pdev; |
332 | 344 | ||
333 | oh = omap_hwmod_lookup("mcpdm"); | 345 | oh = omap_hwmod_lookup("mcpdm"); |
334 | if (!oh) { | 346 | if (!oh) { |
335 | printk(KERN_ERR "Could not look up mcpdm hw_mod\n"); | 347 | printk(KERN_ERR "Could not look up mcpdm hw_mod\n"); |
336 | return; | 348 | return; |
337 | } | 349 | } |
338 | 350 | ||
339 | pdev = omap_device_build("omap-mcpdm", -1, oh, NULL, 0, NULL, 0, 0); | 351 | pdev = omap_device_build("omap-mcpdm", -1, oh, NULL, 0, NULL, 0, 0); |
340 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-mcpdm.\n"); | 352 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-mcpdm.\n"); |
341 | } | 353 | } |
342 | #else | 354 | #else |
343 | static inline void omap_init_mcpdm(void) {} | 355 | static inline void omap_init_mcpdm(void) {} |
344 | #endif | 356 | #endif |
345 | 357 | ||
346 | #if defined(CONFIG_SND_OMAP_SOC_DMIC) || \ | 358 | #if defined(CONFIG_SND_OMAP_SOC_DMIC) || \ |
347 | defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE) | 359 | defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE) |
348 | 360 | ||
349 | static void omap_init_dmic(void) | 361 | static void omap_init_dmic(void) |
350 | { | 362 | { |
351 | struct omap_hwmod *oh; | 363 | struct omap_hwmod *oh; |
352 | struct platform_device *pdev; | 364 | struct platform_device *pdev; |
353 | 365 | ||
354 | oh = omap_hwmod_lookup("dmic"); | 366 | oh = omap_hwmod_lookup("dmic"); |
355 | if (!oh) { | 367 | if (!oh) { |
356 | printk(KERN_ERR "Could not look up mcpdm hw_mod\n"); | 368 | printk(KERN_ERR "Could not look up mcpdm hw_mod\n"); |
357 | return; | 369 | return; |
358 | } | 370 | } |
359 | 371 | ||
360 | pdev = omap_device_build("omap-dmic", -1, oh, NULL, 0, NULL, 0, 0); | 372 | pdev = omap_device_build("omap-dmic", -1, oh, NULL, 0, NULL, 0, 0); |
361 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-dmic.\n"); | 373 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-dmic.\n"); |
362 | } | 374 | } |
363 | #else | 375 | #else |
364 | static inline void omap_init_dmic(void) {} | 376 | static inline void omap_init_dmic(void) {} |
365 | #endif | 377 | #endif |
366 | 378 | ||
367 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) | 379 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) |
368 | 380 | ||
369 | #include <plat/mcspi.h> | 381 | #include <plat/mcspi.h> |
370 | 382 | ||
371 | static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) | 383 | static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) |
372 | { | 384 | { |
373 | struct platform_device *pdev; | 385 | struct platform_device *pdev; |
374 | char *name = "omap2_mcspi"; | 386 | char *name = "omap2_mcspi"; |
375 | struct omap2_mcspi_platform_config *pdata; | 387 | struct omap2_mcspi_platform_config *pdata; |
376 | static int spi_num; | 388 | static int spi_num; |
377 | struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr; | 389 | struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr; |
378 | 390 | ||
379 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | 391 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
380 | if (!pdata) { | 392 | if (!pdata) { |
381 | pr_err("Memory allocation for McSPI device failed\n"); | 393 | pr_err("Memory allocation for McSPI device failed\n"); |
382 | return -ENOMEM; | 394 | return -ENOMEM; |
383 | } | 395 | } |
384 | 396 | ||
385 | pdata->num_cs = mcspi_attrib->num_chipselect; | 397 | pdata->num_cs = mcspi_attrib->num_chipselect; |
386 | switch (oh->class->rev) { | 398 | switch (oh->class->rev) { |
387 | case OMAP2_MCSPI_REV: | 399 | case OMAP2_MCSPI_REV: |
388 | case OMAP3_MCSPI_REV: | 400 | case OMAP3_MCSPI_REV: |
389 | pdata->regs_offset = 0; | 401 | pdata->regs_offset = 0; |
390 | break; | 402 | break; |
391 | case OMAP4_MCSPI_REV: | 403 | case OMAP4_MCSPI_REV: |
392 | pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET; | 404 | pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET; |
393 | break; | 405 | break; |
394 | default: | 406 | default: |
395 | pr_err("Invalid McSPI Revision value\n"); | 407 | pr_err("Invalid McSPI Revision value\n"); |
396 | return -EINVAL; | 408 | return -EINVAL; |
397 | } | 409 | } |
398 | 410 | ||
399 | spi_num++; | 411 | spi_num++; |
400 | pdev = omap_device_build(name, spi_num, oh, pdata, | 412 | pdev = omap_device_build(name, spi_num, oh, pdata, |
401 | sizeof(*pdata), NULL, 0, 0); | 413 | sizeof(*pdata), NULL, 0, 0); |
402 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", | 414 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", |
403 | name, oh->name); | 415 | name, oh->name); |
404 | kfree(pdata); | 416 | kfree(pdata); |
405 | return 0; | 417 | return 0; |
406 | } | 418 | } |
407 | 419 | ||
408 | static void omap_init_mcspi(void) | 420 | static void omap_init_mcspi(void) |
409 | { | 421 | { |
410 | omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL); | 422 | omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL); |
411 | } | 423 | } |
412 | 424 | ||
413 | #else | 425 | #else |
414 | static inline void omap_init_mcspi(void) {} | 426 | static inline void omap_init_mcspi(void) {} |
415 | #endif | 427 | #endif |
416 | 428 | ||
417 | static struct resource omap2_pmu_resource = { | 429 | static struct resource omap2_pmu_resource = { |
418 | .start = 3, | 430 | .start = 3, |
419 | .end = 3, | 431 | .end = 3, |
420 | .flags = IORESOURCE_IRQ, | 432 | .flags = IORESOURCE_IRQ, |
421 | }; | 433 | }; |
422 | 434 | ||
423 | static struct resource omap3_pmu_resource = { | 435 | static struct resource omap3_pmu_resource = { |
424 | .start = INT_34XX_BENCH_MPU_EMUL, | 436 | .start = INT_34XX_BENCH_MPU_EMUL, |
425 | .end = INT_34XX_BENCH_MPU_EMUL, | 437 | .end = INT_34XX_BENCH_MPU_EMUL, |
426 | .flags = IORESOURCE_IRQ, | 438 | .flags = IORESOURCE_IRQ, |
427 | }; | 439 | }; |
428 | 440 | ||
429 | static struct platform_device omap_pmu_device = { | 441 | static struct platform_device omap_pmu_device = { |
430 | .name = "arm-pmu", | 442 | .name = "arm-pmu", |
431 | .id = ARM_PMU_DEVICE_CPU, | 443 | .id = ARM_PMU_DEVICE_CPU, |
432 | .num_resources = 1, | 444 | .num_resources = 1, |
433 | }; | 445 | }; |
434 | 446 | ||
435 | static void omap_init_pmu(void) | 447 | static void omap_init_pmu(void) |
436 | { | 448 | { |
437 | if (cpu_is_omap24xx()) | 449 | if (cpu_is_omap24xx()) |
438 | omap_pmu_device.resource = &omap2_pmu_resource; | 450 | omap_pmu_device.resource = &omap2_pmu_resource; |
439 | else if (cpu_is_omap34xx()) | 451 | else if (cpu_is_omap34xx()) |
440 | omap_pmu_device.resource = &omap3_pmu_resource; | 452 | omap_pmu_device.resource = &omap3_pmu_resource; |
441 | else | 453 | else |
442 | return; | 454 | return; |
443 | 455 | ||
444 | platform_device_register(&omap_pmu_device); | 456 | platform_device_register(&omap_pmu_device); |
445 | } | 457 | } |
446 | 458 | ||
447 | 459 | ||
448 | #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) | 460 | #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) |
449 | 461 | ||
450 | #ifdef CONFIG_ARCH_OMAP2 | 462 | #ifdef CONFIG_ARCH_OMAP2 |
451 | static struct resource omap2_sham_resources[] = { | 463 | static struct resource omap2_sham_resources[] = { |
452 | { | 464 | { |
453 | .start = OMAP24XX_SEC_SHA1MD5_BASE, | 465 | .start = OMAP24XX_SEC_SHA1MD5_BASE, |
454 | .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64, | 466 | .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64, |
455 | .flags = IORESOURCE_MEM, | 467 | .flags = IORESOURCE_MEM, |
456 | }, | 468 | }, |
457 | { | 469 | { |
458 | .start = INT_24XX_SHA1MD5, | 470 | .start = INT_24XX_SHA1MD5, |
459 | .flags = IORESOURCE_IRQ, | 471 | .flags = IORESOURCE_IRQ, |
460 | } | 472 | } |
461 | }; | 473 | }; |
462 | static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources); | 474 | static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources); |
463 | #else | 475 | #else |
464 | #define omap2_sham_resources NULL | 476 | #define omap2_sham_resources NULL |
465 | #define omap2_sham_resources_sz 0 | 477 | #define omap2_sham_resources_sz 0 |
466 | #endif | 478 | #endif |
467 | 479 | ||
468 | #ifdef CONFIG_ARCH_OMAP3 | 480 | #ifdef CONFIG_ARCH_OMAP3 |
469 | static struct resource omap3_sham_resources[] = { | 481 | static struct resource omap3_sham_resources[] = { |
470 | { | 482 | { |
471 | .start = OMAP34XX_SEC_SHA1MD5_BASE, | 483 | .start = OMAP34XX_SEC_SHA1MD5_BASE, |
472 | .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64, | 484 | .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64, |
473 | .flags = IORESOURCE_MEM, | 485 | .flags = IORESOURCE_MEM, |
474 | }, | 486 | }, |
475 | { | 487 | { |
476 | .start = INT_34XX_SHA1MD52_IRQ, | 488 | .start = INT_34XX_SHA1MD52_IRQ, |
477 | .flags = IORESOURCE_IRQ, | 489 | .flags = IORESOURCE_IRQ, |
478 | }, | 490 | }, |
479 | { | 491 | { |
480 | .start = OMAP34XX_DMA_SHA1MD5_RX, | 492 | .start = OMAP34XX_DMA_SHA1MD5_RX, |
481 | .flags = IORESOURCE_DMA, | 493 | .flags = IORESOURCE_DMA, |
482 | } | 494 | } |
483 | }; | 495 | }; |
484 | static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources); | 496 | static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources); |
485 | #else | 497 | #else |
486 | #define omap3_sham_resources NULL | 498 | #define omap3_sham_resources NULL |
487 | #define omap3_sham_resources_sz 0 | 499 | #define omap3_sham_resources_sz 0 |
488 | #endif | 500 | #endif |
489 | 501 | ||
490 | static struct platform_device sham_device = { | 502 | static struct platform_device sham_device = { |
491 | .name = "omap-sham", | 503 | .name = "omap-sham", |
492 | .id = -1, | 504 | .id = -1, |
493 | }; | 505 | }; |
494 | 506 | ||
495 | static void omap_init_sham(void) | 507 | static void omap_init_sham(void) |
496 | { | 508 | { |
497 | if (cpu_is_omap24xx()) { | 509 | if (cpu_is_omap24xx()) { |
498 | sham_device.resource = omap2_sham_resources; | 510 | sham_device.resource = omap2_sham_resources; |
499 | sham_device.num_resources = omap2_sham_resources_sz; | 511 | sham_device.num_resources = omap2_sham_resources_sz; |
500 | } else if (cpu_is_omap34xx()) { | 512 | } else if (cpu_is_omap34xx()) { |
501 | sham_device.resource = omap3_sham_resources; | 513 | sham_device.resource = omap3_sham_resources; |
502 | sham_device.num_resources = omap3_sham_resources_sz; | 514 | sham_device.num_resources = omap3_sham_resources_sz; |
503 | } else { | 515 | } else { |
504 | pr_err("%s: platform not supported\n", __func__); | 516 | pr_err("%s: platform not supported\n", __func__); |
505 | return; | 517 | return; |
506 | } | 518 | } |
507 | platform_device_register(&sham_device); | 519 | platform_device_register(&sham_device); |
508 | } | 520 | } |
509 | #else | 521 | #else |
510 | static inline void omap_init_sham(void) { } | 522 | static inline void omap_init_sham(void) { } |
511 | #endif | 523 | #endif |
512 | 524 | ||
513 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) | 525 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) |
514 | 526 | ||
515 | #ifdef CONFIG_ARCH_OMAP2 | 527 | #ifdef CONFIG_ARCH_OMAP2 |
516 | static struct resource omap2_aes_resources[] = { | 528 | static struct resource omap2_aes_resources[] = { |
517 | { | 529 | { |
518 | .start = OMAP24XX_SEC_AES_BASE, | 530 | .start = OMAP24XX_SEC_AES_BASE, |
519 | .end = OMAP24XX_SEC_AES_BASE + 0x4C, | 531 | .end = OMAP24XX_SEC_AES_BASE + 0x4C, |
520 | .flags = IORESOURCE_MEM, | 532 | .flags = IORESOURCE_MEM, |
521 | }, | 533 | }, |
522 | { | 534 | { |
523 | .start = OMAP24XX_DMA_AES_TX, | 535 | .start = OMAP24XX_DMA_AES_TX, |
524 | .flags = IORESOURCE_DMA, | 536 | .flags = IORESOURCE_DMA, |
525 | }, | 537 | }, |
526 | { | 538 | { |
527 | .start = OMAP24XX_DMA_AES_RX, | 539 | .start = OMAP24XX_DMA_AES_RX, |
528 | .flags = IORESOURCE_DMA, | 540 | .flags = IORESOURCE_DMA, |
529 | } | 541 | } |
530 | }; | 542 | }; |
531 | static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources); | 543 | static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources); |
532 | #else | 544 | #else |
533 | #define omap2_aes_resources NULL | 545 | #define omap2_aes_resources NULL |
534 | #define omap2_aes_resources_sz 0 | 546 | #define omap2_aes_resources_sz 0 |
535 | #endif | 547 | #endif |
536 | 548 | ||
537 | #ifdef CONFIG_ARCH_OMAP3 | 549 | #ifdef CONFIG_ARCH_OMAP3 |
538 | static struct resource omap3_aes_resources[] = { | 550 | static struct resource omap3_aes_resources[] = { |
539 | { | 551 | { |
540 | .start = OMAP34XX_SEC_AES_BASE, | 552 | .start = OMAP34XX_SEC_AES_BASE, |
541 | .end = OMAP34XX_SEC_AES_BASE + 0x4C, | 553 | .end = OMAP34XX_SEC_AES_BASE + 0x4C, |
542 | .flags = IORESOURCE_MEM, | 554 | .flags = IORESOURCE_MEM, |
543 | }, | 555 | }, |
544 | { | 556 | { |
545 | .start = OMAP34XX_DMA_AES2_TX, | 557 | .start = OMAP34XX_DMA_AES2_TX, |
546 | .flags = IORESOURCE_DMA, | 558 | .flags = IORESOURCE_DMA, |
547 | }, | 559 | }, |
548 | { | 560 | { |
549 | .start = OMAP34XX_DMA_AES2_RX, | 561 | .start = OMAP34XX_DMA_AES2_RX, |
550 | .flags = IORESOURCE_DMA, | 562 | .flags = IORESOURCE_DMA, |
551 | } | 563 | } |
552 | }; | 564 | }; |
553 | static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources); | 565 | static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources); |
554 | #else | 566 | #else |
555 | #define omap3_aes_resources NULL | 567 | #define omap3_aes_resources NULL |
556 | #define omap3_aes_resources_sz 0 | 568 | #define omap3_aes_resources_sz 0 |
557 | #endif | 569 | #endif |
558 | 570 | ||
559 | static struct platform_device aes_device = { | 571 | static struct platform_device aes_device = { |
560 | .name = "omap-aes", | 572 | .name = "omap-aes", |
561 | .id = -1, | 573 | .id = -1, |
562 | }; | 574 | }; |
563 | 575 | ||
564 | static void omap_init_aes(void) | 576 | static void omap_init_aes(void) |
565 | { | 577 | { |
566 | if (cpu_is_omap24xx()) { | 578 | if (cpu_is_omap24xx()) { |
567 | aes_device.resource = omap2_aes_resources; | 579 | aes_device.resource = omap2_aes_resources; |
568 | aes_device.num_resources = omap2_aes_resources_sz; | 580 | aes_device.num_resources = omap2_aes_resources_sz; |
569 | } else if (cpu_is_omap34xx()) { | 581 | } else if (cpu_is_omap34xx()) { |
570 | aes_device.resource = omap3_aes_resources; | 582 | aes_device.resource = omap3_aes_resources; |
571 | aes_device.num_resources = omap3_aes_resources_sz; | 583 | aes_device.num_resources = omap3_aes_resources_sz; |
572 | } else { | 584 | } else { |
573 | pr_err("%s: platform not supported\n", __func__); | 585 | pr_err("%s: platform not supported\n", __func__); |
574 | return; | 586 | return; |
575 | } | 587 | } |
576 | platform_device_register(&aes_device); | 588 | platform_device_register(&aes_device); |
577 | } | 589 | } |
578 | 590 | ||
579 | #else | 591 | #else |
580 | static inline void omap_init_aes(void) { } | 592 | static inline void omap_init_aes(void) { } |
581 | #endif | 593 | #endif |
582 | 594 | ||
583 | /*-------------------------------------------------------------------------*/ | 595 | /*-------------------------------------------------------------------------*/ |
584 | 596 | ||
585 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | 597 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) |
586 | 598 | ||
587 | static inline void omap242x_mmc_mux(struct omap_mmc_platform_data | 599 | static inline void omap242x_mmc_mux(struct omap_mmc_platform_data |
588 | *mmc_controller) | 600 | *mmc_controller) |
589 | { | 601 | { |
590 | if ((mmc_controller->slots[0].switch_pin > 0) && \ | 602 | if ((mmc_controller->slots[0].switch_pin > 0) && \ |
591 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) | 603 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) |
592 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, | 604 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, |
593 | OMAP_PIN_INPUT_PULLUP); | 605 | OMAP_PIN_INPUT_PULLUP); |
594 | if ((mmc_controller->slots[0].gpio_wp > 0) && \ | 606 | if ((mmc_controller->slots[0].gpio_wp > 0) && \ |
595 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) | 607 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) |
596 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, | 608 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, |
597 | OMAP_PIN_INPUT_PULLUP); | 609 | OMAP_PIN_INPUT_PULLUP); |
598 | 610 | ||
599 | omap_mux_init_signal("sdmmc_cmd", 0); | 611 | omap_mux_init_signal("sdmmc_cmd", 0); |
600 | omap_mux_init_signal("sdmmc_clki", 0); | 612 | omap_mux_init_signal("sdmmc_clki", 0); |
601 | omap_mux_init_signal("sdmmc_clko", 0); | 613 | omap_mux_init_signal("sdmmc_clko", 0); |
602 | omap_mux_init_signal("sdmmc_dat0", 0); | 614 | omap_mux_init_signal("sdmmc_dat0", 0); |
603 | omap_mux_init_signal("sdmmc_dat_dir0", 0); | 615 | omap_mux_init_signal("sdmmc_dat_dir0", 0); |
604 | omap_mux_init_signal("sdmmc_cmd_dir", 0); | 616 | omap_mux_init_signal("sdmmc_cmd_dir", 0); |
605 | if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) { | 617 | if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) { |
606 | omap_mux_init_signal("sdmmc_dat1", 0); | 618 | omap_mux_init_signal("sdmmc_dat1", 0); |
607 | omap_mux_init_signal("sdmmc_dat2", 0); | 619 | omap_mux_init_signal("sdmmc_dat2", 0); |
608 | omap_mux_init_signal("sdmmc_dat3", 0); | 620 | omap_mux_init_signal("sdmmc_dat3", 0); |
609 | omap_mux_init_signal("sdmmc_dat_dir1", 0); | 621 | omap_mux_init_signal("sdmmc_dat_dir1", 0); |
610 | omap_mux_init_signal("sdmmc_dat_dir2", 0); | 622 | omap_mux_init_signal("sdmmc_dat_dir2", 0); |
611 | omap_mux_init_signal("sdmmc_dat_dir3", 0); | 623 | omap_mux_init_signal("sdmmc_dat_dir3", 0); |
612 | } | 624 | } |
613 | 625 | ||
614 | /* | 626 | /* |
615 | * Use internal loop-back in MMC/SDIO Module Input Clock | 627 | * Use internal loop-back in MMC/SDIO Module Input Clock |
616 | * selection | 628 | * selection |
617 | */ | 629 | */ |
618 | if (mmc_controller->slots[0].internal_clock) { | 630 | if (mmc_controller->slots[0].internal_clock) { |
619 | u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | 631 | u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
620 | v |= (1 << 24); | 632 | v |= (1 << 24); |
621 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | 633 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); |
622 | } | 634 | } |
623 | } | 635 | } |
624 | 636 | ||
625 | void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | 637 | void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) |
626 | { | 638 | { |
627 | char *name = "mmci-omap"; | 639 | char *name = "mmci-omap"; |
628 | 640 | ||
629 | if (!mmc_data[0]) { | 641 | if (!mmc_data[0]) { |
630 | pr_err("%s fails: Incomplete platform data\n", __func__); | 642 | pr_err("%s fails: Incomplete platform data\n", __func__); |
631 | return; | 643 | return; |
632 | } | 644 | } |
633 | 645 | ||
634 | omap242x_mmc_mux(mmc_data[0]); | 646 | omap242x_mmc_mux(mmc_data[0]); |
635 | omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE, | 647 | omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE, |
636 | INT_24XX_MMC_IRQ, mmc_data[0]); | 648 | INT_24XX_MMC_IRQ, mmc_data[0]); |
637 | } | 649 | } |
638 | 650 | ||
639 | #endif | 651 | #endif |
640 | 652 | ||
641 | /*-------------------------------------------------------------------------*/ | 653 | /*-------------------------------------------------------------------------*/ |
642 | 654 | ||
643 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) | 655 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) |
644 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) | 656 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) |
645 | #define OMAP_HDQ_BASE 0x480B2000 | 657 | #define OMAP_HDQ_BASE 0x480B2000 |
646 | #endif | 658 | #endif |
647 | static struct resource omap_hdq_resources[] = { | 659 | static struct resource omap_hdq_resources[] = { |
648 | { | 660 | { |
649 | .start = OMAP_HDQ_BASE, | 661 | .start = OMAP_HDQ_BASE, |
650 | .end = OMAP_HDQ_BASE + 0x1C, | 662 | .end = OMAP_HDQ_BASE + 0x1C, |
651 | .flags = IORESOURCE_MEM, | 663 | .flags = IORESOURCE_MEM, |
652 | }, | 664 | }, |
653 | { | 665 | { |
654 | .start = INT_24XX_HDQ_IRQ, | 666 | .start = INT_24XX_HDQ_IRQ, |
655 | .flags = IORESOURCE_IRQ, | 667 | .flags = IORESOURCE_IRQ, |
656 | }, | 668 | }, |
657 | }; | 669 | }; |
658 | static struct platform_device omap_hdq_dev = { | 670 | static struct platform_device omap_hdq_dev = { |
659 | .name = "omap_hdq", | 671 | .name = "omap_hdq", |
660 | .id = 0, | 672 | .id = 0, |
661 | .dev = { | 673 | .dev = { |
662 | .platform_data = NULL, | 674 | .platform_data = NULL, |
663 | }, | 675 | }, |
664 | .num_resources = ARRAY_SIZE(omap_hdq_resources), | 676 | .num_resources = ARRAY_SIZE(omap_hdq_resources), |
665 | .resource = omap_hdq_resources, | 677 | .resource = omap_hdq_resources, |
666 | }; | 678 | }; |
667 | static inline void omap_hdq_init(void) | 679 | static inline void omap_hdq_init(void) |
668 | { | 680 | { |
669 | (void) platform_device_register(&omap_hdq_dev); | 681 | (void) platform_device_register(&omap_hdq_dev); |
670 | } | 682 | } |
671 | #else | 683 | #else |
672 | static inline void omap_hdq_init(void) {} | 684 | static inline void omap_hdq_init(void) {} |
673 | #endif | 685 | #endif |
674 | 686 | ||
675 | /*---------------------------------------------------------------------------*/ | 687 | /*---------------------------------------------------------------------------*/ |
676 | 688 | ||
677 | #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \ | 689 | #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \ |
678 | defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE) | 690 | defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE) |
679 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) | 691 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
680 | static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = { | 692 | static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = { |
681 | }; | 693 | }; |
682 | #else | 694 | #else |
683 | static struct resource omap_vout_resource[2] = { | 695 | static struct resource omap_vout_resource[2] = { |
684 | }; | 696 | }; |
685 | #endif | 697 | #endif |
686 | 698 | ||
687 | static struct platform_device omap_vout_device = { | 699 | static struct platform_device omap_vout_device = { |
688 | .name = "omap_vout", | 700 | .name = "omap_vout", |
689 | .num_resources = ARRAY_SIZE(omap_vout_resource), | 701 | .num_resources = ARRAY_SIZE(omap_vout_resource), |
690 | .resource = &omap_vout_resource[0], | 702 | .resource = &omap_vout_resource[0], |
691 | .id = -1, | 703 | .id = -1, |
692 | }; | 704 | }; |
693 | static void omap_init_vout(void) | 705 | static void omap_init_vout(void) |
694 | { | 706 | { |
695 | if (platform_device_register(&omap_vout_device) < 0) | 707 | if (platform_device_register(&omap_vout_device) < 0) |
696 | printk(KERN_ERR "Unable to register OMAP-VOUT device\n"); | 708 | printk(KERN_ERR "Unable to register OMAP-VOUT device\n"); |
697 | } | 709 | } |
698 | #else | 710 | #else |
699 | static inline void omap_init_vout(void) {} | 711 | static inline void omap_init_vout(void) {} |
700 | #endif | 712 | #endif |
701 | 713 | ||
702 | /*-------------------------------------------------------------------------*/ | 714 | /*-------------------------------------------------------------------------*/ |
703 | 715 | ||
704 | static int __init omap2_init_devices(void) | 716 | static int __init omap2_init_devices(void) |
705 | { | 717 | { |
706 | /* | 718 | /* |
707 | * please keep these calls, and their implementations above, | 719 | * please keep these calls, and their implementations above, |
708 | * in alphabetical order so they're easier to sort through. | 720 | * in alphabetical order so they're easier to sort through. |
709 | */ | 721 | */ |
710 | omap_init_audio(); | 722 | omap_init_audio(); |
711 | omap_init_mcpdm(); | 723 | omap_init_mcpdm(); |
712 | omap_init_dmic(); | 724 | omap_init_dmic(); |
713 | omap_init_camera(); | 725 | omap_init_camera(); |
714 | omap_init_mbox(); | 726 | omap_init_mbox(); |
715 | omap_init_mcspi(); | 727 | omap_init_mcspi(); |
716 | omap_init_pmu(); | 728 | omap_init_pmu(); |
717 | omap_hdq_init(); | 729 | omap_hdq_init(); |
718 | omap_init_sti(); | 730 | omap_init_sti(); |
719 | omap_init_sham(); | 731 | omap_init_sham(); |
720 | omap_init_aes(); | 732 | omap_init_aes(); |
721 | omap_init_vout(); | 733 | omap_init_vout(); |
722 | 734 | ||
723 | return 0; | 735 | return 0; |
724 | } | 736 | } |
725 | arch_initcall(omap2_init_devices); | 737 | arch_initcall(omap2_init_devices); |
726 | 738 | ||
727 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | 739 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) |
728 | static int __init omap_init_wdt(void) | 740 | static int __init omap_init_wdt(void) |
729 | { | 741 | { |
730 | int id = -1; | 742 | int id = -1; |
731 | struct platform_device *pdev; | 743 | struct platform_device *pdev; |
732 | struct omap_hwmod *oh; | 744 | struct omap_hwmod *oh; |
733 | char *oh_name = "wd_timer2"; | 745 | char *oh_name = "wd_timer2"; |
734 | char *dev_name = "omap_wdt"; | 746 | char *dev_name = "omap_wdt"; |
735 | 747 | ||
736 | if (!cpu_class_is_omap2()) | 748 | if (!cpu_class_is_omap2()) |
737 | return 0; | 749 | return 0; |
738 | 750 | ||
739 | oh = omap_hwmod_lookup(oh_name); | 751 | oh = omap_hwmod_lookup(oh_name); |
740 | if (!oh) { | 752 | if (!oh) { |
741 | pr_err("Could not look up wd_timer%d hwmod\n", id); | 753 | pr_err("Could not look up wd_timer%d hwmod\n", id); |
742 | return -EINVAL; | 754 | return -EINVAL; |
743 | } | 755 | } |
744 | 756 | ||
745 | pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0); | 757 | pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0); |
746 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", | 758 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", |
747 | dev_name, oh->name); | 759 | dev_name, oh->name); |
748 | return 0; | 760 | return 0; |
749 | } | 761 | } |
750 | subsys_initcall(omap_init_wdt); | 762 | subsys_initcall(omap_init_wdt); |
751 | #endif | 763 | #endif |