All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Roy Zang <tie-fei.zang@freescale.com>
Cc: linuxppc-dev@ozlabs.org, linux-mmc-approval@vger.kernel.org
Subject: Re: [PATCH 3/3] mmc: Add ESDHC weird register workaround
Date: Wed, 28 Jul 2010 12:03:12 +0400	[thread overview]
Message-ID: <20100728080312.GA16994@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1280296461-17077-1-git-send-email-tie-fei.zang@freescale.com>

On Wed, Jul 28, 2010 at 01:54:21PM +0800, Roy Zang wrote:
> P4080 ESDHC controller induces weird register setting.
> This patch adds the workaround to correct the weird register setting.
> 
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
>  drivers/mmc/host/sdhci-of-core.c |    5 +++++
>  drivers/mmc/host/sdhci.c         |   13 +++++++++++++
>  drivers/mmc/host/sdhci.h         |    2 ++
>  3 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
> index 0c30242..1b6945a 100644
> --- a/drivers/mmc/host/sdhci-of-core.c
> +++ b/drivers/mmc/host/sdhci-of-core.c
> @@ -164,6 +164,11 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
>  	if (sdhci_of_wp_inverted(np))
>  		host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
>  
> +	if (of_device_is_compatible(np, "fsl,p4080-esdhc")) {
> +		host->quirks |= SDHCI_QUIRK_QORIQ_REG_WEIRD;
> +		host->quirks &= ~SDHCI_QUIRK_INVERTED_WRITE_PROTECT;

You do not mention this change in the patch description, why?

> +	}
> +
>  	clk = of_get_property(np, "clock-frequency", &size);
>  	if (clk && size == sizeof(*clk) && *clk)
>  		of_host->clock = *clk;
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1424d08..b5b3627 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -788,6 +788,15 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
>  		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  	}
>  
> +	/* The default value of DMAS bits of Protocol Control Register is not
> +	 * correct. clear these two bits to use simple DMA */
> +#define  ESDHCI_CTRL_DMAS_MASK		0xFFFFFCFF
> +	if (host->quirks & SDHCI_QUIRK_QORIQ_REG_WEIRD) {
> +		ctrl = sdhci_readl(host, SDHCI_HOST_CONTROL);
> +		ctrl = ctrl & ESDHCI_CTRL_DMAS_MASK;
> +		sdhci_writel(host, ctrl, SDHCI_HOST_CONTROL);
> +	}

You should implement register quirks via SDHCI IO accessors.

See esdhc_writew() for example.

>  	if (!(host->flags & SDHCI_REQ_USE_DMA)) {
>  		int flags;
>  
> @@ -1699,6 +1708,10 @@ int sdhci_add_host(struct sdhci_host *host)
>  
>  	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
>  
> +	 /* Workaround for P4080 host controller capabilities */
> +	if (host->quirks & SDHCI_QUIRK_QORIQ_REG_WEIRD)
> +		caps &= ~(SDHCI_CAN_VDD_180 | SDHCI_CAN_VDD_330);

Ditto. Make a quirk for cap register. Or implement
SDHCI_QUIRK_NO_VDD_180 and SDHCI_QUIRK_NO_VDD_300 quirks
instead.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

  reply	other threads:[~2010-07-28  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28  5:54 [PATCH 3/3] mmc: Add ESDHC weird register workaround Roy Zang
2010-07-28  8:03 ` Anton Vorontsov [this message]
2010-07-28  9:43   ` Zang Roy-R61911
2010-07-28  9:43     ` Zang Roy-R61911
2010-07-30  7:37     ` Anton Vorontsov
  -- strict thread matches above, loose matches on Subject: below --
2010-07-28  6:04 Roy Zang

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=20100728080312.GA16994@oksana.dev.rtsoft.ru \
    --to=cbouatmailru@gmail.com \
    --cc=linux-mmc-approval@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=tie-fei.zang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.