From patchwork Fri Jan 29 22:49:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 8168361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 035CF9F6DA for ; Fri, 29 Jan 2016 22:51:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3003520221 for ; Fri, 29 Jan 2016 22:51:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E9052021B for ; Fri, 29 Jan 2016 22:51:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aPHrJ-0003AC-8t; Fri, 29 Jan 2016 22:49:41 +0000 Received: from mail.kmu-office.ch ([178.209.48.109]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aPHr3-000384-7P for linux-arm-kernel@lists.infradead.org; Fri, 29 Jan 2016 22:49:26 +0000 Received: from trochilidae.toradex.int (75-146-58-181-Washington.hfc.comcastbusiness.net [75.146.58.181]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 5F6E45C1362; Fri, 29 Jan 2016 23:47:40 +0100 (CET) From: Stefan Agner To: shawnguo@kernel.org, kernel@pengutronix.de, mturquette@baylibre.com, sboyd@codeaurora.org Subject: [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled Date: Fri, 29 Jan 2016 14:49:23 -0800 Message-Id: <1454107764-19876-1-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.7.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1454107663; bh=LCOoTpZXqiRRKdgdG4LMVr7Rh4Ucc0xKOJCh7/lL06E=; h=From:To:Cc:Subject:Date:Message-Id; b=nPqpvYS/lOcwAlTo0P8jXIfreoHZEBFJiQqh+0Jepo0E65alh/FZtUqrJ7anmxgmDKGgXT/01b9dVQxaa6SbQ11kRDj/wh6LGESV6edHqFryJhQIOlIRbxUBAWJGvKFqMsbHynt8Wwe2gojvQVuPrWDm5xa59/Xco3EJTbIZcp0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160129_144925_849300_294703E9 X-CRM114-Status: UNSURE ( 8.52 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Agner , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a clock gets enabled early during boot time, it can lead to a PLL startup. The wait_lock function makes sure that the PLL is really stareted up before it gets used. However, the function sleeps which leads to scheduling and an error: bad: scheduling from the idle thread! ... Use udelay in case IRQ's are still disabled. Signed-off-by: Stefan Agner --- drivers/clk/imx/clk-pllv3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index c05c43d..b5ff561 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c @@ -63,7 +63,10 @@ static int clk_pllv3_wait_lock(struct clk_pllv3 *pll) break; if (time_after(jiffies, timeout)) break; - usleep_range(50, 500); + if (unlikely(irqs_disabled())) + udelay(50); + else + usleep_range(50, 500); } while (1); return readl_relaxed(pll->base) & BM_PLL_LOCK ? 0 : -ETIMEDOUT;