aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Brice <aaron.brice@datasoft.com>2016-10-10 14:39:52 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-10-13 02:58:03 -0400
commit77da3da0b22a67508eb1cf2b241a1fe852a6cb1a (patch)
tree3dfe0f4075be037e28b5bb58bcd34d51959e4d70
parentfee686b74a9c115d3c4c851eb6613d1378ad0e0c (diff)
mmc: sdhci-esdhc-imx: Correct two register accesses
- The DMA error interrupt bit is in a different position as compared to the sdhci standard. This is accounted for in many cases, but not handled in the case of clearing the INT_STATUS register by writing a 1 to that location. - The HOST_CONTROL register is very different as compared to the sdhci standard. This is accounted for in the write case, but not when read back out (which it is in the sdhci code). Signed-off-by: Dave Russell <david.russell@datasoft.com> Signed-off-by: Aaron Brice <aaron.brice@datasoft.com> Acked-by: Dong Aisheng <aisheng.dong@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1f54fd8755c8..7123ef96ed18 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -346,7 +346,8 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
346 struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); 346 struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
347 u32 data; 347 u32 data;
348 348
349 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) { 349 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE ||
350 reg == SDHCI_INT_STATUS)) {
350 if ((val & SDHCI_INT_CARD_INT) && !esdhc_is_usdhc(imx_data)) { 351 if ((val & SDHCI_INT_CARD_INT) && !esdhc_is_usdhc(imx_data)) {
351 /* 352 /*
352 * Clear and then set D3CD bit to avoid missing the 353 * Clear and then set D3CD bit to avoid missing the
@@ -555,6 +556,25 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
555 esdhc_clrset_le(host, 0xffff, val, reg); 556 esdhc_clrset_le(host, 0xffff, val, reg);
556} 557}
557 558
559static u8 esdhc_readb_le(struct sdhci_host *host, int reg)
560{
561 u8 ret;
562 u32 val;
563
564 switch (reg) {
565 case SDHCI_HOST_CONTROL:
566 val = readl(host->ioaddr + reg);
567
568 ret = val & SDHCI_CTRL_LED;
569 ret |= (val >> 5) & SDHCI_CTRL_DMA_MASK;
570 ret |= (val & ESDHC_CTRL_4BITBUS);
571 ret |= (val & ESDHC_CTRL_8BITBUS) << 3;
572 return ret;
573 }
574
575 return readb(host->ioaddr + reg);
576}
577
558static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) 578static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
559{ 579{
560 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 580 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -947,6 +967,7 @@ static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
947static struct sdhci_ops sdhci_esdhc_ops = { 967static struct sdhci_ops sdhci_esdhc_ops = {
948 .read_l = esdhc_readl_le, 968 .read_l = esdhc_readl_le,
949 .read_w = esdhc_readw_le, 969 .read_w = esdhc_readw_le,
970 .read_b = esdhc_readb_le,
950 .write_l = esdhc_writel_le, 971 .write_l = esdhc_writel_le,
951 .write_w = esdhc_writew_le, 972 .write_w = esdhc_writew_le,
952 .write_b = esdhc_writeb_le, 973 .write_b = esdhc_writeb_le,