linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: aisheng.dong@nxp.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 06/15] mmc: sdhci-esdhc-imx: support setting tuning start point
Date: Tue, 12 Jul 2016 15:46:15 +0800	[thread overview]
Message-ID: <1468309584-3591-7-git-send-email-aisheng.dong@nxp.com> (raw)
In-Reply-To: <1468309584-3591-1-git-send-email-aisheng.dong@nxp.com>

The delay cells of some SoCs may have less delay per one cell,
for such SoCs, user could set the start delay cell point to bypass
the first a few meaningless tuning commands.

Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c          | 14 +++++++++++---
 include/linux/platform_data/mmc-esdhc-imx.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 874d5105f83c..b47dad15fa3e 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -76,7 +76,8 @@
 #define ESDHC_TUNING_CTRL		0xcc
 #define ESDHC_STD_TUNING_EN		(1 << 24)
 /* NOTE: the minimum valid tuning start tap for mx6sl is 1 */
-#define ESDHC_TUNING_START_TAP		0x1
+#define ESDHC_TUNING_START_TAP_DEFAULT	0x1
+#define ESDHC_TUNING_START_TAP_MASK	0xff
 #define ESDHC_TUNING_STEP_MASK		0x00070000
 #define ESDHC_TUNING_STEP_SHIFT		16
 
@@ -490,7 +491,12 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 				v |= ESDHC_MIX_CTRL_EXE_TUNE;
 				m |= ESDHC_MIX_CTRL_FBCLK_SEL;
 				tuning_ctrl = readl(host->ioaddr + ESDHC_TUNING_CTRL);
-				tuning_ctrl |= ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP;
+				tuning_ctrl |= ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP_DEFAULT;
+				if (imx_data->boarddata.tuning_start_tap) {
+					tuning_ctrl &= ~ESDHC_TUNING_START_TAP_MASK;
+					tuning_ctrl |= imx_data->boarddata.tuning_start_tap;
+				}
+
 				if (imx_data->boarddata.tuning_step) {
 					tuning_ctrl &= ~ESDHC_TUNING_STEP_MASK;
 					tuning_ctrl |= imx_data->boarddata.tuning_step << ESDHC_TUNING_STEP_SHIFT;
@@ -976,6 +982,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
 		boarddata->wp_type = ESDHC_WP_GPIO;
 
 	of_property_read_u32(np, "fsl,tuning-step", &boarddata->tuning_step);
+	of_property_read_u32(np, "fsl,tuning-start-tap",
+			     &boarddata->tuning_start_tap);
 
 	if (of_find_property(np, "no-1-8-v", NULL))
 		boarddata->support_vsel = false;
@@ -1198,7 +1206,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING)
 		writel(readl(host->ioaddr + ESDHC_TUNING_CTRL) |
-			ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP,
+			ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP_DEFAULT,
 			host->ioaddr + ESDHC_TUNING_CTRL);
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536)
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index 95ccab3f454a..7daa78a2f342 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -46,5 +46,6 @@ struct esdhc_platform_data {
 	bool support_vsel;
 	unsigned int delay_line;
 	unsigned int tuning_step;       /* The delay cell steps in tuning procedure */
+	unsigned int tuning_start_tap;	/* The start delay cell point in tuning procedure */
 };
 #endif /* __ASM_ARCH_IMX_ESDHC_H */
-- 
1.9.1

  parent reply	other threads:[~2016-07-12  7:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12  7:46 [PATCH V2 00/15] a few sdhci/imx clean up and fix patches Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 01/15] mmc: sdhci: using common mmc_regulator_set_vqmmc() Dong Aisheng
2016-07-21  7:06   ` Adrian Hunter
2016-07-12  7:46 ` [PATCH V2 02/15] mmc: sdhci-esdhc-imx: remove SDHCI_QUIRK_BROKEN_TIMEOUT_VAL Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 03/15] mmc: sdhci-esdhc-imx: add esdhc specific suspend resume callback Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 04/15] mmc: sdhci-esdhc-imx: restore watermark level setting after resume Dong Aisheng
2016-07-21  7:18   ` Adrian Hunter
2016-07-12  7:46 ` [PATCH V2 05/15] mmc: sdhci-esdhci-imx: disable DLL delay line settings explicitly Dong Aisheng
2016-07-12  7:46 ` Dong Aisheng [this message]
2016-07-12  7:46 ` [PATCH V2 07/15] doc: dt: fsl-imx-esdhc: add set tuning start point binding Dong Aisheng
2016-07-12 13:59   ` Andrew Lunn
2016-07-13  9:10     ` Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 08/15] mmc: sdhci: add standard hw auto retuning support Dong Aisheng
2016-07-21  7:46   ` Adrian Hunter
2016-07-12  7:46 ` [PATCH V2 09/15] mmc: sdhci-esdhc-imx: enable hw auto retuning for STD_TUNING Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 10/15] mmc: sdhci-esdhc-imx: enable hw auto retuning for MAN_TUNING Dong Aisheng
2016-08-15 14:59   ` [V2, " Gary Bisson
2016-08-16 10:18     ` Dong Aisheng
2016-08-16 12:44       ` Gary Bisson
2016-08-17 14:31         ` Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 11/15] mmc: sdhci-esdhc-imx: fix strobe DLL lock wrong clock issue Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 12/15] mmc: sdhci-esdhc-imx: factor out hw related initialization into function Dong Aisheng
2016-07-21  8:11   ` Adrian Hunter
2016-07-12  7:46 ` [PATCH V2 13/15] mmc: sdhci-esdhc-imx: move tuning static configuration into hwinit function Dong Aisheng
2016-07-12  7:46 ` [PATCH V2 14/15] mmc: sdhci-esdhci-imx: re-initialize hw state after resume Dong Aisheng
2016-07-21  8:11   ` Adrian Hunter
2016-07-12  7:46 ` [PATCH V2 15/15] mmc: sdhci-esdhc-imx: clear tuning bits during driver probe Dong Aisheng
2016-07-21  8:33   ` Adrian Hunter
2016-07-12 13:54 ` [PATCH V2 00/15] a few sdhci/imx clean up and fix patches Andrew Lunn
2016-07-13  8:55   ` Dong Aisheng
2016-07-13 13:40     ` Andrew Lunn
2016-07-21  9:32 ` Adrian Hunter
2016-07-21 10:23   ` Dong Aisheng
2016-07-23  9:37 ` Ulf Hansson

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=1468309584-3591-7-git-send-email-aisheng.dong@nxp.com \
    --to=aisheng.dong@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.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).