aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-11-13 12:17:34 -0500
committerTero Kristo <t-kristo@ti.com>2015-03-27 04:56:00 -0400
commit2208bf115fecae211480ea41d25e6d56ec20d405 (patch)
treef501ce2dab6097b2cf47f06c08174ac3187755e1
parentae521d4d9c54995df1e0fb53ef6820374a3cae4e (diff)
ARM: OMAP2+: control: determine control module base address from DT
There is no need to provide the control module base address through a low-level API from the low-level IO init, as this information is available through DT. This patch adds a new API to initialize the control module though, but mostly makes the old API obsolete. The old API can be completely removed once OMAP3 is made DT only. Signed-off-by: Tero Kristo <t-kristo@ti.com>
-rw-r--r--arch/arm/mach-omap2/control.c49
-rw-r--r--arch/arm/mach-omap2/control.h2
-rw-r--r--arch/arm/mach-omap2/io.c34
-rw-r--r--arch/arm/mach-omap2/prm.h1
-rw-r--r--arch/arm/mach-omap2/prm_common.c5
5 files changed, 61 insertions, 30 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index e8818242f968..21ff32c6001a 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -616,6 +616,7 @@ void __init omap3_ctrl_init(void)
616 616
617struct control_init_data { 617struct control_init_data {
618 int index; 618 int index;
619 void __iomem *mem;
619}; 620};
620 621
621static struct control_init_data ctrl_data = { 622static struct control_init_data ctrl_data = {
@@ -627,10 +628,39 @@ static const struct of_device_id omap_scrm_dt_match_table[] = {
627 { .compatible = "ti,am4-scrm", .data = &ctrl_data }, 628 { .compatible = "ti,am4-scrm", .data = &ctrl_data },
628 { .compatible = "ti,omap2-scrm", .data = &ctrl_data }, 629 { .compatible = "ti,omap2-scrm", .data = &ctrl_data },
629 { .compatible = "ti,omap3-scrm", .data = &ctrl_data }, 630 { .compatible = "ti,omap3-scrm", .data = &ctrl_data },
631 { .compatible = "ti,dm816-scrm", .data = &ctrl_data },
630 { } 632 { }
631}; 633};
632 634
633/** 635/**
636 * omap2_control_base_init - initialize iomappings for the control driver
637 *
638 * Detects and initializes the iomappings for the control driver, based
639 * on the DT data. Returns 0 in success, negative error value
640 * otherwise.
641 */
642int __init omap2_control_base_init(void)
643{
644 struct device_node *np;
645 const struct of_device_id *match;
646 struct control_init_data *data;
647 void __iomem *mem;
648
649 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
650 data = (struct control_init_data *)match->data;
651
652 mem = of_iomap(np, 0);
653 if (!mem)
654 return -ENOMEM;
655
656 omap2_ctrl_base = mem;
657 data->mem = mem;
658 }
659
660 return 0;
661}
662
663/**
634 * omap_control_init - low level init for the control driver 664 * omap_control_init - low level init for the control driver
635 * 665 *
636 * Initializes the low level clock infrastructure for control driver. 666 * Initializes the low level clock infrastructure for control driver.
@@ -639,7 +669,6 @@ static const struct of_device_id omap_scrm_dt_match_table[] = {
639int __init omap_control_init(void) 669int __init omap_control_init(void)
640{ 670{
641 struct device_node *np; 671 struct device_node *np;
642 void __iomem *mem;
643 const struct of_device_id *match; 672 const struct of_device_id *match;
644 const struct omap_prcm_init_data *data; 673 const struct omap_prcm_init_data *data;
645 int ret; 674 int ret;
@@ -647,14 +676,22 @@ int __init omap_control_init(void)
647 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) { 676 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
648 data = match->data; 677 data = match->data;
649 678
650 mem = of_iomap(np, 0); 679 ret = omap2_clk_provider_init(np, data->index, data->mem);
651 if (!mem)
652 return -ENOMEM;
653
654 ret = omap2_clk_provider_init(np, data->index, mem);
655 if (ret) 680 if (ret)
656 return ret; 681 return ret;
657 } 682 }
658 683
659 return 0; 684 return 0;
660} 685}
686
687/**
688 * omap3_control_legacy_iomap_init - legacy iomap init for clock providers
689 *
690 * Legacy iomap init for clock provider. Needed only by legacy boot mode,
691 * where the base addresses are not parsed from DT, but still required
692 * by the clock driver to be setup properly.
693 */
694void __init omap3_control_legacy_iomap_init(void)
695{
696 omap2_clk_legacy_provider_init(TI_CLKM_SCRM, omap2_ctrl_base);
697}
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index baf5783cb05d..c1057eb9d4e4 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -464,9 +464,11 @@ extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
464extern void omap3630_ctrl_disable_rta(void); 464extern void omap3630_ctrl_disable_rta(void);
465extern int omap3_ctrl_save_padconf(void); 465extern int omap3_ctrl_save_padconf(void);
466void omap3_ctrl_init(void); 466void omap3_ctrl_init(void);
467int omap2_control_base_init(void);
467int omap_control_init(void); 468int omap_control_init(void);
468extern void omap2_set_globals_control(void __iomem *ctrl, 469extern void omap2_set_globals_control(void __iomem *ctrl,
469 void __iomem *ctrl_pad); 470 void __iomem *ctrl_pad);
471void __init omap3_control_legacy_iomap_init(void);
470#else 472#else
471#define omap_ctrl_base_get() 0 473#define omap_ctrl_base_get() 0
472#define omap_ctrl_readb(x) 0 474#define omap_ctrl_readb(x) 0
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 712dd42bb5c2..622ee3bddd32 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -384,8 +384,7 @@ void __init omap2420_init_early(void)
384 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); 384 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
385 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), 385 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
386 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); 386 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
387 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE), 387 omap2_control_base_init();
388 NULL);
389 omap2xxx_check_revision(); 388 omap2xxx_check_revision();
390 omap2xxx_prm_init(); 389 omap2xxx_prm_init();
391 omap2xxx_cm_init(); 390 omap2xxx_cm_init();
@@ -412,8 +411,7 @@ void __init omap2430_init_early(void)
412 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); 411 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
413 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), 412 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
414 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); 413 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
415 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), 414 omap2_control_base_init();
416 NULL);
417 omap2xxx_check_revision(); 415 omap2xxx_check_revision();
418 omap2xxx_prm_init(); 416 omap2xxx_prm_init();
419 omap2xxx_cm_init(); 417 omap2xxx_cm_init();
@@ -444,11 +442,15 @@ void __init omap3_init_early(void)
444 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); 442 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
445 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), 443 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
446 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); 444 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
447 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), 445 /* XXX: remove these once OMAP3 is DT only */
448 NULL); 446 if (!of_have_populated_dt()) {
449 /* XXX: remove these two once OMAP3 is DT only */ 447 omap2_set_globals_control(
450 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); 448 OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), NULL);
451 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL); 449 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
450 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
451 NULL);
452 }
453 omap2_control_base_init();
452 omap3xxx_check_revision(); 454 omap3xxx_check_revision();
453 omap3xxx_check_features(); 455 omap3xxx_check_features();
454 omap3xxx_prm_init(); 456 omap3xxx_prm_init();
@@ -459,7 +461,7 @@ void __init omap3_init_early(void)
459 omap3xxx_hwmod_init(); 461 omap3xxx_hwmod_init();
460 omap_hwmod_init_postsetup(); 462 omap_hwmod_init_postsetup();
461 if (!of_have_populated_dt()) { 463 if (!of_have_populated_dt()) {
462 omap3_prcm_legacy_iomaps_init(); 464 omap3_control_legacy_iomap_init();
463 if (soc_is_am35xx()) 465 if (soc_is_am35xx())
464 omap_clk_soc_init = am35xx_clk_legacy_init; 466 omap_clk_soc_init = am35xx_clk_legacy_init;
465 else if (cpu_is_omap3630()) 467 else if (cpu_is_omap3630())
@@ -546,8 +548,7 @@ void __init ti814x_init_early(void)
546{ 548{
547 omap2_set_globals_tap(TI814X_CLASS, 549 omap2_set_globals_tap(TI814X_CLASS,
548 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); 550 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
549 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), 551 omap2_control_base_init();
550 NULL);
551 omap3xxx_check_revision(); 552 omap3xxx_check_revision();
552 ti81xx_check_features(); 553 ti81xx_check_features();
553 am33xx_prm_init(); 554 am33xx_prm_init();
@@ -565,8 +566,7 @@ void __init ti816x_init_early(void)
565{ 566{
566 omap2_set_globals_tap(TI816X_CLASS, 567 omap2_set_globals_tap(TI816X_CLASS,
567 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); 568 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
568 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), 569 omap2_control_base_init();
569 NULL);
570 omap3xxx_check_revision(); 570 omap3xxx_check_revision();
571 ti81xx_check_features(); 571 ti81xx_check_features();
572 am33xx_prm_init(); 572 am33xx_prm_init();
@@ -586,8 +586,7 @@ void __init am33xx_init_early(void)
586{ 586{
587 omap2_set_globals_tap(AM335X_CLASS, 587 omap2_set_globals_tap(AM335X_CLASS,
588 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); 588 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
589 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), 589 omap2_control_base_init();
590 NULL);
591 omap3xxx_check_revision(); 590 omap3xxx_check_revision();
592 am33xx_check_features(); 591 am33xx_check_features();
593 am33xx_prm_init(); 592 am33xx_prm_init();
@@ -610,8 +609,7 @@ void __init am43xx_init_early(void)
610{ 609{
611 omap2_set_globals_tap(AM335X_CLASS, 610 omap2_set_globals_tap(AM335X_CLASS,
612 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); 611 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
613 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), 612 omap2_control_base_init();
614 NULL);
615 omap3xxx_check_revision(); 613 omap3xxx_check_revision();
616 am33xx_check_features(); 614 am33xx_check_features();
617 omap44xx_prm_init(); 615 omap44xx_prm_init();
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 6d0a808f33f7..670733365287 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -21,7 +21,6 @@ extern u16 prm_features;
21extern void omap2_set_globals_prm(void __iomem *prm); 21extern void omap2_set_globals_prm(void __iomem *prm);
22int omap_prcm_init(void); 22int omap_prcm_init(void);
23int omap2_prm_base_init(void); 23int omap2_prm_base_init(void);
24void omap3_prcm_legacy_iomaps_init(void);
25# endif 24# endif
26 25
27/* 26/*
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index b23d2327bafe..a943e1447536 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -722,11 +722,6 @@ int __init omap_prcm_init(void)
722 return 0; 722 return 0;
723} 723}
724 724
725void __init omap3_prcm_legacy_iomaps_init(void)
726{
727 omap2_clk_legacy_provider_init(TI_CLKM_SCRM, omap_ctrl_base_get());
728}
729
730static int __init prm_late_init(void) 725static int __init prm_late_init(void)
731{ 726{
732 if (prm_ll_data->late_init) 727 if (prm_ll_data->late_init)