aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-03-12 12:33:45 -0400
committerTero Kristo <t-kristo@ti.com>2015-03-27 04:55:56 -0400
commitfe87414f71d0035756cf91a80ac256557d16b488 (patch)
treef9808093ca44fa2cd7f7c43182c171052945ab85 /arch/arm
parent9f029b1579b2dfe291006e5bfe8e7d0c4ef20828 (diff)
ARM: OMAP2+: PRCM: split PRCM module init to their own driver files
Splits the clock related provider module inits under their own driver files. Previously this was done for all modules under the common PRM driver. Signed-off-by: Tero Kristo <t-kristo@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/cm.h1
-rw-r--r--arch/arm/mach-omap2/cm_common.c51
-rw-r--r--arch/arm/mach-omap2/control.c47
-rw-r--r--arch/arm/mach-omap2/control.h1
-rw-r--r--arch/arm/mach-omap2/io.c4
-rw-r--r--arch/arm/mach-omap2/prm_common.c23
6 files changed, 106 insertions, 21 deletions
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index 6222e87a79b6..748ac338812b 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -70,6 +70,7 @@ int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
70int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs); 70int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
71extern int cm_register(struct cm_ll_data *cld); 71extern int cm_register(struct cm_ll_data *cld);
72extern int cm_unregister(struct cm_ll_data *cld); 72extern int cm_unregister(struct cm_ll_data *cld);
73int omap_cm_init(void);
73 74
74# endif 75# endif
75 76
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 8fe02fcedc48..f3d578be3272 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -15,10 +15,13 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/bug.h> 17#include <linux/bug.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
18 20
19#include "cm2xxx.h" 21#include "cm2xxx.h"
20#include "cm3xxx.h" 22#include "cm3xxx.h"
21#include "cm44xx.h" 23#include "cm44xx.h"
24#include "clock.h"
22 25
23/* 26/*
24 * cm_ll_data: function pointers to SoC-specific implementations of 27 * cm_ll_data: function pointers to SoC-specific implementations of
@@ -212,3 +215,51 @@ int cm_unregister(struct cm_ll_data *cld)
212 215
213 return 0; 216 return 0;
214} 217}
218
219static struct omap_prcm_init_data cm_data = {
220 .index = TI_CLKM_CM,
221};
222
223static struct omap_prcm_init_data cm2_data = {
224 .index = TI_CLKM_CM2,
225};
226
227static const struct of_device_id omap_cm_dt_match_table[] = {
228 { .compatible = "ti,omap3-cm", .data = &cm_data },
229 { .compatible = "ti,omap4-cm1", .data = &cm_data },
230 { .compatible = "ti,omap4-cm2", .data = &cm2_data },
231 { .compatible = "ti,omap5-cm-core-aon", .data = &cm_data },
232 { .compatible = "ti,omap5-cm-core", .data = &cm2_data },
233 { .compatible = "ti,dra7-cm-core-aon", .data = &cm_data },
234 { .compatible = "ti,dra7-cm-core", .data = &cm2_data },
235 { }
236};
237
238/**
239 * omap_cm_init - low level init for the CM drivers
240 *
241 * Initializes the low level clock infrastructure for CM drivers.
242 * Returns 0 in success, negative error value in failure.
243 */
244int __init omap_cm_init(void)
245{
246 struct device_node *np;
247 void __iomem *mem;
248 const struct of_device_id *match;
249 const struct omap_prcm_init_data *data;
250 int ret;
251
252 for_each_matching_node_and_match(np, omap_cm_dt_match_table, &match) {
253 data = match->data;
254
255 mem = of_iomap(np, 0);
256 if (!mem)
257 return -ENOMEM;
258
259 ret = omap2_clk_provider_init(np, data->index, mem);
260 if (ret)
261 return ret;
262 }
263
264 return 0;
265}
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index da041b4ab29c..e8818242f968 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of_address.h>
17 18
18#include "soc.h" 19#include "soc.h"
19#include "iomap.h" 20#include "iomap.h"
@@ -25,6 +26,7 @@
25#include "sdrc.h" 26#include "sdrc.h"
26#include "pm.h" 27#include "pm.h"
27#include "control.h" 28#include "control.h"
29#include "clock.h"
28 30
29/* Used by omap3_ctrl_save_padconf() */ 31/* Used by omap3_ctrl_save_padconf() */
30#define START_PADCONF_SAVE 0x2 32#define START_PADCONF_SAVE 0x2
@@ -611,3 +613,48 @@ void __init omap3_ctrl_init(void)
611 omap3_ctrl_setup_d2d_padconf(); 613 omap3_ctrl_setup_d2d_padconf();
612} 614}
613#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 615#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
616
617struct control_init_data {
618 int index;
619};
620
621static struct control_init_data ctrl_data = {
622 .index = TI_CLKM_CTRL,
623};
624
625static const struct of_device_id omap_scrm_dt_match_table[] = {
626 { .compatible = "ti,am3-scrm", .data = &ctrl_data },
627 { .compatible = "ti,am4-scrm", .data = &ctrl_data },
628 { .compatible = "ti,omap2-scrm", .data = &ctrl_data },
629 { .compatible = "ti,omap3-scrm", .data = &ctrl_data },
630 { }
631};
632
633/**
634 * omap_control_init - low level init for the control driver
635 *
636 * Initializes the low level clock infrastructure for control driver.
637 * Returns 0 in success, negative error value in failure.
638 */
639int __init omap_control_init(void)
640{
641 struct device_node *np;
642 void __iomem *mem;
643 const struct of_device_id *match;
644 const struct omap_prcm_init_data *data;
645 int ret;
646
647 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
648 data = match->data;
649
650 mem = of_iomap(np, 0);
651 if (!mem)
652 return -ENOMEM;
653
654 ret = omap2_clk_provider_init(np, data->index, mem);
655 if (ret)
656 return ret;
657 }
658
659 return 0;
660}
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index b8a487181210..baf5783cb05d 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -464,6 +464,7 @@ 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 omap_control_init(void);
467extern void omap2_set_globals_control(void __iomem *ctrl, 468extern void omap2_set_globals_control(void __iomem *ctrl,
468 void __iomem *ctrl_pad); 469 void __iomem *ctrl_pad);
469#else 470#else
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 460da22a005c..46640c0ddc0f 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -756,6 +756,10 @@ int __init omap_clk_init(void)
756 ti_clk_init_features(); 756 ti_clk_init_features();
757 757
758 if (of_have_populated_dt()) { 758 if (of_have_populated_dt()) {
759 ret = omap_control_init();
760 if (ret)
761 return ret;
762
759 ret = omap_prcm_init(); 763 ret = omap_prcm_init();
760 if (ret) 764 if (ret)
761 return ret; 765 return ret;
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 1bfd00e10f76..6cbebbe252c4 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -637,43 +637,22 @@ static struct omap_prcm_init_data prm_data = {
637 .index = TI_CLKM_PRM, 637 .index = TI_CLKM_PRM,
638}; 638};
639 639
640static struct omap_prcm_init_data cm_data = {
641 .index = TI_CLKM_CM,
642};
643
644static struct omap_prcm_init_data cm2_data = {
645 .index = TI_CLKM_CM2,
646};
647
648static struct omap_prcm_init_data scrm_data = { 640static struct omap_prcm_init_data scrm_data = {
649 .index = TI_CLKM_SCRM, 641 .index = TI_CLKM_SCRM,
650}; 642};
651 643
652static const struct of_device_id omap_prcm_dt_match_table[] = { 644static const struct of_device_id omap_prcm_dt_match_table[] = {
653 { .compatible = "ti,am3-prcm", .data = &prm_data }, 645 { .compatible = "ti,am3-prcm", .data = &prm_data },
654 { .compatible = "ti,am3-scrm", .data = &scrm_data },
655 { .compatible = "ti,am4-prcm", .data = &prm_data }, 646 { .compatible = "ti,am4-prcm", .data = &prm_data },
656 { .compatible = "ti,am4-scrm", .data = &scrm_data },
657 { .compatible = "ti,dm814-prcm", .data = &prm_data }, 647 { .compatible = "ti,dm814-prcm", .data = &prm_data },
658 { .compatible = "ti,dm814-scrm", .data = &scrm_data },
659 { .compatible = "ti,dm816-prcm", .data = &prm_data }, 648 { .compatible = "ti,dm816-prcm", .data = &prm_data },
660 { .compatible = "ti,dm816-scrm", .data = &scrm_data },
661 { .compatible = "ti,omap2-prcm", .data = &prm_data }, 649 { .compatible = "ti,omap2-prcm", .data = &prm_data },
662 { .compatible = "ti,omap2-scrm", .data = &scrm_data },
663 { .compatible = "ti,omap3-prm", .data = &prm_data }, 650 { .compatible = "ti,omap3-prm", .data = &prm_data },
664 { .compatible = "ti,omap3-cm", .data = &cm_data },
665 { .compatible = "ti,omap3-scrm", .data = &scrm_data },
666 { .compatible = "ti,omap4-cm1", .data = &cm_data },
667 { .compatible = "ti,omap4-prm", .data = &prm_data }, 651 { .compatible = "ti,omap4-prm", .data = &prm_data },
668 { .compatible = "ti,omap4-cm2", .data = &cm2_data },
669 { .compatible = "ti,omap4-scrm", .data = &scrm_data }, 652 { .compatible = "ti,omap4-scrm", .data = &scrm_data },
670 { .compatible = "ti,omap5-prm", .data = &prm_data }, 653 { .compatible = "ti,omap5-prm", .data = &prm_data },
671 { .compatible = "ti,omap5-cm-core-aon", .data = &cm_data },
672 { .compatible = "ti,omap5-scrm", .data = &scrm_data }, 654 { .compatible = "ti,omap5-scrm", .data = &scrm_data },
673 { .compatible = "ti,omap5-cm-core", .data = &cm2_data },
674 { .compatible = "ti,dra7-prm", .data = &prm_data }, 655 { .compatible = "ti,dra7-prm", .data = &prm_data },
675 { .compatible = "ti,dra7-cm-core-aon", .data = &cm_data },
676 { .compatible = "ti,dra7-cm-core", .data = &cm2_data },
677 { } 656 { }
678}; 657};
679 658
@@ -703,6 +682,8 @@ int __init omap_prcm_init(void)
703 return ret; 682 return ret;
704 } 683 }
705 684
685 omap_cm_init();
686
706 return 0; 687 return 0;
707} 688}
708 689