Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: tegra: enable UHS-I modes

Keep the quirk bits, as Tegra30 and Tegra114 host have different levels
of support for UHS-I modes and so need different spare bits to be set,
but change the logic to be positive.

Tegra210 needs a different tuning sequence than Tegra30+. Disable
UHS modes until support for this is properly added.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Lucas Stach and committed by
Ulf Hansson
7ad2ed1d c3c2384c

+17 -20
+17 -20
drivers/mmc/host/sdhci-tegra.c
··· 45 45 #define NVQUIRK_FORCE_SDHCI_SPEC_200 BIT(0) 46 46 #define NVQUIRK_ENABLE_BLOCK_GAP_DET BIT(1) 47 47 #define NVQUIRK_ENABLE_SDHCI_SPEC_300 BIT(2) 48 - #define NVQUIRK_DISABLE_SDR50 BIT(3) 49 - #define NVQUIRK_DISABLE_SDR104 BIT(4) 50 - #define NVQUIRK_DISABLE_DDR50 BIT(5) 48 + #define NVQUIRK_ENABLE_SDR50 BIT(3) 49 + #define NVQUIRK_ENABLE_SDR104 BIT(4) 50 + #define NVQUIRK_ENABLE_DDR50 BIT(5) 51 51 52 52 struct sdhci_tegra_soc_data { 53 53 const struct sdhci_pltfm_data *pdata; ··· 144 144 /* Erratum: Enable SDHCI spec v3.00 support */ 145 145 if (soc_data->nvquirks & NVQUIRK_ENABLE_SDHCI_SPEC_300) 146 146 misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300; 147 - /* Don't advertise UHS modes which aren't supported yet */ 148 - if (soc_data->nvquirks & NVQUIRK_DISABLE_SDR50) 149 - misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_SDR50; 150 - if (soc_data->nvquirks & NVQUIRK_DISABLE_DDR50) 151 - misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_DDR50; 152 - if (soc_data->nvquirks & NVQUIRK_DISABLE_SDR104) 153 - misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_SDR104; 147 + /* Advertise UHS modes as supported by host */ 148 + if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50) 149 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR50; 150 + if (soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) 151 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50; 152 + if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104) 153 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104; 154 154 sdhci_writew(host, misc_ctrl, SDHCI_TEGRA_VENDOR_MISC_CTRL); 155 155 156 156 clk_ctrl = sdhci_readl(host, SDHCI_TEGRA_VENDOR_CLOCK_CTRL); 157 157 clk_ctrl &= ~SDHCI_CLOCK_CTRL_SPI_MODE_CLKEN_OVERRIDE; 158 - if (!(soc_data->nvquirks & NVQUIRK_DISABLE_SDR50)) 158 + if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50) 159 159 clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE; 160 160 sdhci_writel(host, clk_ctrl, SDHCI_TEGRA_VENDOR_CLOCK_CTRL); 161 161 ··· 305 305 static const struct sdhci_tegra_soc_data soc_data_tegra30 = { 306 306 .pdata = &sdhci_tegra30_pdata, 307 307 .nvquirks = NVQUIRK_ENABLE_SDHCI_SPEC_300 | 308 - NVQUIRK_DISABLE_SDR50 | 309 - NVQUIRK_DISABLE_SDR104, 308 + NVQUIRK_ENABLE_SDR50 | 309 + NVQUIRK_ENABLE_SDR104, 310 310 }; 311 311 312 312 static const struct sdhci_ops tegra114_sdhci_ops = { ··· 335 335 336 336 static const struct sdhci_tegra_soc_data soc_data_tegra114 = { 337 337 .pdata = &sdhci_tegra114_pdata, 338 - .nvquirks = NVQUIRK_DISABLE_SDR50 | 339 - NVQUIRK_DISABLE_DDR50 | 340 - NVQUIRK_DISABLE_SDR104, 338 + .nvquirks = NVQUIRK_ENABLE_SDR50 | 339 + NVQUIRK_ENABLE_DDR50 | 340 + NVQUIRK_ENABLE_SDR104, 341 341 }; 342 342 343 343 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { ··· 353 353 354 354 static const struct sdhci_tegra_soc_data soc_data_tegra210 = { 355 355 .pdata = &sdhci_tegra210_pdata, 356 - .nvquirks = NVQUIRK_DISABLE_SDR50 | 357 - NVQUIRK_DISABLE_DDR50 | 358 - NVQUIRK_DISABLE_SDR104, 359 356 }; 360 357 361 358 static const struct of_device_id sdhci_tegra_dt_match[] = { ··· 399 402 if (rc) 400 403 goto err_parse_dt; 401 404 402 - if (!(tegra_host->soc_data->nvquirks & NVQUIRK_DISABLE_DDR50)) 405 + if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) 403 406 host->mmc->caps |= MMC_CAP_1_8V_DDR; 404 407 405 408 tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",