On 21/12/22 13:28, haibo.chen@xxxxxxx wrote: > From: Haibo Chen <haibo.chen@xxxxxxx> > > USDHC IP has one limitation: the tuning circuit can't handle the async > sdio device interrupt correctly. When sdio device use 4 data lines, > async sdio interrupt will use the shared DAT[1], if enable auto tuning > circuit to check these 4 data lines, include the DAT[1], this circuit > will detect this interrupt, take this as data on DAT[1], and adjust the > delay cell wrongly, finally will cause the DATA/CMD CRC error. > So for SDIO device, only enable DAT[0] and CMD line for auto tuning. > > Signed-off-by: Haibo Chen <haibo.chen@xxxxxxx> > --- > drivers/mmc/host/sdhci-esdhc-imx.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c > index bf8d6f60a9ee..d6ce4c8d23dc 100644 > --- a/drivers/mmc/host/sdhci-esdhc-imx.c > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c > @@ -448,6 +448,20 @@ static inline void usdhc_auto_tuning_mode_sel_and_en(struct sdhci_host *host) > break; > } > > + /* > + * For USDHC, auto tuning circuit can not handle the async sdio > + * device interrupt correctly. When sdio device use 4 data lines, > + * async sdio interrupt will use the shared DAT[1], if enable auto > + * tuning circuit check these 4 data lines, include the DAT[1], > + * this circuit will detect this interrupt, take this as a data on > + * DAT[1], and adjust the delay cell wrongly. > + * This is the hardware design limitation, to avoid this, for sdio > + * device, config the auto tuning circuit only check DAT[0] and CMD > + * line. > + */ > + if (!host->mmc->card && mmc_card_sdio(host->mmc->card)) Looks like !host->mmc->card should be host->mmc->card > + auto_tune_buswidth = ESDHC_VEND_SPEC2_AUTO_TUNE_1BIT_EN; > + > esdhc_clrset_le(host, ESDHC_VEND_SPEC2_AUTO_TUNE_MODE_MASK, > auto_tune_buswidth | ESDHC_VEND_SPEC2_AUTO_TUNE_CMD_EN, > ESDHC_VEND_SPEC2);