diff options
Diffstat (limited to 'arch/arm/mach-omap2/cm_common.c')
-rw-r--r-- | arch/arm/mach-omap2/cm_common.c | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c index 32af8fc749f0..ff24fdfb3bb2 100644 --- a/arch/arm/mach-omap2/cm_common.c +++ b/arch/arm/mach-omap2/cm_common.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "cm2xxx.h" | 21 | #include "cm2xxx.h" |
22 | #include "cm3xxx.h" | 22 | #include "cm3xxx.h" |
23 | #include "cm33xx.h" | ||
23 | #include "cm44xx.h" | 24 | #include "cm44xx.h" |
24 | #include "clock.h" | 25 | #include "clock.h" |
25 | 26 | ||
@@ -37,6 +38,7 @@ void __iomem *cm_base; | |||
37 | void __iomem *cm2_base; | 38 | void __iomem *cm2_base; |
38 | 39 | ||
39 | #define CM_NO_CLOCKS 0x1 | 40 | #define CM_NO_CLOCKS 0x1 |
41 | #define CM_SINGLE_INSTANCE 0x2 | ||
40 | 42 | ||
41 | /** | 43 | /** |
42 | * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use) | 44 | * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use) |
@@ -218,21 +220,32 @@ int cm_unregister(struct cm_ll_data *cld) | |||
218 | return 0; | 220 | return 0; |
219 | } | 221 | } |
220 | 222 | ||
221 | static struct omap_prcm_init_data cm_data = { | 223 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ |
224 | defined(CONFIG_SOC_DRA7XX) | ||
225 | static struct omap_prcm_init_data cm_data __initdata = { | ||
222 | .index = TI_CLKM_CM, | 226 | .index = TI_CLKM_CM, |
227 | .init = omap4_cm_init, | ||
223 | }; | 228 | }; |
224 | 229 | ||
225 | static struct omap_prcm_init_data cm2_data = { | 230 | static struct omap_prcm_init_data cm2_data __initdata = { |
226 | .index = TI_CLKM_CM2, | 231 | .index = TI_CLKM_CM2, |
232 | .init = omap4_cm_init, | ||
227 | }; | 233 | }; |
234 | #endif | ||
228 | 235 | ||
229 | static struct omap_prcm_init_data omap2_prcm_data = { | 236 | #ifdef CONFIG_ARCH_OMAP2 |
237 | static struct omap_prcm_init_data omap2_prcm_data __initdata = { | ||
230 | .index = TI_CLKM_CM, | 238 | .index = TI_CLKM_CM, |
231 | .flags = CM_NO_CLOCKS, | 239 | .init = omap2xxx_cm_init, |
240 | .flags = CM_NO_CLOCKS | CM_SINGLE_INSTANCE, | ||
232 | }; | 241 | }; |
242 | #endif | ||
233 | 243 | ||
234 | static struct omap_prcm_init_data omap3_cm_data = { | 244 | #ifdef CONFIG_ARCH_OMAP3 |
245 | static struct omap_prcm_init_data omap3_cm_data __initdata = { | ||
235 | .index = TI_CLKM_CM, | 246 | .index = TI_CLKM_CM, |
247 | .init = omap3xxx_cm_init, | ||
248 | .flags = CM_SINGLE_INSTANCE, | ||
236 | 249 | ||
237 | /* | 250 | /* |
238 | * IVA2 offset is a negative value, must offset the cm_base address | 251 | * IVA2 offset is a negative value, must offset the cm_base address |
@@ -240,28 +253,53 @@ static struct omap_prcm_init_data omap3_cm_data = { | |||
240 | */ | 253 | */ |
241 | .offset = -OMAP3430_IVA2_MOD, | 254 | .offset = -OMAP3430_IVA2_MOD, |
242 | }; | 255 | }; |
256 | #endif | ||
243 | 257 | ||
244 | static struct omap_prcm_init_data am3_prcm_data = { | 258 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_TI81XX) |
259 | static struct omap_prcm_init_data am3_prcm_data __initdata = { | ||
245 | .index = TI_CLKM_CM, | 260 | .index = TI_CLKM_CM, |
246 | .flags = CM_NO_CLOCKS, | 261 | .flags = CM_NO_CLOCKS | CM_SINGLE_INSTANCE, |
262 | .init = am33xx_cm_init, | ||
247 | }; | 263 | }; |
264 | #endif | ||
248 | 265 | ||
249 | static struct omap_prcm_init_data am4_prcm_data = { | 266 | #ifdef CONFIG_SOC_AM43XX |
267 | static struct omap_prcm_init_data am4_prcm_data __initdata = { | ||
250 | .index = TI_CLKM_CM, | 268 | .index = TI_CLKM_CM, |
251 | .flags = CM_NO_CLOCKS, | 269 | .flags = CM_NO_CLOCKS | CM_SINGLE_INSTANCE, |
270 | .init = omap4_cm_init, | ||
252 | }; | 271 | }; |
272 | #endif | ||
253 | 273 | ||
254 | static const struct of_device_id omap_cm_dt_match_table[] = { | 274 | static const struct of_device_id omap_cm_dt_match_table[] __initconst = { |
275 | #ifdef CONFIG_ARCH_OMAP2 | ||
255 | { .compatible = "ti,omap2-prcm", .data = &omap2_prcm_data }, | 276 | { .compatible = "ti,omap2-prcm", .data = &omap2_prcm_data }, |
277 | #endif | ||
278 | #ifdef CONFIG_ARCH_OMAP3 | ||
256 | { .compatible = "ti,omap3-cm", .data = &omap3_cm_data }, | 279 | { .compatible = "ti,omap3-cm", .data = &omap3_cm_data }, |
280 | #endif | ||
281 | #ifdef CONFIG_ARCH_OMAP4 | ||
257 | { .compatible = "ti,omap4-cm1", .data = &cm_data }, | 282 | { .compatible = "ti,omap4-cm1", .data = &cm_data }, |
258 | { .compatible = "ti,omap4-cm2", .data = &cm2_data }, | 283 | { .compatible = "ti,omap4-cm2", .data = &cm2_data }, |
284 | #endif | ||
285 | #ifdef CONFIG_SOC_OMAP5 | ||
259 | { .compatible = "ti,omap5-cm-core-aon", .data = &cm_data }, | 286 | { .compatible = "ti,omap5-cm-core-aon", .data = &cm_data }, |
260 | { .compatible = "ti,omap5-cm-core", .data = &cm2_data }, | 287 | { .compatible = "ti,omap5-cm-core", .data = &cm2_data }, |
288 | #endif | ||
289 | #ifdef CONFIG_SOC_DRA7XX | ||
261 | { .compatible = "ti,dra7-cm-core-aon", .data = &cm_data }, | 290 | { .compatible = "ti,dra7-cm-core-aon", .data = &cm_data }, |
262 | { .compatible = "ti,dra7-cm-core", .data = &cm2_data }, | 291 | { .compatible = "ti,dra7-cm-core", .data = &cm2_data }, |
292 | #endif | ||
293 | #ifdef CONFIG_SOC_AM33XX | ||
263 | { .compatible = "ti,am3-prcm", .data = &am3_prcm_data }, | 294 | { .compatible = "ti,am3-prcm", .data = &am3_prcm_data }, |
295 | #endif | ||
296 | #ifdef CONFIG_SOC_AM43XX | ||
264 | { .compatible = "ti,am4-prcm", .data = &am4_prcm_data }, | 297 | { .compatible = "ti,am4-prcm", .data = &am4_prcm_data }, |
298 | #endif | ||
299 | #ifdef CONFIG_SOC_TI81XX | ||
300 | { .compatible = "ti,dm814-prcm", .data = &am3_prcm_data }, | ||
301 | { .compatible = "ti,dm816-prcm", .data = &am3_prcm_data }, | ||
302 | #endif | ||
265 | { } | 303 | { } |
266 | }; | 304 | }; |
267 | 305 | ||
@@ -293,6 +331,12 @@ int __init omap2_cm_base_init(void) | |||
293 | cm2_base = mem + data->offset; | 331 | cm2_base = mem + data->offset; |
294 | 332 | ||
295 | data->mem = mem; | 333 | data->mem = mem; |
334 | |||
335 | data->np = np; | ||
336 | |||
337 | if (data->init && (data->flags & CM_SINGLE_INSTANCE || | ||
338 | (cm_base && cm2_base))) | ||
339 | data->init(data); | ||
296 | } | 340 | } |
297 | 341 | ||
298 | return 0; | 342 | return 0; |