From: Paul Walmsley Date: Fri, 14 Nov 2008 17:46:14 +0000 (-0700) Subject: OMAP3 clock: disable DPLL autoidle while waiting for DPLL to lock X-Git-Tag: v2.6.28-omap1~120 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?p=linux-2.6-omap-h63xx.git;a=commitdiff_plain;h=3b7de4be879f1f4f55ae59882a5cbd80f6dcf0f0 OMAP3 clock: disable DPLL autoidle while waiting for DPLL to lock During _omap3_noncore_dpll_lock(), if a DPLL has no active downstream clocks and DPLL autoidle is enabled, the DPLL may never lock, since it will enter autoidle immediately. To resolve this, disable DPLL autoidle while locking the DPLL, and unconditionally wait for the DPLL to lock. This fixes some bugs where the kernel would hang when returning from retention or return the wrong rate for the DPLL. This patch is a collaboration with Peter de Schrijver and Kevin Hilman . Signed-off-by: Paul Walmsley Cc: Peter de Schrijver Cc: Kevin Hilman Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 3a4e160dc33..b8b44947b05 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c @@ -163,19 +163,14 @@ static int _omap3_noncore_dpll_lock(struct clk *clk) ai = omap3_dpll_autoidle_read(clk); + omap3_dpll_deny_idle(clk); + _omap3_dpll_write_clken(clk, DPLL_LOCKED); - if (ai) { - /* - * If no downstream clocks are enabled, CM_IDLEST bit - * may never become active, so don't wait for DPLL to lock. - */ - r = 0; + r = _omap3_wait_dpll_status(clk, 1); + + if (ai) omap3_dpll_allow_idle(clk); - } else { - r = _omap3_wait_dpll_status(clk, 1); - omap3_dpll_deny_idle(clk); - }; return r; }