diff options
author | Tony Lindgren <tony@atomide.com> | 2018-04-16 13:23:46 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2018-04-30 15:04:51 -0400 |
commit | 02b83dcb3db7974cc25834b67ffac7eb90ce56ac (patch) | |
tree | 0769846454f047728c1ee301342ebec607865a43 | |
parent | 71941002ad140cba0ee922a2bc9f5dcf9ac70b54 (diff) |
ARM: OMAP2+: Initialize SoC PM later
There's no need to probe devices until at module_init time and we
currently have at least PM trying to use I2C for PMICs early on.
As only a part of the SoC init_early is SoC specific, we only need to call
the SoC specific PM init function. And we can modify omap2_common_pm_late_init()
so it becomes a late_initcall().
Note that this changes am335x to call omap2_clk_enable_autoidle_all() that
seems to be missing currently.
Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/common.h | 16 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 67 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm33xx-core.c | 4 |
4 files changed, 40 insertions, 66 deletions
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index fbe0b78bf489..75c1a89fab73 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define OMAP_INTC_START NR_IRQS | 45 | #define OMAP_INTC_START NR_IRQS |
46 | 46 | ||
47 | extern int (*omap_pm_soc_init)(void); | ||
48 | int omap_pm_nop_init(void); | ||
49 | |||
47 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) | 50 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) |
48 | int omap2_pm_init(void); | 51 | int omap2_pm_init(void); |
49 | #else | 52 | #else |
@@ -79,9 +82,12 @@ static inline int omap4_pm_init_early(void) | |||
79 | 82 | ||
80 | #if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \ | 83 | #if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \ |
81 | defined(CONFIG_SOC_AM43XX)) | 84 | defined(CONFIG_SOC_AM43XX)) |
82 | void amx3_common_pm_init(void); | 85 | int amx3_common_pm_init(void); |
83 | #else | 86 | #else |
84 | static inline void amx3_common_pm_init(void) { } | 87 | static inline int amx3_common_pm_init(void) |
88 | { | ||
89 | return 0; | ||
90 | } | ||
85 | #endif | 91 | #endif |
86 | 92 | ||
87 | extern void omap2_init_common_infrastructure(void); | 93 | extern void omap2_init_common_infrastructure(void); |
@@ -122,14 +128,10 @@ void am43xx_init_early(void); | |||
122 | void am43xx_init_late(void); | 128 | void am43xx_init_late(void); |
123 | void omap4430_init_early(void); | 129 | void omap4430_init_early(void); |
124 | void omap5_init_early(void); | 130 | void omap5_init_early(void); |
125 | void omap3_init_late(void); /* Do not use this one */ | 131 | void omap3_init_late(void); |
126 | void omap4430_init_late(void); | 132 | void omap4430_init_late(void); |
127 | void omap2420_init_late(void); | 133 | void omap2420_init_late(void); |
128 | void omap2430_init_late(void); | 134 | void omap2430_init_late(void); |
129 | void omap3430_init_late(void); | ||
130 | void omap35xx_init_late(void); | ||
131 | void omap3630_init_late(void); | ||
132 | void am35xx_init_late(void); | ||
133 | void ti81xx_init_late(void); | 135 | void ti81xx_init_late(void); |
134 | void am33xx_init_late(void); | 136 | void am33xx_init_late(void); |
135 | void omap5_init_late(void); | 137 | void omap5_init_late(void); |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 6ce60a478409..bb8e0bb7ef5d 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -422,11 +422,6 @@ static void __init __maybe_unused omap_hwmod_init_postsetup(void) | |||
422 | omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); | 422 | omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); |
423 | } | 423 | } |
424 | 424 | ||
425 | static void __init __maybe_unused omap_common_late_init(void) | ||
426 | { | ||
427 | omap2_common_pm_late_init(); | ||
428 | } | ||
429 | |||
430 | #ifdef CONFIG_SOC_OMAP2420 | 425 | #ifdef CONFIG_SOC_OMAP2420 |
431 | void __init omap2420_init_early(void) | 426 | void __init omap2420_init_early(void) |
432 | { | 427 | { |
@@ -447,9 +442,7 @@ void __init omap2420_init_early(void) | |||
447 | 442 | ||
448 | void __init omap2420_init_late(void) | 443 | void __init omap2420_init_late(void) |
449 | { | 444 | { |
450 | omap_common_late_init(); | 445 | omap_pm_soc_init = omap2_pm_init; |
451 | omap2_pm_init(); | ||
452 | omap2_clk_enable_autoidle_all(); | ||
453 | } | 446 | } |
454 | #endif | 447 | #endif |
455 | 448 | ||
@@ -473,9 +466,7 @@ void __init omap2430_init_early(void) | |||
473 | 466 | ||
474 | void __init omap2430_init_late(void) | 467 | void __init omap2430_init_late(void) |
475 | { | 468 | { |
476 | omap_common_late_init(); | 469 | omap_pm_soc_init = omap2_pm_init; |
477 | omap2_pm_init(); | ||
478 | omap2_clk_enable_autoidle_all(); | ||
479 | } | 470 | } |
480 | #endif | 471 | #endif |
481 | 472 | ||
@@ -526,43 +517,12 @@ void __init am35xx_init_early(void) | |||
526 | 517 | ||
527 | void __init omap3_init_late(void) | 518 | void __init omap3_init_late(void) |
528 | { | 519 | { |
529 | omap_common_late_init(); | 520 | omap_pm_soc_init = omap3_pm_init; |
530 | omap3_pm_init(); | ||
531 | omap2_clk_enable_autoidle_all(); | ||
532 | } | ||
533 | |||
534 | void __init omap3430_init_late(void) | ||
535 | { | ||
536 | omap_common_late_init(); | ||
537 | omap3_pm_init(); | ||
538 | omap2_clk_enable_autoidle_all(); | ||
539 | } | ||
540 | |||
541 | void __init omap35xx_init_late(void) | ||
542 | { | ||
543 | omap_common_late_init(); | ||
544 | omap3_pm_init(); | ||
545 | omap2_clk_enable_autoidle_all(); | ||
546 | } | ||
547 | |||
548 | void __init omap3630_init_late(void) | ||
549 | { | ||
550 | omap_common_late_init(); | ||
551 | omap3_pm_init(); | ||
552 | omap2_clk_enable_autoidle_all(); | ||
553 | } | ||
554 | |||
555 | void __init am35xx_init_late(void) | ||
556 | { | ||
557 | omap_common_late_init(); | ||
558 | omap3_pm_init(); | ||
559 | omap2_clk_enable_autoidle_all(); | ||
560 | } | 521 | } |
561 | 522 | ||
562 | void __init ti81xx_init_late(void) | 523 | void __init ti81xx_init_late(void) |
563 | { | 524 | { |
564 | omap_common_late_init(); | 525 | omap_pm_soc_init = omap_pm_nop_init; |
565 | omap2_clk_enable_autoidle_all(); | ||
566 | } | 526 | } |
567 | #endif | 527 | #endif |
568 | 528 | ||
@@ -618,8 +578,7 @@ void __init am33xx_init_early(void) | |||
618 | 578 | ||
619 | void __init am33xx_init_late(void) | 579 | void __init am33xx_init_late(void) |
620 | { | 580 | { |
621 | omap_common_late_init(); | 581 | omap_pm_soc_init = amx3_common_pm_init; |
622 | amx3_common_pm_init(); | ||
623 | } | 582 | } |
624 | #endif | 583 | #endif |
625 | 584 | ||
@@ -642,9 +601,7 @@ void __init am43xx_init_early(void) | |||
642 | 601 | ||
643 | void __init am43xx_init_late(void) | 602 | void __init am43xx_init_late(void) |
644 | { | 603 | { |
645 | omap_common_late_init(); | 604 | omap_pm_soc_init = amx3_common_pm_init; |
646 | omap2_clk_enable_autoidle_all(); | ||
647 | amx3_common_pm_init(); | ||
648 | } | 605 | } |
649 | #endif | 606 | #endif |
650 | 607 | ||
@@ -672,9 +629,7 @@ void __init omap4430_init_early(void) | |||
672 | 629 | ||
673 | void __init omap4430_init_late(void) | 630 | void __init omap4430_init_late(void) |
674 | { | 631 | { |
675 | omap_common_late_init(); | 632 | omap_pm_soc_init = omap4_pm_init; |
676 | omap4_pm_init(); | ||
677 | omap2_clk_enable_autoidle_all(); | ||
678 | } | 633 | } |
679 | #endif | 634 | #endif |
680 | 635 | ||
@@ -700,9 +655,7 @@ void __init omap5_init_early(void) | |||
700 | 655 | ||
701 | void __init omap5_init_late(void) | 656 | void __init omap5_init_late(void) |
702 | { | 657 | { |
703 | omap_common_late_init(); | 658 | omap_pm_soc_init = omap4_pm_init; |
704 | omap4_pm_init(); | ||
705 | omap2_clk_enable_autoidle_all(); | ||
706 | } | 659 | } |
707 | #endif | 660 | #endif |
708 | 661 | ||
@@ -725,9 +678,7 @@ void __init dra7xx_init_early(void) | |||
725 | 678 | ||
726 | void __init dra7xx_init_late(void) | 679 | void __init dra7xx_init_late(void) |
727 | { | 680 | { |
728 | omap_common_late_init(); | 681 | omap_pm_soc_init = omap4_pm_init; |
729 | omap4_pm_init(); | ||
730 | omap2_clk_enable_autoidle_all(); | ||
731 | } | 682 | } |
732 | #endif | 683 | #endif |
733 | 684 | ||
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index b98c46d7f112..ca03af8fe43f 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -230,8 +230,20 @@ static void __init omap4_init_voltages(void) | |||
230 | omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); | 230 | omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); |
231 | } | 231 | } |
232 | 232 | ||
233 | int __maybe_unused omap_pm_nop_init(void) | ||
234 | { | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | int (*omap_pm_soc_init)(void); | ||
239 | |||
233 | int __init omap2_common_pm_late_init(void) | 240 | int __init omap2_common_pm_late_init(void) |
234 | { | 241 | { |
242 | int error; | ||
243 | |||
244 | if (!omap_pm_soc_init) | ||
245 | return 0; | ||
246 | |||
235 | /* Init the voltage layer */ | 247 | /* Init the voltage layer */ |
236 | omap3_twl_init(); | 248 | omap3_twl_init(); |
237 | omap4_twl_init(); | 249 | omap4_twl_init(); |
@@ -244,5 +256,12 @@ int __init omap2_common_pm_late_init(void) | |||
244 | /* Smartreflex device init */ | 256 | /* Smartreflex device init */ |
245 | omap_devinit_smartreflex(); | 257 | omap_devinit_smartreflex(); |
246 | 258 | ||
259 | error = omap_pm_soc_init(); | ||
260 | if (error) | ||
261 | pr_warn("%s: pm soc init failed: %i\n", __func__, error); | ||
262 | |||
263 | omap2_clk_enable_autoidle_all(); | ||
264 | |||
247 | return 0; | 265 | return 0; |
248 | } | 266 | } |
267 | omap_late_initcall(omap2_common_pm_late_init); | ||
diff --git a/arch/arm/mach-omap2/pm33xx-core.c b/arch/arm/mach-omap2/pm33xx-core.c index 93c0b5ba9f09..9b3755a2e2ec 100644 --- a/arch/arm/mach-omap2/pm33xx-core.c +++ b/arch/arm/mach-omap2/pm33xx-core.c | |||
@@ -173,7 +173,7 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void) | |||
173 | return NULL; | 173 | return NULL; |
174 | } | 174 | } |
175 | 175 | ||
176 | void __init amx3_common_pm_init(void) | 176 | int __init amx3_common_pm_init(void) |
177 | { | 177 | { |
178 | struct am33xx_pm_platform_data *pdata; | 178 | struct am33xx_pm_platform_data *pdata; |
179 | struct platform_device_info devinfo; | 179 | struct platform_device_info devinfo; |
@@ -186,4 +186,6 @@ void __init amx3_common_pm_init(void) | |||
186 | devinfo.size_data = sizeof(*pdata); | 186 | devinfo.size_data = sizeof(*pdata); |
187 | devinfo.id = -1; | 187 | devinfo.id = -1; |
188 | platform_device_register_full(&devinfo); | 188 | platform_device_register_full(&devinfo); |
189 | |||
190 | return 0; | ||
189 | } | 191 | } |