|
@@ -24,6 +24,82 @@
|
|
#undef pr_fmt
|
|
#undef pr_fmt
|
|
#define pr_fmt(fmt) "%s: " fmt, __func__
|
|
#define pr_fmt(fmt) "%s: " fmt, __func__
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
|
|
|
|
+ * @hw: struct clk_hw * of the clock being enabled
|
|
|
|
+ *
|
|
|
|
+ * Increment the usecount of the clockdomain of the clock pointed to
|
|
|
|
+ * by @hw; if the usecount is 1, the clockdomain will be "enabled."
|
|
|
|
+ * Only needed for clocks that don't use omap2_dflt_clk_enable() as
|
|
|
|
+ * their enable function pointer. Passes along the return value of
|
|
|
|
+ * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
|
|
|
|
+ * clockdomain, or 0 if clock framework-based clockdomain control is
|
|
|
|
+ * not implemented.
|
|
|
|
+ */
|
|
|
|
+int omap2_clkops_enable_clkdm(struct clk_hw *hw)
|
|
|
|
+{
|
|
|
|
+ struct clk_hw_omap *clk;
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ clk = to_clk_hw_omap(hw);
|
|
|
|
+
|
|
|
|
+ if (unlikely(!clk->clkdm)) {
|
|
|
|
+ pr_err("%s: %s: no clkdm set ?!\n", __func__,
|
|
|
|
+ __clk_get_name(hw->clk));
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (unlikely(clk->enable_reg))
|
|
|
|
+ pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
|
|
|
|
+ __clk_get_name(hw->clk));
|
|
|
|
+
|
|
|
|
+ if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
|
|
|
|
+ pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
|
|
|
|
+ __func__, __clk_get_name(hw->clk));
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk);
|
|
|
|
+ WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
|
|
|
|
+ __func__, __clk_get_name(hw->clk), clk->clkdm_name, ret);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
|
|
|
|
+ * @hw: struct clk_hw * of the clock being disabled
|
|
|
|
+ *
|
|
|
|
+ * Decrement the usecount of the clockdomain of the clock pointed to
|
|
|
|
+ * by @hw; if the usecount is 0, the clockdomain will be "disabled."
|
|
|
|
+ * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
|
|
|
|
+ * disable function pointer. No return value.
|
|
|
|
+ */
|
|
|
|
+void omap2_clkops_disable_clkdm(struct clk_hw *hw)
|
|
|
|
+{
|
|
|
|
+ struct clk_hw_omap *clk;
|
|
|
|
+
|
|
|
|
+ clk = to_clk_hw_omap(hw);
|
|
|
|
+
|
|
|
|
+ if (unlikely(!clk->clkdm)) {
|
|
|
|
+ pr_err("%s: %s: no clkdm set ?!\n", __func__,
|
|
|
|
+ __clk_get_name(hw->clk));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (unlikely(clk->enable_reg))
|
|
|
|
+ pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
|
|
|
|
+ __clk_get_name(hw->clk));
|
|
|
|
+
|
|
|
|
+ if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
|
|
|
|
+ pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
|
|
|
|
+ __func__, __clk_get_name(hw->clk));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ti_clk_ll_ops->clkdm_clk_disable(clk->clkdm, hw->clk);
|
|
|
|
+}
|
|
|
|
+
|
|
static void __init of_ti_clockdomain_setup(struct device_node *node)
|
|
static void __init of_ti_clockdomain_setup(struct device_node *node)
|
|
{
|
|
{
|
|
struct clk *clk;
|
|
struct clk *clk;
|