Lines Matching full:slot

32 #include <linux/mmc/slot-gpio.h>
54 struct sdhci_pci_slot *slot = chip->slots[i]; in sdhci_pci_init_wakeup() local
56 if (slot) { in sdhci_pci_init_wakeup()
57 pm_flags |= slot->host->mmc->pm_flags; in sdhci_pci_init_wakeup()
58 if (slot->host->mmc->caps & MMC_CAP_CD_WAKE) in sdhci_pci_init_wakeup()
78 struct sdhci_pci_slot *slot = chip->slots[i]; in sdhci_pci_suspend_host() local
81 if (!slot) in sdhci_pci_suspend_host()
84 host = slot->host; in sdhci_pci_suspend_host()
107 struct sdhci_pci_slot *slot; in sdhci_pci_resume_host() local
111 slot = chip->slots[i]; in sdhci_pci_resume_host()
112 if (!slot) in sdhci_pci_resume_host()
115 ret = sdhci_resume_host(slot->host); in sdhci_pci_resume_host()
119 mmc_gpio_set_cd_wake(slot->host->mmc, false); in sdhci_pci_resume_host()
151 struct sdhci_pci_slot *slot; in sdhci_pci_runtime_suspend_host() local
156 slot = chip->slots[i]; in sdhci_pci_runtime_suspend_host()
157 if (!slot) in sdhci_pci_runtime_suspend_host()
160 host = slot->host; in sdhci_pci_runtime_suspend_host()
181 struct sdhci_pci_slot *slot; in sdhci_pci_runtime_resume_host() local
185 slot = chip->slots[i]; in sdhci_pci_runtime_resume_host()
186 if (!slot) in sdhci_pci_runtime_resume_host()
189 ret = sdhci_runtime_resume_host(slot->host, 0); in sdhci_pci_runtime_resume_host()
252 static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot) in ricoh_mmc_probe_slot() argument
263 __sdhci_read_caps(slot->host, NULL, &caps, &caps1); in ricoh_mmc_probe_slot()
310 static int ene_714_probe_slot(struct sdhci_pci_slot *slot) in ene_714_probe_slot() argument
312 slot->host->mmc_host_ops.set_ios = ene_714_set_ios; in ene_714_probe_slot()
338 static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot) in mrst_hc_probe_slot() argument
340 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA; in mrst_hc_probe_slot()
358 static int pch_hc_probe_slot(struct sdhci_pci_slot *slot) in pch_hc_probe_slot() argument
360 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA; in pch_hc_probe_slot()
364 static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot) in mfd_emmc_probe_slot() argument
366 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; in mfd_emmc_probe_slot()
367 slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC; in mfd_emmc_probe_slot()
371 static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot) in mfd_sdio_probe_slot() argument
373 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE; in mfd_sdio_probe_slot()
560 struct sdhci_pci_slot *slot = sdhci_priv(host); in intel_select_drive_strength() local
561 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_select_drive_strength()
590 struct sdhci_pci_slot *slot = sdhci_priv(host); in sdhci_intel_set_power() local
591 struct intel_host *intel_host = sdhci_pci_priv(slot); in sdhci_intel_set_power()
659 struct sdhci_pci_slot *slot = sdhci_priv(host); in intel_start_signal_voltage_switch() local
660 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_start_signal_voltage_switch()
708 static void byt_read_dsm(struct sdhci_pci_slot *slot) in byt_read_dsm() argument
710 struct intel_host *intel_host = sdhci_pci_priv(slot); in byt_read_dsm()
711 struct device *dev = &slot->chip->pdev->dev; in byt_read_dsm()
712 struct mmc_host *mmc = slot->host->mmc; in byt_read_dsm()
715 slot->chip->rpm_retune = intel_host->d3_retune; in byt_read_dsm()
745 static void intel_cache_ltr(struct sdhci_pci_slot *slot) in intel_cache_ltr() argument
747 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_cache_ltr()
748 struct sdhci_host *host = slot->host; in intel_cache_ltr()
757 struct sdhci_pci_slot *slot = chip->slots[0]; in intel_ltr_set() local
758 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_ltr_set()
759 struct sdhci_host *host = slot->host; in intel_ltr_set()
795 intel_cache_ltr(slot); in intel_ltr_set()
838 static void byt_probe_slot(struct sdhci_pci_slot *slot) in byt_probe_slot() argument
840 struct mmc_host_ops *ops = &slot->host->mmc_host_ops; in byt_probe_slot()
841 struct device *dev = &slot->chip->pdev->dev; in byt_probe_slot()
842 struct mmc_host *mmc = slot->host->mmc; in byt_probe_slot()
844 byt_read_dsm(slot); in byt_probe_slot()
846 byt_ocp_setting(slot->chip->pdev); in byt_probe_slot()
854 slot->chip->slots[mmc->slotno] = slot; in byt_probe_slot()
855 intel_ltr_expose(slot->chip); in byt_probe_slot()
859 static void byt_add_debugfs(struct sdhci_pci_slot *slot) in byt_add_debugfs() argument
861 struct intel_host *intel_host = sdhci_pci_priv(slot); in byt_add_debugfs()
862 struct mmc_host *mmc = slot->host->mmc; in byt_add_debugfs()
865 if (!intel_use_ltr(slot->chip)) in byt_add_debugfs()
871 intel_cache_ltr(slot); in byt_add_debugfs()
874 static int byt_add_host(struct sdhci_pci_slot *slot) in byt_add_host() argument
876 int ret = sdhci_add_host(slot->host); in byt_add_host()
879 byt_add_debugfs(slot); in byt_add_host()
883 static void byt_remove_slot(struct sdhci_pci_slot *slot, int dead) in byt_remove_slot() argument
885 struct mmc_host *mmc = slot->host->mmc; in byt_remove_slot()
888 intel_ltr_hide(slot->chip); in byt_remove_slot()
891 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) in byt_emmc_probe_slot() argument
893 byt_probe_slot(slot); in byt_emmc_probe_slot()
894 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | in byt_emmc_probe_slot()
898 slot->hw_reset = sdhci_pci_int_hw_reset; in byt_emmc_probe_slot()
899 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC) in byt_emmc_probe_slot()
900 slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */ in byt_emmc_probe_slot()
901 slot->host->mmc_host_ops.select_drive_strength = in byt_emmc_probe_slot()
906 static bool glk_broken_cqhci(struct sdhci_pci_slot *slot) in glk_broken_cqhci() argument
908 return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && in glk_broken_cqhci()
913 static bool jsl_broken_hs400es(struct sdhci_pci_slot *slot) in jsl_broken_hs400es() argument
915 return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_JSL_EMMC && in jsl_broken_hs400es()
919 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot) in glk_emmc_probe_slot() argument
921 int ret = byt_emmc_probe_slot(slot); in glk_emmc_probe_slot()
923 if (!glk_broken_cqhci(slot)) in glk_emmc_probe_slot()
924 slot->host->mmc->caps2 |= MMC_CAP2_CQE; in glk_emmc_probe_slot()
926 if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) { in glk_emmc_probe_slot()
927 if (!jsl_broken_hs400es(slot)) { in glk_emmc_probe_slot()
928 slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES; in glk_emmc_probe_slot()
929 slot->host->mmc_host_ops.hs400_enhanced_strobe = in glk_emmc_probe_slot()
932 slot->host->mmc->caps2 |= MMC_CAP2_CQE_DCMD; in glk_emmc_probe_slot()
944 static int glk_emmc_add_host(struct sdhci_pci_slot *slot) in glk_emmc_add_host() argument
946 struct device *dev = &slot->chip->pdev->dev; in glk_emmc_add_host()
947 struct sdhci_host *host = slot->host; in glk_emmc_add_host()
978 byt_add_debugfs(slot); in glk_emmc_add_host()
995 struct sdhci_pci_slot *slot = chip->slots[0]; in glk_rpm_retune_wa() local
996 struct intel_host *intel_host = sdhci_pci_priv(slot); in glk_rpm_retune_wa()
997 struct sdhci_host *host = slot->host; in glk_rpm_retune_wa()
1059 static int ni_set_max_freq(struct sdhci_pci_slot *slot) in ni_set_max_freq() argument
1064 status = acpi_evaluate_integer(ACPI_HANDLE(&slot->chip->pdev->dev), in ni_set_max_freq()
1067 dev_err(&slot->chip->pdev->dev, in ni_set_max_freq()
1072 slot->host->mmc->f_max = max_freq * 1000000; in ni_set_max_freq()
1077 static inline int ni_set_max_freq(struct sdhci_pci_slot *slot) in ni_set_max_freq() argument
1083 static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot) in ni_byt_sdio_probe_slot() argument
1087 byt_probe_slot(slot); in ni_byt_sdio_probe_slot()
1089 err = ni_set_max_freq(slot); in ni_byt_sdio_probe_slot()
1093 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | in ni_byt_sdio_probe_slot()
1098 static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot) in byt_sdio_probe_slot() argument
1100 byt_probe_slot(slot); in byt_sdio_probe_slot()
1101 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | in byt_sdio_probe_slot()
1106 static void byt_needs_pwr_off(struct sdhci_pci_slot *slot) in byt_needs_pwr_off() argument
1108 struct intel_host *intel_host = sdhci_pci_priv(slot); in byt_needs_pwr_off()
1109 u8 reg = sdhci_readb(slot->host, SDHCI_POWER_CONTROL); in byt_needs_pwr_off()
1114 static int byt_sd_probe_slot(struct sdhci_pci_slot *slot) in byt_sd_probe_slot() argument
1116 byt_probe_slot(slot); in byt_sd_probe_slot()
1117 slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | in byt_sd_probe_slot()
1119 slot->cd_idx = 0; in byt_sd_probe_slot()
1120 slot->cd_override_level = true; in byt_sd_probe_slot()
1121 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD || in byt_sd_probe_slot()
1122 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD || in byt_sd_probe_slot()
1123 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD || in byt_sd_probe_slot()
1124 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_SD) in byt_sd_probe_slot()
1125 slot->host->mmc_host_ops.get_cd = bxt_get_cd; in byt_sd_probe_slot()
1127 if (slot->chip->pdev->subsystem_vendor == PCI_VENDOR_ID_NI && in byt_sd_probe_slot()
1128 slot->chip->pdev->subsystem_device == PCI_SUBDEVICE_ID_NI_78E3) in byt_sd_probe_slot()
1129 slot->host->mmc->caps2 |= MMC_CAP2_AVOID_3_3V; in byt_sd_probe_slot()
1131 byt_needs_pwr_off(slot); in byt_sd_probe_slot()
1266 static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) in intel_mrfld_mmc_fix_up_power_slot() argument
1270 device = ACPI_COMPANION(&slot->chip->pdev->dev); in intel_mrfld_mmc_fix_up_power_slot()
1275 static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {} in intel_mrfld_mmc_fix_up_power_slot() argument
1278 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) in intel_mrfld_mmc_probe_slot() argument
1280 unsigned int func = PCI_FUNC(slot->chip->pdev->devfn); in intel_mrfld_mmc_probe_slot()
1285 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE | in intel_mrfld_mmc_probe_slot()
1290 slot->cd_idx = 0; in intel_mrfld_mmc_probe_slot()
1291 slot->cd_override_level = true; in intel_mrfld_mmc_probe_slot()
1293 * There are two PCB designs of SD card slot with the opposite in intel_mrfld_mmc_probe_slot()
1297 slot->host->mmc_host_ops.get_cd = mrfld_get_cd; in intel_mrfld_mmc_probe_slot()
1298 slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; in intel_mrfld_mmc_probe_slot()
1302 slot->host->ocr_mask = MMC_VDD_20_21 | MMC_VDD_165_195; in intel_mrfld_mmc_probe_slot()
1303 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE | in intel_mrfld_mmc_probe_slot()
1310 intel_mrfld_mmc_fix_up_power_slot(slot); in intel_mrfld_mmc_probe_slot()
1440 static int jmicron_probe_slot(struct sdhci_pci_slot *slot) in jmicron_probe_slot() argument
1442 if (slot->chip->pdev->revision == 0) { in jmicron_probe_slot()
1445 version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION); in jmicron_probe_slot()
1455 slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; in jmicron_probe_slot()
1459 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { in jmicron_probe_slot()
1460 slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 | in jmicron_probe_slot()
1463 slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 | in jmicron_probe_slot()
1471 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || in jmicron_probe_slot()
1472 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) in jmicron_probe_slot()
1473 jmicron_enable_mmc(slot->host, 1); in jmicron_probe_slot()
1475 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST; in jmicron_probe_slot()
1478 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD || in jmicron_probe_slot()
1479 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) in jmicron_probe_slot()
1480 slot->host->mmc_host_ops.get_ro = jmicron_jmb388_get_ro; in jmicron_probe_slot()
1485 static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead) in jmicron_remove_slot() argument
1490 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || in jmicron_remove_slot()
1491 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) in jmicron_remove_slot()
1492 jmicron_enable_mmc(slot->host, 0); in jmicron_remove_slot()
1573 static int syskt_probe_slot(struct sdhci_pci_slot *slot) in syskt_probe_slot() argument
1577 u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV); in syskt_probe_slot()
1578 u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV); in syskt_probe_slot()
1579 dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, " in syskt_probe_slot()
1584 slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA; in syskt_probe_slot()
1586 writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA); in syskt_probe_slot()
1587 writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD); in syskt_probe_slot()
1591 ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS); in syskt_probe_slot()
1597 dev_err(&slot->chip->pdev->dev, in syskt_probe_slot()
1599 writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD); in syskt_probe_slot()
1624 static int rtsx_probe_slot(struct sdhci_pci_slot *slot) in rtsx_probe_slot() argument
1626 slot->host->mmc->caps2 |= MMC_CAP2_HS200; in rtsx_probe_slot()
1688 struct sdhci_pci_slot *slot = sdhci_priv(host); in amd_execute_tuning_hs200() local
1689 struct pci_dev *pdev = slot->chip->pdev; in amd_execute_tuning_hs200()
1737 static int amd_probe_slot(struct sdhci_pci_slot *slot) in amd_probe_slot() argument
1739 struct mmc_host_ops *ops = &slot->host->mmc_host_ops; in amd_probe_slot()
1783 struct sdhci_pci_slot *slot = sdhci_priv(host); in amd_sdhci_reset() local
1784 struct pci_dev *pdev = slot->chip->pdev; in amd_sdhci_reset()
1948 struct sdhci_pci_slot *slot; in sdhci_pci_enable_dma() local
1951 slot = sdhci_priv(host); in sdhci_pci_enable_dma()
1952 pdev = slot->chip->pdev; in sdhci_pci_enable_dma()
1968 struct sdhci_pci_slot *slot = sdhci_priv(host); in sdhci_pci_hw_reset() local
1970 if (slot->hw_reset) in sdhci_pci_hw_reset()
1971 slot->hw_reset(host); in sdhci_pci_hw_reset()
2061 struct sdhci_pci_slot *slot; in sdhci_pci_probe_slot() local
2086 host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size); in sdhci_pci_probe_slot()
2092 slot = sdhci_priv(host); in sdhci_pci_probe_slot()
2094 slot->chip = chip; in sdhci_pci_probe_slot()
2095 slot->host = host; in sdhci_pci_probe_slot()
2096 slot->cd_idx = -1; in sdhci_pci_probe_slot()
2116 ret = chip->fixes->probe_slot(slot); in sdhci_pci_probe_slot()
2131 if (slot->cd_idx >= 0) { in sdhci_pci_probe_slot()
2132 ret = mmc_gpiod_request_cd(host->mmc, "cd", slot->cd_idx, in sdhci_pci_probe_slot()
2133 slot->cd_override_level, 0); in sdhci_pci_probe_slot()
2136 slot->cd_idx, in sdhci_pci_probe_slot()
2137 slot->cd_override_level, in sdhci_pci_probe_slot()
2144 slot->cd_idx = -1; in sdhci_pci_probe_slot()
2149 ret = chip->fixes->add_host(slot); in sdhci_pci_probe_slot()
2159 if (chip->fixes && chip->fixes->own_cd_for_runtime_pm && slot->cd_idx < 0) in sdhci_pci_probe_slot()
2162 return slot; in sdhci_pci_probe_slot()
2166 chip->fixes->remove_slot(slot, 0); in sdhci_pci_probe_slot()
2174 static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot) in sdhci_pci_remove_slot() argument
2180 scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS); in sdhci_pci_remove_slot()
2184 sdhci_remove_host(slot->host, dead); in sdhci_pci_remove_slot()
2186 if (slot->chip->fixes && slot->chip->fixes->remove_slot) in sdhci_pci_remove_slot()
2187 slot->chip->fixes->remove_slot(slot, dead); in sdhci_pci_remove_slot()
2189 sdhci_free_host(slot->host); in sdhci_pci_remove_slot()
2212 struct sdhci_pci_slot *slot; in sdhci_pci_probe() local
2228 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); in sdhci_pci_probe()
2273 slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i); in sdhci_pci_probe()
2274 if (IS_ERR(slot)) { in sdhci_pci_probe()
2277 return PTR_ERR(slot); in sdhci_pci_probe()
2280 chip->slots[i] = slot; in sdhci_pci_probe()