diff options
author | Dong Aisheng <b29396@freescale.com> | 2013-10-21 03:27:40 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:05:49 -0400 |
commit | 6bb4a50d9b60d4787d1e116a84c5994291eb2872 (patch) | |
tree | ca8e1530dbd1aad8e0d3046a76d615acc09ddf2b /drivers/mmc | |
parent | 6f522be6a849db8666676a91080cff7bbf312215 (diff) |
mmc: sdhci-esdhc-imx: add DDR mode support for mx6
When DDR mode is enabled, the initial pre_div should be 2.
And the pre_div value should be changed accordingly
from
...
02h) Base clock divided by 4
01h) Base clock divided by 2
00h) Base clock divided by 1
to
..
02h) Base clock divided by 8
01h) Base clock divided by 4
00h) Base clock divided by 2
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.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6540934f2ab9..4b6cd9fa4808 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON (1 << 8) | 38 | #define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON (1 << 8) |
39 | #define ESDHC_WTMK_LVL 0x44 | 39 | #define ESDHC_WTMK_LVL 0x44 |
40 | #define ESDHC_MIX_CTRL 0x48 | 40 | #define ESDHC_MIX_CTRL 0x48 |
41 | #define ESDHC_MIX_CTRL_DDREN (1 << 3) | ||
41 | #define ESDHC_MIX_CTRL_AC23EN (1 << 7) | 42 | #define ESDHC_MIX_CTRL_AC23EN (1 << 7) |
42 | #define ESDHC_MIX_CTRL_EXE_TUNE (1 << 22) | 43 | #define ESDHC_MIX_CTRL_EXE_TUNE (1 << 22) |
43 | #define ESDHC_MIX_CTRL_SMPCLK_SEL (1 << 23) | 44 | #define ESDHC_MIX_CTRL_SMPCLK_SEL (1 << 23) |
@@ -152,6 +153,7 @@ struct pltfm_imx_data { | |||
152 | WAIT_FOR_INT, /* sent CMD12, waiting for response INT */ | 153 | WAIT_FOR_INT, /* sent CMD12, waiting for response INT */ |
153 | } multiblock_status; | 154 | } multiblock_status; |
154 | u32 uhs_mode; | 155 | u32 uhs_mode; |
156 | u32 is_ddr; | ||
155 | }; | 157 | }; |
156 | 158 | ||
157 | static struct platform_device_id imx_esdhc_devtype[] = { | 159 | static struct platform_device_id imx_esdhc_devtype[] = { |
@@ -537,8 +539,10 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) | |||
537 | * The reset on usdhc fails to clear MIX_CTRL register. | 539 | * The reset on usdhc fails to clear MIX_CTRL register. |
538 | * Do it manually here. | 540 | * Do it manually here. |
539 | */ | 541 | */ |
540 | if (esdhc_is_usdhc(imx_data)) | 542 | if (esdhc_is_usdhc(imx_data)) { |
541 | writel(0, host->ioaddr + ESDHC_MIX_CTRL); | 543 | writel(0, host->ioaddr + ESDHC_MIX_CTRL); |
544 | imx_data->is_ddr = 0; | ||
545 | } | ||
542 | } | 546 | } |
543 | } | 547 | } |
544 | 548 | ||
@@ -567,7 +571,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, | |||
567 | goto out; | 571 | goto out; |
568 | } | 572 | } |
569 | 573 | ||
570 | if (esdhc_is_usdhc(imx_data)) | 574 | if (esdhc_is_usdhc(imx_data) && !imx_data->is_ddr) |
571 | pre_div = 1; | 575 | pre_div = 1; |
572 | 576 | ||
573 | temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); | 577 | temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); |
@@ -585,7 +589,10 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, | |||
585 | dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n", | 589 | dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n", |
586 | clock, host->mmc->actual_clock); | 590 | clock, host->mmc->actual_clock); |
587 | 591 | ||
588 | pre_div >>= 1; | 592 | if (imx_data->is_ddr) |
593 | pre_div >>= 2; | ||
594 | else | ||
595 | pre_div >>= 1; | ||
589 | div--; | 596 | div--; |
590 | 597 | ||
591 | temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); | 598 | temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); |
@@ -851,6 +858,10 @@ static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs) | |||
851 | break; | 858 | break; |
852 | case MMC_TIMING_UHS_DDR50: | 859 | case MMC_TIMING_UHS_DDR50: |
853 | imx_data->uhs_mode = SDHCI_CTRL_UHS_DDR50; | 860 | imx_data->uhs_mode = SDHCI_CTRL_UHS_DDR50; |
861 | writel(readl(host->ioaddr + ESDHC_MIX_CTRL) | | ||
862 | ESDHC_MIX_CTRL_DDREN, | ||
863 | host->ioaddr + ESDHC_MIX_CTRL); | ||
864 | imx_data->is_ddr = 1; | ||
854 | break; | 865 | break; |
855 | } | 866 | } |
856 | 867 | ||