Merge branch 'linus' into x86/cpu, to pick up fixes
[cascardo/linux.git] / drivers / mmc / host / sdhci-acpi.c
index bed6a49..008709c 100644 (file)
@@ -43,6 +43,7 @@
 
 #ifdef CONFIG_X86
 #include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
 #include <asm/iosf_mbi.h>
 #endif
 
@@ -126,7 +127,7 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = {
 static bool sdhci_acpi_byt(void)
 {
        static const struct x86_cpu_id byt[] = {
-               { X86_VENDOR_INTEL, 6, 0x37 },
+               { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT1 },
                {}
        };
 
@@ -200,8 +201,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
        if (!gpio_cd)
                return 0;
 
-       pm_runtime_get_sync(mmc->parent);
-
        spin_lock_irqsave(&host->lock, flags);
 
        if (host->flags & SDHCI_DEVICE_DEAD)
@@ -211,9 +210,6 @@ static int bxt_get_cd(struct mmc_host *mmc)
 out:
        spin_unlock_irqrestore(&host->lock, flags);
 
-       pm_runtime_mark_last_busy(mmc->parent);
-       pm_runtime_put_autosuspend(mmc->parent);
-
        return ret;
 }
 
@@ -267,8 +263,10 @@ static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev,
 
        /* Platform specific code during sd probe slot goes here */
 
-       if (hid && !strcmp(hid, "80865ACA"))
+       if (hid && !strcmp(hid, "80865ACA")) {
                host->mmc_host_ops.get_cd = bxt_get_cd;
+               host->mmc->caps |= MMC_CAP_AGGRESSIVE_PM;
+       }
 
        return 0;
 }
@@ -277,7 +275,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
        .chip    = &sdhci_acpi_chip_int,
        .caps    = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
                   MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
-                  MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
+                  MMC_CAP_WAIT_WHILE_BUSY,
        .caps2   = MMC_CAP2_HC_ERASE_SZ,
        .flags   = SDHCI_ACPI_RUNTIME_PM,
        .quirks  = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
@@ -292,7 +290,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
                   SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
        .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
        .caps    = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD |
-                  MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
+                  MMC_CAP_WAIT_WHILE_BUSY,
        .flags   = SDHCI_ACPI_RUNTIME_PM,
        .pm_caps = MMC_PM_KEEP_POWER,
        .probe_slot     = sdhci_acpi_sdio_probe_slot,
@@ -304,7 +302,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = {
        .quirks  = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
        .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
                   SDHCI_QUIRK2_STOP_WITH_TC,
-       .caps    = MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
+       .caps    = MMC_CAP_WAIT_WHILE_BUSY,
        .probe_slot     = sdhci_acpi_sd_probe_slot,
 };
 
@@ -381,7 +379,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        acpi_handle handle = ACPI_HANDLE(dev);
-       struct acpi_device *device;
+       struct acpi_device *device, *child;
        struct sdhci_acpi_host *c;
        struct sdhci_host *host;
        struct resource *iomem;
@@ -393,6 +391,11 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
        if (acpi_bus_get_device(handle, &device))
                return -ENODEV;
 
+       /* Power on the SDHCI controller and its children */
+       acpi_device_fix_up_power(device);
+       list_for_each_entry(child, &device->children, node)
+               acpi_device_fix_up_power(child);
+
        if (acpi_bus_get_status(device) || !device->status.present)
                return -ENODEV;