OMAP3 clock: correct module IDLEST bits: SSI; DSS; USBHOST; HSOTGUSB
Fix two bugs in the OMAP3 clock tree pertaining to the SSI, DSS, USBHOST, and HSOTGUSB devices. These devices are both interconnect initiators and targets. Without this patch, clk_enable()s on clocks for these modules can be very high latency (potentially up to ~200 milliseconds) and message such as the following are generated: Clock usbhost_48m_fck didn't enable in 100000 tries Two bugs are fixed by this patch. First, OMAP hardware only supports target CM_IDLEST register bits on ES2+ chips and beyond. ES1 chips should not wait for these clocks to enable. So, split the appropriate clocks into ES1 and ES2+ variants, so that kernels running on ES1 devices won't try to wait. Second, the current heuristic in omap2_clk_dflt_find_idlest() will fail for these clocks. It assumes that the CM_IDLEST bit to wait upon is the same as the CM_*CLKEN bit, which is false[1]. Fix by implementing custom clkops .find_idlest function pointers for the appropriate clocks that return the correct slave IDLEST bit shift. This was originally fixed in the linux-omap kernel during 2.6.29 in a slightly different manner[2][3]. In the medium-term future, all of the module IDLEST code will eventually be moved to the omap_hwmod code. Problem reported by Jarkko Nikula <jhnikula@gmail.com>: http://marc.info/?l=linux-omap&m=124306184903679&w=2 ... 1. See for example 34xx TRM Revision P Table 4-213 and 4-217 (for the DSS case). 2. http://www.spinics.net/lists/linux-omap/msg05512.html et seq. 3. http://lkml.indiana.edu/hypermail/linux/kernel/0901.3/01498.html Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Jarkko Nikula <jhnikula@gmail.com>
This commit is contained in:
@ -1568,7 +1568,7 @@ static const struct clksel ssi_ssr_clksel[] = {
|
||||
{ .parent = NULL }
|
||||
};
|
||||
|
||||
static struct clk ssi_ssr_fck = {
|
||||
static struct clk ssi_ssr_fck_3430es1 = {
|
||||
.name = "ssi_ssr_fck",
|
||||
.ops = &clkops_omap2_dflt,
|
||||
.init = &omap2_init_clksel_parent,
|
||||
@ -1581,10 +1581,31 @@ static struct clk ssi_ssr_fck = {
|
||||
.recalc = &omap2_clksel_recalc,
|
||||
};
|
||||
|
||||
static struct clk ssi_sst_fck = {
|
||||
static struct clk ssi_ssr_fck_3430es2 = {
|
||||
.name = "ssi_ssr_fck",
|
||||
.ops = &clkops_omap3430es2_ssi_wait,
|
||||
.init = &omap2_init_clksel_parent,
|
||||
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
|
||||
.enable_bit = OMAP3430_EN_SSI_SHIFT,
|
||||
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
|
||||
.clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
|
||||
.clksel = ssi_ssr_clksel,
|
||||
.clkdm_name = "core_l4_clkdm",
|
||||
.recalc = &omap2_clksel_recalc,
|
||||
};
|
||||
|
||||
static struct clk ssi_sst_fck_3430es1 = {
|
||||
.name = "ssi_sst_fck",
|
||||
.ops = &clkops_null,
|
||||
.parent = &ssi_ssr_fck,
|
||||
.parent = &ssi_ssr_fck_3430es1,
|
||||
.fixed_div = 2,
|
||||
.recalc = &omap2_fixed_divisor_recalc,
|
||||
};
|
||||
|
||||
static struct clk ssi_sst_fck_3430es2 = {
|
||||
.name = "ssi_sst_fck",
|
||||
.ops = &clkops_null,
|
||||
.parent = &ssi_ssr_fck_3430es2,
|
||||
.fixed_div = 2,
|
||||
.recalc = &omap2_fixed_divisor_recalc,
|
||||
};
|
||||
@ -1606,9 +1627,19 @@ static struct clk core_l3_ick = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk hsotgusb_ick = {
|
||||
static struct clk hsotgusb_ick_3430es1 = {
|
||||
.name = "hsotgusb_ick",
|
||||
.ops = &clkops_omap2_dflt_wait,
|
||||
.ops = &clkops_omap2_dflt,
|
||||
.parent = &core_l3_ick,
|
||||
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
|
||||
.enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
|
||||
.clkdm_name = "core_l3_clkdm",
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk hsotgusb_ick_3430es2 = {
|
||||
.name = "hsotgusb_ick",
|
||||
.ops = &clkops_omap3430es2_hsotgusb_wait,
|
||||
.parent = &core_l3_ick,
|
||||
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
|
||||
.enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
|
||||
@ -1947,7 +1978,7 @@ static struct clk ssi_l4_ick = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk ssi_ick = {
|
||||
static struct clk ssi_ick_3430es1 = {
|
||||
.name = "ssi_ick",
|
||||
.ops = &clkops_omap2_dflt,
|
||||
.parent = &ssi_l4_ick,
|
||||
@ -1957,6 +1988,16 @@ static struct clk ssi_ick = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk ssi_ick_3430es2 = {
|
||||
.name = "ssi_ick",
|
||||
.ops = &clkops_omap3430es2_ssi_wait,
|
||||
.parent = &ssi_l4_ick,
|
||||
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
|
||||
.enable_bit = OMAP3430_EN_SSI_SHIFT,
|
||||
.clkdm_name = "core_l4_clkdm",
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
|
||||
* but l4_ick makes more sense to me */
|
||||
|
||||
@ -2024,7 +2065,7 @@ static struct clk des1_ick = {
|
||||
};
|
||||
|
||||
/* DSS */
|
||||
static struct clk dss1_alwon_fck = {
|
||||
static struct clk dss1_alwon_fck_3430es1 = {
|
||||
.name = "dss1_alwon_fck",
|
||||
.ops = &clkops_omap2_dflt,
|
||||
.parent = &dpll4_m4x2_ck,
|
||||
@ -2034,6 +2075,16 @@ static struct clk dss1_alwon_fck = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dss1_alwon_fck_3430es2 = {
|
||||
.name = "dss1_alwon_fck",
|
||||
.ops = &clkops_omap3430es2_dss_usbhost_wait,
|
||||
.parent = &dpll4_m4x2_ck,
|
||||
.enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
|
||||
.enable_bit = OMAP3430_EN_DSS1_SHIFT,
|
||||
.clkdm_name = "dss_clkdm",
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dss_tv_fck = {
|
||||
.name = "dss_tv_fck",
|
||||
.ops = &clkops_omap2_dflt,
|
||||
@ -2067,7 +2118,7 @@ static struct clk dss2_alwon_fck = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dss_ick = {
|
||||
static struct clk dss_ick_3430es1 = {
|
||||
/* Handles both L3 and L4 clocks */
|
||||
.name = "dss_ick",
|
||||
.ops = &clkops_omap2_dflt,
|
||||
@ -2079,6 +2130,18 @@ static struct clk dss_ick = {
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dss_ick_3430es2 = {
|
||||
/* Handles both L3 and L4 clocks */
|
||||
.name = "dss_ick",
|
||||
.ops = &clkops_omap3430es2_dss_usbhost_wait,
|
||||
.parent = &l4_ick,
|
||||
.init = &omap2_init_clk_clkdm,
|
||||
.enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
|
||||
.enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
|
||||
.clkdm_name = "dss_clkdm",
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
/* CAM */
|
||||
|
||||
static struct clk cam_mclk = {
|
||||
@ -2118,7 +2181,7 @@ static struct clk csi2_96m_fck = {
|
||||
|
||||
static struct clk usbhost_120m_fck = {
|
||||
.name = "usbhost_120m_fck",
|
||||
.ops = &clkops_omap2_dflt_wait,
|
||||
.ops = &clkops_omap2_dflt,
|
||||
.parent = &dpll5_m2_ck,
|
||||
.init = &omap2_init_clk_clkdm,
|
||||
.enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
|
||||
@ -2129,7 +2192,7 @@ static struct clk usbhost_120m_fck = {
|
||||
|
||||
static struct clk usbhost_48m_fck = {
|
||||
.name = "usbhost_48m_fck",
|
||||
.ops = &clkops_omap2_dflt_wait,
|
||||
.ops = &clkops_omap3430es2_dss_usbhost_wait,
|
||||
.parent = &omap_48m_fck,
|
||||
.init = &omap2_init_clk_clkdm,
|
||||
.enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
|
||||
@ -2141,7 +2204,7 @@ static struct clk usbhost_48m_fck = {
|
||||
static struct clk usbhost_ick = {
|
||||
/* Handles both L3 and L4 clocks */
|
||||
.name = "usbhost_ick",
|
||||
.ops = &clkops_omap2_dflt_wait,
|
||||
.ops = &clkops_omap3430es2_dss_usbhost_wait,
|
||||
.parent = &l4_ick,
|
||||
.init = &omap2_init_clk_clkdm,
|
||||
.enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
|
||||
|
Reference in New Issue
Block a user