summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRuss Dill <Russ.Dill@ti.com>2014-08-26 11:13:35 +0530
committerTero Kristo <t-kristo@ti.com>2014-09-01 10:55:12 +0300
commit31bdb0f10c7129a157e238fde12390dae8e08d92 (patch)
treee7ca7da7e1c8d94c8b5c672a33f5ed2256465692 /include
parentdc8e25ce5d131e9b94ebace14bf7edde76960fac (diff)
ARM: OMAP2: Add functions to save and restore clock/dpll context en-masse.
The clock/dpll registers are in the WKUP power domain. Under both RTC-only suspend and hibernation, these registers are lost. Signed-off-by: Russ Dill <Russ.Dill@ti.com> [j-keerthy@ti.com] ported to 3.14 with quite a bit of rework Signed-off-by: Keerthy <j-keerthy@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/clk-provider.h11
-rw-r--r--include/linux/clk.h24
-rw-r--r--include/linux/clk/ti.h7
3 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 939533da93a..5c1b9fad04d 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -73,6 +73,11 @@ struct clk_hw;
* Called with enable_lock held. This function must not
* sleep.
*
+ * @save_context: Save the context of the clock in prepration for poweroff.
+ *
+ * @restore_context: Restore the context of the clock after a restoration
+ * of power.
+ *
* @recalc_rate Recalculate the rate of this clock, by querying hardware. The
* parent rate is an input parameter. It is up to the caller to
* ensure that the prepare_mutex is held across this call.
@@ -148,6 +153,8 @@ struct clk_ops {
void (*disable)(struct clk_hw *hw);
int (*is_enabled)(struct clk_hw *hw);
void (*disable_unused)(struct clk_hw *hw);
+ int (*save_context)(struct clk_hw *hw);
+ void (*restore_context)(struct clk_hw *hw);
unsigned long (*recalc_rate)(struct clk_hw *hw,
unsigned long parent_rate);
long (*round_rate)(struct clk_hw *hw, unsigned long,
@@ -313,6 +320,7 @@ struct clk_divider {
u8 flags;
const struct clk_div_table *table;
spinlock_t *lock;
+ u32 context;
};
#define CLK_DIVIDER_ONE_BASED BIT(0)
@@ -360,6 +368,7 @@ struct clk_mux {
u8 shift;
u8 flags;
spinlock_t *lock;
+ u8 saved_parent;
};
#define CLK_MUX_INDEX_ONE BIT(0)
@@ -570,5 +579,7 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
#endif /* platform dependent I/O accessors */
+void clk_dflt_restore_context(struct clk_hw *hw);
+
#endif /* CONFIG_COMMON_CLK */
#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dd91148165..e88a9275cfe 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -293,6 +293,23 @@ struct clk *clk_get_parent(struct clk *clk);
*/
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
+/**
+ * clks_save_context - save clock context for poweroff
++ *
+ * Saves the context of the clock register for powerstates in which the
+ * contents of the registers will be lost. Occurs deep within the suspend
+ * code so locking is not necessary.
+ */
+int clks_save_context(void);
+
+/**
++ * clks_restore_context - restore clock context after poweroff
+ *
+ * This occurs with all clocks enabled. Occurs deep within the resume code
+ * so locking is not necessary.
+ */
+void clks_restore_context(void);
+
#else /* !CONFIG_HAVE_CLK */
static inline struct clk *clk_get(struct device *dev, const char *id)
@@ -341,6 +358,13 @@ static inline struct clk *clk_get_parent(struct clk *clk)
return NULL;
}
+static inline int clks_save_context(void)
+{
+ return 0;
+}
+
+static inline void clks_restore_context(void) {}
+
#endif
/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 845f640302a..f411764a8b7 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -148,6 +148,7 @@ struct clk_hw_omap {
const char *clkdm_name;
struct clockdomain *clkdm;
const struct clk_hw_omap_ops *ops;
+ u32 context;
};
/*
@@ -318,6 +319,12 @@ static inline void of_ti_clk_allow_autoidle_all(void) { }
static inline void of_ti_clk_deny_autoidle_all(void) { }
#endif
+int omap3_noncore_dpll_save_context(struct clk_hw *hw);
+void omap3_noncore_dpll_restore_context(struct clk_hw *hw);
+
+int omap3_core_dpll_save_context(struct clk_hw *hw);
+void omap3_core_dpll_restore_context(struct clk_hw *hw);
+
extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;