Lines Matching +full:re +full:- +full:tuning

1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/pinctrl/pinconf-generic.h>
17 #include <linux/dma-mapping.h>
32 #include <linux/mmc/slot-gpio.h>
90 return (void *)c->private; in sdhci_acpi_priv()
95 return c->slot && (c->slot->flags & flag); in sdhci_acpi_flag()
127 return -EOPNOTSUPP; in __intel_dsm()
129 if (obj->type == ACPI_TYPE_INTEGER) { in __intel_dsm()
130 *result = obj->integer.value; in __intel_dsm()
131 } else if (obj->type == ACPI_TYPE_BUFFER && obj->buffer.length > 0) { in __intel_dsm()
132 size_t len = min_t(size_t, obj->buffer.length, 4); in __intel_dsm()
135 memcpy(result, obj->buffer.pointer, len); in __intel_dsm()
137 dev_err(dev, "%s DSM fn %u obj->type %d obj->buffer.length %d\n", in __intel_dsm()
138 __func__, fn, obj->type, obj->buffer.length); in __intel_dsm()
139 err = -EINVAL; in __intel_dsm()
150 if (fn > 31 || !(intel_host->dsm_fns & (1 << fn))) in intel_dsm()
151 return -EOPNOTSUPP; in intel_dsm()
161 intel_host->hs_caps = ~0; in intel_dsm_init()
163 err = __intel_dsm(intel_host, dev, INTEL_DSM_FNS, &intel_host->dsm_fns); in intel_dsm_init()
171 mmc_hostname(mmc), intel_host->dsm_fns); in intel_dsm_init()
173 intel_dsm(intel_host, dev, INTEL_DSM_HS_CAPS, &intel_host->hs_caps); in intel_dsm_init()
190 switch (ios->signal_voltage) { in intel_start_signal_voltage_switch()
315 struct sdhci_host *host = c->host; in intel_probe_slot()
320 host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */ in intel_probe_slot()
323 host->mmc_host_ops.get_cd = bxt_get_cd; in intel_probe_slot()
325 intel_dsm_init(intel_host, &pdev->dev, host->mmc); in intel_probe_slot()
327 host->mmc_host_ops.start_signal_voltage_switch = in intel_probe_slot()
330 c->is_intel = true; in intel_probe_slot()
340 if (!(intel_host->hs_caps & INTEL_DSM_HS_CAPS_SDR25)) in intel_setup_host()
341 c->host->mmc->caps &= ~MMC_CAP_UHS_SDR25; in intel_setup_host()
343 if (!(intel_host->hs_caps & INTEL_DSM_HS_CAPS_SDR50)) in intel_setup_host()
344 c->host->mmc->caps &= ~MMC_CAP_UHS_SDR50; in intel_setup_host()
346 if (!(intel_host->hs_caps & INTEL_DSM_HS_CAPS_DDR50)) in intel_setup_host()
347 c->host->mmc->caps &= ~MMC_CAP_UHS_DDR50; in intel_setup_host()
349 if (!(intel_host->hs_caps & INTEL_DSM_HS_CAPS_SDR104)) in intel_setup_host()
350 c->host->mmc->caps &= ~MMC_CAP_UHS_SDR104; in intel_setup_host()
413 struct sdhci_host *host = c->host; in qcom_probe_slot()
416 *irq = -EINVAL; in qcom_probe_slot()
432 struct device *dev = &pdev->dev; in qcom_free_slot()
434 struct sdhci_host *host = c->host; in qcom_free_slot()
440 return -ENODEV; in qcom_free_slot()
478 struct sdhci_host *host = mmc_priv(card->host); in amd_select_drive_strength()
497 * while HS400 tuning is in progress we end up with mismatched driver in amd_select_drive_strength()
498 * strengths between the controller and the card. HS400 tuning requires in amd_select_drive_strength()
499 * switching from HS400->DDR52->HS->HS200->HS400. So the driver mismatch in amd_select_drive_strength()
524 amd_host->dll_enabled = enable; in sdhci_acpi_amd_hs400_dll()
529 * HS->HS200->Perform Tuning->HS->HS400
531 * The re-tuning sequence is:
532 * HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400
536 * If we have previously performed tuning and switch back to HS200 or
537 * HS400, we can re-enable the tuned clock.
545 unsigned int old_timing = host->timing; in amd_set_ios()
550 if (old_timing != host->timing && amd_host->tuned_clock) { in amd_set_ios()
551 if (host->timing == MMC_TIMING_MMC_HS400 || in amd_set_ios()
552 host->timing == MMC_TIMING_MMC_HS200) { in amd_set_ios()
563 if (host->timing == MMC_TIMING_MMC_HS400 && in amd_set_ios()
564 !amd_host->dll_enabled) in amd_set_ios()
576 amd_host->tuned_clock = false; in amd_sdhci_execute_tuning()
580 if (!err && !host->tuning_err) in amd_sdhci_execute_tuning()
581 amd_host->tuned_clock = true; in amd_sdhci_execute_tuning()
592 amd_host->tuned_clock = false; in amd_sdhci_reset()
614 struct sdhci_host *host = c->host; in sdhci_acpi_emmc_amd_probe_slot()
617 if (host->caps1 & SDHCI_SUPPORT_DDR50) in sdhci_acpi_emmc_amd_probe_slot()
618 host->mmc->caps = MMC_CAP_1_8V_DDR; in sdhci_acpi_emmc_amd_probe_slot()
620 if ((host->caps1 & SDHCI_SUPPORT_SDR104) && in sdhci_acpi_emmc_amd_probe_slot()
621 (host->mmc->caps & MMC_CAP_1_8V_DDR)) in sdhci_acpi_emmc_amd_probe_slot()
622 host->mmc->caps2 = MMC_CAP2_HS400_1_8V; in sdhci_acpi_emmc_amd_probe_slot()
635 * strength of B. As part of initializing HS400, HS200 tuning in sdhci_acpi_emmc_amd_probe_slot()
637 * between tuning and operation is wrong. It results in different in sdhci_acpi_emmc_amd_probe_slot()
647 * 2) sdhci_get_preset_value is using a non-standard register to in sdhci_acpi_emmc_amd_probe_slot()
649 * non-standard register. In fact, it doesn't expose the HS400 in sdhci_acpi_emmc_amd_probe_slot()
659 host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN; in sdhci_acpi_emmc_amd_probe_slot()
661 host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; in sdhci_acpi_emmc_amd_probe_slot()
662 host->mmc_host_ops.set_ios = amd_set_ios; in sdhci_acpi_emmc_amd_probe_slot()
663 host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning; in sdhci_acpi_emmc_amd_probe_slot()
729 * The Acer Aspire Switch 10 (SW5-012) microSD slot always
730 * reports the card being write-protected even though microSD
731 * cards do not have a write-protect switch at all.
735 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
740 /* Asus T100TA, needs pull-up for cd but DSDT GpioInt has NoPull set */
749 * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of
757 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
774 DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
783 * The Toshiba WT8-B's microSD slot always reports the card being
784 * write-protected.
788 DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA ENCORE 2 WT8-B"),
794 * The Toshiba WT10-A's microSD slot always reports the card being
795 * write-protected.
799 DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A"),
810 for (u = sdhci_acpi_uids; u->hid; u++) { in sdhci_acpi_get_slot()
811 if (acpi_dev_hid_uid_match(adev, u->hid, u->uid)) in sdhci_acpi_get_slot()
812 return u->slot; in sdhci_acpi_get_slot()
819 struct device *dev = &pdev->dev; in sdhci_acpi_probe()
833 return -ENODEV; in sdhci_acpi_probe()
837 quirks = (long)id->driver_data; in sdhci_acpi_probe()
845 return -EPROBE_DEFER; in sdhci_acpi_probe()
849 return -ENOMEM; in sdhci_acpi_probe()
855 if (!devm_request_mem_region(dev, iomem->start, len, dev_name(dev))) in sdhci_acpi_probe()
856 return -ENOMEM; in sdhci_acpi_probe()
858 priv_size = slot ? slot->priv_size : 0; in sdhci_acpi_probe()
864 c->host = host; in sdhci_acpi_probe()
865 c->slot = slot; in sdhci_acpi_probe()
866 c->pdev = pdev; in sdhci_acpi_probe()
867 c->use_runtime_pm = sdhci_acpi_flag(c, SDHCI_ACPI_RUNTIME_PM); in sdhci_acpi_probe()
871 host->hw_name = "ACPI"; in sdhci_acpi_probe()
872 host->ops = &sdhci_acpi_ops_dflt; in sdhci_acpi_probe()
873 host->irq = platform_get_irq(pdev, 0); in sdhci_acpi_probe()
874 if (host->irq < 0) { in sdhci_acpi_probe()
875 err = host->irq; in sdhci_acpi_probe()
879 host->ioaddr = devm_ioremap(dev, iomem->start, in sdhci_acpi_probe()
881 if (host->ioaddr == NULL) { in sdhci_acpi_probe()
882 err = -ENOMEM; in sdhci_acpi_probe()
886 if (c->slot) { in sdhci_acpi_probe()
887 if (c->slot->probe_slot) { in sdhci_acpi_probe()
888 err = c->slot->probe_slot(pdev, device); in sdhci_acpi_probe()
892 if (c->slot->chip) { in sdhci_acpi_probe()
893 host->ops = c->slot->chip->ops; in sdhci_acpi_probe()
894 host->quirks |= c->slot->chip->quirks; in sdhci_acpi_probe()
895 host->quirks2 |= c->slot->chip->quirks2; in sdhci_acpi_probe()
896 host->mmc->caps |= c->slot->chip->caps; in sdhci_acpi_probe()
897 host->mmc->caps2 |= c->slot->chip->caps2; in sdhci_acpi_probe()
898 host->mmc->pm_caps |= c->slot->chip->pm_caps; in sdhci_acpi_probe()
900 host->quirks |= c->slot->quirks; in sdhci_acpi_probe()
901 host->quirks2 |= c->slot->quirks2; in sdhci_acpi_probe()
902 host->mmc->caps |= c->slot->caps; in sdhci_acpi_probe()
903 host->mmc->caps2 |= c->slot->caps2; in sdhci_acpi_probe()
904 host->mmc->pm_caps |= c->slot->pm_caps; in sdhci_acpi_probe()
907 host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP; in sdhci_acpi_probe()
913 host->mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; in sdhci_acpi_probe()
915 err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0); in sdhci_acpi_probe()
917 if (err == -EPROBE_DEFER) in sdhci_acpi_probe()
920 c->use_runtime_pm = false; in sdhci_acpi_probe()
922 mmc_gpiod_set_cd_config(host->mmc, in sdhci_acpi_probe()
927 c->reset_signal_volt_on_suspend = true; in sdhci_acpi_probe()
930 host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; in sdhci_acpi_probe()
937 if (c->slot && c->slot->setup_host) { in sdhci_acpi_probe()
938 err = c->slot->setup_host(pdev); in sdhci_acpi_probe()
947 if (c->use_runtime_pm) { in sdhci_acpi_probe()
960 sdhci_cleanup_host(c->host); in sdhci_acpi_probe()
962 if (c->slot && c->slot->free_slot) in sdhci_acpi_probe()
963 c->slot->free_slot(pdev); in sdhci_acpi_probe()
965 sdhci_free_host(c->host); in sdhci_acpi_probe()
972 struct device *dev = &pdev->dev; in sdhci_acpi_remove()
975 if (c->use_runtime_pm) { in sdhci_acpi_remove()
981 if (c->slot && c->slot->remove_slot) in sdhci_acpi_remove()
982 c->slot->remove_slot(pdev); in sdhci_acpi_remove()
984 dead = (sdhci_readl(c->host, SDHCI_INT_STATUS) == ~0); in sdhci_acpi_remove()
985 sdhci_remove_host(c->host, dead); in sdhci_acpi_remove()
987 if (c->slot && c->slot->free_slot) in sdhci_acpi_remove()
988 c->slot->free_slot(pdev); in sdhci_acpi_remove()
990 sdhci_free_host(c->host); in sdhci_acpi_remove()
997 struct sdhci_host *host = c->host; in sdhci_acpi_reset_signal_voltage_if_needed()
999 if (c->is_intel && c->reset_signal_volt_on_suspend && in sdhci_acpi_reset_signal_voltage_if_needed()
1000 host->mmc->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_330) { in sdhci_acpi_reset_signal_voltage_if_needed()
1014 struct sdhci_host *host = c->host; in sdhci_acpi_suspend()
1017 if (host->tuning_mode != SDHCI_TUNING_MODE_3) in sdhci_acpi_suspend()
1018 mmc_retune_needed(host->mmc); in sdhci_acpi_suspend()
1032 sdhci_acpi_byt_setting(&c->pdev->dev); in sdhci_acpi_resume()
1034 return sdhci_resume_host(c->host); in sdhci_acpi_resume()
1044 struct sdhci_host *host = c->host; in sdhci_acpi_runtime_suspend()
1047 if (host->tuning_mode != SDHCI_TUNING_MODE_3) in sdhci_acpi_runtime_suspend()
1048 mmc_retune_needed(host->mmc); in sdhci_acpi_runtime_suspend()
1062 sdhci_acpi_byt_setting(&c->pdev->dev); in sdhci_acpi_runtime_resume()
1064 return sdhci_runtime_resume_host(c->host, 0); in sdhci_acpi_runtime_resume()
1077 .name = "sdhci-acpi",