Message ID | 20221221112853.789675-1-haibo.chen@nxp.com |
---|---|
Headers | show |
Series | fix the sdio device DATA/CMD CRC and Timeout issue after tuning | expand |
On 21/12/22 13:28, haibo.chen@nxp.com wrote: > From: Haibo Chen <haibo.chen@nxp.com> > > 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@nxp.com> > --- > 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);
> -----Original Message----- > From: Adrian Hunter <adrian.hunter@intel.com> > Sent: 2022年12月21日 22:21 > To: Bough Chen <haibo.chen@nxp.com> > Cc: shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de; > festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>; > linux-mmc@vger.kernel.org; kgroeneveld@lenbrook.com; > ulf.hansson@linaro.org > Subject: Re: [PATCH v2 3/3] mmc: sdhci-esdhc-imx: only enable DAT[0] and > CMD line auto tuning for SDIO device > > On 21/12/22 13:28, haibo.chen@nxp.com wrote: > > From: Haibo Chen <haibo.chen@nxp.com> > > > > 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@nxp.com> > > --- > > 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 Yes, my mistake, my local test version is correct, I will fix this. Best Regards Haibo Chen > > > + 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);
From: Haibo Chen <haibo.chen@nxp.com> V2: - drop the dts/dt-binding change, since this is one IC limitation, so handle this directlly in driver. - simply the auto tuning code logic. - To detect the SDIO device in host driver side, add some change in common code, move host->card = card a bit upper. Haibo Chen (3): mmc: sdhci-esdhc-imx: simplify the auto tuning logic mmc: let the host side can find card type during card init process mmc: sdhci-esdhc-imx: only enable DAT[0] and CMD line auto tuning for SDIO device drivers/mmc/core/mmc.c | 9 ++++--- drivers/mmc/core/sd.c | 7 ++++-- drivers/mmc/core/sdio.c | 10 +++++--- drivers/mmc/host/sdhci-esdhc-imx.c | 39 +++++++++++++++++++++++------- 4 files changed, 46 insertions(+), 19 deletions(-)