devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@st.com>
To: Peter Griffin <peter.griffin@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, patrice.chotard@st.com,
	srinivas.kandagatla@gmail.com, chris@printf.net,
	ulf.hansson@linaro.org
Cc: lee.jones@linaro.org, devicetree@vger.kernel.org,
	linux-mmc@vger.kernel.org, peppe.cavallaro@st.com
Subject: Re: [PATCH v2 3/8] mmc: sdhci-st: Add delay management functions for top registers (eMMC).
Date: Tue, 3 Mar 2015 11:47:56 +0100	[thread overview]
Message-ID: <54F5915C.6090707@st.com> (raw)
In-Reply-To: <1424956227-18258-4-git-send-email-peter.griffin@linaro.org>


On 02/26/2015 02:10 PM, Peter Griffin wrote:
> Due to the tight timing constriants in some UHS modes, it is required to have
s/constriant/constraints/
> some delay management in the design. Two types of delay management are supported
> in the HW: -
>
> 1) Static delay management
> 2) Dynamic delay management
>
> NB: The delay management is only there when eMMC interface is selected.
>
> 1: Static delay management: is used to provide PVT dependent static delay on the
> clock/data lines to manage setup/hold requirements of the interface. The maximum
> delay possible is 3.25ns. These delays are PVT dependent, and thus delay values
> applied are not accurate and vary across provcess voltage and temperature range.
> Due to this these delays must not be used on the very time critical paths.
>
> 2. Dynamic delay locked loop (DLL): is used to provide dynamic delay management.
> The advantage of DLL is that it provides accurate & PVT indepedent delay.
>
> The DLL is used to provide delay on the loopback clock on "Read Path" to capture
> read data reliably. On TX path the clock on which output data is transmitted is
> delayed, resulting in delay of TX data.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>   drivers/mmc/host/sdhci-st.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 58 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
> index 0101ae9..3443cc0 100644
> --- a/drivers/mmc/host/sdhci-st.c
> +++ b/drivers/mmc/host/sdhci-st.c
> @@ -122,6 +122,64 @@ struct st_mmc_platform_data {
>   		 ST_TOP_MMC_DLY_CTRL_ATUNE_NOT_CFG_DLY | \
>   		 ST_TOP_MMC_START_DLL_LOCK)
>   
> +/*
> + * For clock speeds greater than 90MHz, we need to check that the
> + * DLL procedure has finished before switching to ultra-speed modes.
> + */
> +#define	CLK_TO_CHECK_DLL_LOCK	90000000
> +
> +static inline void st_mmcss_set_static_delay(void __iomem *ioaddr)
> +{
> +	if (ioaddr) {
Maybe you could do:
     if (!ioaddr)
         return;

     writel_relaxed....
> +		writel_relaxed(0x0, ioaddr + ST_TOP_MMC_DLY_CTRL);
> +		writel_relaxed(ST_TOP_MMC_DLY_MAX,
> +				ioaddr + ST_TOP_MMC_TX_CLK_DLY);
> +	}
> +}
> +
> +static inline void st_mmcss_set_dll(void __iomem *ioaddr)
> +{
> +	if (ioaddr) {
Ditto


> +		writel_relaxed(ST_TOP_MMC_DYN_DLY_CONF,
> +			ioaddr + ST_TOP_MMC_DLY_CTRL);
> +		writel_relaxed(ST_TOP_MMC_TX_DLL_STEP_DLY_VALID,
> +			ioaddr + ST_TOP_MMC_TX_DLL_STEP_DLY);
> +	}
> +}
> +
> +static int st_mmcss_lock_dll(void __iomem *ioaddr)
> +{
> +	unsigned long curr, value;
> +	unsigned long finish = jiffies + HZ;
> +
> +	/* Checks if the DLL procedure is finished */
> +	do {
> +		curr = jiffies;
> +		value = readl(ioaddr + ST_MMC_STATUS_R);
> +		if (value & 0x1)
> +			return 0;
> +
> +		cpu_relax();
> +	} while (!time_after_eq(curr, finish));
> +
> +	return -EBUSY;
> +}
> +
> +static int sdhci_st_set_dll_for_clock(struct sdhci_host *host)
> +{
> +	int ret = 0;
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct st_mmc_platform_data *pdata = pltfm_host->priv;
> +
> +	if (host->clock > CLK_TO_CHECK_DLL_LOCK) {
> +		st_mmcss_set_dll(pdata->top_ioaddr);
> +		ret = st_mmcss_lock_dll(host->ioaddr);
> +	}
> +
> +	return ret;
> +}
> +
> +
>   static u32 sdhci_st_readl(struct sdhci_host *host, int reg)
>   {
>   	u32 ret;


  reply	other threads:[~2015-03-03 10:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 13:10 [PATCH v2 0/8] Add sd/emmc support for stih407 family silicon Peter Griffin
2015-02-26 13:10 ` [PATCH v2 1/8] mmc: sdhci-st: Add macros for register offsets and bitfields for mmcss glue regs Peter Griffin
2015-03-03 10:24   ` Maxime Coquelin
     [not found]     ` <54F58BED.4020900-qxv4g6HH51o@public.gmane.org>
2015-03-30 10:29       ` Peter Griffin
2015-02-26 13:10 ` [PATCH v2 2/8] mmc: sdhci-st: Add support for de-asserting reset signal and top regs resource Peter Griffin
2015-03-03 10:34   ` Maxime Coquelin
2015-02-26 13:10 ` [PATCH v2 3/8] mmc: sdhci-st: Add delay management functions for top registers (eMMC) Peter Griffin
2015-03-03 10:47   ` Maxime Coquelin [this message]
2015-03-30 10:33     ` Peter Griffin
2015-02-26 13:10 ` [PATCH v2 4/8] mmc: sdhci-st: Add st_mmcss_cconfig function to configure mmcss glue registers Peter Griffin
2015-03-03 10:53   ` Maxime Coquelin
2015-02-26 13:10 ` [PATCH v2 5/8] mmc: sdhci-st: Add sdhci_st_set_uhs_signaling function Peter Griffin
2015-03-03 10:56   ` Maxime Coquelin
2015-03-30 10:46     ` Peter Griffin
2015-02-26 13:10 ` [PATCH v2 6/8] mmc: sdhci-st: Update the quirks for this controller Peter Griffin
2015-03-03 10:57   ` Maxime Coquelin
2015-02-26 13:10 ` [PATCH v2 7/8] mmc: sdhci-st: Update ST SDHCI binding documentation Peter Griffin
2015-03-03 11:01   ` Maxime Coquelin
2015-02-26 13:10 ` [PATCH v2 8/8] ARM: STi: DT: STiH407: Add dt nodes for sdhci and emmc Peter Griffin
2015-03-03 11:03   ` Maxime Coquelin
2015-03-30 11:23     ` Peter Griffin
2015-03-30 11:37       ` Lee Jones
2015-03-30 11:43         ` Maxime Coquelin

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=54F5915C.6090707@st.com \
    --to=maxime.coquelin@st.com \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=patrice.chotard@st.com \
    --cc=peppe.cavallaro@st.com \
    --cc=peter.griffin@linaro.org \
    --cc=srinivas.kandagatla@gmail.com \
    --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).