Commit 205f37af authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

OMAP3 clock: don't wait for USBHOST IDLEST bit on usbhost_120m_fclk enable

USBHOST on 3430ES2+ has both an initiator and a target CM_IDLEST bit.
Previously, usbhost_48m_fclk enable waited on the wrong bit -- now
fixed.  Also, it appears that USBHOST module readiness (in terms of
CM_IDLEST) only depends on usbhost_48m_fclk and usbhost_iclk.  So
don't wait on usbhost_120m_fck.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 15c706e8
...@@ -222,8 +222,8 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name) ...@@ -222,8 +222,8 @@ 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; u32 other_bit, idlest_bit;
unsigned long reg, other_reg, st_reg, prcm_mod, prcm_regid; unsigned long reg, other_reg, idlest_reg, prcm_mod, prcm_regid;
reg = (unsigned long)clk->enable_reg; reg = (unsigned long)clk->enable_reg;
prcm_mod = reg & ~0xff; prcm_mod = reg & ~0xff;
...@@ -236,6 +236,10 @@ static void omap2_clk_wait_ready(struct clk *clk) ...@@ -236,6 +236,10 @@ static void omap2_clk_wait_ready(struct clk *clk)
else else
return; return;
/* Covers most of the cases - a few exceptions are below */
other_bit = 1 << clk->enable_bit;
idlest_bit = other_bit;
/* 24xx: DSS and CAM have no idlest bits for their target agents */ /* 24xx: DSS and CAM have no idlest bits for their target agents */
if (cpu_is_omap24xx() && if (cpu_is_omap24xx() &&
(prcm_mod == OMAP2420_CM_REGADDR(CORE_MOD, 0) || (prcm_mod == OMAP2420_CM_REGADDR(CORE_MOD, 0) ||
...@@ -253,12 +257,16 @@ static void omap2_clk_wait_ready(struct clk *clk) ...@@ -253,12 +257,16 @@ static void omap2_clk_wait_ready(struct clk *clk)
if (cpu_is_omap34xx()) { if (cpu_is_omap34xx()) {
/* SSI */ /* SSI */
if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0) && if (prcm_mod == OMAP34XX_CM_REGADDR(CORE_MOD, 0) &&
prcm_mod == OMAP34XX_CM_REGADDR(CORE_MOD, 0) &&
(reg & 0x0f) == 0 && (reg & 0x0f) == 0 &&
clk->enable_bit == OMAP3430_EN_SSI_SHIFT) clk->enable_bit == OMAP3430_EN_SSI_SHIFT) {
if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
return; return;
idlest_bit = OMAP3430ES2_ST_SSI_IDLE;
}
/* DSS */ /* DSS */
if (prcm_mod == OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD, 0)) { if (prcm_mod == OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD, 0)) {
...@@ -272,38 +280,35 @@ static void omap2_clk_wait_ready(struct clk *clk) ...@@ -272,38 +280,35 @@ static void omap2_clk_wait_ready(struct clk *clk)
*/ */
if (clk->enable_bit != OMAP3430_EN_DSS1_SHIFT) if (clk->enable_bit != OMAP3430_EN_DSS1_SHIFT)
return; return;
}
idlest_bit = OMAP3430ES2_ST_DSS_IDLE;
} }
/* Check if both functional and interface clocks /* USBHOST */
* are running. */ if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0) &&
bit = 1 << clk->enable_bit; prcm_mod == OMAP34XX_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, 0)) {
if (!(__raw_readl((void __iomem *)other_reg) & bit))
return;
/* /*
* OMAP3430ES2+ has target idlest bits at unusual offsets for * The 120MHz clock apparently has nothing to do with
* modules with both initiator and target agents * USBHOST module accessibility
*/ */
if (cpu_is_omap34xx()) { if (clk->enable_bit == OMAP3430ES2_EN_USBHOST2_SHIFT)
return;
/* SSI */
if (prcm_mod == OMAP34XX_CM_REGADDR(CORE_MOD, 0) &&
(reg & 0x0f) == 0 &&
clk->enable_bit == OMAP3430_EN_SSI_SHIFT)
bit = OMAP3430ES2_ST_SSI_IDLE;
/* DSS */ idlest_bit = OMAP3430ES2_ST_USBHOST_IDLE;
if (prcm_mod == OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD, 0) &&
clk->enable_bit == OMAP3430_EN_DSS1_SHIFT)
bit = OMAP3430ES2_ST_DSS_IDLE;
} }
}
st_reg = ((other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */ /* Check if both functional and interface clocks
* are running. */
if (!(__raw_readl((void __iomem *)other_reg) & other_bit))
return;
omap2_wait_clock_ready((void __iomem *)st_reg, bit, clk->name); idlest_reg = ((other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */
omap2_wait_clock_ready((void __iomem *)idlest_reg, idlest_bit,
clk->name);
} }
/* Enables clock without considering parent dependencies or use count /* Enables clock without considering parent dependencies or use count
......
...@@ -690,6 +690,8 @@ ...@@ -690,6 +690,8 @@
#define OMAP3430ES2_EN_USBHOST_MASK (1 << 0) #define OMAP3430ES2_EN_USBHOST_MASK (1 << 0)
/* CM_IDLEST_USBHOST */ /* CM_IDLEST_USBHOST */
#define OMAP3430ES2_ST_USBHOST_IDLE (1 << 1)
#define OMAP3430ES2_ST_USBHOST_STDBY (1 << 0)
/* CM_AUTOIDLE_USBHOST */ /* CM_AUTOIDLE_USBHOST */
#define OMAP3430ES2_AUTO_USBHOST_SHIFT 0 #define OMAP3430ES2_AUTO_USBHOST_SHIFT 0
......
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