Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+40 -66
+9 -7
arch/arm/mach-omap2/common.h
··· 44 44 45 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 50 #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 48 51 int omap2_pm_init(void); 49 52 #else ··· 82 79 83 80 #if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \ 84 81 defined(CONFIG_SOC_AM43XX)) 85 - void amx3_common_pm_init(void); 82 + int amx3_common_pm_init(void); 86 83 #else 87 - static inline void amx3_common_pm_init(void) { } 84 + static inline int amx3_common_pm_init(void) 85 + { 86 + return 0; 87 + } 88 88 #endif 89 89 90 90 extern void omap2_init_common_infrastructure(void); ··· 128 122 void am43xx_init_late(void); 129 123 void omap4430_init_early(void); 130 124 void omap5_init_early(void); 131 - void omap3_init_late(void); /* Do not use this one */ 125 + void omap3_init_late(void); 132 126 void omap4430_init_late(void); 133 127 void omap2420_init_late(void); 134 128 void omap2430_init_late(void); 135 - void omap3430_init_late(void); 136 - void omap35xx_init_late(void); 137 - void omap3630_init_late(void); 138 - void am35xx_init_late(void); 139 129 void ti81xx_init_late(void); 140 130 void am33xx_init_late(void); 141 131 void omap5_init_late(void);
+9 -58
arch/arm/mach-omap2/io.c
··· 422 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 425 #ifdef CONFIG_SOC_OMAP2420 431 426 void __init omap2420_init_early(void) 432 427 { ··· 442 447 443 448 void __init omap2420_init_late(void) 444 449 { 445 - omap_common_late_init(); 446 - omap2_pm_init(); 447 - omap2_clk_enable_autoidle_all(); 450 + omap_pm_soc_init = omap2_pm_init; 448 451 } 449 452 #endif 450 453 ··· 466 473 467 474 void __init omap2430_init_late(void) 468 475 { 469 - omap_common_late_init(); 470 - omap2_pm_init(); 471 - omap2_clk_enable_autoidle_all(); 476 + omap_pm_soc_init = omap2_pm_init; 472 477 } 473 478 #endif 474 479 ··· 517 526 518 527 void __init omap3_init_late(void) 519 528 { 520 - omap_common_late_init(); 521 - omap3_pm_init(); 522 - omap2_clk_enable_autoidle_all(); 523 - } 524 - 525 - void __init omap3430_init_late(void) 526 - { 527 - omap_common_late_init(); 528 - omap3_pm_init(); 529 - omap2_clk_enable_autoidle_all(); 530 - } 531 - 532 - void __init omap35xx_init_late(void) 533 - { 534 - omap_common_late_init(); 535 - omap3_pm_init(); 536 - omap2_clk_enable_autoidle_all(); 537 - } 538 - 539 - void __init omap3630_init_late(void) 540 - { 541 - omap_common_late_init(); 542 - omap3_pm_init(); 543 - omap2_clk_enable_autoidle_all(); 544 - } 545 - 546 - void __init am35xx_init_late(void) 547 - { 548 - omap_common_late_init(); 549 - omap3_pm_init(); 550 - omap2_clk_enable_autoidle_all(); 529 + omap_pm_soc_init = omap3_pm_init; 551 530 } 552 531 553 532 void __init ti81xx_init_late(void) 554 533 { 555 - omap_common_late_init(); 556 - omap2_clk_enable_autoidle_all(); 534 + omap_pm_soc_init = omap_pm_nop_init; 557 535 } 558 536 #endif 559 537 ··· 578 618 579 619 void __init am33xx_init_late(void) 580 620 { 581 - omap_common_late_init(); 582 - amx3_common_pm_init(); 621 + omap_pm_soc_init = amx3_common_pm_init; 583 622 } 584 623 #endif 585 624 ··· 601 642 602 643 void __init am43xx_init_late(void) 603 644 { 604 - omap_common_late_init(); 605 - omap2_clk_enable_autoidle_all(); 606 - amx3_common_pm_init(); 645 + omap_pm_soc_init = amx3_common_pm_init; 607 646 } 608 647 #endif 609 648 ··· 629 672 630 673 void __init omap4430_init_late(void) 631 674 { 632 - omap_common_late_init(); 633 - omap4_pm_init(); 634 - omap2_clk_enable_autoidle_all(); 675 + omap_pm_soc_init = omap4_pm_init; 635 676 } 636 677 #endif 637 678 ··· 655 700 656 701 void __init omap5_init_late(void) 657 702 { 658 - omap_common_late_init(); 659 - omap4_pm_init(); 660 - omap2_clk_enable_autoidle_all(); 703 + omap_pm_soc_init = omap4_pm_init; 661 704 } 662 705 #endif 663 706 ··· 678 725 679 726 void __init dra7xx_init_late(void) 680 727 { 681 - omap_common_late_init(); 682 - omap4_pm_init(); 683 - omap2_clk_enable_autoidle_all(); 728 + omap_pm_soc_init = omap4_pm_init; 684 729 } 685 730 #endif 686 731
+19
arch/arm/mach-omap2/pm.c
··· 230 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 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 247 /* Init the voltage layer */ 236 248 omap3_twl_init(); 237 249 omap4_twl_init(); ··· 256 244 /* Smartreflex device init */ 257 245 omap_devinit_smartreflex(); 258 246 247 + error = omap_pm_soc_init(); 248 + if (error) 249 + pr_warn("%s: pm soc init failed: %i\n", __func__, error); 250 + 251 + omap2_clk_enable_autoidle_all(); 252 + 259 253 return 0; 260 254 } 255 + omap_late_initcall(omap2_common_pm_late_init);
+3 -1
arch/arm/mach-omap2/pm33xx-core.c
··· 173 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 178 struct am33xx_pm_platform_data *pdata; 179 179 struct platform_device_info devinfo; ··· 186 186 devinfo.size_data = sizeof(*pdata); 187 187 devinfo.id = -1; 188 188 platform_device_register_full(&devinfo); 189 + 190 + return 0; 189 191 }