Skip to content

Commit 97e4ba6

Browse files
Richard Zhucjb
authored andcommitted
mmc: sdhci-esdhc-imx: Enable ADMA2
Eanble the ADMA2 mode for freescale esdhc imx driver, tested on MX25 3DS board, MX51 BBG board and MX53 LOCO board. This patch is only used to enable the ADMA2 for MX51/53 platforms. MX25/35 can't support the ADMA2 mode, set BROKEN_ADMA quirk on MX25/35 platforms. The ADMA mode supported or not can be distinguished by bit 20 of the Capability Register (offset 0x40) in the FSL eSDHC module. Signed-off-by: Richard Zhu <richard.zhu@linaro.org> Tested-and-acked-by: Eric Miao <eric.miao@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 51c5d8d commit 97e4ba6

1 file changed

Lines changed: 41 additions & 3 deletions

File tree

‎drivers/mmc/host/sdhci-esdhc-imx.c‎

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
#define SDHCI_VENDOR_SPEC 0xC0
3434
#define SDHCI_VENDOR_SPEC_SDIO_QUIRK 0x00000002
3535

36+
/*
37+
* There is an INT DMA ERR mis-match between eSDHC and STD SDHC SPEC:
38+
* Bit25 is used in STD SPEC, and is reserved in fsl eSDHC design,
39+
* but bit28 is used as the INT DMA ERR in fsl eSDHC design.
40+
* Define this macro DMA error INT for fsl eSDHC
41+
*/
42+
#define SDHCI_INT_VENDOR_SPEC_DMA_ERR 0x10000000
43+
3644
/*
3745
* The CMDTYPE of the CMD register (offset 0xE) should be set to
3846
* "11" when the STOP CMD12 is issued on imx53 to abort one
@@ -135,6 +143,27 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
135143
val |= SDHCI_CARD_PRESENT;
136144
}
137145

146+
if (unlikely(reg == SDHCI_CAPABILITIES)) {
147+
/* In FSL esdhc IC module, only bit20 is used to indicate the
148+
* ADMA2 capability of esdhc, but this bit is messed up on
149+
* some SOCs (e.g. on MX25, MX35 this bit is set, but they
150+
* don't actually support ADMA2). So set the BROKEN_ADMA
151+
* uirk on MX25/35 platforms.
152+
*/
153+
154+
if (val & SDHCI_CAN_DO_ADMA1) {
155+
val &= ~SDHCI_CAN_DO_ADMA1;
156+
val |= SDHCI_CAN_DO_ADMA2;
157+
}
158+
}
159+
160+
if (unlikely(reg == SDHCI_INT_STATUS)) {
161+
if (val & SDHCI_INT_VENDOR_SPEC_DMA_ERR) {
162+
val &= ~SDHCI_INT_VENDOR_SPEC_DMA_ERR;
163+
val |= SDHCI_INT_ADMA_ERROR;
164+
}
165+
}
166+
138167
return val;
139168
}
140169

@@ -179,6 +208,13 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
179208
writel(v, host->ioaddr + SDHCI_VENDOR_SPEC);
180209
}
181210

211+
if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
212+
if (val & SDHCI_INT_ADMA_ERROR) {
213+
val &= ~SDHCI_INT_ADMA_ERROR;
214+
val |= SDHCI_INT_VENDOR_SPEC_DMA_ERR;
215+
}
216+
}
217+
182218
writel(val, host->ioaddr + reg);
183219
}
184220

@@ -311,9 +347,10 @@ static struct sdhci_ops sdhci_esdhc_ops = {
311347
};
312348

313349
static struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
314-
.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA
350+
.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_HISPD_BIT
351+
| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
352+
| SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC
315353
| SDHCI_QUIRK_BROKEN_CARD_DETECTION,
316-
/* ADMA has issues. Might be fixable */
317354
.ops = &sdhci_esdhc_ops,
318355
};
319356

@@ -405,7 +442,8 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
405442

406443
if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
407444
/* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
408-
host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK;
445+
host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK
446+
| SDHCI_QUIRK_BROKEN_ADMA;
409447

410448
if (is_imx53_esdhc(imx_data))
411449
imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT;

0 commit comments

Comments
 (0)