From patchwork Fri Jul 1 12:10:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Koen Beel X-Patchwork-Id: 935762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p61CAJxF017074 for ; Fri, 1 Jul 2011 12:10:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755084Ab1GAMKG (ORCPT ); Fri, 1 Jul 2011 08:10:06 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:51041 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755265Ab1GAMKD convert rfc822-to-8bit (ORCPT ); Fri, 1 Jul 2011 08:10:03 -0400 Received: by wyg8 with SMTP id 8so2150206wyg.19 for ; Fri, 01 Jul 2011 05:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=pHQ5DUfhD1FRSIHZ4NdIyQMDkk3IEPxarGx7oF0qNoU=; b=jfwTMPFTtgBr3MIOSQDRbANoDeF7AjG7MU8ZnQhHMLORqsniqsl6AlUIsqSOY3Xjo5 TERml2auFmu9GnTEUXsAH2+ZGO25KkhTEcg462eBD1SCXsEh8Trmp0FKf2fP+Mlu4DkE YgIFbyFJueK0Kpj56po4Z2kEowslKEG0tHhC8= MIME-Version: 1.0 Received: by 10.216.63.2 with SMTP id z2mr1088548wec.11.1309522200764; Fri, 01 Jul 2011 05:10:00 -0700 (PDT) Received: by 10.216.166.198 with HTTP; Fri, 1 Jul 2011 05:10:00 -0700 (PDT) In-Reply-To: <20110701091753.GE1922@pengutronix.de> References: <20110630145507.GG1997@pengutronix.de> <20110701091753.GE1922@pengutronix.de> Date: Fri, 1 Jul 2011 14:10:00 +0200 Message-ID: Subject: Re: [PATCH] mxs-mmc: fix clock rate setting From: Koen Beel To: Wolfram Sang Cc: linux-mmc@vger.kernel.org, shawn.guo@freescale.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 01 Jul 2011 12:10:20 +0000 (UTC) Hi, Think the tabs problem was due to the gmail web ui. Hope it's better now. Signed-off-by: Koen Beel barco.com> --- drivers/mmc/host/mxs-mmc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) >> On Thu, Jun 30, 2011 at 12:13:34PM +0200, Koen Beel wrote: >> > Fix clock rate setting on mxs-mmc driver. >> > Previously, if div2 was zero the value for TIMING_CLOCK_RATE would >> > have been 255 instead of 0. >> > Also the limits for div1 (TIMING_CLOCK_DIVIDE) and div2 >> > (TIMING_CLOCK_RATE + 1) where not correctly defined. >> > >> > Can easily be reproduced on mx23evk: default clock for high speed sdio >> > cards is 50 MHz. With a SSP_CLK of 28.8 MHz (default), this resulted in >> > an actual clock rate of about 56 kHz. >> > >> > Signed-off-by: Koen Beel gmail.com> >> >> Looks promising, but your tabs are garbled (0xa0 0x20 here?) > > Can you repost a patch which applies? I'd like to test it. > > -- > Pengutronix e.K.                           | Wolfram Sang                | > Industrial Linux Solutions                 | http://www.pengutronix.de/  | > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEUEARECAAYFAk4NkMEACgkQD27XaX1/VRvw0QCeP4F3oeKe1Ge3SLohJICLxZre > LKYAmJ2sEztaKIVw4NsZMYNqCUbbwFQ= > =C7kg > -----END PGP SIGNATURE----- > > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 99d39a6..3575330 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -570,22 +570,22 @@ static void mxs_mmc_set_clk_rate(struct mxs_mmc_host *host, unsigned int rate) ssp_rate = clk_get_rate(host->clk); - for (div1 = 2; div1 < 254; div1 += 2) { + for (div1 = 2; div1 <= 254; div1 += 2) { div2 = ssp_rate / rate / div1; - if (div2 < 0x100) + if (div2 <= 256) break; } - if (div1 >= 254) { + if (div1 > 254) { dev_err(mmc_dev(host->mmc), "%s: cannot set clock to %d\n", __func__, rate); return; } if (div2 == 0) - bit_rate = ssp_rate / div1; - else - bit_rate = ssp_rate / div1 / div2; + div2 = 1; + + bit_rate = ssp_rate / div1 / div2; val = readl(host->base + HW_SSP_TIMING); val &= ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE); -- 1.7.4.1 On Fri, Jul 1, 2011 at 11:17 AM, Wolfram Sang wrote: > On Thu, Jun 30, 2011 at 04:55:07PM +0200, Wolfram Sang wrote: