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

mmc: tegra: Optimize write_w path for tegra114 and later

Setup a different set of sdhci_ops for tegra114 and later so that
the write_w callback is only used on tegra114. This allows us to
remove the NVQUIRK_SHADOW_XFER_MODE_REG and simply the logic
in tegra_sdhci_writew.

Suggested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Rhyland Klein and committed by
Ulf Hansson
01df7ecd dbb42d96

+26 -21
+26 -21
drivers/mmc/host/sdhci-tegra.c
··· 41 41 #define NVQUIRK_DISABLE_SDR50 BIT(3) 42 42 #define NVQUIRK_DISABLE_SDR104 BIT(4) 43 43 #define NVQUIRK_DISABLE_DDR50 BIT(5) 44 - #define NVQUIRK_SHADOW_XFER_MODE_REG BIT(6) 45 44 46 45 struct sdhci_tegra_soc_data { 47 46 const struct sdhci_pltfm_data *pdata; ··· 70 71 static void tegra_sdhci_writew(struct sdhci_host *host, u16 val, int reg) 71 72 { 72 73 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 73 - struct sdhci_tegra *tegra_host = pltfm_host->priv; 74 - const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data; 75 74 76 - if (soc_data->nvquirks & NVQUIRK_SHADOW_XFER_MODE_REG) { 77 - switch (reg) { 78 - case SDHCI_TRANSFER_MODE: 79 - /* 80 - * Postpone this write, we must do it together with a 81 - * command write that is down below. 82 - */ 83 - pltfm_host->xfer_mode_shadow = val; 84 - return; 85 - case SDHCI_COMMAND: 86 - writel((val << 16) | pltfm_host->xfer_mode_shadow, 87 - host->ioaddr + SDHCI_TRANSFER_MODE); 88 - return; 89 - } 75 + switch (reg) { 76 + case SDHCI_TRANSFER_MODE: 77 + /* 78 + * Postpone this write, we must do it together with a 79 + * command write that is down below. 80 + */ 81 + pltfm_host->xfer_mode_shadow = val; 82 + return; 83 + case SDHCI_COMMAND: 84 + writel((val << 16) | pltfm_host->xfer_mode_shadow, 85 + host->ioaddr + SDHCI_TRANSFER_MODE); 86 + return; 90 87 } 91 88 92 89 writew(val, host->ioaddr + reg); ··· 168 173 static const struct sdhci_ops tegra_sdhci_ops = { 169 174 .get_ro = tegra_sdhci_get_ro, 170 175 .read_w = tegra_sdhci_readw, 171 - .write_w = tegra_sdhci_writew, 172 176 .write_l = tegra_sdhci_writel, 173 177 .set_clock = sdhci_set_clock, 174 178 .set_bus_width = tegra_sdhci_set_bus_width, ··· 208 214 NVQUIRK_DISABLE_SDR104, 209 215 }; 210 216 217 + static const struct sdhci_ops tegra114_sdhci_ops = { 218 + .get_ro = tegra_sdhci_get_ro, 219 + .read_w = tegra_sdhci_readw, 220 + .write_w = tegra_sdhci_writew, 221 + .write_l = tegra_sdhci_writel, 222 + .set_clock = sdhci_set_clock, 223 + .set_bus_width = tegra_sdhci_set_bus_width, 224 + .reset = tegra_sdhci_reset, 225 + .set_uhs_signaling = sdhci_set_uhs_signaling, 226 + .get_max_clock = sdhci_pltfm_clk_get_max_clock, 227 + }; 228 + 211 229 static const struct sdhci_pltfm_data sdhci_tegra114_pdata = { 212 230 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 213 231 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | ··· 227 221 SDHCI_QUIRK_NO_HISPD_BIT | 228 222 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | 229 223 SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, 230 - .ops = &tegra_sdhci_ops, 224 + .ops = &tegra114_sdhci_ops, 231 225 }; 232 226 233 227 static struct sdhci_tegra_soc_data soc_data_tegra114 = { 234 228 .pdata = &sdhci_tegra114_pdata, 235 229 .nvquirks = NVQUIRK_DISABLE_SDR50 | 236 230 NVQUIRK_DISABLE_DDR50 | 237 - NVQUIRK_DISABLE_SDR104 | 238 - NVQUIRK_SHADOW_XFER_MODE_REG, 231 + NVQUIRK_DISABLE_SDR104, 239 232 }; 240 233 241 234 static const struct of_device_id sdhci_tegra_dt_match[] = {