diff mbox

eSDHC controller driver on MPC8308rdb

Message ID 4CBD4EFB.6070603@windriver.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Tonyliu Oct. 19, 2010, 7:55 a.m. UTC
Maria Johansen wrote:
>   
>> -----Original Message-----
>> From: Tonyliu [mailto:Bo.Liu@windriver.com] 
>> <snip>
>>     
>>> Could this be a problem related the eSDHC controller (or the driver), 
>>> or is it the memory card? (a 4GB SanDisk Extreme SDHC card, which unfortunately is the only card I have available at the moment.) I will keep digging into drivers/mmc/host/sdhci.c in search of a solution, and any tips to how I should proceed would be greatly appreciated!
>>>   
>>>       
>> Hi,
>> Try the patch in attatchment. By default, on some e300 platforms such as mpc8308_rdb, the entry "clock-frequency" of section sdchi in DTB is not fixed by u-boot, so has to >caculate the input clock for sdhci controller explicitly in driver.
>>
>> Tony
>>     
>
> Thanks, the missing clock-frequency was part of my problem. The rest was solved by adding some more quirks to the esdhc-driver (SDHCI_QUIRK_FORCE_1_BIT_DATA and SDHCI_QUIRK_RESET_AFTER_REQUEST). Why it is necessary to force 1-bit data transfers I am a bit unsure about, since the mpc8308 reference manual clearly states that 4-bit transfers are supported.
>   
Actually, I did use 4-bit mode. You can try another 2 quicks:

+   if (of_get_property(np, "sdhci,auto-cmd12", NULL))
+       host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
+
+   if (of_get_property(np, "sdhci,broken-timeout", NULL))
+       host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+

    if (host->flags & SDHCI_REQ_USE_DMA)
@@ -1099,6 +1103,13 @@ static void sdhci_request(struct mmc_host *mmc, 
struct mmc_request *mrq)
    sdhci_activate_led(host);
 #endif

+   if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) {
+       if (mrq->stop) {
+           mrq->data->stop = NULL;
+           mrq->stop = NULL;
+       }
+   }
+
    host->mrq = mrq;


I don't have patch for upstream, you can add them manually.

Tony
> Thanks for your help :)
>
> --
> Maria
>
>
>
>
>

Comments

Zang Roy-R61911 Oct. 19, 2010, 8:09 a.m. UTC | #1
> -----Original Message-----
> From: linuxppc-dev-bounces+tie-fei.zang=freescale.com@lists.ozlabs.org
>
[mailto:linuxppc-dev-bounces+tie-fei.zang=freescale.com@lists.ozlabs.org
] On
> Behalf Of Tonyliu
> Sent: Tuesday, October 19, 2010 15:56 PM
> To: Maria Johansen
> Cc: linuxppc-dev@lists.ozlabs.org
> Subject: Re: eSDHC controller driver on MPC8308rdb
> 
> Maria Johansen wrote:
> >
> >> -----Original Message-----
> >> From: Tonyliu [mailto:Bo.Liu@windriver.com]
> >> <snip>
> >>
> >>> Could this be a problem related the eSDHC controller (or the
driver),
> >>> or is it the memory card? (a 4GB SanDisk Extreme SDHC card, which
> unfortunately is the only card I have available at the moment.) I will
keep
> digging into drivers/mmc/host/sdhci.c in search of a solution, and any
tips to
> how I should proceed would be greatly appreciated!
> >>>
> >>>
> >> Hi,
> >> Try the patch in attatchment. By default, on some e300 platforms
such as
> mpc8308_rdb, the entry "clock-frequency" of section sdchi in DTB is
not fixed
> by u-boot, so has to >caculate the input clock for sdhci controller
explicitly
> in driver.
> >>
> >> Tony
> >>
> >
> > Thanks, the missing clock-frequency was part of my problem. The rest
was
> solved by adding some more quirks to the esdhc-driver
> (SDHCI_QUIRK_FORCE_1_BIT_DATA and SDHCI_QUIRK_RESET_AFTER_REQUEST).
Why it is
> necessary to force 1-bit data transfers I am a bit unsure about, since
the
> mpc8308 reference manual clearly states that 4-bit transfers are
supported.
> >
> Actually, I did use 4-bit mode. You can try another 2 quicks:
> 
> +   if (of_get_property(np, "sdhci,auto-cmd12", NULL))
> +       host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
> +
> +   if (of_get_property(np, "sdhci,broken-timeout", NULL))
> +       host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> +
> 
> ===================================================
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 9d4fdfa..b7a1ce4 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -807,8 +807,12 @@ static void sdhci_set_transfer_mode(struct
> sdhci_host *host,
>     WARN_ON(!host->data);
> 
>     mode = SDHCI_TRNS_BLK_CNT_EN;
> -   if (data->blocks > 1)
> +   if (data->blocks > 1) {
> +       if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
> +           mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_ACMD12;
> +       else
>         mode |= SDHCI_TRNS_MULTI;
> +   }
>     if (data->flags & MMC_DATA_READ)
>         mode |= SDHCI_TRNS_READ;
>     if (host->flags & SDHCI_REQ_USE_DMA)
> @@ -1099,6 +1103,13 @@ static void sdhci_request(struct mmc_host *mmc,
> struct mmc_request *mrq)
>     sdhci_activate_led(host);
>  #endif
> 
> +   if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) {
> +       if (mrq->stop) {
> +           mrq->data->stop = NULL;
> +           mrq->stop = NULL;
> +       }
> +   }
> +
>     host->mrq = mrq;
> 
> 
> I don't have patch for upstream, you can add them manually.


https://patchwork.kernel.org/patch/176752/


Roy
Maria Johansen Oct. 19, 2010, 8:49 a.m. UTC | #2
>-----Original Message-----
>From: Tonyliu [mailto:Bo.Liu@windriver.com] 
><snip>
>> Thanks, the missing clock-frequency was part of my problem. The rest was solved by adding some more quirks to the esdhc-driver (SDHCI_QUIRK_FORCE_1_BIT_DATA and >SDHCI_QUIRK_RESET_AFTER_REQUEST). Why it is necessary to force 1-bit data transfers I am a bit unsure about, since the mpc8308 reference manual clearly states that 4-bit >transfers are supported.
>>   
>Actually, I did use 4-bit mode. You can try another 2 quicks:
>
>+   if (of_get_property(np, "sdhci,auto-cmd12", NULL))
>+       host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
>+
>+   if (of_get_property(np, "sdhci,broken-timeout", NULL))
>+       host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>+
>

SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 worked (with my other quirks disabled), thanks!

--
Maria
diff mbox

Patch

===================================================
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9d4fdfa..b7a1ce4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -807,8 +807,12 @@  static void sdhci_set_transfer_mode(struct 
sdhci_host *host,
    WARN_ON(!host->data);

    mode = SDHCI_TRNS_BLK_CNT_EN;
-   if (data->blocks > 1)
+   if (data->blocks > 1) {
+       if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)
+           mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_ACMD12;
+       else
        mode |= SDHCI_TRNS_MULTI;
+   }
    if (data->flags & MMC_DATA_READ)
        mode |= SDHCI_TRNS_READ;