aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-11-04 13:59:32 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 06:38:40 -0500
commitbc51da4ee46d481dc3fbc57ec407594b80e92705 (patch)
tree35f3ad987f9c655127bd449a703b1222e6209484 /arch
parentb36ee724208358bd892ad279efce629740517149 (diff)
[ARM] omap: eliminate unnecessary conditionals in omap2_clk_wait_ready
Rather than employing run-time tests in omap2_clk_wait_ready() to decide whether we need to wait for the clock to become ready, we can set the .ops appropriately. This change deals with the OMAP24xx and OMAP34xx conditionals only. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/clock.c42
-rw-r--r--arch/arm/mach-omap2/clock.h1
-rw-r--r--arch/arm/mach-omap2/clock24xx.h10
-rw-r--r--arch/arm/mach-omap2/clock34xx.h14
4 files changed, 35 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 8c09711d2eaf..986c9f582752 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -237,23 +237,6 @@ static void omap2_clk_wait_ready(struct clk *clk)
237 else 237 else
238 return; 238 return;
239 239
240 /* REVISIT: What are the appropriate exclusions for 34XX? */
241 /* No check for DSS or cam clocks */
242 if (cpu_is_omap24xx() && ((u32)reg & 0x0f) == 0) { /* CM_{F,I}CLKEN1 */
243 if (clk->enable_bit == OMAP24XX_EN_DSS2_SHIFT ||
244 clk->enable_bit == OMAP24XX_EN_DSS1_SHIFT ||
245 clk->enable_bit == OMAP24XX_EN_CAM_SHIFT)
246 return;
247 }
248
249 /* REVISIT: What are the appropriate exclusions for 34XX? */
250 /* OMAP3: ignore DSS-mod clocks */
251 if (cpu_is_omap34xx() &&
252 (((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(OMAP3430_DSS_MOD, 0) ||
253 ((((u32)reg & ~0xff) == (u32)OMAP_CM_REGADDR(CORE_MOD, 0)) &&
254 clk->enable_bit == OMAP3430_EN_SSI_SHIFT)))
255 return;
256
257 /* Check if both functional and interface clocks 240 /* Check if both functional and interface clocks
258 * are running. */ 241 * are running. */
259 bit = 1 << clk->enable_bit; 242 bit = 1 << clk->enable_bit;
@@ -264,7 +247,7 @@ static void omap2_clk_wait_ready(struct clk *clk)
264 omap2_wait_clock_ready(st_reg, bit, clk->name); 247 omap2_wait_clock_ready(st_reg, bit, clk->name);
265} 248}
266 249
267static int omap2_dflt_clk_enable_wait(struct clk *clk) 250static int omap2_dflt_clk_enable(struct clk *clk)
268{ 251{
269 u32 regval32; 252 u32 regval32;
270 253
@@ -282,11 +265,25 @@ static int omap2_dflt_clk_enable_wait(struct clk *clk)
282 __raw_writel(regval32, clk->enable_reg); 265 __raw_writel(regval32, clk->enable_reg);
283 wmb(); 266 wmb();
284 267
285 omap2_clk_wait_ready(clk);
286
287 return 0; 268 return 0;
288} 269}
289 270
271static int omap2_dflt_clk_enable_wait(struct clk *clk)
272{
273 int ret;
274
275 if (unlikely(clk->enable_reg == NULL)) {
276 printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
277 clk->name);
278 return 0; /* REVISIT: -EINVAL */
279 }
280
281 ret = omap2_dflt_clk_enable(clk);
282 if (ret == 0)
283 omap2_clk_wait_ready(clk);
284 return ret;
285}
286
290static void omap2_dflt_clk_disable(struct clk *clk) 287static void omap2_dflt_clk_disable(struct clk *clk)
291{ 288{
292 u32 regval32; 289 u32 regval32;
@@ -315,6 +312,11 @@ const struct clkops clkops_omap2_dflt_wait = {
315 .disable = omap2_dflt_clk_disable, 312 .disable = omap2_dflt_clk_disable,
316}; 313};
317 314
315const struct clkops clkops_omap2_dflt = {
316 .enable = omap2_dflt_clk_enable,
317 .disable = omap2_dflt_clk_disable,
318};
319
318/* Enables clock without considering parent dependencies or use count 320/* Enables clock without considering parent dependencies or use count
319 * REVISIT: Maybe change this to use clk->enable like on omap1? 321 * REVISIT: Maybe change this to use clk->enable like on omap1?
320 */ 322 */
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index d4bdb59b3000..b0358b659b43 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -52,6 +52,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
52void omap2_clk_prepare_for_reboot(void); 52void omap2_clk_prepare_for_reboot(void);
53 53
54extern const struct clkops clkops_omap2_dflt_wait; 54extern const struct clkops clkops_omap2_dflt_wait;
55extern const struct clkops clkops_omap2_dflt;
55 56
56extern u8 cpu_mask; 57extern u8 cpu_mask;
57 58
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index b59bf902ce7c..d386b3dfabae 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -1455,7 +1455,7 @@ static const struct clksel dss1_fck_clksel[] = {
1455 1455
1456static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ 1456static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
1457 .name = "dss_ick", 1457 .name = "dss_ick",
1458 .ops = &clkops_omap2_dflt_wait, 1458 .ops = &clkops_omap2_dflt,
1459 .parent = &l4_ck, /* really both l3 and l4 */ 1459 .parent = &l4_ck, /* really both l3 and l4 */
1460 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1460 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1461 .clkdm_name = "dss_clkdm", 1461 .clkdm_name = "dss_clkdm",
@@ -1466,7 +1466,7 @@ static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
1466 1466
1467static struct clk dss1_fck = { 1467static struct clk dss1_fck = {
1468 .name = "dss1_fck", 1468 .name = "dss1_fck",
1469 .ops = &clkops_omap2_dflt_wait, 1469 .ops = &clkops_omap2_dflt,
1470 .parent = &core_ck, /* Core or sys */ 1470 .parent = &core_ck, /* Core or sys */
1471 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 1471 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
1472 DELAYED_APP, 1472 DELAYED_APP,
@@ -1500,7 +1500,7 @@ static const struct clksel dss2_fck_clksel[] = {
1500 1500
1501static struct clk dss2_fck = { /* Alt clk used in power management */ 1501static struct clk dss2_fck = { /* Alt clk used in power management */
1502 .name = "dss2_fck", 1502 .name = "dss2_fck",
1503 .ops = &clkops_omap2_dflt_wait, 1503 .ops = &clkops_omap2_dflt,
1504 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */ 1504 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
1505 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 1505 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
1506 DELAYED_APP, 1506 DELAYED_APP,
@@ -2206,7 +2206,7 @@ static struct clk icr_ick = {
2206 2206
2207static struct clk cam_ick = { 2207static struct clk cam_ick = {
2208 .name = "cam_ick", 2208 .name = "cam_ick",
2209 .ops = &clkops_omap2_dflt_wait, 2209 .ops = &clkops_omap2_dflt,
2210 .parent = &l4_ck, 2210 .parent = &l4_ck,
2211 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 2211 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
2212 .clkdm_name = "core_l4_clkdm", 2212 .clkdm_name = "core_l4_clkdm",
@@ -2222,7 +2222,7 @@ static struct clk cam_ick = {
2222 */ 2222 */
2223static struct clk cam_fck = { 2223static struct clk cam_fck = {
2224 .name = "cam_fck", 2224 .name = "cam_fck",
2225 .ops = &clkops_omap2_dflt_wait, 2225 .ops = &clkops_omap2_dflt,
2226 .parent = &func_96m_ck, 2226 .parent = &func_96m_ck,
2227 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 2227 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
2228 .clkdm_name = "core_l3_clkdm", 2228 .clkdm_name = "core_l3_clkdm",
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 0d6a11ca132d..1ff05d351b38 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1652,7 +1652,7 @@ static const struct clksel ssi_ssr_clksel[] = {
1652 1652
1653static struct clk ssi_ssr_fck = { 1653static struct clk ssi_ssr_fck = {
1654 .name = "ssi_ssr_fck", 1654 .name = "ssi_ssr_fck",
1655 .ops = &clkops_omap2_dflt_wait, 1655 .ops = &clkops_omap2_dflt,
1656 .init = &omap2_init_clksel_parent, 1656 .init = &omap2_init_clksel_parent,
1657 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1657 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1658 .enable_bit = OMAP3430_EN_SSI_SHIFT, 1658 .enable_bit = OMAP3430_EN_SSI_SHIFT,
@@ -2064,7 +2064,7 @@ static struct clk ssi_l4_ick = {
2064 2064
2065static struct clk ssi_ick = { 2065static struct clk ssi_ick = {
2066 .name = "ssi_ick", 2066 .name = "ssi_ick",
2067 .ops = &clkops_omap2_dflt_wait, 2067 .ops = &clkops_omap2_dflt,
2068 .parent = &ssi_l4_ick, 2068 .parent = &ssi_l4_ick,
2069 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2069 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2070 .enable_bit = OMAP3430_EN_SSI_SHIFT, 2070 .enable_bit = OMAP3430_EN_SSI_SHIFT,
@@ -2156,7 +2156,7 @@ static const struct clksel dss1_alwon_fck_clksel[] = {
2156 2156
2157static struct clk dss1_alwon_fck = { 2157static struct clk dss1_alwon_fck = {
2158 .name = "dss1_alwon_fck", 2158 .name = "dss1_alwon_fck",
2159 .ops = &clkops_omap2_dflt_wait, 2159 .ops = &clkops_omap2_dflt,
2160 .parent = &dpll4_m4x2_ck, 2160 .parent = &dpll4_m4x2_ck,
2161 .init = &omap2_init_clksel_parent, 2161 .init = &omap2_init_clksel_parent,
2162 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2162 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
@@ -2171,7 +2171,7 @@ static struct clk dss1_alwon_fck = {
2171 2171
2172static struct clk dss_tv_fck = { 2172static struct clk dss_tv_fck = {
2173 .name = "dss_tv_fck", 2173 .name = "dss_tv_fck",
2174 .ops = &clkops_omap2_dflt_wait, 2174 .ops = &clkops_omap2_dflt,
2175 .parent = &omap_54m_fck, 2175 .parent = &omap_54m_fck,
2176 .init = &omap2_init_clk_clkdm, 2176 .init = &omap2_init_clk_clkdm,
2177 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2177 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
@@ -2183,7 +2183,7 @@ static struct clk dss_tv_fck = {
2183 2183
2184static struct clk dss_96m_fck = { 2184static struct clk dss_96m_fck = {
2185 .name = "dss_96m_fck", 2185 .name = "dss_96m_fck",
2186 .ops = &clkops_omap2_dflt_wait, 2186 .ops = &clkops_omap2_dflt,
2187 .parent = &omap_96m_fck, 2187 .parent = &omap_96m_fck,
2188 .init = &omap2_init_clk_clkdm, 2188 .init = &omap2_init_clk_clkdm,
2189 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2189 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
@@ -2195,7 +2195,7 @@ static struct clk dss_96m_fck = {
2195 2195
2196static struct clk dss2_alwon_fck = { 2196static struct clk dss2_alwon_fck = {
2197 .name = "dss2_alwon_fck", 2197 .name = "dss2_alwon_fck",
2198 .ops = &clkops_omap2_dflt_wait, 2198 .ops = &clkops_omap2_dflt,
2199 .parent = &sys_ck, 2199 .parent = &sys_ck,
2200 .init = &omap2_init_clk_clkdm, 2200 .init = &omap2_init_clk_clkdm,
2201 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2201 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
@@ -2208,7 +2208,7 @@ static struct clk dss2_alwon_fck = {
2208static struct clk dss_ick = { 2208static struct clk dss_ick = {
2209 /* Handles both L3 and L4 clocks */ 2209 /* Handles both L3 and L4 clocks */
2210 .name = "dss_ick", 2210 .name = "dss_ick",
2211 .ops = &clkops_omap2_dflt_wait, 2211 .ops = &clkops_omap2_dflt,
2212 .parent = &l4_ick, 2212 .parent = &l4_ick,
2213 .init = &omap2_init_clk_clkdm, 2213 .init = &omap2_init_clk_clkdm,
2214 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), 2214 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),