Commit 999ccb50 authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

OMAP2/3 clock: clean up omap2_clk_wait_ready()

Minor cleanup on omap2_clk_wait_ready() in preparation for DSS, SSI fix
patches.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 0901f90f
...@@ -222,20 +222,22 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name) ...@@ -222,20 +222,22 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)
*/ */
static void omap2_clk_wait_ready(struct clk *clk) static void omap2_clk_wait_ready(struct clk *clk)
{ {
u32 bit, reg, other_reg, st_reg; u32 bit;
unsigned long reg, other_reg, st_reg, prcm_mod, prcm_regid;
reg = (__force u32)clk->enable_reg; reg = (unsigned long)clk->enable_reg;
if (((reg & 0xff) >= CM_FCLKEN1) && prcm_mod = reg & ~0xff;
((reg & 0xff) <= OMAP24XX_CM_FCLKEN2)) prcm_regid = reg & 0xff;
if (prcm_regid >= CM_FCLKEN1 && prcm_regid <= OMAP24XX_CM_FCLKEN2)
other_reg = ((reg & ~0xf0) | 0x10); /* CM_ICLKEN* */ other_reg = ((reg & ~0xf0) | 0x10); /* CM_ICLKEN* */
else if (((reg & 0xff) >= CM_ICLKEN1) && else if (prcm_regid >= CM_ICLKEN1 && prcm_regid <= OMAP24XX_CM_ICLKEN4)
((reg & 0xff) <= OMAP24XX_CM_ICLKEN4))
other_reg = ((reg & ~0xf0) | 0x00); /* CM_FCLKEN* */ other_reg = ((reg & ~0xf0) | 0x00); /* CM_FCLKEN* */
else else
return; return;
/* REVISIT: What are the appropriate exclusions for 34XX? */ /* No check for DSS or CAM clocks on 24xx */
/* No check for DSS or cam clocks */ /* REVISIT: This should check prcm_mod against CORE_MOD */
if (cpu_is_omap24xx() && (reg & 0x0f) == 0) { /* CM_{F,I}CLKEN1 */ if (cpu_is_omap24xx() && (reg & 0x0f) == 0) { /* CM_{F,I}CLKEN1 */
if (clk->enable_bit == OMAP24XX_EN_DSS2_SHIFT || if (clk->enable_bit == OMAP24XX_EN_DSS2_SHIFT ||
clk->enable_bit == OMAP24XX_EN_DSS1_SHIFT || clk->enable_bit == OMAP24XX_EN_DSS1_SHIFT ||
...@@ -246,19 +248,19 @@ static void omap2_clk_wait_ready(struct clk *clk) ...@@ -246,19 +248,19 @@ static void omap2_clk_wait_ready(struct clk *clk)
/* REVISIT: What are the appropriate exclusions for 34XX? */ /* REVISIT: What are the appropriate exclusions for 34XX? */
/* OMAP3: ignore DSS-mod clocks */ /* OMAP3: ignore DSS-mod clocks */
if (cpu_is_omap34xx() && if (cpu_is_omap34xx() &&
((reg & ~0xff) == (__force u32)OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD, 0) || (prcm_mod == OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD, 0) ||
(((reg & ~0xff) == (__force u32)OMAP34XX_CM_REGADDR(CORE_MOD, 0)) && (prcm_mod == OMAP34XX_CM_REGADDR(CORE_MOD, 0) &&
clk->enable_bit == OMAP3430_EN_SSI_SHIFT))) clk->enable_bit == OMAP3430_EN_SSI_SHIFT)))
return; return;
/* Check if both functional and interface clocks /* Check if both functional and interface clocks
* are running. */ * are running. */
bit = 1 << clk->enable_bit; bit = 1 << clk->enable_bit;
if (!(__raw_readl((__force void __iomem *)other_reg) & bit)) if (!(__raw_readl((void __iomem *)other_reg) & bit))
return; return;
st_reg = ((other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */ st_reg = ((other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */
omap2_wait_clock_ready((__force void __iomem *)st_reg, bit, clk->name); omap2_wait_clock_ready((void __iomem *)st_reg, bit, clk->name);
} }
/* Enables clock without considering parent dependencies or use count /* Enables clock without considering parent dependencies or use count
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment