Commit 5b742232 authored by Yangbo Lu's avatar Yangbo Lu Committed by Ulf Hansson

mmc: sdhci-of-esdhc: update tuning erratum A-008171

There is an official update for eSDHC tuning erratum A-008171.
This patch is to implement the changes,
- Affect all revisions of SoC.
- Changes for tuning window checking.
- Hardware hits a new condition that tuning succeeds although
  the eSDHC might not have tuned properly for type2 SoCs
  (soc_tuning_erratum_type2[] array in driver). So check
  tuning window after tuning succeeds.
Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20191212075219.48625-2-yangbo.lu@nxp.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f3c20825
...@@ -854,20 +854,20 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, ...@@ -854,20 +854,20 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc,
} }
static struct soc_device_attribute soc_tuning_erratum_type1[] = { static struct soc_device_attribute soc_tuning_erratum_type1[] = {
{ .family = "QorIQ T1023", .revision = "1.0", }, { .family = "QorIQ T1023", },
{ .family = "QorIQ T1040", .revision = "1.0", }, { .family = "QorIQ T1040", },
{ .family = "QorIQ T2080", .revision = "1.0", }, { .family = "QorIQ T2080", },
{ .family = "QorIQ LS1021A", .revision = "1.0", }, { .family = "QorIQ LS1021A", },
{ }, { },
}; };
static struct soc_device_attribute soc_tuning_erratum_type2[] = { static struct soc_device_attribute soc_tuning_erratum_type2[] = {
{ .family = "QorIQ LS1012A", .revision = "1.0", }, { .family = "QorIQ LS1012A", },
{ .family = "QorIQ LS1043A", .revision = "1.*", }, { .family = "QorIQ LS1043A", },
{ .family = "QorIQ LS1046A", .revision = "1.0", }, { .family = "QorIQ LS1046A", },
{ .family = "QorIQ LS1080A", .revision = "1.0", }, { .family = "QorIQ LS1080A", },
{ .family = "QorIQ LS2080A", .revision = "1.0", }, { .family = "QorIQ LS2080A", },
{ .family = "QorIQ LA1575A", .revision = "1.0", }, { .family = "QorIQ LA1575A", },
{ }, { },
}; };
...@@ -935,13 +935,13 @@ static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start, ...@@ -935,13 +935,13 @@ static void esdhc_prepare_sw_tuning(struct sdhci_host *host, u8 *window_start,
/* Write 32'hFFFF_FFFF to IRQSTAT register */ /* Write 32'hFFFF_FFFF to IRQSTAT register */
sdhci_writel(host, 0xFFFFFFFF, SDHCI_INT_STATUS); sdhci_writel(host, 0xFFFFFFFF, SDHCI_INT_STATUS);
/* If TBSTAT[15:8]-TBSTAT[7:0] > 4 * div_ratio /* If TBSTAT[15:8]-TBSTAT[7:0] > (4 * div_ratio) + 2
* or TBSTAT[7:0]-TBSTAT[15:8] > 4 * div_ratio, * or TBSTAT[7:0]-TBSTAT[15:8] > (4 * div_ratio) + 2,
* then program TBPTR[TB_WNDW_END_PTR] = 4 * div_ratio * then program TBPTR[TB_WNDW_END_PTR] = 4 * div_ratio
* and program TBPTR[TB_WNDW_START_PTR] = 8 * div_ratio. * and program TBPTR[TB_WNDW_START_PTR] = 8 * div_ratio.
*/ */
if (abs(start_ptr - end_ptr) > (4 * esdhc->div_ratio)) { if (abs(start_ptr - end_ptr) > (4 * esdhc->div_ratio + 2)) {
*window_start = 8 * esdhc->div_ratio; *window_start = 8 * esdhc->div_ratio;
*window_end = 4 * esdhc->div_ratio; *window_end = 4 * esdhc->div_ratio;
} else { } else {
...@@ -1014,6 +1014,19 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) ...@@ -1014,6 +1014,19 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
if (ret) if (ret)
break; break;
/* For type2 affected platforms of the tuning erratum,
* tuning may succeed although eSDHC might not have
* tuned properly. Need to check tuning window.
*/
if (esdhc->quirk_tuning_erratum_type2 &&
!host->tuning_err) {
esdhc_tuning_window_ptr(host, &window_start,
&window_end);
if (abs(window_start - window_end) >
(4 * esdhc->div_ratio + 2))
host->tuning_err = -EAGAIN;
}
/* If HW tuning fails and triggers erratum, /* If HW tuning fails and triggers erratum,
* try workaround. * try workaround.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment