aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/control.c
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 /arch/arm/mach-omap2/control.c
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>
Diffstat (limited to 'arch/arm/mach-omap2/control.c')
-rw-r--r--arch/arm/mach-omap2/control.c49
1 files changed, 43 insertions, 6 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}