linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Jun Nie <jun.nie@linaro.org>,
	ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts
Date: Tue, 3 Dec 2019 09:52:24 +0200	[thread overview]
Message-ID: <525d4414-e55c-c9a4-ad9c-edca908727c4@intel.com> (raw)
In-Reply-To: <20191202144104.5069-4-jun.nie@linaro.org>

On 2/12/19 4:41 pm, Jun Nie wrote:
> Because ctrl_hs400 value is non-standard, add support to set it
> in dts.
> 
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  drivers/mmc/host/sdhci.c | 9 ++++++++-
>  drivers/mmc/host/sdhci.h | 6 +++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a654f0aeb438..d8a6c1c91448 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1899,7 +1899,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
>  		 (timing == MMC_TIMING_MMC_DDR52))
>  		ctrl_2 |= SDHCI_CTRL_UHS_DDR50;
>  	else if (timing == MMC_TIMING_MMC_HS400)
> -		ctrl_2 |= SDHCI_CTRL_HS400; /* Non-standard */
> +		ctrl_2 |= host->sdhci_ctrl_hs400; /* Non-standard */

Let's limit this to the correct bits i.e.

		ctrl_2 |= host->sdhci_ctrl_hs400 & 7; /* Non-standard */

>  	sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
>  }
>  EXPORT_SYMBOL_GPL(sdhci_set_uhs_signaling);
> @@ -3635,6 +3635,13 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver,
>  	of_property_read_u64(mmc_dev(host->mmc)->of_node,
>  			     "sdhci-caps", &dt_caps);

Would you mind changing these APIs from 'of' to 'dev' properties?
Needs to be a separate patch.

>  
> +	if (of_property_read_u32(mmc_dev(host->mmc)->of_node,
> +				 "sdhci-ctrl-hs400", &host->sdhci_ctrl_hs400))

And then use a 'dev' property API here.

> +		host->sdhci_ctrl_hs400 = SDHCI_CTRL_HS400;
> +	else
> +		WARN_ON(host->sdhci_ctrl_hs400 > 7
> +			|| host->sdhci_ctrl_hs400 < 5);

Please remove this warning.

> +
>  	v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION);
>  	host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
>  
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0e6f97eaa796..cac4d819f62c 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -184,7 +184,8 @@
>  #define   SDHCI_CTRL_UHS_SDR50		0x0002
>  #define   SDHCI_CTRL_UHS_SDR104		0x0003
>  #define   SDHCI_CTRL_UHS_DDR50		0x0004
> -#define   SDHCI_CTRL_HS400		0x0005 /* Non-standard */
> +/* SDHCI_CTRL_HS400 is non-standard value, can change it in dts */
> +#define   SDHCI_CTRL_HS400		0x0005
>  #define  SDHCI_CTRL_VDD_180		0x0008
>  #define  SDHCI_CTRL_DRV_TYPE_MASK	0x0030
>  #define   SDHCI_CTRL_DRV_TYPE_B		0x0000
> @@ -605,6 +606,9 @@ struct sdhci_host {
>  
>  	u64			data_timeout;
>  
> +	/* SDHCI_CTRL_HS400 value */
> +	u32			sdhci_ctrl_hs400;
> +
>  	unsigned long private[0] ____cacheline_aligned;
>  };
>  
> 


  reply	other threads:[~2019-12-03  7:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 14:41 [PATCH 0/4] mmc: Add sdhci workaround stability enhencement Jun Nie
2019-12-02 14:41 ` [PATCH 1/4] mmc: sdhci: Add delay after power off Jun Nie
2019-12-03  7:26   ` Adrian Hunter
2019-12-02 14:41 ` [PATCH 2/4] mmc: sdhci: dt: Add DMA boundary and HS400 properties Jun Nie
2019-12-13 23:01   ` Rob Herring
2019-12-17 14:56     ` Jun Nie
2019-12-02 14:41 ` [PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts Jun Nie
2019-12-03  7:52   ` Adrian Hunter [this message]
2019-12-02 14:41 ` [PATCH 4/4] mmc: sdhci: Add DMA memory boundary workaround Jun Nie
2019-12-02 17:52   ` Christoph Hellwig
2019-12-03  3:29     ` Jun Nie
2019-12-03  7:36       ` Christoph Hellwig
2019-12-04  6:00         ` Jun Nie
2019-12-04  7:14           ` Jisheng Zhang
2019-12-10  9:36             ` Ulf Hansson
2019-12-03  2:47   ` Jisheng Zhang
2019-12-03  3:33     ` Jun Nie
2019-12-03  9:05       ` Jisheng Zhang
2019-12-03  9:18         ` Christoph Hellwig
2019-12-03  9:49           ` Jisheng Zhang
2019-12-03 13:06             ` Christoph Hellwig
2019-12-04  7:11               ` Jisheng Zhang
2019-12-03  9:49         ` Jisheng Zhang
2019-12-03 13:04           ` Christoph Hellwig

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=525d4414-e55c-c9a4-ad9c-edca908727c4@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jun.nie@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).