Lines Matching full:slot

29 #include <linux/mmc/slot-gpio.h>
53 struct sdhci_pci_slot *slot = chip->slots[i]; in sdhci_pci_init_wakeup() local
55 if (slot) { in sdhci_pci_init_wakeup()
56 pm_flags |= slot->host->mmc->pm_flags; in sdhci_pci_init_wakeup()
57 if (slot->host->mmc->caps & MMC_CAP_CD_WAKE) in sdhci_pci_init_wakeup()
77 struct sdhci_pci_slot *slot = chip->slots[i]; in sdhci_pci_suspend_host() local
80 if (!slot) in sdhci_pci_suspend_host()
83 host = slot->host; in sdhci_pci_suspend_host()
106 struct sdhci_pci_slot *slot; in sdhci_pci_resume_host() local
110 slot = chip->slots[i]; in sdhci_pci_resume_host()
111 if (!slot) in sdhci_pci_resume_host()
114 ret = sdhci_resume_host(slot->host); in sdhci_pci_resume_host()
118 mmc_gpio_set_cd_wake(slot->host->mmc, false); in sdhci_pci_resume_host()
150 struct sdhci_pci_slot *slot; in sdhci_pci_runtime_suspend_host() local
155 slot = chip->slots[i]; in sdhci_pci_runtime_suspend_host()
156 if (!slot) in sdhci_pci_runtime_suspend_host()
159 host = slot->host; in sdhci_pci_runtime_suspend_host()
180 struct sdhci_pci_slot *slot; in sdhci_pci_runtime_resume_host() local
184 slot = chip->slots[i]; in sdhci_pci_runtime_resume_host()
185 if (!slot) in sdhci_pci_runtime_resume_host()
188 ret = sdhci_runtime_resume_host(slot->host, 0); in sdhci_pci_runtime_resume_host()
259 static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot) in ricoh_mmc_probe_slot() argument
261 slot->host->caps = in ricoh_mmc_probe_slot()
322 static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot) in mrst_hc_probe_slot() argument
324 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA; in mrst_hc_probe_slot()
342 static int pch_hc_probe_slot(struct sdhci_pci_slot *slot) in pch_hc_probe_slot() argument
344 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA; in pch_hc_probe_slot()
352 struct sdhci_pci_slot *slot = dev_id; in sdhci_pci_sd_cd() local
353 struct sdhci_host *host = slot->host; in sdhci_pci_sd_cd()
359 static void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot) in sdhci_pci_add_own_cd() argument
361 int err, irq, gpio = slot->cd_gpio; in sdhci_pci_add_own_cd()
363 slot->cd_gpio = -EINVAL; in sdhci_pci_add_own_cd()
364 slot->cd_irq = -EINVAL; in sdhci_pci_add_own_cd()
369 err = devm_gpio_request(&slot->chip->pdev->dev, gpio, "sd_cd"); in sdhci_pci_add_own_cd()
382 IRQF_TRIGGER_FALLING, "sd_cd", slot); in sdhci_pci_add_own_cd()
386 slot->cd_gpio = gpio; in sdhci_pci_add_own_cd()
387 slot->cd_irq = irq; in sdhci_pci_add_own_cd()
392 devm_gpio_free(&slot->chip->pdev->dev, gpio); in sdhci_pci_add_own_cd()
394 dev_warn(&slot->chip->pdev->dev, "failed to setup card detect wake up\n"); in sdhci_pci_add_own_cd()
397 static void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot) in sdhci_pci_remove_own_cd() argument
399 if (slot->cd_irq >= 0) in sdhci_pci_remove_own_cd()
400 free_irq(slot->cd_irq, slot); in sdhci_pci_remove_own_cd()
405 static inline void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot) in sdhci_pci_add_own_cd() argument
409 static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot) in sdhci_pci_remove_own_cd() argument
415 static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot) in mfd_emmc_probe_slot() argument
417 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; in mfd_emmc_probe_slot()
418 slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC; in mfd_emmc_probe_slot()
422 static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot) in mfd_sdio_probe_slot() argument
424 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE; in mfd_sdio_probe_slot()
609 struct sdhci_pci_slot *slot = sdhci_priv(host); in intel_select_drive_strength() local
610 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_select_drive_strength()
699 struct sdhci_pci_slot *slot = sdhci_priv(host); in intel_start_signal_voltage_switch() local
700 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_start_signal_voltage_switch()
748 static void byt_read_dsm(struct sdhci_pci_slot *slot) in byt_read_dsm() argument
750 struct intel_host *intel_host = sdhci_pci_priv(slot); in byt_read_dsm()
751 struct device *dev = &slot->chip->pdev->dev; in byt_read_dsm()
752 struct mmc_host *mmc = slot->host->mmc; in byt_read_dsm()
755 slot->chip->rpm_retune = intel_host->d3_retune; in byt_read_dsm()
785 static void intel_cache_ltr(struct sdhci_pci_slot *slot) in intel_cache_ltr() argument
787 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_cache_ltr()
788 struct sdhci_host *host = slot->host; in intel_cache_ltr()
797 struct sdhci_pci_slot *slot = chip->slots[0]; in intel_ltr_set() local
798 struct intel_host *intel_host = sdhci_pci_priv(slot); in intel_ltr_set()
799 struct sdhci_host *host = slot->host; in intel_ltr_set()
835 intel_cache_ltr(slot); in intel_ltr_set()
878 static void byt_probe_slot(struct sdhci_pci_slot *slot) in byt_probe_slot() argument
880 struct mmc_host_ops *ops = &slot->host->mmc_host_ops; in byt_probe_slot()
881 struct device *dev = &slot->chip->pdev->dev; in byt_probe_slot()
882 struct mmc_host *mmc = slot->host->mmc; in byt_probe_slot()
884 byt_read_dsm(slot); in byt_probe_slot()
886 byt_ocp_setting(slot->chip->pdev); in byt_probe_slot()
894 slot->chip->slots[mmc->slotno] = slot; in byt_probe_slot()
895 intel_ltr_expose(slot->chip); in byt_probe_slot()
899 static void byt_add_debugfs(struct sdhci_pci_slot *slot) in byt_add_debugfs() argument
901 struct intel_host *intel_host = sdhci_pci_priv(slot); in byt_add_debugfs()
902 struct mmc_host *mmc = slot->host->mmc; in byt_add_debugfs()
905 if (!intel_use_ltr(slot->chip)) in byt_add_debugfs()
911 intel_cache_ltr(slot); in byt_add_debugfs()
914 static int byt_add_host(struct sdhci_pci_slot *slot) in byt_add_host() argument
916 int ret = sdhci_add_host(slot->host); in byt_add_host()
919 byt_add_debugfs(slot); in byt_add_host()
923 static void byt_remove_slot(struct sdhci_pci_slot *slot, int dead) in byt_remove_slot() argument
925 struct mmc_host *mmc = slot->host->mmc; in byt_remove_slot()
928 intel_ltr_hide(slot->chip); in byt_remove_slot()
931 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) in byt_emmc_probe_slot() argument
933 byt_probe_slot(slot); in byt_emmc_probe_slot()
934 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | in byt_emmc_probe_slot()
938 slot->hw_reset = sdhci_pci_int_hw_reset; in byt_emmc_probe_slot()
939 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC) in byt_emmc_probe_slot()
940 slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */ in byt_emmc_probe_slot()
941 slot->host->mmc_host_ops.select_drive_strength = in byt_emmc_probe_slot()
946 static bool glk_broken_cqhci(struct sdhci_pci_slot *slot) in glk_broken_cqhci() argument
948 return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && in glk_broken_cqhci()
953 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot) in glk_emmc_probe_slot() argument
955 int ret = byt_emmc_probe_slot(slot); in glk_emmc_probe_slot()
957 if (!glk_broken_cqhci(slot)) in glk_emmc_probe_slot()
958 slot->host->mmc->caps2 |= MMC_CAP2_CQE; in glk_emmc_probe_slot()
960 if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) { in glk_emmc_probe_slot()
961 slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES, in glk_emmc_probe_slot()
962 slot->host->mmc_host_ops.hs400_enhanced_strobe = in glk_emmc_probe_slot()
964 slot->host->mmc->caps2 |= MMC_CAP2_CQE_DCMD; in glk_emmc_probe_slot()
976 static int glk_emmc_add_host(struct sdhci_pci_slot *slot) in glk_emmc_add_host() argument
978 struct device *dev = &slot->chip->pdev->dev; in glk_emmc_add_host()
979 struct sdhci_host *host = slot->host; in glk_emmc_add_host()
1010 byt_add_debugfs(slot); in glk_emmc_add_host()
1027 struct sdhci_pci_slot *slot = chip->slots[0]; in glk_rpm_retune_wa() local
1028 struct intel_host *intel_host = sdhci_pci_priv(slot); in glk_rpm_retune_wa()
1029 struct sdhci_host *host = slot->host; in glk_rpm_retune_wa()
1091 static int ni_set_max_freq(struct sdhci_pci_slot *slot) in ni_set_max_freq() argument
1096 status = acpi_evaluate_integer(ACPI_HANDLE(&slot->chip->pdev->dev), in ni_set_max_freq()
1099 dev_err(&slot->chip->pdev->dev, in ni_set_max_freq()
1104 slot->host->mmc->f_max = max_freq * 1000000; in ni_set_max_freq()
1109 static inline int ni_set_max_freq(struct sdhci_pci_slot *slot) in ni_set_max_freq() argument
1115 static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot) in ni_byt_sdio_probe_slot() argument
1119 byt_probe_slot(slot); in ni_byt_sdio_probe_slot()
1121 err = ni_set_max_freq(slot); in ni_byt_sdio_probe_slot()
1125 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | in ni_byt_sdio_probe_slot()
1130 static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot) in byt_sdio_probe_slot() argument
1132 byt_probe_slot(slot); in byt_sdio_probe_slot()
1133 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE | in byt_sdio_probe_slot()
1138 static int byt_sd_probe_slot(struct sdhci_pci_slot *slot) in byt_sd_probe_slot() argument
1140 byt_probe_slot(slot); in byt_sd_probe_slot()
1141 slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | in byt_sd_probe_slot()
1143 slot->cd_idx = 0; in byt_sd_probe_slot()
1144 slot->cd_override_level = true; in byt_sd_probe_slot()
1145 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD || in byt_sd_probe_slot()
1146 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD || in byt_sd_probe_slot()
1147 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD || in byt_sd_probe_slot()
1148 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_SD) in byt_sd_probe_slot()
1149 slot->host->mmc_host_ops.get_cd = bxt_get_cd; in byt_sd_probe_slot()
1151 if (slot->chip->pdev->subsystem_vendor == PCI_VENDOR_ID_NI && in byt_sd_probe_slot()
1152 slot->chip->pdev->subsystem_device == PCI_SUBDEVICE_ID_NI_78E3) in byt_sd_probe_slot()
1153 slot->host->mmc->caps2 |= MMC_CAP2_AVOID_3_3V; in byt_sd_probe_slot()
1288 static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) in intel_mrfld_mmc_fix_up_power_slot() argument
1292 device = ACPI_COMPANION(&slot->chip->pdev->dev); in intel_mrfld_mmc_fix_up_power_slot()
1302 static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {} in intel_mrfld_mmc_fix_up_power_slot() argument
1305 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot) in intel_mrfld_mmc_probe_slot() argument
1307 unsigned int func = PCI_FUNC(slot->chip->pdev->devfn); in intel_mrfld_mmc_probe_slot()
1312 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE | in intel_mrfld_mmc_probe_slot()
1317 slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; in intel_mrfld_mmc_probe_slot()
1321 slot->host->ocr_mask = MMC_VDD_20_21 | MMC_VDD_165_195; in intel_mrfld_mmc_probe_slot()
1322 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE | in intel_mrfld_mmc_probe_slot()
1329 intel_mrfld_mmc_fix_up_power_slot(slot); in intel_mrfld_mmc_probe_slot()
1444 static int jmicron_probe_slot(struct sdhci_pci_slot *slot) in jmicron_probe_slot() argument
1446 if (slot->chip->pdev->revision == 0) { in jmicron_probe_slot()
1449 version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION); in jmicron_probe_slot()
1459 slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; in jmicron_probe_slot()
1463 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) { in jmicron_probe_slot()
1464 slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 | in jmicron_probe_slot()
1467 slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 | in jmicron_probe_slot()
1475 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || in jmicron_probe_slot()
1476 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) in jmicron_probe_slot()
1477 jmicron_enable_mmc(slot->host, 1); in jmicron_probe_slot()
1479 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST; in jmicron_probe_slot()
1484 static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead) in jmicron_remove_slot() argument
1489 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC || in jmicron_remove_slot()
1490 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) in jmicron_remove_slot()
1491 jmicron_enable_mmc(slot->host, 0); in jmicron_remove_slot()
1572 static int syskt_probe_slot(struct sdhci_pci_slot *slot) in syskt_probe_slot() argument
1576 u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV); in syskt_probe_slot()
1577 u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV); in syskt_probe_slot()
1578 dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, " in syskt_probe_slot()
1583 slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA; in syskt_probe_slot()
1585 writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA); in syskt_probe_slot()
1586 writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD); in syskt_probe_slot()
1590 ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS); in syskt_probe_slot()
1596 dev_err(&slot->chip->pdev->dev, in syskt_probe_slot()
1598 writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD); in syskt_probe_slot()
1623 static int rtsx_probe_slot(struct sdhci_pci_slot *slot) in rtsx_probe_slot() argument
1625 slot->host->mmc->caps2 |= MMC_CAP2_HS200; in rtsx_probe_slot()
1687 struct sdhci_pci_slot *slot = sdhci_priv(host); in amd_execute_tuning_hs200() local
1688 struct pci_dev *pdev = slot->chip->pdev; in amd_execute_tuning_hs200()
1736 static int amd_probe_slot(struct sdhci_pci_slot *slot) in amd_probe_slot() argument
1738 struct mmc_host_ops *ops = &slot->host->mmc_host_ops; in amd_probe_slot()
1780 struct sdhci_pci_slot *slot = sdhci_priv(host); in amd_sdhci_reset() local
1781 struct pci_dev *pdev = slot->chip->pdev; in amd_sdhci_reset()
1937 struct sdhci_pci_slot *slot; in sdhci_pci_enable_dma() local
1940 slot = sdhci_priv(host); in sdhci_pci_enable_dma()
1941 pdev = slot->chip->pdev; in sdhci_pci_enable_dma()
1957 struct sdhci_pci_slot *slot = sdhci_priv(host); in sdhci_pci_gpio_hw_reset() local
1958 int rst_n_gpio = slot->rst_n_gpio; in sdhci_pci_gpio_hw_reset()
1972 struct sdhci_pci_slot *slot = sdhci_priv(host); in sdhci_pci_hw_reset() local
1974 if (slot->hw_reset) in sdhci_pci_hw_reset()
1975 slot->hw_reset(host); in sdhci_pci_hw_reset()
2065 struct sdhci_pci_slot *slot; in sdhci_pci_probe_slot() local
2090 host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size); in sdhci_pci_probe_slot()
2096 slot = sdhci_priv(host); in sdhci_pci_probe_slot()
2098 slot->chip = chip; in sdhci_pci_probe_slot()
2099 slot->host = host; in sdhci_pci_probe_slot()
2100 slot->rst_n_gpio = -EINVAL; in sdhci_pci_probe_slot()
2101 slot->cd_gpio = -EINVAL; in sdhci_pci_probe_slot()
2102 slot->cd_idx = -1; in sdhci_pci_probe_slot()
2106 slot->data = sdhci_pci_get_data(pdev, slotno); in sdhci_pci_probe_slot()
2108 if (slot->data) { in sdhci_pci_probe_slot()
2109 if (slot->data->setup) { in sdhci_pci_probe_slot()
2110 ret = slot->data->setup(slot->data); in sdhci_pci_probe_slot()
2116 slot->rst_n_gpio = slot->data->rst_n_gpio; in sdhci_pci_probe_slot()
2117 slot->cd_gpio = slot->data->cd_gpio; in sdhci_pci_probe_slot()
2138 ret = chip->fixes->probe_slot(slot); in sdhci_pci_probe_slot()
2143 if (gpio_is_valid(slot->rst_n_gpio)) { in sdhci_pci_probe_slot()
2144 if (!devm_gpio_request(&pdev->dev, slot->rst_n_gpio, "eMMC_reset")) { in sdhci_pci_probe_slot()
2145 gpio_direction_output(slot->rst_n_gpio, 1); in sdhci_pci_probe_slot()
2146 slot->host->mmc->caps |= MMC_CAP_HW_RESET; in sdhci_pci_probe_slot()
2147 slot->hw_reset = sdhci_pci_gpio_hw_reset; in sdhci_pci_probe_slot()
2150 slot->rst_n_gpio = -EINVAL; in sdhci_pci_probe_slot()
2164 if (slot->cd_idx >= 0) { in sdhci_pci_probe_slot()
2165 ret = mmc_gpiod_request_cd(host->mmc, "cd", slot->cd_idx, in sdhci_pci_probe_slot()
2166 slot->cd_override_level, 0); in sdhci_pci_probe_slot()
2169 slot->cd_idx, in sdhci_pci_probe_slot()
2170 slot->cd_override_level, in sdhci_pci_probe_slot()
2177 slot->cd_idx = -1; in sdhci_pci_probe_slot()
2182 ret = chip->fixes->add_host(slot); in sdhci_pci_probe_slot()
2188 sdhci_pci_add_own_cd(slot); in sdhci_pci_probe_slot()
2193 * Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure. in sdhci_pci_probe_slot()
2196 !gpio_is_valid(slot->cd_gpio) && slot->cd_idx < 0) in sdhci_pci_probe_slot()
2199 return slot; in sdhci_pci_probe_slot()
2203 chip->fixes->remove_slot(slot, 0); in sdhci_pci_probe_slot()
2206 if (slot->data && slot->data->cleanup) in sdhci_pci_probe_slot()
2207 slot->data->cleanup(slot->data); in sdhci_pci_probe_slot()
2215 static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot) in sdhci_pci_remove_slot() argument
2220 sdhci_pci_remove_own_cd(slot); in sdhci_pci_remove_slot()
2223 scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS); in sdhci_pci_remove_slot()
2227 sdhci_remove_host(slot->host, dead); in sdhci_pci_remove_slot()
2229 if (slot->chip->fixes && slot->chip->fixes->remove_slot) in sdhci_pci_remove_slot()
2230 slot->chip->fixes->remove_slot(slot, dead); in sdhci_pci_remove_slot()
2232 if (slot->data && slot->data->cleanup) in sdhci_pci_remove_slot()
2233 slot->data->cleanup(slot->data); in sdhci_pci_remove_slot()
2235 sdhci_free_host(slot->host); in sdhci_pci_remove_slot()
2258 struct sdhci_pci_slot *slot; in sdhci_pci_probe() local
2274 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); in sdhci_pci_probe()
2319 slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i); in sdhci_pci_probe()
2320 if (IS_ERR(slot)) { in sdhci_pci_probe()
2323 return PTR_ERR(slot); in sdhci_pci_probe()
2326 chip->slots[i] = slot; in sdhci_pci_probe()