Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mmc@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] mmc: sdhci: continue normal tuning if unsupported by platform tuning
Date: Fri, 2 Dec 2016 16:18:55 +0200	[thread overview]
Message-ID: <0edcfd1d-e7fa-bf51-a1a3-110f1bfdc73c@intel.com> (raw)
In-Reply-To: <1480645311-13004-2-git-send-email-yamada.masahiro@socionext.com>

On 02/12/16 04:21, Masahiro Yamada wrote:
> Some SDHCI-compat controllers support not only SD, but also eMMC,
> but they use different commands for tuning: CMD19 for SD, CMD21 for
> eMMC.
> 
> Due to the difference of the underlying mechanism, some controllers
> (at least, the Cadence IP is the case) provide their own registers
> for the eMMC tuning.
> 
> This commit will be useful when we want to use platform-specific
> tuning (to support eMMC HS200), but still let it reuse the code
> provided by sdhci_execute_tuning() for SD timing.
> 
> If sdhci_ops::platform_execute_tuning receives a timing it does not
> take care of, it can return -ENOTSUPP.  Then, it will fall back to
> the SDHCI standard tuning.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
> I want to use this in the next commit.
> 
> The Cadence IP supports eMMC as well as SD.
> 
> The tuning for SD is pretty simple; just set the "Execute Tuning" bit
> of the HOST_CONTROL2 register.  So, I can re-use the
> sdhci_execute_tuning().
> 
> On the other hand, Cadence provides its own way for eMMC HS200 tuning;
> I need to touch some registers that are specific to Cadence's design.
> 
> 
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/mmc/host/sdhci.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 42ef3eb..cdce489 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2004,7 +2004,9 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  	if (host->ops->platform_execute_tuning) {
>  		spin_unlock_irqrestore(&host->lock, flags);
>  		err = host->ops->platform_execute_tuning(host, opcode);
> -		return err;
> +		if (err != -ENOTSUPP)
> +			return err;
> +		spin_lock_irqsave(&host->lock, flags);

platform_execute_tuning() should not exist.  You could export
sdhci_execute_tuning() and then provide your ->execute_tuning() (e.g.
host->mmc_host_ops.execute_tuning = sdhci_cdns_execute_tuning) which can
call sdhci_execute_tuning() if it needs to.


>  	}
>  
>  	ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
> 


  reply	other threads:[~2016-12-02 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  2:21 [PATCH v3 0/2] mmc: sdhci: one expansion for SDHCI base code and add Cadence SDHCI driver Masahiro Yamada
2016-12-02  2:21 ` [PATCH v3 1/2] mmc: sdhci: continue normal tuning if unsupported by platform tuning Masahiro Yamada
2016-12-02 14:18   ` Adrian Hunter [this message]
     [not found] ` <1480645311-13004-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2016-12-02  2:21   ` [PATCH v3 2/2] mmc: sdhci-cadence: add Cadence SD4HC support Masahiro Yamada

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=0edcfd1d-e7fa-bf51-a1a3-110f1bfdc73c@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=yamada.masahiro@socionext.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