All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/9] mmc: tmio: sdhi: Track current tap number in private data
Date: Thu, 21 Nov 2019 01:57:51 +0000	[thread overview]
Message-ID: <AM0PR04MB44811DAB597166656BC04318884E0@AM0PR04MB4481.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20191110154012.24603-1-marek.vasut+renesas@gmail.com>

> Subject: [PATCH 1/9] mmc: tmio: sdhi: Track current tap number in private
> data

After CI https://travis-ci.org/MrVan/u-boot/builds/614839218
patchset will show in mmc/master.

Thanks,
Peng.

> 
> Retain the tap number from last calibration in private data. This will be later
> used for SCC error checking after each command.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>  drivers/mmc/renesas-sdhi.c | 31 ++++++++++++++++---------------
> drivers/mmc/tmio-common.h  |  1 +
>  2 files changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index
> 0cb65b480d..acc44e5b90 100644
> --- a/drivers/mmc/renesas-sdhi.c
> +++ b/drivers/mmc/renesas-sdhi.c
> @@ -289,8 +289,7 @@ static unsigned int
> renesas_sdhi_compare_scc_data(struct tmio_sd_priv *priv)  }
> 
>  static int renesas_sdhi_select_tuning(struct tmio_sd_priv *priv,
> -				     unsigned int tap_num, unsigned int taps,
> -				     unsigned int smpcmp)
> +				     unsigned int taps, unsigned int smpcmp)
>  {
>  	unsigned long tap_cnt;  /* counter of tuning success */
>  	unsigned long tap_start;/* start position of tuning success */ @@
> -307,14 +306,14 @@ static int renesas_sdhi_select_tuning(struct
> tmio_sd_priv *priv,
>  	tmio_sd_writel(priv, 0, RENESAS_SDHI_SCC_RVSREQ);
> 
>  	/* Merge the results */
> -	for (i = 0; i < tap_num * 2; i++) {
> +	for (i = 0; i < priv->tap_num * 2; i++) {
>  		if (!(taps & BIT(i))) {
> -			taps &= ~BIT(i % tap_num);
> -			taps &= ~BIT((i % tap_num) + tap_num);
> +			taps &= ~BIT(i % priv->tap_num);
> +			taps &= ~BIT((i % priv->tap_num) + priv->tap_num);
>  		}
>  		if (!(smpcmp & BIT(i))) {
> -			smpcmp &= ~BIT(i % tap_num);
> -			smpcmp &= ~BIT((i % tap_num) + tap_num);
> +			smpcmp &= ~BIT(i % priv->tap_num);
> +			smpcmp &= ~BIT((i % priv->tap_num) + priv->tap_num);
>  		}
>  	}
> 
> @@ -327,7 +326,7 @@ static int renesas_sdhi_select_tuning(struct
> tmio_sd_priv *priv,
>  	ntap = 0;
>  	tap_start = 0;
>  	tap_end = 0;
> -	for (i = 0; i < tap_num * 2; i++) {
> +	for (i = 0; i < priv->tap_num * 2; i++) {
>  		if (taps & BIT(i))
>  			ntap++;
>  		else {
> @@ -350,12 +349,12 @@ static int renesas_sdhi_select_tuning(struct
> tmio_sd_priv *priv,
>  	 * If all of the TAP is OK, the sampling clock position is selected by
>  	 * identifying the change point of data.
>  	 */
> -	if (tap_cnt == tap_num * 2) {
> +	if (tap_cnt == priv->tap_num * 2) {
>  		match_cnt = 0;
>  		ntap = 0;
>  		tap_start = 0;
>  		tap_end = 0;
> -		for (i = 0; i < tap_num * 2; i++) {
> +		for (i = 0; i < priv->tap_num * 2; i++) {
>  			if (smpcmp & BIT(i))
>  				ntap++;
>  			else {
> @@ -378,7 +377,7 @@ static int renesas_sdhi_select_tuning(struct
> tmio_sd_priv *priv,
>  		select = true;
> 
>  	if (select)
> -		priv->tap_set = ((tap_start + tap_end) / 2) % tap_num;
> +		priv->tap_set = ((tap_start + tap_end) / 2) % priv->tap_num;
>  	else
>  		return -EIO;
> 
> @@ -419,15 +418,17 @@ int renesas_sdhi_execute_tuning(struct udevice
> *dev, uint opcode)
>  		/* Tuning is not supported */
>  		goto out;
> 
> -	if (tap_num * 2 >= sizeof(taps) * 8) {
> +	priv->tap_num = tap_num;
> +
> +	if (priv->tap_num * 2 >= sizeof(taps) * 8) {
>  		dev_err(dev,
>  			"Too many taps, skipping tuning. Please consider updating size
> of taps field of tmio_mmc_host\n");
>  		goto out;
>  	}
> 
>  	/* Issue CMD19 twice for each tap */
> -	for (i = 0; i < 2 * tap_num; i++) {
> -		renesas_sdhi_prepare_tuning(priv, i % tap_num);
> +	for (i = 0; i < 2 * priv->tap_num; i++) {
> +		renesas_sdhi_prepare_tuning(priv, i % priv->tap_num);
> 
>  		/* Force PIO for the tuning */
>  		caps = priv->caps;
> @@ -447,7 +448,7 @@ int renesas_sdhi_execute_tuning(struct udevice *dev,
> uint opcode)
>  		mdelay(1);
>  	}
> 
> -	ret = renesas_sdhi_select_tuning(priv, tap_num, taps, smpcmp);
> +	ret = renesas_sdhi_select_tuning(priv, taps, smpcmp);
> 
>  out:
>  	if (ret < 0) {
> diff --git a/drivers/mmc/tmio-common.h b/drivers/mmc/tmio-common.h
> index 51607de142..da89cc90c2 100644
> --- a/drivers/mmc/tmio-common.h
> +++ b/drivers/mmc/tmio-common.h
> @@ -138,6 +138,7 @@ struct tmio_sd_priv {  #endif  #if
> CONFIG_IS_ENABLED(RENESAS_SDHI)
>  	u8				tap_set;
> +	u8				tap_num;
>  	u8				nrtaps;
>  	bool				needs_adjust_hs400;
>  	bool				adjust_hs400_enable;
> --
> 2.24.0.rc1

      parent reply	other threads:[~2019-11-21  1:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10 15:40 [U-Boot] [PATCH 1/9] mmc: tmio: sdhi: Track current tap number in private data Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 2/9] mmc: tmio: sdhi: Track SMPCMP valu " Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 3/9] mmc: tmio: sdhi: Use 4 tuning taps on M3W up to ES1.2 Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 4/9] mmc: tmio: sdhi: Adjust DT2FF settings for HS400 mode Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 5/9] mmc: tmio: sdhi: Adjust HS400 calibration offsets Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 6/9] mmc: tmio: sdhi: Disable auto-retuning in HS400 Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 7/9] mmc: tmio: sdhi: Add SCC error checking Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 8/9] mmc: tmio: sdhi: Skip bad taps Marek Vasut
2019-11-10 15:40 ` [U-Boot] [PATCH 9/9] mmc: tmio: sdhi: Add calibration tables Marek Vasut
2019-11-22  6:22   ` Peng Fan
2019-11-23 12:38     ` Marek Vasut
2019-11-21  1:57 ` Peng Fan [this message]

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=AM0PR04MB44811DAB597166656BC04318884E0@AM0PR04MB4481.eurprd04.prod.outlook.com \
    --to=peng.fan@nxp.com \
    --cc=u-boot@lists.denx.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.