aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-09-08 04:29:43 -0400
committerTero Kristo <t-kristo@ti.com>2015-03-31 14:26:44 -0400
commit48e0c1148d18de677f1b2aec179f36fb7c1e3839 (patch)
treea99f48711d42fe91fd81ef55d5ced8352c4bdc2f
parentab7b2ffcf576a49b51c240dcd68ca4b7cd60b84d (diff)
ARM: OMAP4+: PRM: determine prm_device_inst based on DT compatibility
PRM device instance offset is now provided through the prm_init_data. This gets rid of some cpu_is_X / soc_is_X calls from PRM core code, preparing for PRM to be its own separate driver. Signed-off-by: Tero Kristo <t-kristo@ti.com>
-rw-r--r--arch/arm/mach-omap2/prcm-common.h2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c2
-rw-r--r--arch/arm/mach-omap2/prm_common.c37
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c18
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h1
5 files changed, 42 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 461bdc4ea8ec..6ae0b3a1781e 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -524,6 +524,7 @@ struct omap_prcm_irq_setup {
524 * @mem: IO mem pointer for this module 524 * @mem: IO mem pointer for this module
525 * @offset: module base address offset from the IO base 525 * @offset: module base address offset from the IO base
526 * @flags: PRCM module init flags 526 * @flags: PRCM module init flags
527 * @device_inst_offset: device instance offset within the module address space
527 * @init: low level PRCM init function for this module 528 * @init: low level PRCM init function for this module
528 * @np: device node for this PRCM module 529 * @np: device node for this PRCM module
529 */ 530 */
@@ -532,6 +533,7 @@ struct omap_prcm_init_data {
532 void __iomem *mem; 533 void __iomem *mem;
533 s16 offset; 534 s16 offset;
534 u16 flags; 535 u16 flags;
536 s32 device_inst_offset;
535 int (*init)(const struct omap_prcm_init_data *data); 537 int (*init)(const struct omap_prcm_init_data *data);
536 struct device_node *np; 538 struct device_node *np;
537}; 539};
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index e3f2d313e341..a980d245a0bb 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -713,6 +713,8 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
713 if (!soc_is_dra7xx()) 713 if (!soc_is_dra7xx())
714 prm_features |= PRM_HAS_VOLTAGE; 714 prm_features |= PRM_HAS_VOLTAGE;
715 715
716 omap4_prminst_set_prm_dev_inst(data->device_inst_offset);
717
716 return prm_register(&omap44xx_prm_ll_data); 718 return prm_register(&omap44xx_prm_ll_data);
717} 719}
718 720
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index aede589822fb..a834124c5309 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -34,6 +34,9 @@
34#include "prm3xxx.h" 34#include "prm3xxx.h"
35#include "prm33xx.h" 35#include "prm33xx.h"
36#include "prm44xx.h" 36#include "prm44xx.h"
37#include "prm54xx.h"
38#include "prm7xx.h"
39#include "prcm43xx.h"
37#include "common.h" 40#include "common.h"
38#include "clock.h" 41#include "clock.h"
39#include "cm.h" 42#include "cm.h"
@@ -661,11 +664,35 @@ static struct omap_prcm_init_data am3_prm_data __initdata = {
661}; 664};
662#endif 665#endif
663 666
664#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ 667#ifdef CONFIG_ARCH_OMAP4
665 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX)
666static struct omap_prcm_init_data omap4_prm_data __initdata = { 668static struct omap_prcm_init_data omap4_prm_data __initdata = {
667 .index = TI_CLKM_PRM, 669 .index = TI_CLKM_PRM,
668 .init = omap44xx_prm_init, 670 .init = omap44xx_prm_init,
671 .device_inst_offset = OMAP4430_PRM_DEVICE_INST,
672};
673#endif
674
675#ifdef CONFIG_SOC_OMAP5
676static struct omap_prcm_init_data omap5_prm_data __initdata = {
677 .index = TI_CLKM_PRM,
678 .init = omap44xx_prm_init,
679 .device_inst_offset = OMAP54XX_PRM_DEVICE_INST,
680};
681#endif
682
683#ifdef CONFIG_SOC_DRA7XX
684static struct omap_prcm_init_data dra7_prm_data __initdata = {
685 .index = TI_CLKM_PRM,
686 .init = omap44xx_prm_init,
687 .device_inst_offset = DRA7XX_PRM_DEVICE_INST,
688};
689#endif
690
691#ifdef CONFIG_SOC_AM43XX
692static struct omap_prcm_init_data am4_prm_data __initdata = {
693 .index = TI_CLKM_PRM,
694 .init = omap44xx_prm_init,
695 .device_inst_offset = AM43XX_PRM_DEVICE_INST,
669}; 696};
670#endif 697#endif
671 698
@@ -680,7 +707,7 @@ static const struct of_device_id omap_prcm_dt_match_table[] __initconst = {
680 { .compatible = "ti,am3-prcm", .data = &am3_prm_data }, 707 { .compatible = "ti,am3-prcm", .data = &am3_prm_data },
681#endif 708#endif
682#ifdef CONFIG_SOC_AM43XX 709#ifdef CONFIG_SOC_AM43XX
683 { .compatible = "ti,am4-prcm", .data = &omap4_prm_data }, 710 { .compatible = "ti,am4-prcm", .data = &am4_prm_data },
684#endif 711#endif
685#ifdef CONFIG_SOC_TI81XX 712#ifdef CONFIG_SOC_TI81XX
686 { .compatible = "ti,dm814-prcm", .data = &am3_prm_data }, 713 { .compatible = "ti,dm814-prcm", .data = &am3_prm_data },
@@ -697,11 +724,11 @@ static const struct of_device_id omap_prcm_dt_match_table[] __initconst = {
697 { .compatible = "ti,omap4-scrm", .data = &scrm_data }, 724 { .compatible = "ti,omap4-scrm", .data = &scrm_data },
698#endif 725#endif
699#ifdef CONFIG_SOC_OMAP5 726#ifdef CONFIG_SOC_OMAP5
700 { .compatible = "ti,omap5-prm", .data = &omap4_prm_data }, 727 { .compatible = "ti,omap5-prm", .data = &omap5_prm_data },
701 { .compatible = "ti,omap5-scrm", .data = &scrm_data }, 728 { .compatible = "ti,omap5-scrm", .data = &scrm_data },
702#endif 729#endif
703#ifdef CONFIG_SOC_DRA7XX 730#ifdef CONFIG_SOC_DRA7XX
704 { .compatible = "ti,dra7-prm", .data = &omap4_prm_data }, 731 { .compatible = "ti,dra7-prm", .data = &dra7_prm_data },
705#endif 732#endif
706 { } 733 { }
707}; 734};
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 8adf7b1a1dce..c4859c4d3646 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -47,22 +47,14 @@ void omap_prm_base_init(void)
47 47
48s32 omap4_prmst_get_prm_dev_inst(void) 48s32 omap4_prmst_get_prm_dev_inst(void)
49{ 49{
50 if (prm_dev_inst != PRM_INSTANCE_UNKNOWN)
51 return prm_dev_inst;
52
53 /* This cannot be done way early at boot.. as things are not setup */
54 if (cpu_is_omap44xx())
55 prm_dev_inst = OMAP4430_PRM_DEVICE_INST;
56 else if (soc_is_omap54xx())
57 prm_dev_inst = OMAP54XX_PRM_DEVICE_INST;
58 else if (soc_is_dra7xx())
59 prm_dev_inst = DRA7XX_PRM_DEVICE_INST;
60 else if (soc_is_am43xx())
61 prm_dev_inst = AM43XX_PRM_DEVICE_INST;
62
63 return prm_dev_inst; 50 return prm_dev_inst;
64} 51}
65 52
53void omap4_prminst_set_prm_dev_inst(s32 dev_inst)
54{
55 prm_dev_inst = dev_inst;
56}
57
66/* Read a register in a PRM instance */ 58/* Read a register in a PRM instance */
67u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) 59u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
68{ 60{
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index fb1c9d7a2f9d..0c03d0731d7f 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -14,6 +14,7 @@
14 14
15#define PRM_INSTANCE_UNKNOWN -1 15#define PRM_INSTANCE_UNKNOWN -1
16extern s32 omap4_prmst_get_prm_dev_inst(void); 16extern s32 omap4_prmst_get_prm_dev_inst(void);
17void omap4_prminst_set_prm_dev_inst(s32 dev_inst);
17 18
18/* 19/*
19 * In an ideal world, we would not export these low-level functions, 20 * In an ideal world, we would not export these low-level functions,