aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c13
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c13
-rw-r--r--arch/arm/mach-omap2/clock.h22
-rw-r--r--arch/arm/mach-omap2/clock34xx.c51
-rw-r--r--arch/arm/mach-omap2/clock3517.c37
-rw-r--r--arch/arm/mach-omap2/clock36xx.c25
-rw-r--r--arch/arm/mach-omap2/clock36xx.h4
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c10
-rw-r--r--arch/arm/mach-omap2/clock3xxx.h7
9 files changed, 170 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 5510d92abe6e..aeaaa87cca06 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -45,8 +45,15 @@
45 * Program the DPLL M2 divider with the rounded target rate. Returns 45 * Program the DPLL M2 divider with the rounded target rate. Returns
46 * -EINVAL upon error, or 0 upon success. 46 * -EINVAL upon error, or 0 upon success.
47 */ 47 */
48#ifdef CONFIG_COMMON_CLK
49int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
50 unsigned long parent_rate)
51{
52 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
53#else
48int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) 54int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
49{ 55{
56#endif
50 u32 new_div = 0; 57 u32 new_div = 0;
51 u32 unlock_dll = 0; 58 u32 unlock_dll = 0;
52 u32 c; 59 u32 c;
@@ -64,7 +71,11 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
64 return -EINVAL; 71 return -EINVAL;
65 72
66 sdrcrate = __clk_get_rate(sdrc_ick_p); 73 sdrcrate = __clk_get_rate(sdrc_ick_p);
74#ifdef CONFIG_COMMON_CLK
75 clkrate = __clk_get_rate(hw->clk);
76#else
67 clkrate = __clk_get_rate(clk); 77 clkrate = __clk_get_rate(clk);
78#endif
68 if (rate > clkrate) 79 if (rate > clkrate)
69 sdrcrate <<= ((rate / clkrate) >> 1); 80 sdrcrate <<= ((rate / clkrate) >> 1);
70 else 81 else
@@ -113,7 +124,9 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
113 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 124 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
114 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 125 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
115 0, 0, 0, 0); 126 0, 0, 0, 0);
127#ifndef CONFIG_COMMON_CLK
116 clk->rate = rate; 128 clk->rate = rate;
129#endif
117 130
118 return 0; 131 return 0;
119} 132}
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 3b661ba73fc2..650c8c77a573 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -27,7 +27,11 @@
27/* Private functions */ 27/* Private functions */
28 28
29/* XXX */ 29/* XXX */
30#ifdef CONFIG_COMMON_CLK
31void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
32#else
30void omap2_clkt_iclk_allow_idle(struct clk *clk) 33void omap2_clkt_iclk_allow_idle(struct clk *clk)
34#endif
31{ 35{
32 u32 v, r; 36 u32 v, r;
33 37
@@ -39,7 +43,11 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk)
39} 43}
40 44
41/* XXX */ 45/* XXX */
46#ifdef CONFIG_COMMON_CLK
47void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
48#else
42void omap2_clkt_iclk_deny_idle(struct clk *clk) 49void omap2_clkt_iclk_deny_idle(struct clk *clk)
50#endif
43{ 51{
44 u32 v, r; 52 u32 v, r;
45 53
@@ -53,6 +61,11 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk)
53/* Public data */ 61/* Public data */
54 62
55#ifdef CONFIG_COMMON_CLK 63#ifdef CONFIG_COMMON_CLK
64const struct clk_hw_omap_ops clkhwops_iclk = {
65 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle,
67};
68
56const struct clk_hw_omap_ops clkhwops_iclk_wait = { 69const struct clk_hw_omap_ops clkhwops_iclk_wait = {
57 .allow_idle = omap2_clkt_iclk_allow_idle, 70 .allow_idle = omap2_clkt_iclk_allow_idle,
58 .deny_idle = omap2_clkt_iclk_deny_idle, 71 .deny_idle = omap2_clkt_iclk_deny_idle,
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 5a4f4fe42b9b..6800d5f82050 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -509,8 +509,13 @@ int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent);
509#endif 509#endif
510 510
511/* clkt_iclk.c public functions */ 511/* clkt_iclk.c public functions */
512#ifdef CONFIG_COMMON_CLK
513extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
514extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
515#else
512extern void omap2_clkt_iclk_allow_idle(struct clk *clk); 516extern void omap2_clkt_iclk_allow_idle(struct clk *clk);
513extern void omap2_clkt_iclk_deny_idle(struct clk *clk); 517extern void omap2_clkt_iclk_deny_idle(struct clk *clk);
518#endif
514 519
515#ifdef CONFIG_COMMON_CLK 520#ifdef CONFIG_COMMON_CLK
516u8 omap2_init_dpll_parent(struct clk_hw *hw); 521u8 omap2_init_dpll_parent(struct clk_hw *hw);
@@ -561,8 +566,20 @@ extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
561extern const struct clk_hw_omap_ops clkhwops_iclk_wait; 566extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
562extern const struct clk_hw_omap_ops clkhwops_wait; 567extern const struct clk_hw_omap_ops clkhwops_wait;
563extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx; 568extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
564#endif 569extern const struct clk_hw_omap_ops clkhwops_iclk;
565 570extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
571extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
572extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
573extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
574extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
575extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
576extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
577extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
578extern const struct clk_hw_omap_ops clkhwops_apll54;
579extern const struct clk_hw_omap_ops clkhwops_apll96;
580extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
581extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
582#else
566extern const struct clkops clkops_omap2_iclk_dflt_wait; 583extern const struct clkops clkops_omap2_iclk_dflt_wait;
567extern const struct clkops clkops_omap2_iclk_dflt; 584extern const struct clkops clkops_omap2_iclk_dflt;
568extern const struct clkops clkops_omap2_iclk_idle_only; 585extern const struct clkops clkops_omap2_iclk_idle_only;
@@ -571,6 +588,7 @@ extern const struct clkops clkops_omap2xxx_dpll_ops;
571extern const struct clkops clkops_omap3_noncore_dpll_ops; 588extern const struct clkops clkops_omap3_noncore_dpll_ops;
572extern const struct clkops clkops_omap3_core_dpll_ops; 589extern const struct clkops clkops_omap3_core_dpll_ops;
573extern const struct clkops clkops_omap4_dpllmx_ops; 590extern const struct clkops clkops_omap4_dpllmx_ops;
591#endif /* CONFIG_COMMON_CLK */
574 592
575/* clksel_rate blocks shared between OMAP44xx and AM33xx */ 593/* clksel_rate blocks shared between OMAP44xx and AM33xx */
576extern const struct clksel_rate div_1_0_rates[]; 594extern const struct clksel_rate div_1_0_rates[];
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index e41819ba7482..b398a4655fed 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -37,7 +37,11 @@
37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via 37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
38 * @idlest_reg and @idlest_bit. No return value. 38 * @idlest_reg and @idlest_bit. No return value.
39 */ 39 */
40#ifdef CONFIG_COMMON_CLK
41static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
42#else
40static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, 43static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
44#endif
41 void __iomem **idlest_reg, 45 void __iomem **idlest_reg,
42 u8 *idlest_bit, 46 u8 *idlest_bit,
43 u8 *idlest_val) 47 u8 *idlest_val)
@@ -49,7 +53,19 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; 53 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
50 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 54 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
51} 55}
56#ifdef CONFIG_COMMON_CLK
57const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
58 .find_idlest = omap3430es2_clk_ssi_find_idlest,
59 .find_companion = omap2_clk_dflt_find_companion,
60};
52 61
62const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
63 .allow_idle = omap2_clkt_iclk_allow_idle,
64 .deny_idle = omap2_clkt_iclk_deny_idle,
65 .find_idlest = omap3430es2_clk_ssi_find_idlest,
66 .find_companion = omap2_clk_dflt_find_companion,
67};
68#else
53const struct clkops clkops_omap3430es2_ssi_wait = { 69const struct clkops clkops_omap3430es2_ssi_wait = {
54 .enable = omap2_dflt_clk_enable, 70 .enable = omap2_dflt_clk_enable,
55 .disable = omap2_dflt_clk_disable, 71 .disable = omap2_dflt_clk_disable,
@@ -65,6 +81,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
65 .allow_idle = omap2_clkt_iclk_allow_idle, 81 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle, 82 .deny_idle = omap2_clkt_iclk_deny_idle,
67}; 83};
84#endif
68 85
69/** 86/**
70 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST 87 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
@@ -80,7 +97,11 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
80 * default find_idlest code assumes that they are at the same 97 * default find_idlest code assumes that they are at the same
81 * position.) No return value. 98 * position.) No return value.
82 */ 99 */
100#ifdef CONFIG_COMMON_CLK
101static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
102#else
83static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, 103static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
104#endif
84 void __iomem **idlest_reg, 105 void __iomem **idlest_reg,
85 u8 *idlest_bit, 106 u8 *idlest_bit,
86 u8 *idlest_val) 107 u8 *idlest_val)
@@ -93,7 +114,19 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
93 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT; 114 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
94 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 115 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
95} 116}
117#ifdef CONFIG_COMMON_CLK
118const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
119 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
120 .find_companion = omap2_clk_dflt_find_companion,
121};
96 122
123const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
124 .allow_idle = omap2_clkt_iclk_allow_idle,
125 .deny_idle = omap2_clkt_iclk_deny_idle,
126 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
127 .find_companion = omap2_clk_dflt_find_companion,
128};
129#else
97const struct clkops clkops_omap3430es2_dss_usbhost_wait = { 130const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
98 .enable = omap2_dflt_clk_enable, 131 .enable = omap2_dflt_clk_enable,
99 .disable = omap2_dflt_clk_disable, 132 .disable = omap2_dflt_clk_disable,
@@ -109,6 +142,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
109 .allow_idle = omap2_clkt_iclk_allow_idle, 142 .allow_idle = omap2_clkt_iclk_allow_idle,
110 .deny_idle = omap2_clkt_iclk_deny_idle, 143 .deny_idle = omap2_clkt_iclk_deny_idle,
111}; 144};
145#endif
112 146
113/** 147/**
114 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB 148 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
@@ -121,7 +155,11 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
121 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via 155 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
122 * @idlest_reg and @idlest_bit. No return value. 156 * @idlest_reg and @idlest_bit. No return value.
123 */ 157 */
158#ifdef CONFIG_COMMON_CLK
159static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
160#else
124static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, 161static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
162#endif
125 void __iomem **idlest_reg, 163 void __iomem **idlest_reg,
126 u8 *idlest_bit, 164 u8 *idlest_bit,
127 u8 *idlest_val) 165 u8 *idlest_val)
@@ -133,7 +171,19 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
133 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT; 171 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
134 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 172 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
135} 173}
174#ifdef CONFIG_COMMON_CLK
175const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
176 .allow_idle = omap2_clkt_iclk_allow_idle,
177 .deny_idle = omap2_clkt_iclk_deny_idle,
178 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
179 .find_companion = omap2_clk_dflt_find_companion,
180};
136 181
182const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
183 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
184 .find_companion = omap2_clk_dflt_find_companion,
185};
186#else
137const struct clkops clkops_omap3430es2_hsotgusb_wait = { 187const struct clkops clkops_omap3430es2_hsotgusb_wait = {
138 .enable = omap2_dflt_clk_enable, 188 .enable = omap2_dflt_clk_enable,
139 .disable = omap2_dflt_clk_disable, 189 .disable = omap2_dflt_clk_disable,
@@ -149,3 +199,4 @@ const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = {
149 .allow_idle = omap2_clkt_iclk_allow_idle, 199 .allow_idle = omap2_clkt_iclk_allow_idle,
150 .deny_idle = omap2_clkt_iclk_deny_idle, 200 .deny_idle = omap2_clkt_iclk_deny_idle,
151}; 201};
202#endif
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 622ea0502610..467d8bc6b4aa 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -47,7 +47,11 @@
47 * in the enable register itsel at a bit offset of 4 from the enable 47 * in the enable register itsel at a bit offset of 4 from the enable
48 * bit. A value of 1 indicates that clock is enabled. 48 * bit. A value of 1 indicates that clock is enabled.
49 */ 49 */
50#ifdef CONFIG_COMMON_CLK
51static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
52#else
50static void am35xx_clk_find_idlest(struct clk *clk, 53static void am35xx_clk_find_idlest(struct clk *clk,
54#endif
51 void __iomem **idlest_reg, 55 void __iomem **idlest_reg,
52 u8 *idlest_bit, 56 u8 *idlest_bit,
53 u8 *idlest_val) 57 u8 *idlest_val)
@@ -71,8 +75,14 @@ static void am35xx_clk_find_idlest(struct clk *clk,
71 * associate this type of code with per-module data structures to 75 * associate this type of code with per-module data structures to
72 * avoid this issue, and remove the casts. No return value. 76 * avoid this issue, and remove the casts. No return value.
73 */ 77 */
74static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, 78#ifdef CONFIG_COMMON_CLK
75 u8 *other_bit) 79static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
80 void __iomem **other_reg,
81#else
82static void am35xx_clk_find_companion(struct clk *clk,
83 void __iomem **other_reg,
84#endif
85 u8 *other_bit)
76{ 86{
77 *other_reg = (__force void __iomem *)(clk->enable_reg); 87 *other_reg = (__force void __iomem *)(clk->enable_reg);
78 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK) 88 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
@@ -80,13 +90,19 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg,
80 else 90 else
81 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; 91 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
82} 92}
83 93#ifdef CONFIG_COMMON_CLK
94const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
95 .find_idlest = am35xx_clk_find_idlest,
96 .find_companion = am35xx_clk_find_companion,
97};
98#else
84const struct clkops clkops_am35xx_ipss_module_wait = { 99const struct clkops clkops_am35xx_ipss_module_wait = {
85 .enable = omap2_dflt_clk_enable, 100 .enable = omap2_dflt_clk_enable,
86 .disable = omap2_dflt_clk_disable, 101 .disable = omap2_dflt_clk_disable,
87 .find_idlest = am35xx_clk_find_idlest, 102 .find_idlest = am35xx_clk_find_idlest,
88 .find_companion = am35xx_clk_find_companion, 103 .find_companion = am35xx_clk_find_companion,
89}; 104};
105#endif
90 106
91/** 107/**
92 * am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS 108 * am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS
@@ -99,7 +115,11 @@ const struct clkops clkops_am35xx_ipss_module_wait = {
99 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg 115 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
100 * and @idlest_bit. No return value. 116 * and @idlest_bit. No return value.
101 */ 117 */
118#ifdef CONFIG_COMMON_CLK
119static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
120#else
102static void am35xx_clk_ipss_find_idlest(struct clk *clk, 121static void am35xx_clk_ipss_find_idlest(struct clk *clk,
122#endif
103 void __iomem **idlest_reg, 123 void __iomem **idlest_reg,
104 u8 *idlest_bit, 124 u8 *idlest_bit,
105 u8 *idlest_val) 125 u8 *idlest_val)
@@ -111,7 +131,14 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk,
111 *idlest_bit = AM35XX_ST_IPSS_SHIFT; 131 *idlest_bit = AM35XX_ST_IPSS_SHIFT;
112 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 132 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
113} 133}
114 134#ifdef CONFIG_COMMON_CLK
135const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
136 .allow_idle = omap2_clkt_iclk_allow_idle,
137 .deny_idle = omap2_clkt_iclk_deny_idle,
138 .find_idlest = am35xx_clk_ipss_find_idlest,
139 .find_companion = omap2_clk_dflt_find_companion,
140};
141#else
115const struct clkops clkops_am35xx_ipss_wait = { 142const struct clkops clkops_am35xx_ipss_wait = {
116 .enable = omap2_dflt_clk_enable, 143 .enable = omap2_dflt_clk_enable,
117 .disable = omap2_dflt_clk_disable, 144 .disable = omap2_dflt_clk_disable,
@@ -120,5 +147,5 @@ const struct clkops clkops_am35xx_ipss_wait = {
120 .allow_idle = omap2_clkt_iclk_allow_idle, 147 .allow_idle = omap2_clkt_iclk_allow_idle,
121 .deny_idle = omap2_clkt_iclk_deny_idle, 148 .deny_idle = omap2_clkt_iclk_deny_idle,
122}; 149};
123 150#endif
124 151
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 0e1e9e4e2fa4..9f50e9704891 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -37,34 +37,51 @@
37 * (Any other value different from the Read value) to the 37 * (Any other value different from the Read value) to the
38 * corresponding CM_CLKSEL register will refresh the dividers. 38 * corresponding CM_CLKSEL register will refresh the dividers.
39 */ 39 */
40#ifdef CONFIG_COMMON_CLK
41int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
42{
43 struct clk_hw_omap *parent;
44 struct clk_hw *parent_hw;
45#else
40static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk) 46static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk)
41{ 47{
48 struct clk *parent;
49#endif
42 u32 dummy_v, orig_v, clksel_shift; 50 u32 dummy_v, orig_v, clksel_shift;
43 int ret; 51 int ret;
44 52
45 /* Clear PWRDN bit of HSDIVIDER */ 53 /* Clear PWRDN bit of HSDIVIDER */
46 ret = omap2_dflt_clk_enable(clk); 54 ret = omap2_dflt_clk_enable(clk);
47 55
56#ifdef CONFIG_COMMON_CLK
57 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
58 parent = to_clk_hw_omap(parent_hw);
59#else
60 parent = clk->parent;
61#endif
62
48 /* Restore the dividers */ 63 /* Restore the dividers */
49 if (!ret) { 64 if (!ret) {
50 clksel_shift = __ffs(clk->parent->clksel_mask); 65 clksel_shift = __ffs(parent->clksel_mask);
51 orig_v = __raw_readl(clk->parent->clksel_reg); 66 orig_v = __raw_readl(parent->clksel_reg);
52 dummy_v = orig_v; 67 dummy_v = orig_v;
53 68
54 /* Write any other value different from the Read value */ 69 /* Write any other value different from the Read value */
55 dummy_v ^= (1 << clksel_shift); 70 dummy_v ^= (1 << clksel_shift);
56 __raw_writel(dummy_v, clk->parent->clksel_reg); 71 __raw_writel(dummy_v, parent->clksel_reg);
57 72
58 /* Write the original divider */ 73 /* Write the original divider */
59 __raw_writel(orig_v, clk->parent->clksel_reg); 74 __raw_writel(orig_v, parent->clksel_reg);
60 } 75 }
61 76
62 return ret; 77 return ret;
63} 78}
64 79
80#ifndef CONFIG_COMMON_CLK
65const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = { 81const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = {
66 .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore, 82 .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
67 .disable = omap2_dflt_clk_disable, 83 .disable = omap2_dflt_clk_disable,
68 .find_companion = omap2_clk_dflt_find_companion, 84 .find_companion = omap2_clk_dflt_find_companion,
69 .find_idlest = omap2_clk_dflt_find_idlest, 85 .find_idlest = omap2_clk_dflt_find_idlest,
70}; 86};
87#endif
diff --git a/arch/arm/mach-omap2/clock36xx.h b/arch/arm/mach-omap2/clock36xx.h
index a7dee5bc6364..e6a748e54215 100644
--- a/arch/arm/mach-omap2/clock36xx.h
+++ b/arch/arm/mach-omap2/clock36xx.h
@@ -8,6 +8,10 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
10 10
11#ifdef CONFIG_COMMON_CLK
12extern int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *hw);
13#else
11extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; 14extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
15#endif
12 16
13#endif 17#endif
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 3e8aca2b1b61..a6f75cd85327 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -38,8 +38,12 @@
38 38
39/* needed by omap3_core_dpll_m2_set_rate() */ 39/* needed by omap3_core_dpll_m2_set_rate() */
40struct clk *sdrc_ick_p, *arm_fck_p; 40struct clk *sdrc_ick_p, *arm_fck_p;
41 41#ifdef CONFIG_COMMON_CLK
42int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
43 unsigned long parent_rate)
44#else
42int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) 45int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
46#endif
43{ 47{
44 /* 48 /*
45 * According to the 12-5 CDP code from TI, "Limitation 2.5" 49 * According to the 12-5 CDP code from TI, "Limitation 2.5"
@@ -51,7 +55,11 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
51 return -EINVAL; 55 return -EINVAL;
52 } 56 }
53 57
58#ifdef CONFIG_COMMON_CLK
59 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
60#else
54 return omap3_noncore_dpll_set_rate(clk, rate); 61 return omap3_noncore_dpll_set_rate(clk, rate);
62#endif
55} 63}
56 64
57void __init omap3_clk_lock_dpll5(void) 65void __init omap3_clk_lock_dpll5(void)
diff --git a/arch/arm/mach-omap2/clock3xxx.h b/arch/arm/mach-omap2/clock3xxx.h
index 8bbeeaf399e2..87f098dde71d 100644
--- a/arch/arm/mach-omap2/clock3xxx.h
+++ b/arch/arm/mach-omap2/clock3xxx.h
@@ -9,8 +9,15 @@
9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H
10 10
11int omap3xxx_clk_init(void); 11int omap3xxx_clk_init(void);
12#ifdef CONFIG_COMMON_CLK
13int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
14 unsigned long parent_rate);
15int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
16 unsigned long parent_rate);
17#else
12int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate); 18int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate);
13int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate); 19int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate);
20#endif
14void omap3_clk_lock_dpll5(void); 21void omap3_clk_lock_dpll5(void);
15 22
16extern struct clk *sdrc_ick_p; 23extern struct clk *sdrc_ick_p;