aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2013-10-21 04:54:40 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:05:50 -0400
commit384cefbb3f6605f92aa6fb008320f57f7eb07d20 (patch)
tree501ef81ed1d25f18cd67647a1dc661c7d065cbd2 /drivers/mmc
parent6bb4a50d9b60d4787d1e116a84c5994291eb2872 (diff)
mmc: sdhci-esdhc-imx: add delay line setting support
The DLL(Delay Line) is newly added to assist in sampling read data. The DLL provides the ability to programmatically select a quantized delay (in fractions of the clock period) regardless of on-chip variations such as process, voltage and temperature (PVT). This patch adds a user interface to set slave delay line via device tree. It's usually used in high speed mode like mmc DDR mode when the signal quality is not good caused by board design, e.g. the signal path is too long. User can manually set delay line to find a suitable data sampling window for card to work properly. Signed-off-by: Dong Aisheng <b29396@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 4b6cd9fa4808..1537e87abe39 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -46,6 +46,11 @@
46/* Bits 3 and 6 are not SDHCI standard definitions */ 46/* Bits 3 and 6 are not SDHCI standard definitions */
47#define ESDHC_MIX_CTRL_SDHCI_MASK 0xb7 47#define ESDHC_MIX_CTRL_SDHCI_MASK 0xb7
48 48
49/* dll control register */
50#define ESDHC_DLL_CTRL 0x60
51#define ESDHC_DLL_OVERRIDE_VAL_SHIFT 9
52#define ESDHC_DLL_OVERRIDE_EN_SHIFT 8
53
49/* tune control register */ 54/* tune control register */
50#define ESDHC_TUNE_CTRL_STATUS 0x68 55#define ESDHC_TUNE_CTRL_STATUS 0x68
51#define ESDHC_TUNE_CTRL_STEP 1 56#define ESDHC_TUNE_CTRL_STEP 1
@@ -842,6 +847,7 @@ static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
842{ 847{
843 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 848 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
844 struct pltfm_imx_data *imx_data = pltfm_host->priv; 849 struct pltfm_imx_data *imx_data = pltfm_host->priv;
850 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
845 851
846 switch (uhs) { 852 switch (uhs) {
847 case MMC_TIMING_UHS_SDR12: 853 case MMC_TIMING_UHS_SDR12:
@@ -862,6 +868,15 @@ static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
862 ESDHC_MIX_CTRL_DDREN, 868 ESDHC_MIX_CTRL_DDREN,
863 host->ioaddr + ESDHC_MIX_CTRL); 869 host->ioaddr + ESDHC_MIX_CTRL);
864 imx_data->is_ddr = 1; 870 imx_data->is_ddr = 1;
871 if (boarddata->delay_line) {
872 u32 v;
873 v = boarddata->delay_line <<
874 ESDHC_DLL_OVERRIDE_VAL_SHIFT |
875 (1 << ESDHC_DLL_OVERRIDE_EN_SHIFT);
876 if (is_imx53_esdhc(imx_data))
877 v <<= 1;
878 writel(v, host->ioaddr + ESDHC_DLL_CTRL);
879 }
865 break; 880 break;
866 } 881 }
867 882
@@ -924,6 +939,9 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
924 else 939 else
925 boarddata->support_vsel = true; 940 boarddata->support_vsel = true;
926 941
942 if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line))
943 boarddata->delay_line = 0;
944
927 return 0; 945 return 0;
928} 946}
929#else 947#else