aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cm_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/cm_common.c')
-rw-r--r--arch/arm/mach-omap2/cm_common.c51
1 files changed, 51 insertions, 0 deletions
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}