All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Dong Aisheng <b29396@freescale.com>
Cc: s.hauer@pengutronix.de, cjb@laptop.org,
	linux-mmc@vger.kernel.org, anton@enomsg.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/8] mmc: sdhci: add hooks for platform specific tuning
Date: Thu, 5 Sep 2013 11:14:04 +0800	[thread overview]
Message-ID: <20130905031401.GA775@shlinux1.ap.freescale.net> (raw)
In-Reply-To: <1378299257-2980-2-git-send-email-b29396@freescale.com>

On Wed, Sep 04, 2013 at 08:54:10PM +0800, Dong Aisheng wrote:
> The tuning of some platforms may not follow the standard host control
> spec v3.0, e.g. Freescale uSDHC on i.MX6Q/DL.
> Add a hook here to allow execute platform specific tuning instead of
> standard host controller tuning.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c |    8 ++++++++
>  drivers/mmc/host/sdhci.h |    1 +
>  2 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index dd2c083..2890cfd 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1875,6 +1875,14 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  		return 0;
>  	}
>  
> +	if (host->ops->platform_execute_tuning) {
> +		spin_unlock(&host->lock);
> +		enable_irq(host->irq);

Hmm, you want these two functions be called before
platform_execute_tuning()?  That probably means you do not need to call
spin_lock() and disable_irq() for platform_execute_tuning()?  In that
case, can we not just put this platform hook at the beginning of the
function, something like below?

	host = mmc_priv(mmc);

	if (host->ops->platform_execute_tuning) {
		sdhci_runtime_pm_get(host);
		err = host->ops->platform_execute_tuning(host, opcode);
		sdhci_runtime_pm_put(host);
	}

I guess that's more clear to tell that platform_execute_tuning hook is
there to replace sdhci_execute_tuning() completely.  Is it the case?

Shawn

> +		err = host->ops->platform_execute_tuning(host, opcode);
> +		sdhci_runtime_pm_put(host);
> +		return err;
> +	}
> +
>  	sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
>  
>  	/*
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index b037f18..976c14b 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -288,6 +288,7 @@ struct sdhci_ops {
>  	unsigned int    (*get_ro)(struct sdhci_host *host);
>  	void	(*platform_reset_enter)(struct sdhci_host *host, u8 mask);
>  	void	(*platform_reset_exit)(struct sdhci_host *host, u8 mask);
> +	int	(*platform_execute_tuning)(struct sdhci_host *host, u32 opcode);
>  	int	(*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs);
>  	void	(*hw_reset)(struct sdhci_host *host);
>  	void	(*platform_suspend)(struct sdhci_host *host);
> -- 
> 1.7.1
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] mmc: sdhci: add hooks for platform specific tuning
Date: Thu, 5 Sep 2013 11:14:04 +0800	[thread overview]
Message-ID: <20130905031401.GA775@shlinux1.ap.freescale.net> (raw)
In-Reply-To: <1378299257-2980-2-git-send-email-b29396@freescale.com>

On Wed, Sep 04, 2013 at 08:54:10PM +0800, Dong Aisheng wrote:
> The tuning of some platforms may not follow the standard host control
> spec v3.0, e.g. Freescale uSDHC on i.MX6Q/DL.
> Add a hook here to allow execute platform specific tuning instead of
> standard host controller tuning.
> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c |    8 ++++++++
>  drivers/mmc/host/sdhci.h |    1 +
>  2 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index dd2c083..2890cfd 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1875,6 +1875,14 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  		return 0;
>  	}
>  
> +	if (host->ops->platform_execute_tuning) {
> +		spin_unlock(&host->lock);
> +		enable_irq(host->irq);

Hmm, you want these two functions be called before
platform_execute_tuning()?  That probably means you do not need to call
spin_lock() and disable_irq() for platform_execute_tuning()?  In that
case, can we not just put this platform hook at the beginning of the
function, something like below?

	host = mmc_priv(mmc);

	if (host->ops->platform_execute_tuning) {
		sdhci_runtime_pm_get(host);
		err = host->ops->platform_execute_tuning(host, opcode);
		sdhci_runtime_pm_put(host);
	}

I guess that's more clear to tell that platform_execute_tuning hook is
there to replace sdhci_execute_tuning() completely.  Is it the case?

Shawn

> +		err = host->ops->platform_execute_tuning(host, opcode);
> +		sdhci_runtime_pm_put(host);
> +		return err;
> +	}
> +
>  	sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
>  
>  	/*
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index b037f18..976c14b 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -288,6 +288,7 @@ struct sdhci_ops {
>  	unsigned int    (*get_ro)(struct sdhci_host *host);
>  	void	(*platform_reset_enter)(struct sdhci_host *host, u8 mask);
>  	void	(*platform_reset_exit)(struct sdhci_host *host, u8 mask);
> +	int	(*platform_execute_tuning)(struct sdhci_host *host, u32 opcode);
>  	int	(*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs);
>  	void	(*hw_reset)(struct sdhci_host *host);
>  	void	(*platform_suspend)(struct sdhci_host *host);
> -- 
> 1.7.1
> 
> 

  reply	other threads:[~2013-09-05  3:14 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 12:54 [PATCH 0/8] mmc: sdhci-esdhc-imx: add SD3.0 support Dong Aisheng
2013-09-04 12:54 ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 1/8] mmc: sdhci: add hooks for platform specific tuning Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-05  3:14   ` Shawn Guo [this message]
2013-09-05  3:14     ` Shawn Guo
2013-09-05 14:53     ` Dong Aisheng
2013-09-05 14:53       ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 2/8] mmc: sdhci: allow platform access of sdhci_send_command Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 3/8] sdhci: sdhci-esdhc-imx: support real clock on and off for imx6q Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-05  4:32   ` Shawn Guo
2013-09-05  4:32     ` Shawn Guo
2013-09-05 14:59     ` Dong Aisheng
2013-09-05 14:59       ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 4/8] sdhci: sdhci-esdhci-imx: add sd3.0 clock tuning support Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-05  6:00   ` Shawn Guo
2013-09-05  6:00     ` Shawn Guo
2013-09-05 15:02     ` Dong Aisheng
2013-09-05 15:02       ` Dong Aisheng
2013-09-05  7:33   ` Ulf Hansson
2013-09-05  7:33     ` Ulf Hansson
2013-09-05 17:52     ` Dong Aisheng
2013-09-05 17:52       ` Dong Aisheng
2013-09-16  7:48       ` Ulf Hansson
2013-09-16  7:48         ` Ulf Hansson
2013-09-04 12:54 ` [PATCH 5/8] sdhci: sdhci-esdhc-imx: change pinctrl state according to uhs mode Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-05  6:34   ` Shawn Guo
2013-09-05  6:34     ` Shawn Guo
2013-09-05 15:06     ` Dong Aisheng
2013-09-05 15:06       ` Dong Aisheng
2013-09-05  7:38   ` Ulf Hansson
2013-09-05  7:38     ` Ulf Hansson
2013-09-05 16:04     ` Dong Aisheng
2013-09-05 16:04       ` Dong Aisheng
2013-09-13 14:01       ` Ulf Hansson
2013-09-13 14:01         ` Ulf Hansson
2013-09-13 16:38         ` Dong Aisheng
2013-09-13 16:38           ` Dong Aisheng
2013-09-05 18:40   ` Matt Sealey
2013-09-05 18:40     ` Matt Sealey
2013-09-11  9:26     ` Dong Aisheng
2013-09-11  9:26       ` Dong Aisheng
2013-09-27  0:28       ` Matt Sealey
2013-09-27  0:28         ` Matt Sealey
2013-09-04 12:54 ` [PATCH 6/8] mmc: sdhci-esdhc: correct pre_div for imx6q Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 7/8] mmc: sdhci-esdhc: set actual_clock in clock setting Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-04 12:54 ` [PATCH 8/8] ARM: dts: imx6qdl: add uhs pinctrl state for usdhc3 Dong Aisheng
2013-09-04 12:54   ` Dong Aisheng
2013-09-05  6:43   ` Shawn Guo
2013-09-05  6:43     ` Shawn Guo
2013-09-05 15:09     ` Dong Aisheng
2013-09-05 15:09       ` Dong Aisheng
2013-09-05  8:03   ` Sascha Hauer
2013-09-05  8:03     ` Sascha Hauer
2013-09-05 15:29     ` Dong Aisheng
2013-09-05 15:29       ` Dong Aisheng
2013-09-05  7:42 ` [PATCH 0/8] mmc: sdhci-esdhc-imx: add SD3.0 support Ulf Hansson
2013-09-05  7:42   ` Ulf Hansson
2013-09-05 18:01   ` Dong Aisheng
2013-09-05 18:01     ` Dong Aisheng

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=20130905031401.GA775@shlinux1.ap.freescale.net \
    --to=shawn.guo@linaro.org \
    --cc=anton@enomsg.org \
    --cc=b29396@freescale.com \
    --cc=cjb@laptop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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.