diff options
author | Tero Kristo <t-kristo@ti.com> | 2014-11-11 10:17:18 -0500 |
---|---|---|
committer | Tero Kristo <t-kristo@ti.com> | 2015-03-27 04:55:58 -0400 |
commit | ae521d4d9c54995df1e0fb53ef6820374a3cae4e (patch) | |
tree | 977166d09c5836b2c6a87019667d11da96e6246f | |
parent | 5970ca2db960b2c14e077d27950e402e063298e6 (diff) |
ARM: OMAP2+: PRM: determine PRM base address from device tree
There is no need to provide the PRM base address through a low-level API
from the low-level IO init, as this information is available through DT.
Re-routed the parsing function to be called from the PRM drivers also to
simplify the implementation under io.c.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/io.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm2xxx.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm33xx.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm3xxx.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm44xx.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm_common.c | 51 |
7 files changed, 52 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index b43e09da8038..712dd42bb5c2 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -386,7 +386,6 @@ void __init omap2420_init_early(void) | |||
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_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE), |
388 | NULL); | 388 | NULL); |
389 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE)); | ||
390 | omap2xxx_check_revision(); | 389 | omap2xxx_check_revision(); |
391 | omap2xxx_prm_init(); | 390 | omap2xxx_prm_init(); |
392 | omap2xxx_cm_init(); | 391 | omap2xxx_cm_init(); |
@@ -415,7 +414,6 @@ void __init omap2430_init_early(void) | |||
415 | OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); | 414 | OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); |
416 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), | 415 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), |
417 | NULL); | 416 | NULL); |
418 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE)); | ||
419 | omap2xxx_check_revision(); | 417 | omap2xxx_check_revision(); |
420 | omap2xxx_prm_init(); | 418 | omap2xxx_prm_init(); |
421 | omap2xxx_cm_init(); | 419 | omap2xxx_cm_init(); |
@@ -448,9 +446,8 @@ void __init omap3_init_early(void) | |||
448 | OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); | 446 | OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); |
449 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), | 447 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), |
450 | NULL); | 448 | NULL); |
449 | /* XXX: remove these two once OMAP3 is DT only */ | ||
451 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); | 450 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); |
452 | |||
453 | /* XXX: remove this once OMAP3 is DT only */ | ||
454 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL); | 451 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL); |
455 | omap3xxx_check_revision(); | 452 | omap3xxx_check_revision(); |
456 | omap3xxx_check_features(); | 453 | omap3xxx_check_features(); |
@@ -551,7 +548,6 @@ void __init ti814x_init_early(void) | |||
551 | OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); | 548 | OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); |
552 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), | 549 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), |
553 | NULL); | 550 | NULL); |
554 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE)); | ||
555 | omap3xxx_check_revision(); | 551 | omap3xxx_check_revision(); |
556 | ti81xx_check_features(); | 552 | ti81xx_check_features(); |
557 | am33xx_prm_init(); | 553 | am33xx_prm_init(); |
@@ -571,7 +567,6 @@ void __init ti816x_init_early(void) | |||
571 | OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); | 567 | OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); |
572 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), | 568 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), |
573 | NULL); | 569 | NULL); |
574 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE)); | ||
575 | omap3xxx_check_revision(); | 570 | omap3xxx_check_revision(); |
576 | ti81xx_check_features(); | 571 | ti81xx_check_features(); |
577 | am33xx_prm_init(); | 572 | am33xx_prm_init(); |
@@ -593,7 +588,6 @@ void __init am33xx_init_early(void) | |||
593 | AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); | 588 | AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); |
594 | omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), | 589 | omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), |
595 | NULL); | 590 | NULL); |
596 | omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE)); | ||
597 | omap3xxx_check_revision(); | 591 | omap3xxx_check_revision(); |
598 | am33xx_check_features(); | 592 | am33xx_check_features(); |
599 | am33xx_prm_init(); | 593 | am33xx_prm_init(); |
@@ -618,7 +612,6 @@ void __init am43xx_init_early(void) | |||
618 | AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); | 612 | AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); |
619 | omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), | 613 | omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), |
620 | NULL); | 614 | NULL); |
621 | omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE)); | ||
622 | omap3xxx_check_revision(); | 615 | omap3xxx_check_revision(); |
623 | am33xx_check_features(); | 616 | am33xx_check_features(); |
624 | omap44xx_prm_init(); | 617 | omap44xx_prm_init(); |
@@ -644,7 +637,6 @@ void __init omap4430_init_early(void) | |||
644 | OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); | 637 | OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); |
645 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), | 638 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), |
646 | OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE)); | 639 | OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE)); |
647 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE)); | ||
648 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE)); | 640 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE)); |
649 | omap4xxx_check_revision(); | 641 | omap4xxx_check_revision(); |
650 | omap4xxx_check_features(); | 642 | omap4xxx_check_features(); |
@@ -675,7 +667,6 @@ void __init omap5_init_early(void) | |||
675 | OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); | 667 | OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); |
676 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), | 668 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), |
677 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE)); | 669 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE)); |
678 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE)); | ||
679 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); | 670 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); |
680 | omap4_pm_init_early(); | 671 | omap4_pm_init_early(); |
681 | omap44xx_prm_init(); | 672 | omap44xx_prm_init(); |
@@ -703,7 +694,6 @@ void __init dra7xx_init_early(void) | |||
703 | omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); | 694 | omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); |
704 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), | 695 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), |
705 | OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE)); | 696 | OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE)); |
706 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE)); | ||
707 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); | 697 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); |
708 | omap4_pm_init_early(); | 698 | omap4_pm_init_early(); |
709 | omap44xx_prm_init(); | 699 | omap44xx_prm_init(); |
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h index 4e390ec0ed85..6d0a808f33f7 100644 --- a/arch/arm/mach-omap2/prm.h +++ b/arch/arm/mach-omap2/prm.h | |||
@@ -20,6 +20,7 @@ extern void __iomem *prm_base; | |||
20 | extern u16 prm_features; | 20 | extern u16 prm_features; |
21 | extern void omap2_set_globals_prm(void __iomem *prm); | 21 | extern void omap2_set_globals_prm(void __iomem *prm); |
22 | int omap_prcm_init(void); | 22 | int omap_prcm_init(void); |
23 | int omap2_prm_base_init(void); | ||
23 | void omap3_prcm_legacy_iomaps_init(void); | 24 | void omap3_prcm_legacy_iomaps_init(void); |
24 | # endif | 25 | # endif |
25 | 26 | ||
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c index bacb05e8cc39..29e203f38d07 100644 --- a/arch/arm/mach-omap2/prm2xxx.c +++ b/arch/arm/mach-omap2/prm2xxx.c | |||
@@ -222,6 +222,7 @@ static struct prm_ll_data omap2xxx_prm_ll_data = { | |||
222 | 222 | ||
223 | int __init omap2xxx_prm_init(void) | 223 | int __init omap2xxx_prm_init(void) |
224 | { | 224 | { |
225 | omap2_prm_base_init(); | ||
225 | return prm_register(&omap2xxx_prm_ll_data); | 226 | return prm_register(&omap2xxx_prm_ll_data); |
226 | } | 227 | } |
227 | 228 | ||
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c index 02f628601b09..1e052aaf92cd 100644 --- a/arch/arm/mach-omap2/prm33xx.c +++ b/arch/arm/mach-omap2/prm33xx.c | |||
@@ -380,6 +380,7 @@ static struct prm_ll_data am33xx_prm_ll_data = { | |||
380 | 380 | ||
381 | int __init am33xx_prm_init(void) | 381 | int __init am33xx_prm_init(void) |
382 | { | 382 | { |
383 | omap2_prm_base_init(); | ||
383 | return prm_register(&am33xx_prm_ll_data); | 384 | return prm_register(&am33xx_prm_ll_data); |
384 | } | 385 | } |
385 | 386 | ||
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 2b478adc337d..a347993a7bfe 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "prm-regbits-34xx.h" | 29 | #include "prm-regbits-34xx.h" |
30 | #include "cm3xxx.h" | 30 | #include "cm3xxx.h" |
31 | #include "cm-regbits-34xx.h" | 31 | #include "cm-regbits-34xx.h" |
32 | #include "clock.h" | ||
32 | 33 | ||
33 | static void omap3xxx_prm_read_pending_irqs(unsigned long *events); | 34 | static void omap3xxx_prm_read_pending_irqs(unsigned long *events); |
34 | static void omap3xxx_prm_ocp_barrier(void); | 35 | static void omap3xxx_prm_ocp_barrier(void); |
@@ -671,6 +672,10 @@ static struct prm_ll_data omap3xxx_prm_ll_data = { | |||
671 | 672 | ||
672 | int __init omap3xxx_prm_init(void) | 673 | int __init omap3xxx_prm_init(void) |
673 | { | 674 | { |
675 | omap2_clk_legacy_provider_init(TI_CLKM_PRM, | ||
676 | prm_base + OMAP3430_IVA2_MOD); | ||
677 | omap2_prm_base_init(); | ||
678 | |||
674 | if (omap3_has_io_wakeup()) | 679 | if (omap3_has_io_wakeup()) |
675 | prm_features |= PRM_HAS_IO_WAKEUP; | 680 | prm_features |= PRM_HAS_IO_WAKEUP; |
676 | 681 | ||
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index 6f647f698467..b479a33eacfd 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
@@ -705,6 +705,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = { | |||
705 | 705 | ||
706 | int __init omap44xx_prm_init(void) | 706 | int __init omap44xx_prm_init(void) |
707 | { | 707 | { |
708 | omap2_prm_base_init(); | ||
708 | omap_prm_base_init(); | 709 | omap_prm_base_init(); |
709 | 710 | ||
710 | if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) | 711 | if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) |
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 9f9c816ef59f..b23d2327bafe 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
@@ -637,6 +637,16 @@ static struct omap_prcm_init_data prm_data = { | |||
637 | .index = TI_CLKM_PRM, | 637 | .index = TI_CLKM_PRM, |
638 | }; | 638 | }; |
639 | 639 | ||
640 | static struct omap_prcm_init_data omap3_prm_data = { | ||
641 | .index = TI_CLKM_PRM, | ||
642 | |||
643 | /* | ||
644 | * IVA2 offset is a negative value, must offset the prm_base | ||
645 | * address by this to get it to positive | ||
646 | */ | ||
647 | .offset = -OMAP3430_IVA2_MOD, | ||
648 | }; | ||
649 | |||
640 | static struct omap_prcm_init_data scrm_data = { | 650 | static struct omap_prcm_init_data scrm_data = { |
641 | .index = TI_CLKM_SCRM, | 651 | .index = TI_CLKM_SCRM, |
642 | }; | 652 | }; |
@@ -647,7 +657,7 @@ static const struct of_device_id omap_prcm_dt_match_table[] = { | |||
647 | { .compatible = "ti,dm814-prcm", .data = &prm_data }, | 657 | { .compatible = "ti,dm814-prcm", .data = &prm_data }, |
648 | { .compatible = "ti,dm816-prcm", .data = &prm_data }, | 658 | { .compatible = "ti,dm816-prcm", .data = &prm_data }, |
649 | { .compatible = "ti,omap2-prcm", .data = &prm_data }, | 659 | { .compatible = "ti,omap2-prcm", .data = &prm_data }, |
650 | { .compatible = "ti,omap3-prm", .data = &prm_data }, | 660 | { .compatible = "ti,omap3-prm", .data = &omap3_prm_data }, |
651 | { .compatible = "ti,omap4-prm", .data = &prm_data }, | 661 | { .compatible = "ti,omap4-prm", .data = &prm_data }, |
652 | { .compatible = "ti,omap4-scrm", .data = &scrm_data }, | 662 | { .compatible = "ti,omap4-scrm", .data = &scrm_data }, |
653 | { .compatible = "ti,omap5-prm", .data = &prm_data }, | 663 | { .compatible = "ti,omap5-prm", .data = &prm_data }, |
@@ -657,6 +667,36 @@ static const struct of_device_id omap_prcm_dt_match_table[] = { | |||
657 | }; | 667 | }; |
658 | 668 | ||
659 | /** | 669 | /** |
670 | * omap2_prm_base_init - initialize iomappings for the PRM driver | ||
671 | * | ||
672 | * Detects and initializes the iomappings for the PRM driver, based | ||
673 | * on the DT data. Returns 0 in success, negative error value | ||
674 | * otherwise. | ||
675 | */ | ||
676 | int __init omap2_prm_base_init(void) | ||
677 | { | ||
678 | struct device_node *np; | ||
679 | const struct of_device_id *match; | ||
680 | struct omap_prcm_init_data *data; | ||
681 | void __iomem *mem; | ||
682 | |||
683 | for_each_matching_node_and_match(np, omap_prcm_dt_match_table, &match) { | ||
684 | data = (struct omap_prcm_init_data *)match->data; | ||
685 | |||
686 | mem = of_iomap(np, 0); | ||
687 | if (!mem) | ||
688 | return -ENOMEM; | ||
689 | |||
690 | if (data->index == TI_CLKM_PRM) | ||
691 | prm_base = mem + data->offset; | ||
692 | |||
693 | data->mem = mem; | ||
694 | } | ||
695 | |||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | /** | ||
660 | * omap_prcm_init - low level init for the PRCM drivers | 700 | * omap_prcm_init - low level init for the PRCM drivers |
661 | * | 701 | * |
662 | * Initializes the low level clock infrastructure for PRCM drivers. | 702 | * Initializes the low level clock infrastructure for PRCM drivers. |
@@ -665,7 +705,6 @@ static const struct of_device_id omap_prcm_dt_match_table[] = { | |||
665 | int __init omap_prcm_init(void) | 705 | int __init omap_prcm_init(void) |
666 | { | 706 | { |
667 | struct device_node *np; | 707 | struct device_node *np; |
668 | void __iomem *mem; | ||
669 | const struct of_device_id *match; | 708 | const struct of_device_id *match; |
670 | const struct omap_prcm_init_data *data; | 709 | const struct omap_prcm_init_data *data; |
671 | int ret; | 710 | int ret; |
@@ -673,11 +712,7 @@ int __init omap_prcm_init(void) | |||
673 | for_each_matching_node_and_match(np, omap_prcm_dt_match_table, &match) { | 712 | for_each_matching_node_and_match(np, omap_prcm_dt_match_table, &match) { |
674 | data = match->data; | 713 | data = match->data; |
675 | 714 | ||
676 | mem = of_iomap(np, 0); | 715 | ret = omap2_clk_provider_init(np, data->index, data->mem); |
677 | if (!mem) | ||
678 | return -ENOMEM; | ||
679 | |||
680 | ret = omap2_clk_provider_init(np, data->index, mem); | ||
681 | if (ret) | 716 | if (ret) |
682 | return ret; | 717 | return ret; |
683 | } | 718 | } |
@@ -689,8 +724,6 @@ int __init omap_prcm_init(void) | |||
689 | 724 | ||
690 | void __init omap3_prcm_legacy_iomaps_init(void) | 725 | void __init omap3_prcm_legacy_iomaps_init(void) |
691 | { | 726 | { |
692 | omap2_clk_legacy_provider_init(TI_CLKM_PRM, | ||
693 | prm_base + OMAP3430_IVA2_MOD); | ||
694 | omap2_clk_legacy_provider_init(TI_CLKM_SCRM, omap_ctrl_base_get()); | 727 | omap2_clk_legacy_provider_init(TI_CLKM_SCRM, omap_ctrl_base_get()); |
695 | } | 728 | } |
696 | 729 | ||