Re: [PATCH] mxs-mmc: fix clock rate setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Think the tabs problem was due to the gmail web ui.
Hope it's better now.


Signed-off-by: Koen Beel <koen.beel <at> barco.com>
---
 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

On Fri, Jul 1, 2011 at 11:17 AM, Wolfram Sang <w.sang@xxxxxxxxxxxxxx> wrote:
> On Thu, Jun 30, 2011 at 04:55:07PM +0200, Wolfram Sang wrote:
>> 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?)
>
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux