public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Koen Beel <koen.beel.barco@gmail.com>
Cc: linux-mmc@vger.kernel.org, shawn.guo@freescale.com
Subject: Re: [PATCH] mxs-mmc: fix clock rate setting
Date: Thu, 30 Jun 2011 16:55:07 +0200	[thread overview]
Message-ID: <20110630145507.GG1997@pengutronix.de> (raw)
In-Reply-To: <BANLkTinKcb-=m3sURawdEjR=vTt=ApBKaQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]

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 <koen.beel.barco <at> gmail.com>

Looks promising, but your tabs are garbled (0xa0 0x20 here?)

> ---
>  drivers/mmc/host/mxs-mmc.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 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
> --
> 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

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-06-30 14:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTi==Y_MJ2H_u15DzunWusUb=GsotWg@mail.gmail.com>
2011-06-30 10:13 ` [PATCH] mxs-mmc: fix clock rate setting Koen Beel
2011-06-30 14:55   ` Wolfram Sang [this message]
2011-07-01  9:17     ` Wolfram Sang
2011-07-01 11:41       ` Sachin Nikam
2011-07-01 14:38         ` Sachin Nikam
2011-07-01 14:46           ` Wolfram Sang
2011-07-01 12:10       ` Koen Beel
2011-07-01 12:27         ` Wolfram Sang
2011-07-01 13:26           ` Koen Beel
2011-07-01 14:44             ` Wolfram Sang
2011-07-01 15:46               ` Shawn Guo
2011-07-02 13:12                 ` Wolfram Sang
2011-07-03  9:28                   ` Shawn Guo
2011-07-03 10:31                     ` Wolfram Sang
2011-07-03 11:54                       ` Shawn Guo
2011-07-04 10:34                         ` Wolfram Sang
2011-07-04 10:59                           ` Koen Beel
2011-07-06  9:38                             ` Wolfram Sang
2011-07-06  9:53                               ` Koen Beel
2011-07-06  9:58                                 ` Wolfram Sang
2011-07-04 10:37                         ` Koen Beel
2011-07-04 11:01               ` Koen Beel
2011-07-06  9:26                 ` Wolfram Sang
2011-07-09 21:04   ` Chris Ball

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110630145507.GG1997@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=koen.beel.barco@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.guo@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox