|
@@ -716,3 +716,55 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
|
|
}
|
|
}
|
|
|
|
|
|
kfree(pdata);
|
|
kfree(pdata);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap2_dm_timer_init - top level regular device initialization
|
|
|
|
+ *
|
|
|
|
+ * Uses dedicated hwmod api to parse through hwmod database for
|
|
|
|
+ * given class name and then build and register the timer device.
|
|
|
|
+ */
|
|
|
|
+static int __init omap2_dm_timer_init(void)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ /* If dtb is there, the devices will be created dynamically */
|
|
|
|
+ if (of_have_populated_dt())
|
|
|
|
+ return -ENODEV;
|
|
|
|
+
|
|
|
|
+ ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
|
|
|
|
+ if (unlikely(ret)) {
|
|
|
|
+ pr_err("%s: device registration failed.\n", __func__);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+arch_initcall(omap2_dm_timer_init);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap2_override_clocksource - clocksource override with user configuration
|
|
|
|
+ *
|
|
|
|
+ * Allows user to override default clocksource, using kernel parameter
|
|
|
|
+ * clocksource="gp_timer" (For all OMAP2PLUS architectures)
|
|
|
|
+ *
|
|
|
|
+ * Note that, here we are using same standard kernel parameter "clocksource=",
|
|
|
|
+ * and not introducing any OMAP specific interface.
|
|
|
|
+ */
|
|
|
|
+static int __init omap2_override_clocksource(char *str)
|
|
|
|
+{
|
|
|
|
+ if (!str)
|
|
|
|
+ return 0;
|
|
|
|
+ /*
|
|
|
|
+ * For OMAP architecture, we only have two options
|
|
|
|
+ * - sync_32k (default)
|
|
|
|
+ * - gp_timer (sys_clk based)
|
|
|
|
+ */
|
|
|
|
+ if (!strcmp(str, "gp_timer"))
|
|
|
|
+ use_gptimer_clksrc = true;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+early_param("clocksource", omap2_override_clocksource);
|