Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <cjb@laptop.org>

authored by

Dong Aisheng and committed by
Chris Ball
de5bdbff 114f2bf6

+14 -3
+14 -3
drivers/mmc/host/sdhci-esdhc-imx.c
··· 38 38 #define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON (1 << 8) 39 39 #define ESDHC_WTMK_LVL 0x44 40 40 #define ESDHC_MIX_CTRL 0x48 41 + #define ESDHC_MIX_CTRL_DDREN (1 << 3) 41 42 #define ESDHC_MIX_CTRL_AC23EN (1 << 7) 42 43 #define ESDHC_MIX_CTRL_EXE_TUNE (1 << 22) 43 44 #define ESDHC_MIX_CTRL_SMPCLK_SEL (1 << 23) ··· 153 152 WAIT_FOR_INT, /* sent CMD12, waiting for response INT */ 154 153 } multiblock_status; 155 154 u32 uhs_mode; 155 + u32 is_ddr; 156 156 }; 157 157 158 158 static struct platform_device_id imx_esdhc_devtype[] = { ··· 539 537 * The reset on usdhc fails to clear MIX_CTRL register. 540 538 * Do it manually here. 541 539 */ 542 - if (esdhc_is_usdhc(imx_data)) 540 + if (esdhc_is_usdhc(imx_data)) { 543 541 writel(0, host->ioaddr + ESDHC_MIX_CTRL); 542 + imx_data->is_ddr = 0; 543 + } 544 544 } 545 545 } 546 546 ··· 586 582 goto out; 587 583 } 588 584 589 - if (esdhc_is_usdhc(imx_data)) 585 + if (esdhc_is_usdhc(imx_data) && !imx_data->is_ddr) 590 586 pre_div = 1; 591 587 592 588 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); ··· 604 600 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n", 605 601 clock, host->mmc->actual_clock); 606 602 607 - pre_div >>= 1; 603 + if (imx_data->is_ddr) 604 + pre_div >>= 2; 605 + else 606 + pre_div >>= 1; 608 607 div--; 609 608 610 609 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); ··· 833 826 break; 834 827 case MMC_TIMING_UHS_DDR50: 835 828 imx_data->uhs_mode = SDHCI_CTRL_UHS_DDR50; 829 + writel(readl(host->ioaddr + ESDHC_MIX_CTRL) | 830 + ESDHC_MIX_CTRL_DDREN, 831 + host->ioaddr + ESDHC_MIX_CTRL); 832 + imx_data->is_ddr = 1; 836 833 break; 837 834 } 838 835