1 /* linux/drivers/mmc/host/sdhci-pci.c - SDHCI on PCI bus interface
3 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
10 * Thanks to the following companies for their support:
12 * - JMicron (hardware and technical support)
15 #include <linux/string.h>
16 #include <linux/delay.h>
17 #include <linux/highmem.h>
18 #include <linux/module.h>
19 #include <linux/pci.h>
20 #include <linux/dma-mapping.h>
21 #include <linux/slab.h>
22 #include <linux/device.h>
23 #include <linux/mmc/host.h>
24 #include <linux/mmc/mmc.h>
25 #include <linux/scatterlist.h>
27 #include <linux/gpio.h>
28 #include <linux/pm_runtime.h>
29 #include <linux/mmc/slot-gpio.h>
30 #include <linux/mmc/sdhci-pci-data.h>
31 #include <linux/acpi.h>
34 #include "sdhci-pci.h"
35 #include "sdhci-pci-o2micro.h"
37 static int sdhci_pci_enable_dma(struct sdhci_host *host);
38 static void sdhci_pci_set_bus_width(struct sdhci_host *host, int width);
39 static void sdhci_pci_hw_reset(struct sdhci_host *host);
41 #ifdef CONFIG_PM_SLEEP
42 static int __sdhci_pci_suspend_host(struct sdhci_pci_chip *chip)
46 for (i = 0; i < chip->num_slots; i++) {
47 struct sdhci_pci_slot *slot = chip->slots[i];
48 struct sdhci_host *host;
55 if (chip->pm_retune && host->tuning_mode != SDHCI_TUNING_MODE_3)
56 mmc_retune_needed(host->mmc);
58 ret = sdhci_suspend_host(host);
62 if (host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ)
63 sdhci_enable_irq_wakeups(host);
70 sdhci_resume_host(chip->slots[i]->host);
74 static int sdhci_pci_init_wakeup(struct sdhci_pci_chip *chip)
76 mmc_pm_flag_t pm_flags = 0;
79 for (i = 0; i < chip->num_slots; i++) {
80 struct sdhci_pci_slot *slot = chip->slots[i];
83 pm_flags |= slot->host->mmc->pm_flags;
86 return device_init_wakeup(&chip->pdev->dev,
87 (pm_flags & MMC_PM_KEEP_POWER) &&
88 (pm_flags & MMC_PM_WAKE_SDIO_IRQ));
91 static int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip)
95 ret = __sdhci_pci_suspend_host(chip);
99 sdhci_pci_init_wakeup(chip);
104 int sdhci_pci_resume_host(struct sdhci_pci_chip *chip)
106 struct sdhci_pci_slot *slot;
109 for (i = 0; i < chip->num_slots; i++) {
110 slot = chip->slots[i];
114 ret = sdhci_resume_host(slot->host);
124 static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip)
126 struct sdhci_pci_slot *slot;
127 struct sdhci_host *host;
130 for (i = 0; i < chip->num_slots; i++) {
131 slot = chip->slots[i];
137 ret = sdhci_runtime_suspend_host(host);
139 goto err_pci_runtime_suspend;
141 if (chip->rpm_retune &&
142 host->tuning_mode != SDHCI_TUNING_MODE_3)
143 mmc_retune_needed(host->mmc);
148 err_pci_runtime_suspend:
150 sdhci_runtime_resume_host(chip->slots[i]->host);
154 static int sdhci_pci_runtime_resume_host(struct sdhci_pci_chip *chip)
156 struct sdhci_pci_slot *slot;
159 for (i = 0; i < chip->num_slots; i++) {
160 slot = chip->slots[i];
164 ret = sdhci_runtime_resume_host(slot->host);
173 /*****************************************************************************\
175 * Hardware specific quirk handling *
177 \*****************************************************************************/
179 static int ricoh_probe(struct sdhci_pci_chip *chip)
181 if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
182 chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
183 chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
187 static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
190 ((0x21 << SDHCI_TIMEOUT_CLK_SHIFT)
191 & SDHCI_TIMEOUT_CLK_MASK) |
193 ((0x21 << SDHCI_CLOCK_BASE_SHIFT)
194 & SDHCI_CLOCK_BASE_MASK) |
196 SDHCI_TIMEOUT_CLK_UNIT |
203 #ifdef CONFIG_PM_SLEEP
204 static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)
206 /* Apply a delay to allow controller to settle */
207 /* Otherwise it becomes confused if card state changed
210 return sdhci_pci_resume_host(chip);
214 static const struct sdhci_pci_fixes sdhci_ricoh = {
215 .probe = ricoh_probe,
216 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
217 SDHCI_QUIRK_FORCE_DMA |
218 SDHCI_QUIRK_CLOCK_BEFORE_RESET,
221 static const struct sdhci_pci_fixes sdhci_ricoh_mmc = {
222 .probe_slot = ricoh_mmc_probe_slot,
223 #ifdef CONFIG_PM_SLEEP
224 .resume = ricoh_mmc_resume,
226 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
227 SDHCI_QUIRK_CLOCK_BEFORE_RESET |
228 SDHCI_QUIRK_NO_CARD_NO_RESET |
229 SDHCI_QUIRK_MISSING_CAPS
232 static const struct sdhci_pci_fixes sdhci_ene_712 = {
233 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
234 SDHCI_QUIRK_BROKEN_DMA,
237 static const struct sdhci_pci_fixes sdhci_ene_714 = {
238 .quirks = SDHCI_QUIRK_SINGLE_POWER_WRITE |
239 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS |
240 SDHCI_QUIRK_BROKEN_DMA,
243 static const struct sdhci_pci_fixes sdhci_cafe = {
244 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
245 SDHCI_QUIRK_NO_BUSY_IRQ |
246 SDHCI_QUIRK_BROKEN_CARD_DETECTION |
247 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
250 static const struct sdhci_pci_fixes sdhci_intel_qrk = {
251 .quirks = SDHCI_QUIRK_NO_HISPD_BIT,
254 static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
256 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
261 * ADMA operation is disabled for Moorestown platform due to
264 static int mrst_hc_probe(struct sdhci_pci_chip *chip)
267 * slots number is fixed here for MRST as SDIO3/5 are never used and
268 * have hardware bugs.
274 static int pch_hc_probe_slot(struct sdhci_pci_slot *slot)
276 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
282 static irqreturn_t sdhci_pci_sd_cd(int irq, void *dev_id)
284 struct sdhci_pci_slot *slot = dev_id;
285 struct sdhci_host *host = slot->host;
287 mmc_detect_change(host->mmc, msecs_to_jiffies(200));
291 static void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
293 int err, irq, gpio = slot->cd_gpio;
295 slot->cd_gpio = -EINVAL;
296 slot->cd_irq = -EINVAL;
298 if (!gpio_is_valid(gpio))
301 err = devm_gpio_request(&slot->chip->pdev->dev, gpio, "sd_cd");
305 err = gpio_direction_input(gpio);
309 irq = gpio_to_irq(gpio);
313 err = request_irq(irq, sdhci_pci_sd_cd, IRQF_TRIGGER_RISING |
314 IRQF_TRIGGER_FALLING, "sd_cd", slot);
318 slot->cd_gpio = gpio;
324 devm_gpio_free(&slot->chip->pdev->dev, gpio);
326 dev_warn(&slot->chip->pdev->dev, "failed to setup card detect wake up\n");
329 static void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
331 if (slot->cd_irq >= 0)
332 free_irq(slot->cd_irq, slot);
337 static inline void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
341 static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
347 static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
349 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
350 slot->host->mmc->caps2 |= MMC_CAP2_BOOTPART_NOACC |
351 MMC_CAP2_HC_ERASE_SZ;
355 static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot)
357 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE;
361 static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
362 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
363 .probe_slot = mrst_hc_probe_slot,
366 static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
367 .quirks = SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
368 .probe = mrst_hc_probe,
371 static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
372 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
373 .allow_runtime_pm = true,
374 .own_cd_for_runtime_pm = true,
377 static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
378 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
379 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
380 .allow_runtime_pm = true,
381 .probe_slot = mfd_sdio_probe_slot,
384 static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
385 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
386 .allow_runtime_pm = true,
387 .probe_slot = mfd_emmc_probe_slot,
390 static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = {
391 .quirks = SDHCI_QUIRK_BROKEN_ADMA,
392 .probe_slot = pch_hc_probe_slot,
397 INTEL_DSM_DRV_STRENGTH = 9,
398 INTEL_DSM_D3_RETUNE = 10,
407 const u8 intel_dsm_uuid[] = {
408 0xA5, 0x3E, 0xC1, 0xF6, 0xCD, 0x65, 0x1F, 0x46,
409 0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61,
412 static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
413 unsigned int fn, u32 *result)
415 union acpi_object *obj;
419 obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), intel_dsm_uuid, 0, fn, NULL);
423 if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < 1) {
428 len = min_t(size_t, obj->buffer.length, 4);
431 memcpy(result, obj->buffer.pointer, len);
438 static int intel_dsm(struct intel_host *intel_host, struct device *dev,
439 unsigned int fn, u32 *result)
441 if (fn > 31 || !(intel_host->dsm_fns & (1 << fn)))
444 return __intel_dsm(intel_host, dev, fn, result);
447 static void intel_dsm_init(struct intel_host *intel_host, struct device *dev,
448 struct mmc_host *mmc)
453 err = __intel_dsm(intel_host, dev, INTEL_DSM_FNS, &intel_host->dsm_fns);
455 pr_debug("%s: DSM not supported, error %d\n",
456 mmc_hostname(mmc), err);
460 pr_debug("%s: DSM function mask %#x\n",
461 mmc_hostname(mmc), intel_host->dsm_fns);
463 err = intel_dsm(intel_host, dev, INTEL_DSM_DRV_STRENGTH, &val);
464 intel_host->drv_strength = err ? 0 : val;
466 err = intel_dsm(intel_host, dev, INTEL_DSM_D3_RETUNE, &val);
467 intel_host->d3_retune = err ? true : !!val;
470 static void sdhci_pci_int_hw_reset(struct sdhci_host *host)
474 reg = sdhci_readb(host, SDHCI_POWER_CONTROL);
476 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
477 /* For eMMC, minimum is 1us but give it 9us for good measure */
480 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
481 /* For eMMC, minimum is 200us but give it 300us for good measure */
482 usleep_range(300, 1000);
485 static int intel_select_drive_strength(struct mmc_card *card,
486 unsigned int max_dtr, int host_drv,
487 int card_drv, int *drv_type)
489 struct sdhci_host *host = mmc_priv(card->host);
490 struct sdhci_pci_slot *slot = sdhci_priv(host);
491 struct intel_host *intel_host = sdhci_pci_priv(slot);
493 return intel_host->drv_strength;
496 static int bxt_get_cd(struct mmc_host *mmc)
498 int gpio_cd = mmc_gpio_get_cd(mmc);
499 struct sdhci_host *host = mmc_priv(mmc);
506 spin_lock_irqsave(&host->lock, flags);
508 if (host->flags & SDHCI_DEVICE_DEAD)
511 ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT);
513 spin_unlock_irqrestore(&host->lock, flags);
518 #define SDHCI_INTEL_PWR_TIMEOUT_CNT 20
519 #define SDHCI_INTEL_PWR_TIMEOUT_UDELAY 100
521 static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
527 sdhci_set_power(host, mode, vdd);
529 if (mode == MMC_POWER_OFF)
533 * Bus power might not enable after D3 -> D0 transition due to the
534 * present state not yet having propagated. Retry for up to 2ms.
536 for (cntr = 0; cntr < SDHCI_INTEL_PWR_TIMEOUT_CNT; cntr++) {
537 reg = sdhci_readb(host, SDHCI_POWER_CONTROL);
538 if (reg & SDHCI_POWER_ON)
540 udelay(SDHCI_INTEL_PWR_TIMEOUT_UDELAY);
541 reg |= SDHCI_POWER_ON;
542 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
546 static const struct sdhci_ops sdhci_intel_byt_ops = {
547 .set_clock = sdhci_set_clock,
548 .set_power = sdhci_intel_set_power,
549 .enable_dma = sdhci_pci_enable_dma,
550 .set_bus_width = sdhci_pci_set_bus_width,
551 .reset = sdhci_reset,
552 .set_uhs_signaling = sdhci_set_uhs_signaling,
553 .hw_reset = sdhci_pci_hw_reset,
556 static void byt_read_dsm(struct sdhci_pci_slot *slot)
558 struct intel_host *intel_host = sdhci_pci_priv(slot);
559 struct device *dev = &slot->chip->pdev->dev;
560 struct mmc_host *mmc = slot->host->mmc;
562 intel_dsm_init(intel_host, dev, mmc);
563 slot->chip->rpm_retune = intel_host->d3_retune;
566 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
569 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
570 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
571 MMC_CAP_CMD_DURING_TFR |
572 MMC_CAP_WAIT_WHILE_BUSY;
573 slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
574 slot->hw_reset = sdhci_pci_int_hw_reset;
575 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BSW_EMMC)
576 slot->host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
577 slot->host->mmc_host_ops.select_drive_strength =
578 intel_select_drive_strength;
583 static int ni_set_max_freq(struct sdhci_pci_slot *slot)
586 unsigned long long max_freq;
588 status = acpi_evaluate_integer(ACPI_HANDLE(&slot->chip->pdev->dev),
589 "MXFQ", NULL, &max_freq);
590 if (ACPI_FAILURE(status)) {
591 dev_err(&slot->chip->pdev->dev,
592 "MXFQ not found in acpi table\n");
596 slot->host->mmc->f_max = max_freq * 1000000;
601 static inline int ni_set_max_freq(struct sdhci_pci_slot *slot)
607 static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
613 err = ni_set_max_freq(slot);
617 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE |
618 MMC_CAP_WAIT_WHILE_BUSY;
622 static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
625 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE |
626 MMC_CAP_WAIT_WHILE_BUSY;
630 static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
633 slot->host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY |
634 MMC_CAP_AGGRESSIVE_PM;
636 slot->cd_override_level = true;
637 if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD ||
638 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD ||
639 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD ||
640 slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_SD)
641 slot->host->mmc_host_ops.get_cd = bxt_get_cd;
646 static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
647 .allow_runtime_pm = true,
648 .probe_slot = byt_emmc_probe_slot,
649 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
650 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
651 SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 |
652 SDHCI_QUIRK2_STOP_WITH_TC,
653 .ops = &sdhci_intel_byt_ops,
654 .priv_size = sizeof(struct intel_host),
657 static const struct sdhci_pci_fixes sdhci_ni_byt_sdio = {
658 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
659 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON |
660 SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
661 .allow_runtime_pm = true,
662 .probe_slot = ni_byt_sdio_probe_slot,
663 .ops = &sdhci_intel_byt_ops,
664 .priv_size = sizeof(struct intel_host),
667 static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
668 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
669 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON |
670 SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
671 .allow_runtime_pm = true,
672 .probe_slot = byt_sdio_probe_slot,
673 .ops = &sdhci_intel_byt_ops,
674 .priv_size = sizeof(struct intel_host),
677 static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
678 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
679 .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
680 SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
681 SDHCI_QUIRK2_STOP_WITH_TC,
682 .allow_runtime_pm = true,
683 .own_cd_for_runtime_pm = true,
684 .probe_slot = byt_sd_probe_slot,
685 .ops = &sdhci_intel_byt_ops,
686 .priv_size = sizeof(struct intel_host),
689 /* Define Host controllers for Intel Merrifield platform */
690 #define INTEL_MRFLD_EMMC_0 0
691 #define INTEL_MRFLD_EMMC_1 1
692 #define INTEL_MRFLD_SD 2
693 #define INTEL_MRFLD_SDIO 3
695 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
697 unsigned int func = PCI_FUNC(slot->chip->pdev->devfn);
700 case INTEL_MRFLD_EMMC_0:
701 case INTEL_MRFLD_EMMC_1:
702 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
707 slot->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
709 case INTEL_MRFLD_SDIO:
710 slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
711 MMC_CAP_POWER_OFF_CARD;
719 static const struct sdhci_pci_fixes sdhci_intel_mrfld_mmc = {
720 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
721 .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 |
722 SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
723 .allow_runtime_pm = true,
724 .probe_slot = intel_mrfld_mmc_probe_slot,
727 /* O2Micro extra registers */
728 #define O2_SD_LOCK_WP 0xD3
729 #define O2_SD_MULTI_VCC3V 0xEE
730 #define O2_SD_CLKREQ 0xEC
731 #define O2_SD_CAPS 0xE0
732 #define O2_SD_ADMA1 0xE2
733 #define O2_SD_ADMA2 0xE7
734 #define O2_SD_INF_MOD 0xF1
736 static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
741 ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch);
746 * Turn PMOS on [bit 0], set over current detection to 2.4 V
747 * [bit 1:2] and enable over current debouncing [bit 6].
754 return pci_write_config_byte(chip->pdev, 0xAE, scratch);
757 static int jmicron_probe(struct sdhci_pci_chip *chip)
762 if (chip->pdev->revision == 0) {
763 chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
764 SDHCI_QUIRK_32BIT_DMA_SIZE |
765 SDHCI_QUIRK_32BIT_ADMA_SIZE |
766 SDHCI_QUIRK_RESET_AFTER_REQUEST |
767 SDHCI_QUIRK_BROKEN_SMALL_PIO;
771 * JMicron chips can have two interfaces to the same hardware
772 * in order to work around limitations in Microsoft's driver.
773 * We need to make sure we only bind to one of them.
775 * This code assumes two things:
777 * 1. The PCI code adds subfunctions in order.
779 * 2. The MMC interface has a lower subfunction number
780 * than the SD interface.
782 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_SD)
783 mmcdev = PCI_DEVICE_ID_JMICRON_JMB38X_MMC;
784 else if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD)
785 mmcdev = PCI_DEVICE_ID_JMICRON_JMB388_ESD;
788 struct pci_dev *sd_dev;
791 while ((sd_dev = pci_get_device(PCI_VENDOR_ID_JMICRON,
792 mmcdev, sd_dev)) != NULL) {
793 if ((PCI_SLOT(chip->pdev->devfn) ==
794 PCI_SLOT(sd_dev->devfn)) &&
795 (chip->pdev->bus == sd_dev->bus))
801 dev_info(&chip->pdev->dev, "Refusing to bind to "
802 "secondary interface.\n");
808 * JMicron chips need a bit of a nudge to enable the power
811 ret = jmicron_pmos(chip, 1);
813 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
817 /* quirk for unsable RO-detection on JM388 chips */
818 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_SD ||
819 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
820 chip->quirks |= SDHCI_QUIRK_UNSTABLE_RO_DETECT;
825 static void jmicron_enable_mmc(struct sdhci_host *host, int on)
829 scratch = readb(host->ioaddr + 0xC0);
836 writeb(scratch, host->ioaddr + 0xC0);
839 static int jmicron_probe_slot(struct sdhci_pci_slot *slot)
841 if (slot->chip->pdev->revision == 0) {
844 version = readl(slot->host->ioaddr + SDHCI_HOST_VERSION);
845 version = (version & SDHCI_VENDOR_VER_MASK) >>
846 SDHCI_VENDOR_VER_SHIFT;
849 * Older versions of the chip have lots of nasty glitches
850 * in the ADMA engine. It's best just to avoid it
854 slot->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
857 /* JM388 MMC doesn't support 1.8V while SD supports it */
858 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
859 slot->host->ocr_avail_sd = MMC_VDD_32_33 | MMC_VDD_33_34 |
860 MMC_VDD_29_30 | MMC_VDD_30_31 |
861 MMC_VDD_165_195; /* allow 1.8V */
862 slot->host->ocr_avail_mmc = MMC_VDD_32_33 | MMC_VDD_33_34 |
863 MMC_VDD_29_30 | MMC_VDD_30_31; /* no 1.8V for MMC */
867 * The secondary interface requires a bit set to get the
870 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
871 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
872 jmicron_enable_mmc(slot->host, 1);
874 slot->host->mmc->caps |= MMC_CAP_BUS_WIDTH_TEST;
879 static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)
884 if (slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
885 slot->chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD)
886 jmicron_enable_mmc(slot->host, 0);
889 #ifdef CONFIG_PM_SLEEP
890 static int jmicron_suspend(struct sdhci_pci_chip *chip)
894 ret = __sdhci_pci_suspend_host(chip);
898 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
899 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
900 for (i = 0; i < chip->num_slots; i++)
901 jmicron_enable_mmc(chip->slots[i]->host, 0);
904 sdhci_pci_init_wakeup(chip);
909 static int jmicron_resume(struct sdhci_pci_chip *chip)
913 if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
914 chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
915 for (i = 0; i < chip->num_slots; i++)
916 jmicron_enable_mmc(chip->slots[i]->host, 1);
919 ret = jmicron_pmos(chip, 1);
921 dev_err(&chip->pdev->dev, "Failure enabling card power\n");
925 return sdhci_pci_resume_host(chip);
929 static const struct sdhci_pci_fixes sdhci_o2 = {
930 .probe = sdhci_pci_o2_probe,
931 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
932 .quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD,
933 .probe_slot = sdhci_pci_o2_probe_slot,
934 #ifdef CONFIG_PM_SLEEP
935 .resume = sdhci_pci_o2_resume,
939 static const struct sdhci_pci_fixes sdhci_jmicron = {
940 .probe = jmicron_probe,
942 .probe_slot = jmicron_probe_slot,
943 .remove_slot = jmicron_remove_slot,
945 #ifdef CONFIG_PM_SLEEP
946 .suspend = jmicron_suspend,
947 .resume = jmicron_resume,
951 /* SysKonnect CardBus2SDIO extra registers */
952 #define SYSKT_CTRL 0x200
953 #define SYSKT_RDFIFO_STAT 0x204
954 #define SYSKT_WRFIFO_STAT 0x208
955 #define SYSKT_POWER_DATA 0x20c
956 #define SYSKT_POWER_330 0xef
957 #define SYSKT_POWER_300 0xf8
958 #define SYSKT_POWER_184 0xcc
959 #define SYSKT_POWER_CMD 0x20d
960 #define SYSKT_POWER_START (1 << 7)
961 #define SYSKT_POWER_STATUS 0x20e
962 #define SYSKT_POWER_STATUS_OK (1 << 0)
963 #define SYSKT_BOARD_REV 0x210
964 #define SYSKT_CHIP_REV 0x211
965 #define SYSKT_CONF_DATA 0x212
966 #define SYSKT_CONF_DATA_1V8 (1 << 2)
967 #define SYSKT_CONF_DATA_2V5 (1 << 1)
968 #define SYSKT_CONF_DATA_3V3 (1 << 0)
970 static int syskt_probe(struct sdhci_pci_chip *chip)
972 if ((chip->pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
973 chip->pdev->class &= ~0x0000FF;
974 chip->pdev->class |= PCI_SDHCI_IFDMA;
979 static int syskt_probe_slot(struct sdhci_pci_slot *slot)
983 u8 board_rev = readb(slot->host->ioaddr + SYSKT_BOARD_REV);
984 u8 chip_rev = readb(slot->host->ioaddr + SYSKT_CHIP_REV);
985 dev_info(&slot->chip->pdev->dev, "SysKonnect CardBus2SDIO, "
986 "board rev %d.%d, chip rev %d.%d\n",
987 board_rev >> 4, board_rev & 0xf,
988 chip_rev >> 4, chip_rev & 0xf);
989 if (chip_rev >= 0x20)
990 slot->host->quirks |= SDHCI_QUIRK_FORCE_DMA;
992 writeb(SYSKT_POWER_330, slot->host->ioaddr + SYSKT_POWER_DATA);
993 writeb(SYSKT_POWER_START, slot->host->ioaddr + SYSKT_POWER_CMD);
995 tm = 10; /* Wait max 1 ms */
997 ps = readw(slot->host->ioaddr + SYSKT_POWER_STATUS);
998 if (ps & SYSKT_POWER_STATUS_OK)
1003 dev_err(&slot->chip->pdev->dev,
1004 "power regulator never stabilized");
1005 writeb(0, slot->host->ioaddr + SYSKT_POWER_CMD);
1012 static const struct sdhci_pci_fixes sdhci_syskt = {
1013 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER,
1014 .probe = syskt_probe,
1015 .probe_slot = syskt_probe_slot,
1018 static int via_probe(struct sdhci_pci_chip *chip)
1020 if (chip->pdev->revision == 0x10)
1021 chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER;
1026 static const struct sdhci_pci_fixes sdhci_via = {
1030 static int rtsx_probe_slot(struct sdhci_pci_slot *slot)
1032 slot->host->mmc->caps2 |= MMC_CAP2_HS200;
1036 static const struct sdhci_pci_fixes sdhci_rtsx = {
1037 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
1038 SDHCI_QUIRK2_BROKEN_64_BIT_DMA |
1039 SDHCI_QUIRK2_BROKEN_DDR50,
1040 .probe_slot = rtsx_probe_slot,
1043 /*AMD chipset generation*/
1044 enum amd_chipset_gen {
1045 AMD_CHIPSET_BEFORE_ML,
1048 AMD_CHIPSET_UNKNOWN,
1052 #define AMD_SD_AUTO_PATTERN 0xB8
1053 #define AMD_MSLEEP_DURATION 4
1054 #define AMD_SD_MISC_CONTROL 0xD0
1055 #define AMD_MAX_TUNE_VALUE 0x0B
1056 #define AMD_AUTO_TUNE_SEL 0x10800
1057 #define AMD_FIFO_PTR 0x30
1058 #define AMD_BIT_MASK 0x1F
1060 static void amd_tuning_reset(struct sdhci_host *host)
1064 val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
1065 val |= SDHCI_CTRL_PRESET_VAL_ENABLE | SDHCI_CTRL_EXEC_TUNING;
1066 sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
1068 val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
1069 val &= ~SDHCI_CTRL_EXEC_TUNING;
1070 sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
1073 static void amd_config_tuning_phase(struct pci_dev *pdev, u8 phase)
1077 pci_read_config_dword(pdev, AMD_SD_AUTO_PATTERN, &val);
1078 val &= ~AMD_BIT_MASK;
1079 val |= (AMD_AUTO_TUNE_SEL | (phase << 1));
1080 pci_write_config_dword(pdev, AMD_SD_AUTO_PATTERN, val);
1083 static void amd_enable_manual_tuning(struct pci_dev *pdev)
1087 pci_read_config_dword(pdev, AMD_SD_MISC_CONTROL, &val);
1088 val |= AMD_FIFO_PTR;
1089 pci_write_config_dword(pdev, AMD_SD_MISC_CONTROL, val);
1092 static int amd_execute_tuning(struct sdhci_host *host, u32 opcode)
1094 struct sdhci_pci_slot *slot = sdhci_priv(host);
1095 struct pci_dev *pdev = slot->chip->pdev;
1097 u8 valid_win_max = 0;
1098 u8 valid_win_end = 0;
1099 u8 ctrl, tune_around;
1101 amd_tuning_reset(host);
1103 for (tune_around = 0; tune_around < 12; tune_around++) {
1104 amd_config_tuning_phase(pdev, tune_around);
1106 if (mmc_send_tuning(host->mmc, opcode, NULL)) {
1108 msleep(AMD_MSLEEP_DURATION);
1109 ctrl = SDHCI_RESET_CMD | SDHCI_RESET_DATA;
1110 sdhci_writeb(host, ctrl, SDHCI_SOFTWARE_RESET);
1111 } else if (++valid_win > valid_win_max) {
1112 valid_win_max = valid_win;
1113 valid_win_end = tune_around;
1117 if (!valid_win_max) {
1118 dev_err(&pdev->dev, "no tuning point found\n");
1122 amd_config_tuning_phase(pdev, valid_win_end - valid_win_max / 2);
1124 amd_enable_manual_tuning(pdev);
1126 host->mmc->retune_period = 0;
1131 static int amd_probe(struct sdhci_pci_chip *chip)
1133 struct pci_dev *smbus_dev;
1134 enum amd_chipset_gen gen;
1136 smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
1137 PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
1139 gen = AMD_CHIPSET_BEFORE_ML;
1141 smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
1142 PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
1144 if (smbus_dev->revision < 0x51)
1145 gen = AMD_CHIPSET_CZ;
1147 gen = AMD_CHIPSET_NL;
1149 gen = AMD_CHIPSET_UNKNOWN;
1153 if (gen == AMD_CHIPSET_BEFORE_ML || gen == AMD_CHIPSET_CZ)
1154 chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
1159 static const struct sdhci_ops amd_sdhci_pci_ops = {
1160 .set_clock = sdhci_set_clock,
1161 .enable_dma = sdhci_pci_enable_dma,
1162 .set_bus_width = sdhci_pci_set_bus_width,
1163 .reset = sdhci_reset,
1164 .set_uhs_signaling = sdhci_set_uhs_signaling,
1165 .platform_execute_tuning = amd_execute_tuning,
1168 static const struct sdhci_pci_fixes sdhci_amd = {
1170 .ops = &amd_sdhci_pci_ops,
1173 static const struct pci_device_id pci_ids[] = {
1175 .vendor = PCI_VENDOR_ID_RICOH,
1176 .device = PCI_DEVICE_ID_RICOH_R5C822,
1177 .subvendor = PCI_ANY_ID,
1178 .subdevice = PCI_ANY_ID,
1179 .driver_data = (kernel_ulong_t)&sdhci_ricoh,
1183 .vendor = PCI_VENDOR_ID_RICOH,
1185 .subvendor = PCI_ANY_ID,
1186 .subdevice = PCI_ANY_ID,
1187 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
1191 .vendor = PCI_VENDOR_ID_RICOH,
1193 .subvendor = PCI_ANY_ID,
1194 .subdevice = PCI_ANY_ID,
1195 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
1199 .vendor = PCI_VENDOR_ID_RICOH,
1201 .subvendor = PCI_ANY_ID,
1202 .subdevice = PCI_ANY_ID,
1203 .driver_data = (kernel_ulong_t)&sdhci_ricoh_mmc,
1207 .vendor = PCI_VENDOR_ID_ENE,
1208 .device = PCI_DEVICE_ID_ENE_CB712_SD,
1209 .subvendor = PCI_ANY_ID,
1210 .subdevice = PCI_ANY_ID,
1211 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
1215 .vendor = PCI_VENDOR_ID_ENE,
1216 .device = PCI_DEVICE_ID_ENE_CB712_SD_2,
1217 .subvendor = PCI_ANY_ID,
1218 .subdevice = PCI_ANY_ID,
1219 .driver_data = (kernel_ulong_t)&sdhci_ene_712,
1223 .vendor = PCI_VENDOR_ID_ENE,
1224 .device = PCI_DEVICE_ID_ENE_CB714_SD,
1225 .subvendor = PCI_ANY_ID,
1226 .subdevice = PCI_ANY_ID,
1227 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
1231 .vendor = PCI_VENDOR_ID_ENE,
1232 .device = PCI_DEVICE_ID_ENE_CB714_SD_2,
1233 .subvendor = PCI_ANY_ID,
1234 .subdevice = PCI_ANY_ID,
1235 .driver_data = (kernel_ulong_t)&sdhci_ene_714,
1239 .vendor = PCI_VENDOR_ID_MARVELL,
1240 .device = PCI_DEVICE_ID_MARVELL_88ALP01_SD,
1241 .subvendor = PCI_ANY_ID,
1242 .subdevice = PCI_ANY_ID,
1243 .driver_data = (kernel_ulong_t)&sdhci_cafe,
1247 .vendor = PCI_VENDOR_ID_JMICRON,
1248 .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
1249 .subvendor = PCI_ANY_ID,
1250 .subdevice = PCI_ANY_ID,
1251 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
1255 .vendor = PCI_VENDOR_ID_JMICRON,
1256 .device = PCI_DEVICE_ID_JMICRON_JMB38X_MMC,
1257 .subvendor = PCI_ANY_ID,
1258 .subdevice = PCI_ANY_ID,
1259 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
1263 .vendor = PCI_VENDOR_ID_JMICRON,
1264 .device = PCI_DEVICE_ID_JMICRON_JMB388_SD,
1265 .subvendor = PCI_ANY_ID,
1266 .subdevice = PCI_ANY_ID,
1267 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
1271 .vendor = PCI_VENDOR_ID_JMICRON,
1272 .device = PCI_DEVICE_ID_JMICRON_JMB388_ESD,
1273 .subvendor = PCI_ANY_ID,
1274 .subdevice = PCI_ANY_ID,
1275 .driver_data = (kernel_ulong_t)&sdhci_jmicron,
1279 .vendor = PCI_VENDOR_ID_SYSKONNECT,
1281 .subvendor = PCI_ANY_ID,
1282 .subdevice = PCI_ANY_ID,
1283 .driver_data = (kernel_ulong_t)&sdhci_syskt,
1287 .vendor = PCI_VENDOR_ID_VIA,
1289 .subvendor = PCI_ANY_ID,
1290 .subdevice = PCI_ANY_ID,
1291 .driver_data = (kernel_ulong_t)&sdhci_via,
1295 .vendor = PCI_VENDOR_ID_REALTEK,
1297 .subvendor = PCI_ANY_ID,
1298 .subdevice = PCI_ANY_ID,
1299 .driver_data = (kernel_ulong_t)&sdhci_rtsx,
1303 .vendor = PCI_VENDOR_ID_INTEL,
1304 .device = PCI_DEVICE_ID_INTEL_QRK_SD,
1305 .subvendor = PCI_ANY_ID,
1306 .subdevice = PCI_ANY_ID,
1307 .driver_data = (kernel_ulong_t)&sdhci_intel_qrk,
1311 .vendor = PCI_VENDOR_ID_INTEL,
1312 .device = PCI_DEVICE_ID_INTEL_MRST_SD0,
1313 .subvendor = PCI_ANY_ID,
1314 .subdevice = PCI_ANY_ID,
1315 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc0,
1319 .vendor = PCI_VENDOR_ID_INTEL,
1320 .device = PCI_DEVICE_ID_INTEL_MRST_SD1,
1321 .subvendor = PCI_ANY_ID,
1322 .subdevice = PCI_ANY_ID,
1323 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
1327 .vendor = PCI_VENDOR_ID_INTEL,
1328 .device = PCI_DEVICE_ID_INTEL_MRST_SD2,
1329 .subvendor = PCI_ANY_ID,
1330 .subdevice = PCI_ANY_ID,
1331 .driver_data = (kernel_ulong_t)&sdhci_intel_mrst_hc1_hc2,
1335 .vendor = PCI_VENDOR_ID_INTEL,
1336 .device = PCI_DEVICE_ID_INTEL_MFD_SD,
1337 .subvendor = PCI_ANY_ID,
1338 .subdevice = PCI_ANY_ID,
1339 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd,
1343 .vendor = PCI_VENDOR_ID_INTEL,
1344 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO1,
1345 .subvendor = PCI_ANY_ID,
1346 .subdevice = PCI_ANY_ID,
1347 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1351 .vendor = PCI_VENDOR_ID_INTEL,
1352 .device = PCI_DEVICE_ID_INTEL_MFD_SDIO2,
1353 .subvendor = PCI_ANY_ID,
1354 .subdevice = PCI_ANY_ID,
1355 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1359 .vendor = PCI_VENDOR_ID_INTEL,
1360 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC0,
1361 .subvendor = PCI_ANY_ID,
1362 .subdevice = PCI_ANY_ID,
1363 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1367 .vendor = PCI_VENDOR_ID_INTEL,
1368 .device = PCI_DEVICE_ID_INTEL_MFD_EMMC1,
1369 .subvendor = PCI_ANY_ID,
1370 .subdevice = PCI_ANY_ID,
1371 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1375 .vendor = PCI_VENDOR_ID_INTEL,
1376 .device = PCI_DEVICE_ID_INTEL_PCH_SDIO0,
1377 .subvendor = PCI_ANY_ID,
1378 .subdevice = PCI_ANY_ID,
1379 .driver_data = (kernel_ulong_t)&sdhci_intel_pch_sdio,
1383 .vendor = PCI_VENDOR_ID_INTEL,
1384 .device = PCI_DEVICE_ID_INTEL_PCH_SDIO1,
1385 .subvendor = PCI_ANY_ID,
1386 .subdevice = PCI_ANY_ID,
1387 .driver_data = (kernel_ulong_t)&sdhci_intel_pch_sdio,
1391 .vendor = PCI_VENDOR_ID_INTEL,
1392 .device = PCI_DEVICE_ID_INTEL_BYT_EMMC,
1393 .subvendor = PCI_ANY_ID,
1394 .subdevice = PCI_ANY_ID,
1395 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1399 .vendor = PCI_VENDOR_ID_INTEL,
1400 .device = PCI_DEVICE_ID_INTEL_BYT_SDIO,
1401 .subvendor = PCI_VENDOR_ID_NI,
1402 .subdevice = 0x7884,
1403 .driver_data = (kernel_ulong_t)&sdhci_ni_byt_sdio,
1407 .vendor = PCI_VENDOR_ID_INTEL,
1408 .device = PCI_DEVICE_ID_INTEL_BYT_SDIO,
1409 .subvendor = PCI_ANY_ID,
1410 .subdevice = PCI_ANY_ID,
1411 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1415 .vendor = PCI_VENDOR_ID_INTEL,
1416 .device = PCI_DEVICE_ID_INTEL_BYT_SD,
1417 .subvendor = PCI_ANY_ID,
1418 .subdevice = PCI_ANY_ID,
1419 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1423 .vendor = PCI_VENDOR_ID_INTEL,
1424 .device = PCI_DEVICE_ID_INTEL_BYT_EMMC2,
1425 .subvendor = PCI_ANY_ID,
1426 .subdevice = PCI_ANY_ID,
1427 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1431 .vendor = PCI_VENDOR_ID_INTEL,
1432 .device = PCI_DEVICE_ID_INTEL_BSW_EMMC,
1433 .subvendor = PCI_ANY_ID,
1434 .subdevice = PCI_ANY_ID,
1435 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1439 .vendor = PCI_VENDOR_ID_INTEL,
1440 .device = PCI_DEVICE_ID_INTEL_BSW_SDIO,
1441 .subvendor = PCI_ANY_ID,
1442 .subdevice = PCI_ANY_ID,
1443 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1447 .vendor = PCI_VENDOR_ID_INTEL,
1448 .device = PCI_DEVICE_ID_INTEL_BSW_SD,
1449 .subvendor = PCI_ANY_ID,
1450 .subdevice = PCI_ANY_ID,
1451 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1455 .vendor = PCI_VENDOR_ID_INTEL,
1456 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO0,
1457 .subvendor = PCI_ANY_ID,
1458 .subdevice = PCI_ANY_ID,
1459 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sd,
1463 .vendor = PCI_VENDOR_ID_INTEL,
1464 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO1,
1465 .subvendor = PCI_ANY_ID,
1466 .subdevice = PCI_ANY_ID,
1467 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1471 .vendor = PCI_VENDOR_ID_INTEL,
1472 .device = PCI_DEVICE_ID_INTEL_CLV_SDIO2,
1473 .subvendor = PCI_ANY_ID,
1474 .subdevice = PCI_ANY_ID,
1475 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_sdio,
1479 .vendor = PCI_VENDOR_ID_INTEL,
1480 .device = PCI_DEVICE_ID_INTEL_CLV_EMMC0,
1481 .subvendor = PCI_ANY_ID,
1482 .subdevice = PCI_ANY_ID,
1483 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1487 .vendor = PCI_VENDOR_ID_INTEL,
1488 .device = PCI_DEVICE_ID_INTEL_CLV_EMMC1,
1489 .subvendor = PCI_ANY_ID,
1490 .subdevice = PCI_ANY_ID,
1491 .driver_data = (kernel_ulong_t)&sdhci_intel_mfd_emmc,
1495 .vendor = PCI_VENDOR_ID_INTEL,
1496 .device = PCI_DEVICE_ID_INTEL_MRFLD_MMC,
1497 .subvendor = PCI_ANY_ID,
1498 .subdevice = PCI_ANY_ID,
1499 .driver_data = (kernel_ulong_t)&sdhci_intel_mrfld_mmc,
1503 .vendor = PCI_VENDOR_ID_INTEL,
1504 .device = PCI_DEVICE_ID_INTEL_SPT_EMMC,
1505 .subvendor = PCI_ANY_ID,
1506 .subdevice = PCI_ANY_ID,
1507 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1511 .vendor = PCI_VENDOR_ID_INTEL,
1512 .device = PCI_DEVICE_ID_INTEL_SPT_SDIO,
1513 .subvendor = PCI_ANY_ID,
1514 .subdevice = PCI_ANY_ID,
1515 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1519 .vendor = PCI_VENDOR_ID_INTEL,
1520 .device = PCI_DEVICE_ID_INTEL_SPT_SD,
1521 .subvendor = PCI_ANY_ID,
1522 .subdevice = PCI_ANY_ID,
1523 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1527 .vendor = PCI_VENDOR_ID_INTEL,
1528 .device = PCI_DEVICE_ID_INTEL_DNV_EMMC,
1529 .subvendor = PCI_ANY_ID,
1530 .subdevice = PCI_ANY_ID,
1531 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1535 .vendor = PCI_VENDOR_ID_INTEL,
1536 .device = PCI_DEVICE_ID_INTEL_BXT_EMMC,
1537 .subvendor = PCI_ANY_ID,
1538 .subdevice = PCI_ANY_ID,
1539 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1543 .vendor = PCI_VENDOR_ID_INTEL,
1544 .device = PCI_DEVICE_ID_INTEL_BXT_SDIO,
1545 .subvendor = PCI_ANY_ID,
1546 .subdevice = PCI_ANY_ID,
1547 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1551 .vendor = PCI_VENDOR_ID_INTEL,
1552 .device = PCI_DEVICE_ID_INTEL_BXT_SD,
1553 .subvendor = PCI_ANY_ID,
1554 .subdevice = PCI_ANY_ID,
1555 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1559 .vendor = PCI_VENDOR_ID_INTEL,
1560 .device = PCI_DEVICE_ID_INTEL_BXTM_EMMC,
1561 .subvendor = PCI_ANY_ID,
1562 .subdevice = PCI_ANY_ID,
1563 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1567 .vendor = PCI_VENDOR_ID_INTEL,
1568 .device = PCI_DEVICE_ID_INTEL_BXTM_SDIO,
1569 .subvendor = PCI_ANY_ID,
1570 .subdevice = PCI_ANY_ID,
1571 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1575 .vendor = PCI_VENDOR_ID_INTEL,
1576 .device = PCI_DEVICE_ID_INTEL_BXTM_SD,
1577 .subvendor = PCI_ANY_ID,
1578 .subdevice = PCI_ANY_ID,
1579 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1583 .vendor = PCI_VENDOR_ID_INTEL,
1584 .device = PCI_DEVICE_ID_INTEL_APL_EMMC,
1585 .subvendor = PCI_ANY_ID,
1586 .subdevice = PCI_ANY_ID,
1587 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1591 .vendor = PCI_VENDOR_ID_INTEL,
1592 .device = PCI_DEVICE_ID_INTEL_APL_SDIO,
1593 .subvendor = PCI_ANY_ID,
1594 .subdevice = PCI_ANY_ID,
1595 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1599 .vendor = PCI_VENDOR_ID_INTEL,
1600 .device = PCI_DEVICE_ID_INTEL_APL_SD,
1601 .subvendor = PCI_ANY_ID,
1602 .subdevice = PCI_ANY_ID,
1603 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1607 .vendor = PCI_VENDOR_ID_INTEL,
1608 .device = PCI_DEVICE_ID_INTEL_GLK_EMMC,
1609 .subvendor = PCI_ANY_ID,
1610 .subdevice = PCI_ANY_ID,
1611 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc,
1615 .vendor = PCI_VENDOR_ID_INTEL,
1616 .device = PCI_DEVICE_ID_INTEL_GLK_SDIO,
1617 .subvendor = PCI_ANY_ID,
1618 .subdevice = PCI_ANY_ID,
1619 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio,
1623 .vendor = PCI_VENDOR_ID_INTEL,
1624 .device = PCI_DEVICE_ID_INTEL_GLK_SD,
1625 .subvendor = PCI_ANY_ID,
1626 .subdevice = PCI_ANY_ID,
1627 .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd,
1631 .vendor = PCI_VENDOR_ID_O2,
1632 .device = PCI_DEVICE_ID_O2_8120,
1633 .subvendor = PCI_ANY_ID,
1634 .subdevice = PCI_ANY_ID,
1635 .driver_data = (kernel_ulong_t)&sdhci_o2,
1639 .vendor = PCI_VENDOR_ID_O2,
1640 .device = PCI_DEVICE_ID_O2_8220,
1641 .subvendor = PCI_ANY_ID,
1642 .subdevice = PCI_ANY_ID,
1643 .driver_data = (kernel_ulong_t)&sdhci_o2,
1647 .vendor = PCI_VENDOR_ID_O2,
1648 .device = PCI_DEVICE_ID_O2_8221,
1649 .subvendor = PCI_ANY_ID,
1650 .subdevice = PCI_ANY_ID,
1651 .driver_data = (kernel_ulong_t)&sdhci_o2,
1655 .vendor = PCI_VENDOR_ID_O2,
1656 .device = PCI_DEVICE_ID_O2_8320,
1657 .subvendor = PCI_ANY_ID,
1658 .subdevice = PCI_ANY_ID,
1659 .driver_data = (kernel_ulong_t)&sdhci_o2,
1663 .vendor = PCI_VENDOR_ID_O2,
1664 .device = PCI_DEVICE_ID_O2_8321,
1665 .subvendor = PCI_ANY_ID,
1666 .subdevice = PCI_ANY_ID,
1667 .driver_data = (kernel_ulong_t)&sdhci_o2,
1671 .vendor = PCI_VENDOR_ID_O2,
1672 .device = PCI_DEVICE_ID_O2_FUJIN2,
1673 .subvendor = PCI_ANY_ID,
1674 .subdevice = PCI_ANY_ID,
1675 .driver_data = (kernel_ulong_t)&sdhci_o2,
1679 .vendor = PCI_VENDOR_ID_O2,
1680 .device = PCI_DEVICE_ID_O2_SDS0,
1681 .subvendor = PCI_ANY_ID,
1682 .subdevice = PCI_ANY_ID,
1683 .driver_data = (kernel_ulong_t)&sdhci_o2,
1687 .vendor = PCI_VENDOR_ID_O2,
1688 .device = PCI_DEVICE_ID_O2_SDS1,
1689 .subvendor = PCI_ANY_ID,
1690 .subdevice = PCI_ANY_ID,
1691 .driver_data = (kernel_ulong_t)&sdhci_o2,
1695 .vendor = PCI_VENDOR_ID_O2,
1696 .device = PCI_DEVICE_ID_O2_SEABIRD0,
1697 .subvendor = PCI_ANY_ID,
1698 .subdevice = PCI_ANY_ID,
1699 .driver_data = (kernel_ulong_t)&sdhci_o2,
1703 .vendor = PCI_VENDOR_ID_O2,
1704 .device = PCI_DEVICE_ID_O2_SEABIRD1,
1705 .subvendor = PCI_ANY_ID,
1706 .subdevice = PCI_ANY_ID,
1707 .driver_data = (kernel_ulong_t)&sdhci_o2,
1710 .vendor = PCI_VENDOR_ID_AMD,
1711 .device = PCI_ANY_ID,
1712 .class = PCI_CLASS_SYSTEM_SDHCI << 8,
1713 .class_mask = 0xFFFF00,
1714 .subvendor = PCI_ANY_ID,
1715 .subdevice = PCI_ANY_ID,
1716 .driver_data = (kernel_ulong_t)&sdhci_amd,
1718 { /* Generic SD host controller */
1719 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
1722 { /* end: all zeroes */ },
1725 MODULE_DEVICE_TABLE(pci, pci_ids);
1727 /*****************************************************************************\
1729 * SDHCI core callbacks *
1731 \*****************************************************************************/
1733 static int sdhci_pci_enable_dma(struct sdhci_host *host)
1735 struct sdhci_pci_slot *slot;
1736 struct pci_dev *pdev;
1738 slot = sdhci_priv(host);
1739 pdev = slot->chip->pdev;
1741 if (((pdev->class & 0xFFFF00) == (PCI_CLASS_SYSTEM_SDHCI << 8)) &&
1742 ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA) &&
1743 (host->flags & SDHCI_USE_SDMA)) {
1744 dev_warn(&pdev->dev, "Will use DMA mode even though HW "
1745 "doesn't fully claim to support it.\n");
1748 pci_set_master(pdev);
1753 static void sdhci_pci_set_bus_width(struct sdhci_host *host, int width)
1757 ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
1760 case MMC_BUS_WIDTH_8:
1761 ctrl |= SDHCI_CTRL_8BITBUS;
1762 ctrl &= ~SDHCI_CTRL_4BITBUS;
1764 case MMC_BUS_WIDTH_4:
1765 ctrl |= SDHCI_CTRL_4BITBUS;
1766 ctrl &= ~SDHCI_CTRL_8BITBUS;
1769 ctrl &= ~(SDHCI_CTRL_8BITBUS | SDHCI_CTRL_4BITBUS);
1773 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
1776 static void sdhci_pci_gpio_hw_reset(struct sdhci_host *host)
1778 struct sdhci_pci_slot *slot = sdhci_priv(host);
1779 int rst_n_gpio = slot->rst_n_gpio;
1781 if (!gpio_is_valid(rst_n_gpio))
1783 gpio_set_value_cansleep(rst_n_gpio, 0);
1784 /* For eMMC, minimum is 1us but give it 10us for good measure */
1786 gpio_set_value_cansleep(rst_n_gpio, 1);
1787 /* For eMMC, minimum is 200us but give it 300us for good measure */
1788 usleep_range(300, 1000);
1791 static void sdhci_pci_hw_reset(struct sdhci_host *host)
1793 struct sdhci_pci_slot *slot = sdhci_priv(host);
1796 slot->hw_reset(host);
1799 static const struct sdhci_ops sdhci_pci_ops = {
1800 .set_clock = sdhci_set_clock,
1801 .enable_dma = sdhci_pci_enable_dma,
1802 .set_bus_width = sdhci_pci_set_bus_width,
1803 .reset = sdhci_reset,
1804 .set_uhs_signaling = sdhci_set_uhs_signaling,
1805 .hw_reset = sdhci_pci_hw_reset,
1808 /*****************************************************************************\
1812 \*****************************************************************************/
1814 #ifdef CONFIG_PM_SLEEP
1815 static int sdhci_pci_suspend(struct device *dev)
1817 struct pci_dev *pdev = to_pci_dev(dev);
1818 struct sdhci_pci_chip *chip = pci_get_drvdata(pdev);
1823 if (chip->fixes && chip->fixes->suspend)
1824 return chip->fixes->suspend(chip);
1826 return sdhci_pci_suspend_host(chip);
1829 static int sdhci_pci_resume(struct device *dev)
1831 struct pci_dev *pdev = to_pci_dev(dev);
1832 struct sdhci_pci_chip *chip = pci_get_drvdata(pdev);
1837 if (chip->fixes && chip->fixes->resume)
1838 return chip->fixes->resume(chip);
1840 return sdhci_pci_resume_host(chip);
1845 static int sdhci_pci_runtime_suspend(struct device *dev)
1847 struct pci_dev *pdev = to_pci_dev(dev);
1848 struct sdhci_pci_chip *chip = pci_get_drvdata(pdev);
1853 if (chip->fixes && chip->fixes->runtime_suspend)
1854 return chip->fixes->runtime_suspend(chip);
1856 return sdhci_pci_runtime_suspend_host(chip);
1859 static int sdhci_pci_runtime_resume(struct device *dev)
1861 struct pci_dev *pdev = to_pci_dev(dev);
1862 struct sdhci_pci_chip *chip = pci_get_drvdata(pdev);
1867 if (chip->fixes && chip->fixes->runtime_resume)
1868 return chip->fixes->runtime_resume(chip);
1870 return sdhci_pci_runtime_resume_host(chip);
1874 static const struct dev_pm_ops sdhci_pci_pm_ops = {
1875 SET_SYSTEM_SLEEP_PM_OPS(sdhci_pci_suspend, sdhci_pci_resume)
1876 SET_RUNTIME_PM_OPS(sdhci_pci_runtime_suspend,
1877 sdhci_pci_runtime_resume, NULL)
1880 /*****************************************************************************\
1882 * Device probing/removal *
1884 \*****************************************************************************/
1886 static struct sdhci_pci_slot *sdhci_pci_probe_slot(
1887 struct pci_dev *pdev, struct sdhci_pci_chip *chip, int first_bar,
1890 struct sdhci_pci_slot *slot;
1891 struct sdhci_host *host;
1892 int ret, bar = first_bar + slotno;
1893 size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
1895 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1896 dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
1897 return ERR_PTR(-ENODEV);
1900 if (pci_resource_len(pdev, bar) < 0x100) {
1901 dev_err(&pdev->dev, "Invalid iomem size. You may "
1902 "experience problems.\n");
1905 if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
1906 dev_err(&pdev->dev, "Vendor specific interface. Aborting.\n");
1907 return ERR_PTR(-ENODEV);
1910 if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) {
1911 dev_err(&pdev->dev, "Unknown interface. Aborting.\n");
1912 return ERR_PTR(-ENODEV);
1915 host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
1917 dev_err(&pdev->dev, "cannot allocate host\n");
1918 return ERR_CAST(host);
1921 slot = sdhci_priv(host);
1925 slot->rst_n_gpio = -EINVAL;
1926 slot->cd_gpio = -EINVAL;
1929 /* Retrieve platform data if there is any */
1930 if (*sdhci_pci_get_data)
1931 slot->data = sdhci_pci_get_data(pdev, slotno);
1934 if (slot->data->setup) {
1935 ret = slot->data->setup(slot->data);
1937 dev_err(&pdev->dev, "platform setup failed\n");
1941 slot->rst_n_gpio = slot->data->rst_n_gpio;
1942 slot->cd_gpio = slot->data->cd_gpio;
1945 host->hw_name = "PCI";
1946 host->ops = chip->fixes && chip->fixes->ops ?
1949 host->quirks = chip->quirks;
1950 host->quirks2 = chip->quirks2;
1952 host->irq = pdev->irq;
1954 ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
1956 dev_err(&pdev->dev, "cannot request region\n");
1960 host->ioaddr = pcim_iomap_table(pdev)[bar];
1962 if (chip->fixes && chip->fixes->probe_slot) {
1963 ret = chip->fixes->probe_slot(slot);
1968 if (gpio_is_valid(slot->rst_n_gpio)) {
1969 if (!devm_gpio_request(&pdev->dev, slot->rst_n_gpio, "eMMC_reset")) {
1970 gpio_direction_output(slot->rst_n_gpio, 1);
1971 slot->host->mmc->caps |= MMC_CAP_HW_RESET;
1972 slot->hw_reset = sdhci_pci_gpio_hw_reset;
1974 dev_warn(&pdev->dev, "failed to request rst_n_gpio\n");
1975 slot->rst_n_gpio = -EINVAL;
1979 host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;
1980 host->mmc->slotno = slotno;
1981 host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
1983 if (slot->cd_idx >= 0) {
1984 ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx,
1985 slot->cd_override_level, 0, NULL);
1986 if (ret == -EPROBE_DEFER)
1990 dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
1995 if (chip->fixes && chip->fixes->add_host)
1996 ret = chip->fixes->add_host(slot);
1998 ret = sdhci_add_host(host);
2002 sdhci_pci_add_own_cd(slot);
2005 * Check if the chip needs a separate GPIO for card detect to wake up
2006 * from runtime suspend. If it is not there, don't allow runtime PM.
2007 * Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
2009 if (chip->fixes && chip->fixes->own_cd_for_runtime_pm &&
2010 !gpio_is_valid(slot->cd_gpio) && slot->cd_idx < 0)
2011 chip->allow_runtime_pm = false;
2016 if (chip->fixes && chip->fixes->remove_slot)
2017 chip->fixes->remove_slot(slot, 0);
2020 if (slot->data && slot->data->cleanup)
2021 slot->data->cleanup(slot->data);
2024 sdhci_free_host(host);
2026 return ERR_PTR(ret);
2029 static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
2034 sdhci_pci_remove_own_cd(slot);
2037 scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS);
2038 if (scratch == (u32)-1)
2041 sdhci_remove_host(slot->host, dead);
2043 if (slot->chip->fixes && slot->chip->fixes->remove_slot)
2044 slot->chip->fixes->remove_slot(slot, dead);
2046 if (slot->data && slot->data->cleanup)
2047 slot->data->cleanup(slot->data);
2049 sdhci_free_host(slot->host);
2052 static void sdhci_pci_runtime_pm_allow(struct device *dev)
2054 pm_suspend_ignore_children(dev, 1);
2055 pm_runtime_set_autosuspend_delay(dev, 50);
2056 pm_runtime_use_autosuspend(dev);
2057 pm_runtime_allow(dev);
2058 /* Stay active until mmc core scans for a card */
2059 pm_runtime_put_noidle(dev);
2062 static void sdhci_pci_runtime_pm_forbid(struct device *dev)
2064 pm_runtime_forbid(dev);
2065 pm_runtime_get_noresume(dev);
2068 static int sdhci_pci_probe(struct pci_dev *pdev,
2069 const struct pci_device_id *ent)
2071 struct sdhci_pci_chip *chip;
2072 struct sdhci_pci_slot *slot;
2074 u8 slots, first_bar;
2077 BUG_ON(pdev == NULL);
2078 BUG_ON(ent == NULL);
2080 dev_info(&pdev->dev, "SDHCI controller found [%04x:%04x] (rev %x)\n",
2081 (int)pdev->vendor, (int)pdev->device, (int)pdev->revision);
2083 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
2087 slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
2088 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
2092 BUG_ON(slots > MAX_SLOTS);
2094 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar);
2098 first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
2100 if (first_bar > 5) {
2101 dev_err(&pdev->dev, "Invalid first BAR. Aborting.\n");
2105 ret = pcim_enable_device(pdev);
2109 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
2114 chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
2116 chip->quirks = chip->fixes->quirks;
2117 chip->quirks2 = chip->fixes->quirks2;
2118 chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
2120 chip->num_slots = slots;
2121 chip->pm_retune = true;
2122 chip->rpm_retune = true;
2124 pci_set_drvdata(pdev, chip);
2126 if (chip->fixes && chip->fixes->probe) {
2127 ret = chip->fixes->probe(chip);
2132 slots = chip->num_slots; /* Quirk may have changed this */
2134 for (i = 0; i < slots; i++) {
2135 slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i);
2137 for (i--; i >= 0; i--)
2138 sdhci_pci_remove_slot(chip->slots[i]);
2139 return PTR_ERR(slot);
2142 chip->slots[i] = slot;
2145 if (chip->allow_runtime_pm)
2146 sdhci_pci_runtime_pm_allow(&pdev->dev);
2151 static void sdhci_pci_remove(struct pci_dev *pdev)
2154 struct sdhci_pci_chip *chip = pci_get_drvdata(pdev);
2156 if (chip->allow_runtime_pm)
2157 sdhci_pci_runtime_pm_forbid(&pdev->dev);
2159 for (i = 0; i < chip->num_slots; i++)
2160 sdhci_pci_remove_slot(chip->slots[i]);
2163 static struct pci_driver sdhci_driver = {
2164 .name = "sdhci-pci",
2165 .id_table = pci_ids,
2166 .probe = sdhci_pci_probe,
2167 .remove = sdhci_pci_remove,
2169 .pm = &sdhci_pci_pm_ops
2173 module_pci_driver(sdhci_driver);
2175 MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>");
2176 MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver");
2177 MODULE_LICENSE("GPL");