sdhci-acpi.c (9d65cb88e5979d43f47c899601353ca61973ba90) | sdhci-acpi.c (162d6f98005fce408efc5af73956c434ae08ef73) |
---|---|
1/* 2 * Secure Digital Host Controller Interface ACPI driver. 3 * 4 * Copyright (c) 2012, Intel Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2, as published by the Free Software Foundation. --- 62 unchanged lines hidden (view full) --- 71 int (*remove_slot)(struct platform_device *); 72}; 73 74struct sdhci_acpi_host { 75 struct sdhci_host *host; 76 const struct sdhci_acpi_slot *slot; 77 struct platform_device *pdev; 78 bool use_runtime_pm; | 1/* 2 * Secure Digital Host Controller Interface ACPI driver. 3 * 4 * Copyright (c) 2012, Intel Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2, as published by the Free Software Foundation. --- 62 unchanged lines hidden (view full) --- 71 int (*remove_slot)(struct platform_device *); 72}; 73 74struct sdhci_acpi_host { 75 struct sdhci_host *host; 76 const struct sdhci_acpi_slot *slot; 77 struct platform_device *pdev; 78 bool use_runtime_pm; |
79 bool dma_setup; | |
80}; 81 82static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag) 83{ 84 return c->slot && (c->slot->flags & flag); 85} 86 87static int sdhci_acpi_enable_dma(struct sdhci_host *host) 88{ | 79}; 80 81static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag) 82{ 83 return c->slot && (c->slot->flags & flag); 84} 85 86static int sdhci_acpi_enable_dma(struct sdhci_host *host) 87{ |
89 struct sdhci_acpi_host *c = sdhci_priv(host); 90 struct device *dev = &c->pdev->dev; 91 int err = -1; 92 93 if (c->dma_setup) 94 return 0; 95 96 if (host->flags & SDHCI_USE_64_BIT_DMA) { 97 if (host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA) { 98 host->flags &= ~SDHCI_USE_64_BIT_DMA; 99 } else { 100 err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); 101 if (err) 102 dev_warn(dev, "Failed to set 64-bit DMA mask\n"); 103 } 104 } 105 106 if (err) 107 err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 108 109 c->dma_setup = !err; 110 111 return err; | 88 return 0; |
112} 113 114static void sdhci_acpi_int_hw_reset(struct sdhci_host *host) 115{ 116 u8 reg; 117 118 reg = sdhci_readb(host, SDHCI_POWER_CONTROL); 119 reg |= 0x10; --- 78 unchanged lines hidden (view full) --- 198 /* Platform specific code during emmc proble slot goes here */ 199 200 return 0; 201} 202 203static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { 204 .chip = &sdhci_acpi_chip_int, 205 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | | 89} 90 91static void sdhci_acpi_int_hw_reset(struct sdhci_host *host) 92{ 93 u8 reg; 94 95 reg = sdhci_readb(host, SDHCI_POWER_CONTROL); 96 reg |= 0x10; --- 78 unchanged lines hidden (view full) --- 175 /* Platform specific code during emmc proble slot goes here */ 176 177 return 0; 178} 179 180static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { 181 .chip = &sdhci_acpi_chip_int, 182 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | |
206 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR | 207 MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY, | 183 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR, |
208 .caps2 = MMC_CAP2_HC_ERASE_SZ, 209 .flags = SDHCI_ACPI_RUNTIME_PM, | 184 .caps2 = MMC_CAP2_HC_ERASE_SZ, 185 .flags = SDHCI_ACPI_RUNTIME_PM, |
210 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, | |
211 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_STOP_WITH_TC, 212 .probe_slot = sdhci_acpi_emmc_probe_slot, 213}; 214 215static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { | 186 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_STOP_WITH_TC, 187 .probe_slot = sdhci_acpi_emmc_probe_slot, 188}; 189 190static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { |
216 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | 217 SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, | 191 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION, |
218 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON, | 192 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON, |
219 .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD | 220 MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY, | 193 .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD, |
221 .flags = SDHCI_ACPI_RUNTIME_PM, 222 .pm_caps = MMC_PM_KEEP_POWER, 223 .probe_slot = sdhci_acpi_sdio_probe_slot, 224}; 225 226static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = { 227 .flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL | 228 SDHCI_ACPI_RUNTIME_PM, | 194 .flags = SDHCI_ACPI_RUNTIME_PM, 195 .pm_caps = MMC_PM_KEEP_POWER, 196 .probe_slot = sdhci_acpi_sdio_probe_slot, 197}; 198 199static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = { 200 .flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL | 201 SDHCI_ACPI_RUNTIME_PM, |
229 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, | |
230 .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON | 231 SDHCI_QUIRK2_STOP_WITH_TC, | 202 .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON | 203 SDHCI_QUIRK2_STOP_WITH_TC, |
232 .caps = MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY, | |
233 .probe_slot = sdhci_acpi_sd_probe_slot, 234}; 235 236struct sdhci_acpi_uid_slot { 237 const char *hid; 238 const char *uid; 239 const struct sdhci_acpi_slot *slot; 240}; --- 88 unchanged lines hidden (view full) --- 329 330 host->ioaddr = devm_ioremap_nocache(dev, iomem->start, 331 resource_size(iomem)); 332 if (host->ioaddr == NULL) { 333 err = -ENOMEM; 334 goto err_free; 335 } 336 | 204 .probe_slot = sdhci_acpi_sd_probe_slot, 205}; 206 207struct sdhci_acpi_uid_slot { 208 const char *hid; 209 const char *uid; 210 const struct sdhci_acpi_slot *slot; 211}; --- 88 unchanged lines hidden (view full) --- 300 301 host->ioaddr = devm_ioremap_nocache(dev, iomem->start, 302 resource_size(iomem)); 303 if (host->ioaddr == NULL) { 304 err = -ENOMEM; 305 goto err_free; 306 } 307 |
308 if (!dev->dma_mask) { 309 u64 dma_mask; 310 311 if (sdhci_readl(host, SDHCI_CAPABILITIES) & SDHCI_CAN_64BIT) { 312 /* 64-bit DMA is not supported at present */ 313 dma_mask = DMA_BIT_MASK(32); 314 } else { 315 dma_mask = DMA_BIT_MASK(32); 316 } 317 318 err = dma_coerce_mask_and_coherent(dev, dma_mask); 319 if (err) 320 goto err_free; 321 } 322 |
|
337 if (c->slot) { 338 if (c->slot->probe_slot) { 339 err = c->slot->probe_slot(pdev, hid, uid); 340 if (err) 341 goto err_free; 342 } 343 if (c->slot->chip) { 344 host->ops = c->slot->chip->ops; --- 80 unchanged lines hidden (view full) --- 425 426#else 427 428#define sdhci_acpi_suspend NULL 429#define sdhci_acpi_resume NULL 430 431#endif 432 | 323 if (c->slot) { 324 if (c->slot->probe_slot) { 325 err = c->slot->probe_slot(pdev, hid, uid); 326 if (err) 327 goto err_free; 328 } 329 if (c->slot->chip) { 330 host->ops = c->slot->chip->ops; --- 80 unchanged lines hidden (view full) --- 411 412#else 413 414#define sdhci_acpi_suspend NULL 415#define sdhci_acpi_resume NULL 416 417#endif 418 |
433#ifdef CONFIG_PM_RUNTIME | 419#ifdef CONFIG_PM |
434 435static int sdhci_acpi_runtime_suspend(struct device *dev) 436{ 437 struct sdhci_acpi_host *c = dev_get_drvdata(dev); 438 439 return sdhci_runtime_suspend_host(c->host); 440} 441 --- 37 unchanged lines hidden --- | 420 421static int sdhci_acpi_runtime_suspend(struct device *dev) 422{ 423 struct sdhci_acpi_host *c = dev_get_drvdata(dev); 424 425 return sdhci_runtime_suspend_host(c->host); 426} 427 --- 37 unchanged lines hidden --- |