summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/control.c
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-11-13 20:17:34 +0300
committerTero Kristo <t-kristo@ti.com>2015-03-27 11:56:00 +0300
commit2208bf115fecae211480ea41d25e6d56ec20d405 (patch)
treef501ce2dab6097b2cf47f06c08174ac3187755e1 /arch/arm/mach-omap2/control.c
parentae521d4d9c54995df1e0fb53ef6820374a3cae4e (diff)
downloadlinux-2208bf115fecae211480ea41d25e6d56ec20d405.tar.xz
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)
struct control_init_data {
int index;
+ void __iomem *mem;
};
static struct control_init_data ctrl_data = {
@@ -627,10 +628,39 @@ static const struct of_device_id omap_scrm_dt_match_table[] = {
{ .compatible = "ti,am4-scrm", .data = &ctrl_data },
{ .compatible = "ti,omap2-scrm", .data = &ctrl_data },
{ .compatible = "ti,omap3-scrm", .data = &ctrl_data },
+ { .compatible = "ti,dm816-scrm", .data = &ctrl_data },
{ }
};
/**
+ * omap2_control_base_init - initialize iomappings for the control driver
+ *
+ * Detects and initializes the iomappings for the control driver, based
+ * on the DT data. Returns 0 in success, negative error value
+ * otherwise.
+ */
+int __init omap2_control_base_init(void)
+{
+ struct device_node *np;
+ const struct of_device_id *match;
+ struct control_init_data *data;
+ void __iomem *mem;
+
+ for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
+ data = (struct control_init_data *)match->data;
+
+ mem = of_iomap(np, 0);
+ if (!mem)
+ return -ENOMEM;
+
+ omap2_ctrl_base = mem;
+ data->mem = mem;
+ }
+
+ return 0;
+}
+
+/**
* omap_control_init - low level init for the control driver
*
* Initializes the low level clock infrastructure for control driver.
@@ -639,7 +669,6 @@ static const struct of_device_id omap_scrm_dt_match_table[] = {
int __init omap_control_init(void)
{
struct device_node *np;
- void __iomem *mem;
const struct of_device_id *match;
const struct omap_prcm_init_data *data;
int ret;
@@ -647,14 +676,22 @@ int __init omap_control_init(void)
for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
data = match->data;
- mem = of_iomap(np, 0);
- if (!mem)
- return -ENOMEM;
-
- ret = omap2_clk_provider_init(np, data->index, mem);
+ ret = omap2_clk_provider_init(np, data->index, data->mem);
if (ret)
return ret;
}
return 0;
}
+
+/**
+ * omap3_control_legacy_iomap_init - legacy iomap init for clock providers
+ *
+ * Legacy iomap init for clock provider. Needed only by legacy boot mode,
+ * where the base addresses are not parsed from DT, but still required
+ * by the clock driver to be setup properly.
+ */
+void __init omap3_control_legacy_iomap_init(void)
+{
+ omap2_clk_legacy_provider_init(TI_CLKM_SCRM, omap2_ctrl_base);
+}