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

Merge tag 'mmc-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:

- Fix HS400 tuning for ACPI ID AMDI0040

- Fix reset of CQHCI for Intel GLK-based controllers

- Use correct timeout clock for Tegra186/194/210

- Fix eMMC mounting on mt7622/Bpi-64

* tag 'mmc-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
sdhci: tegra: Add missing TMCLK for data timeout
arm64: tegra: Add missing timeout clock to Tegra194 SDMMC nodes
arm64: tegra: Add missing timeout clock to Tegra186 SDMMC nodes
arm64: tegra: Add missing timeout clock to Tegra210 SDMMC
dt-bindings: mmc: tegra: Add tmclk for Tegra210 and later
sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra186
sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra210
arm64: dts: mt7622: add reset node for mmc device
dt-bindings: mmc: Add missing description for clk_in/out_sd1
mmc: mediatek: add optional module reset property
mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040

+203 -43
+7 -3
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
··· 30 30 then: 31 31 properties: 32 32 clock-output-names: 33 - items: 34 - - const: clk_out_sd0 35 - - const: clk_in_sd0 33 + oneOf: 34 + - items: 35 + - const: clk_out_sd0 36 + - const: clk_in_sd0 37 + - items: 38 + - const: clk_out_sd1 39 + - const: clk_in_sd1 36 40 37 41 properties: 38 42 compatible:
+2
Documentation/devicetree/bindings/mmc/mtk-sd.txt
··· 50 50 error caused by stop clock(fifo full) 51 51 Valid range = [0:0x7]. if not present, default value is 0. 52 52 applied to compatible "mediatek,mt2701-mmc". 53 + - resets: Phandle and reset specifier pair to softreset line of MSDC IP. 54 + - reset-names: Should be "hrst". 53 55 54 56 Examples: 55 57 mmc0: mmc@11230000 {
+29 -3
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt
··· 15 15 - "nvidia,tegra210-sdhci": for Tegra210 16 16 - "nvidia,tegra186-sdhci": for Tegra186 17 17 - "nvidia,tegra194-sdhci": for Tegra194 18 - - clocks : Must contain one entry, for the module clock. 19 - See ../clocks/clock-bindings.txt for details. 18 + - clocks: For Tegra210, Tegra186 and Tegra194 must contain two entries. 19 + One for the module clock and one for the timeout clock. 20 + For all other Tegra devices, must contain a single entry for 21 + the module clock. See ../clocks/clock-bindings.txt for details. 22 + - clock-names: For Tegra210, Tegra186 and Tegra194 must contain the 23 + strings 'sdhci' and 'tmclk' to represent the module and 24 + the timeout clocks, respectively. 25 + For all other Tegra devices must contain the string 'sdhci' 26 + to represent the module clock. 20 27 - resets : Must contain an entry for each entry in reset-names. 21 28 See ../reset/reset.txt for details. 22 29 - reset-names : Must include the following entries: ··· 106 99 107 100 Example: 108 101 sdhci@700b0000 { 109 - compatible = "nvidia,tegra210-sdhci", "nvidia,tegra124-sdhci"; 102 + compatible = "nvidia,tegra124-sdhci"; 110 103 reg = <0x0 0x700b0000 0x0 0x200>; 111 104 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 112 105 clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; 113 106 clock-names = "sdhci"; 107 + resets = <&tegra_car 14>; 108 + reset-names = "sdhci"; 109 + pinctrl-names = "sdmmc-3v3", "sdmmc-1v8"; 110 + pinctrl-0 = <&sdmmc1_3v3>; 111 + pinctrl-1 = <&sdmmc1_1v8>; 112 + nvidia,pad-autocal-pull-up-offset-3v3 = <0x00>; 113 + nvidia,pad-autocal-pull-down-offset-3v3 = <0x7d>; 114 + nvidia,pad-autocal-pull-up-offset-1v8 = <0x7b>; 115 + nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>; 116 + status = "disabled"; 117 + }; 118 + 119 + sdhci@700b0000 { 120 + compatible = "nvidia,tegra210-sdhci"; 121 + reg = <0x0 0x700b0000 0x0 0x200>; 122 + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 123 + clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, 124 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 125 + clock-names = "sdhci", "tmclk"; 114 126 resets = <&tegra_car 14>; 115 127 reset-names = "sdhci"; 116 128 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8";
+2
arch/arm64/boot/dts/mediatek/mt7622.dtsi
··· 686 686 clocks = <&pericfg CLK_PERI_MSDC30_0_PD>, 687 687 <&topckgen CLK_TOP_MSDC50_0_SEL>; 688 688 clock-names = "source", "hclk"; 689 + resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>; 690 + reset-names = "hrst"; 689 691 status = "disabled"; 690 692 }; 691 693
+12 -8
arch/arm64/boot/dts/nvidia/tegra186.dtsi
··· 337 337 compatible = "nvidia,tegra186-sdhci"; 338 338 reg = <0x0 0x03400000 0x0 0x10000>; 339 339 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; 340 - clocks = <&bpmp TEGRA186_CLK_SDMMC1>; 341 - clock-names = "sdhci"; 340 + clocks = <&bpmp TEGRA186_CLK_SDMMC1>, 341 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 342 + clock-names = "sdhci", "tmclk"; 342 343 resets = <&bpmp TEGRA186_RESET_SDMMC1>; 343 344 reset-names = "sdhci"; 344 345 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>, ··· 367 366 compatible = "nvidia,tegra186-sdhci"; 368 367 reg = <0x0 0x03420000 0x0 0x10000>; 369 368 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; 370 - clocks = <&bpmp TEGRA186_CLK_SDMMC2>; 371 - clock-names = "sdhci"; 369 + clocks = <&bpmp TEGRA186_CLK_SDMMC2>, 370 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 371 + clock-names = "sdhci", "tmclk"; 372 372 resets = <&bpmp TEGRA186_RESET_SDMMC2>; 373 373 reset-names = "sdhci"; 374 374 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>, ··· 392 390 compatible = "nvidia,tegra186-sdhci"; 393 391 reg = <0x0 0x03440000 0x0 0x10000>; 394 392 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; 395 - clocks = <&bpmp TEGRA186_CLK_SDMMC3>; 396 - clock-names = "sdhci"; 393 + clocks = <&bpmp TEGRA186_CLK_SDMMC3>, 394 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 395 + clock-names = "sdhci", "tmclk"; 397 396 resets = <&bpmp TEGRA186_RESET_SDMMC3>; 398 397 reset-names = "sdhci"; 399 398 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>, ··· 419 416 compatible = "nvidia,tegra186-sdhci"; 420 417 reg = <0x0 0x03460000 0x0 0x10000>; 421 418 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 422 - clocks = <&bpmp TEGRA186_CLK_SDMMC4>; 423 - clock-names = "sdhci"; 419 + clocks = <&bpmp TEGRA186_CLK_SDMMC4>, 420 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 421 + clock-names = "sdhci", "tmclk"; 424 422 assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>, 425 423 <&bpmp TEGRA186_CLK_PLLC4_VCO>; 426 424 assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>;
+9 -6
arch/arm64/boot/dts/nvidia/tegra194.dtsi
··· 460 460 compatible = "nvidia,tegra194-sdhci"; 461 461 reg = <0x03400000 0x10000>; 462 462 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; 463 - clocks = <&bpmp TEGRA194_CLK_SDMMC1>; 464 - clock-names = "sdhci"; 463 + clocks = <&bpmp TEGRA194_CLK_SDMMC1>, 464 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 465 + clock-names = "sdhci", "tmclk"; 465 466 resets = <&bpmp TEGRA194_RESET_SDMMC1>; 466 467 reset-names = "sdhci"; 467 468 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>, ··· 486 485 compatible = "nvidia,tegra194-sdhci"; 487 486 reg = <0x03440000 0x10000>; 488 487 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; 489 - clocks = <&bpmp TEGRA194_CLK_SDMMC3>; 490 - clock-names = "sdhci"; 488 + clocks = <&bpmp TEGRA194_CLK_SDMMC3>, 489 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 490 + clock-names = "sdhci", "tmclk"; 491 491 resets = <&bpmp TEGRA194_RESET_SDMMC3>; 492 492 reset-names = "sdhci"; 493 493 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>, ··· 513 511 compatible = "nvidia,tegra194-sdhci"; 514 512 reg = <0x03460000 0x10000>; 515 513 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 516 - clocks = <&bpmp TEGRA194_CLK_SDMMC4>; 517 - clock-names = "sdhci"; 514 + clocks = <&bpmp TEGRA194_CLK_SDMMC4>, 515 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 516 + clock-names = "sdhci", "tmclk"; 518 517 assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>, 519 518 <&bpmp TEGRA194_CLK_PLLC4>; 520 519 assigned-clock-parents =
+12 -8
arch/arm64/boot/dts/nvidia/tegra210.dtsi
··· 1194 1194 compatible = "nvidia,tegra210-sdhci"; 1195 1195 reg = <0x0 0x700b0000 0x0 0x200>; 1196 1196 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 1197 - clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; 1198 - clock-names = "sdhci"; 1197 + clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, 1198 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1199 + clock-names = "sdhci", "tmclk"; 1199 1200 resets = <&tegra_car 14>; 1200 1201 reset-names = "sdhci"; 1201 1202 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", ··· 1223 1222 compatible = "nvidia,tegra210-sdhci"; 1224 1223 reg = <0x0 0x700b0200 0x0 0x200>; 1225 1224 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 1226 - clocks = <&tegra_car TEGRA210_CLK_SDMMC2>; 1227 - clock-names = "sdhci"; 1225 + clocks = <&tegra_car TEGRA210_CLK_SDMMC2>, 1226 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1227 + clock-names = "sdhci", "tmclk"; 1228 1228 resets = <&tegra_car 9>; 1229 1229 reset-names = "sdhci"; 1230 1230 pinctrl-names = "sdmmc-1v8-drv"; ··· 1241 1239 compatible = "nvidia,tegra210-sdhci"; 1242 1240 reg = <0x0 0x700b0400 0x0 0x200>; 1243 1241 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; 1244 - clocks = <&tegra_car TEGRA210_CLK_SDMMC3>; 1245 - clock-names = "sdhci"; 1242 + clocks = <&tegra_car TEGRA210_CLK_SDMMC3>, 1243 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1244 + clock-names = "sdhci", "tmclk"; 1246 1245 resets = <&tegra_car 69>; 1247 1246 reset-names = "sdhci"; 1248 1247 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", ··· 1265 1262 compatible = "nvidia,tegra210-sdhci"; 1266 1263 reg = <0x0 0x700b0600 0x0 0x200>; 1267 1264 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 1268 - clocks = <&tegra_car TEGRA210_CLK_SDMMC4>; 1269 - clock-names = "sdhci"; 1265 + clocks = <&tegra_car TEGRA210_CLK_SDMMC4>, 1266 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1267 + clock-names = "sdhci", "tmclk"; 1270 1268 resets = <&tegra_car 15>; 1271 1269 reset-names = "sdhci"; 1272 1270 pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv";
+13
drivers/mmc/host/mtk-sd.c
··· 22 22 #include <linux/slab.h> 23 23 #include <linux/spinlock.h> 24 24 #include <linux/interrupt.h> 25 + #include <linux/reset.h> 25 26 26 27 #include <linux/mmc/card.h> 27 28 #include <linux/mmc/core.h> ··· 420 419 struct pinctrl_state *pins_uhs; 421 420 struct delayed_work req_timeout; 422 421 int irq; /* host interrupt */ 422 + struct reset_control *reset; 423 423 424 424 struct clk *src_clk; /* msdc source clock */ 425 425 struct clk *h_clk; /* msdc h_clk */ ··· 1594 1592 u32 val; 1595 1593 u32 tune_reg = host->dev_comp->pad_tune_reg; 1596 1594 1595 + if (host->reset) { 1596 + reset_control_assert(host->reset); 1597 + usleep_range(10, 50); 1598 + reset_control_deassert(host->reset); 1599 + } 1600 + 1597 1601 /* Configure to MMC/SD mode, clock free running */ 1598 1602 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN); 1599 1603 ··· 2397 2389 host->src_clk_cg = devm_clk_get(&pdev->dev, "source_cg"); 2398 2390 if (IS_ERR(host->src_clk_cg)) 2399 2391 host->src_clk_cg = NULL; 2392 + 2393 + host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, 2394 + "hrst"); 2395 + if (IS_ERR(host->reset)) 2396 + return PTR_ERR(host->reset); 2400 2397 2401 2398 host->irq = platform_get_irq(pdev, 0); 2402 2399 if (host->irq < 0) {
+57 -10
drivers/mmc/host/sdhci-acpi.c
··· 535 535 .caps = MMC_CAP_NONREMOVABLE, 536 536 }; 537 537 538 + struct amd_sdhci_host { 539 + bool tuned_clock; 540 + bool dll_enabled; 541 + }; 542 + 538 543 /* AMD sdhci reset dll register. */ 539 544 #define SDHCI_AMD_RESET_DLL_REGISTER 0x908 540 545 ··· 560 555 } 561 556 562 557 /* 563 - * For AMD Platform it is required to disable the tuning 564 - * bit first controller to bring to HS Mode from HS200 565 - * mode, later enable to tune to HS400 mode. 558 + * The initialization sequence for HS400 is: 559 + * HS->HS200->Perform Tuning->HS->HS400 560 + * 561 + * The re-tuning sequence is: 562 + * HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400 563 + * 564 + * The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400 565 + * mode. If we switch to a different mode, we need to disable the tuned clock. 566 + * If we have previously performed tuning and switch back to HS200 or 567 + * HS400, we can re-enable the tuned clock. 568 + * 566 569 */ 567 570 static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 568 571 { 569 572 struct sdhci_host *host = mmc_priv(mmc); 573 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 574 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 570 575 unsigned int old_timing = host->timing; 576 + u16 val; 571 577 572 578 sdhci_set_ios(mmc, ios); 573 - if (old_timing == MMC_TIMING_MMC_HS200 && 574 - ios->timing == MMC_TIMING_MMC_HS) 575 - sdhci_writew(host, 0x9, SDHCI_HOST_CONTROL2); 576 - if (old_timing != MMC_TIMING_MMC_HS400 && 577 - ios->timing == MMC_TIMING_MMC_HS400) { 578 - sdhci_writew(host, 0x80, SDHCI_HOST_CONTROL2); 579 - sdhci_acpi_amd_hs400_dll(host); 579 + 580 + if (old_timing != host->timing && amd_host->tuned_clock) { 581 + if (host->timing == MMC_TIMING_MMC_HS400 || 582 + host->timing == MMC_TIMING_MMC_HS200) { 583 + val = sdhci_readw(host, SDHCI_HOST_CONTROL2); 584 + val |= SDHCI_CTRL_TUNED_CLK; 585 + sdhci_writew(host, val, SDHCI_HOST_CONTROL2); 586 + } else { 587 + val = sdhci_readw(host, SDHCI_HOST_CONTROL2); 588 + val &= ~SDHCI_CTRL_TUNED_CLK; 589 + sdhci_writew(host, val, SDHCI_HOST_CONTROL2); 590 + } 591 + 592 + /* DLL is only required for HS400 */ 593 + if (host->timing == MMC_TIMING_MMC_HS400 && 594 + !amd_host->dll_enabled) { 595 + sdhci_acpi_amd_hs400_dll(host); 596 + amd_host->dll_enabled = true; 597 + } 580 598 } 599 + } 600 + 601 + static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) 602 + { 603 + int err; 604 + struct sdhci_host *host = mmc_priv(mmc); 605 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 606 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 607 + 608 + amd_host->tuned_clock = false; 609 + 610 + err = sdhci_execute_tuning(mmc, opcode); 611 + 612 + if (!err && !host->tuning_err) 613 + amd_host->tuned_clock = true; 614 + 615 + return err; 581 616 } 582 617 583 618 static const struct sdhci_ops sdhci_acpi_ops_amd = { ··· 647 602 648 603 host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; 649 604 host->mmc_host_ops.set_ios = amd_set_ios; 605 + host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning; 650 606 return 0; 651 607 } 652 608 ··· 659 613 SDHCI_QUIRK_32BIT_ADMA_SIZE, 660 614 .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, 661 615 .probe_slot = sdhci_acpi_emmc_amd_probe_slot, 616 + .priv_size = sizeof(struct amd_sdhci_host), 662 617 }; 663 618 664 619 struct sdhci_acpi_uid_slot {
+9 -1
drivers/mmc/host/sdhci-pci-core.c
··· 232 232 sdhci_dumpregs(mmc_priv(mmc)); 233 233 } 234 234 235 + static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask) 236 + { 237 + if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) && 238 + host->mmc->cqe_private) 239 + cqhci_deactivate(host->mmc); 240 + sdhci_reset(host, mask); 241 + } 242 + 235 243 /*****************************************************************************\ 236 244 * * 237 245 * Hardware specific quirk handling * ··· 726 718 .set_power = sdhci_intel_set_power, 727 719 .enable_dma = sdhci_pci_enable_dma, 728 720 .set_bus_width = sdhci_set_bus_width, 729 - .reset = sdhci_reset, 721 + .reset = sdhci_cqhci_reset, 730 722 .set_uhs_signaling = sdhci_set_uhs_signaling, 731 723 .hw_reset = sdhci_pci_hw_reset, 732 724 .irq = sdhci_cqhci_irq,
+51 -4
drivers/mmc/host/sdhci-tegra.c
··· 110 110 #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) 111 111 #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING BIT(9) 112 112 113 + /* 114 + * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra 115 + * SDMMC hardware data timeout. 116 + */ 117 + #define NVQUIRK_HAS_TMCLK BIT(10) 118 + 113 119 /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ 114 120 #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 115 121 ··· 146 140 struct sdhci_tegra { 147 141 const struct sdhci_tegra_soc_data *soc_data; 148 142 struct gpio_desc *power_gpio; 143 + struct clk *tmclk; 149 144 bool ddr_signaling; 150 145 bool pad_calib_required; 151 146 bool pad_control_available; ··· 1425 1418 1426 1419 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { 1427 1420 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 1428 - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 1429 1421 SDHCI_QUIRK_SINGLE_POWER_WRITE | 1430 1422 SDHCI_QUIRK_NO_HISPD_BIT | 1431 1423 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | ··· 1440 1434 NVQUIRK_HAS_PADCALIB | 1441 1435 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1442 1436 NVQUIRK_ENABLE_SDR50 | 1443 - NVQUIRK_ENABLE_SDR104, 1437 + NVQUIRK_ENABLE_SDR104 | 1438 + NVQUIRK_HAS_TMCLK, 1444 1439 .min_tap_delay = 106, 1445 1440 .max_tap_delay = 185, 1446 1441 }; ··· 1463 1456 1464 1457 static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { 1465 1458 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 1466 - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 1467 1459 SDHCI_QUIRK_SINGLE_POWER_WRITE | 1468 1460 SDHCI_QUIRK_NO_HISPD_BIT | 1469 1461 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | ··· 1479 1473 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1480 1474 NVQUIRK_ENABLE_SDR50 | 1481 1475 NVQUIRK_ENABLE_SDR104 | 1476 + NVQUIRK_HAS_TMCLK | 1482 1477 NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING, 1483 1478 .min_tap_delay = 84, 1484 1479 .max_tap_delay = 136, ··· 1492 1485 NVQUIRK_HAS_PADCALIB | 1493 1486 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1494 1487 NVQUIRK_ENABLE_SDR50 | 1495 - NVQUIRK_ENABLE_SDR104, 1488 + NVQUIRK_ENABLE_SDR104 | 1489 + NVQUIRK_HAS_TMCLK, 1496 1490 .min_tap_delay = 96, 1497 1491 .max_tap_delay = 139, 1498 1492 }; ··· 1621 1613 goto err_power_req; 1622 1614 } 1623 1615 1616 + /* 1617 + * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host 1618 + * timeout clock and SW can choose TMCLK or SDCLK for hardware 1619 + * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of 1620 + * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL. 1621 + * 1622 + * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses 1623 + * 12Mhz TMCLK which is advertised in host capability register. 1624 + * With TMCLK of 12Mhz provides maximum data timeout period that can 1625 + * be achieved is 11s better than using SDCLK for data timeout. 1626 + * 1627 + * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's 1628 + * supporting separate TMCLK. 1629 + */ 1630 + 1631 + if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) { 1632 + clk = devm_clk_get(&pdev->dev, "tmclk"); 1633 + if (IS_ERR(clk)) { 1634 + rc = PTR_ERR(clk); 1635 + if (rc == -EPROBE_DEFER) 1636 + goto err_power_req; 1637 + 1638 + dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc); 1639 + clk = NULL; 1640 + } 1641 + 1642 + clk_set_rate(clk, 12000000); 1643 + rc = clk_prepare_enable(clk); 1644 + if (rc) { 1645 + dev_err(&pdev->dev, 1646 + "failed to enable tmclk: %d\n", rc); 1647 + goto err_power_req; 1648 + } 1649 + 1650 + tegra_host->tmclk = clk; 1651 + } 1652 + 1624 1653 clk = devm_clk_get(mmc_dev(host->mmc), NULL); 1625 1654 if (IS_ERR(clk)) { 1626 1655 rc = PTR_ERR(clk); ··· 1701 1656 err_rst_get: 1702 1657 clk_disable_unprepare(pltfm_host->clk); 1703 1658 err_clk_get: 1659 + clk_disable_unprepare(tegra_host->tmclk); 1704 1660 err_power_req: 1705 1661 err_parse_dt: 1706 1662 sdhci_pltfm_free(pdev); ··· 1719 1673 reset_control_assert(tegra_host->rst); 1720 1674 usleep_range(2000, 4000); 1721 1675 clk_disable_unprepare(pltfm_host->clk); 1676 + clk_disable_unprepare(tegra_host->tmclk); 1722 1677 1723 1678 sdhci_pltfm_free(pdev); 1724 1679