From patchwork Mon Jan 16 19:01:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 136350 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC7B5B6F99 for ; Tue, 17 Jan 2012 06:04:41 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Rmrob-0001XG-W3; Mon, 16 Jan 2012 19:01:58 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RmroZ-0001X0-DS for linux-arm-kernel@merlin.infradead.org; Mon, 16 Jan 2012 19:01:55 +0000 Received: from va3ehsobe010.messaging.microsoft.com ([216.32.180.30] helo=VA3EHSOBE010.bigfish.com) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RmroW-0001wM-2o for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2012 19:01:53 +0000 Received: from mail1-va3-R.bigfish.com (10.7.14.239) by VA3EHSOBE010.bigfish.com (10.7.40.12) with Microsoft SMTP Server id 14.1.225.22; Mon, 16 Jan 2012 19:01:23 +0000 Received: from mail1-va3 (localhost [127.0.0.1]) by mail1-va3-R.bigfish.com (Postfix) with ESMTP id 0CE6466024B; Mon, 16 Jan 2012 19:01:24 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dhc1ahc1bh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail1-va3 (localhost.localdomain [127.0.0.1]) by mail1-va3 (MessageSwitch) id 1326740482202036_29402; Mon, 16 Jan 2012 19:01:22 +0000 (UTC) Received: from VA3EHSMHS030.bigfish.com (unknown [10.7.14.240]) by mail1-va3.bigfish.com (Postfix) with ESMTP id 21A5054004F; Mon, 16 Jan 2012 19:01:22 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS030.bigfish.com (10.7.99.40) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 16 Jan 2012 19:01:21 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Mon, 16 Jan 2012 13:01:24 -0600 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.240.144]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id q0GJ1L8n027332; Mon, 16 Jan 2012 13:01:22 -0600 (CST) From: Fabio Estevam To: Subject: [PATCH] ARM: clock-mx28: Fix end of loop condition Date: Mon, 16 Jan 2012 17:01:17 -0200 Message-ID: <1326740477-21576-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20120116_190152_418072_76B2D848 X-CRM114-Status: GOOD ( 14.06 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.30 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Fabio Estevam , marek.vasut@gmail.com, Fabio Estevam , shawn.guo@freescale.com, kernel@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Fabio Estevam Selecting audio on a mx28evk the saif driver was failing: [ 0.660000] saif0_clk_set_rate: divider writing timeout [ 0.670000] mxs-sgtl5000: probe of mxs-sgtl5000.0 failed with error -110 [ 0.670000] ALSA device list: [ 0.680000] No soundcards found. The timeout on saif0_clk_set_rate was due to the wrong condition for the end of loop. After fixing it, the audio driver can be correctly probed and becomes functional. While at it, fix the other locations where the similar issue occurs. Signed-off-by: Fabio Estevam --- arch/arm/mach-mxs/clock-mx28.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 5d68e41..ee9e04b 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c @@ -396,7 +396,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ } \ __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ \ - for (i = 10000; i; i--) \ + for (i = 10000; i < 0; i--) \ if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ HW_CLKCTRL_##dr) & bm_busy)) \ break; \ @@ -439,7 +439,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ } \ __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ \ - for (i = 10000; i; i--) \ + for (i = 10000; i < 0; i--) \ if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ HW_CLKCTRL_##dr) & BM_CLKCTRL_##dr##_BUSY)) \ break; \ @@ -479,7 +479,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ reg |= div << BP_CLKCTRL_##rs##_DIV; \ __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs); \ \ - for (i = 10000; i; i--) \ + for (i = 10000; i < 0; i--) \ if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ HW_CLKCTRL_##rs) & BM_CLKCTRL_##rs##_BUSY)) \ break; \ @@ -756,7 +756,7 @@ static int clk_misc_init(void) reg |= 3 << BP_CLKCTRL_HBUS_DIV; __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS); - for (i = 10000; i; i--) + for (i = 10000; i < 0; i--) if (!(__raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_HBUS) & BM_CLKCTRL_HBUS_ASM_BUSY)) break;