aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/mmc_spi.c19
-rw-r--r--include/linux/spi/mmc_spi.h9
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 35508584ac2..547eb857b1b 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1131,11 +1131,20 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)
1131 return 0; 1131 return 0;
1132} 1132}
1133 1133
1134static int mmc_spi_get_cd(struct mmc_host *mmc)
1135{
1136 struct mmc_spi_host *host = mmc_priv(mmc);
1137
1138 if (host->pdata && host->pdata->get_cd)
1139 return !!host->pdata->get_cd(mmc->parent);
1140 return -ENOSYS;
1141}
1134 1142
1135static const struct mmc_host_ops mmc_spi_ops = { 1143static const struct mmc_host_ops mmc_spi_ops = {
1136 .request = mmc_spi_request, 1144 .request = mmc_spi_request,
1137 .set_ios = mmc_spi_set_ios, 1145 .set_ios = mmc_spi_set_ios,
1138 .get_ro = mmc_spi_get_ro, 1146 .get_ro = mmc_spi_get_ro,
1147 .get_cd = mmc_spi_get_cd,
1139}; 1148};
1140 1149
1141 1150
@@ -1319,17 +1328,23 @@ static int mmc_spi_probe(struct spi_device *spi)
1319 goto fail_glue_init; 1328 goto fail_glue_init;
1320 } 1329 }
1321 1330
1331 /* pass platform capabilities, if any */
1332 if (host->pdata)
1333 mmc->caps |= host->pdata->caps;
1334
1322 status = mmc_add_host(mmc); 1335 status = mmc_add_host(mmc);
1323 if (status != 0) 1336 if (status != 0)
1324 goto fail_add_host; 1337 goto fail_add_host;
1325 1338
1326 dev_info(&spi->dev, "SD/MMC host %s%s%s%s\n", 1339 dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n",
1327 mmc->class_dev.bus_id, 1340 mmc->class_dev.bus_id,
1328 host->dma_dev ? "" : ", no DMA", 1341 host->dma_dev ? "" : ", no DMA",
1329 (host->pdata && host->pdata->get_ro) 1342 (host->pdata && host->pdata->get_ro)
1330 ? "" : ", no WP", 1343 ? "" : ", no WP",
1331 (host->pdata && host->pdata->setpower) 1344 (host->pdata && host->pdata->setpower)
1332 ? "" : ", no poweroff"); 1345 ? "" : ", no poweroff",
1346 (mmc->caps & MMC_CAP_NEEDS_POLL)
1347 ? ", cd polling" : "");
1333 return 0; 1348 return 0;
1334 1349
1335fail_add_host: 1350fail_add_host:
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index d5ca78b93a3..a3626aedaec 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -23,6 +23,15 @@ struct mmc_spi_platform_data {
23 /* sense switch on sd cards */ 23 /* sense switch on sd cards */
24 int (*get_ro)(struct device *); 24 int (*get_ro)(struct device *);
25 25
26 /*
27 * If board does not use CD interrupts, driver can optimize polling
28 * using this function.
29 */
30 int (*get_cd)(struct device *);
31
32 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
33 unsigned long caps;
34
26 /* how long to debounce card detect, in msecs */ 35 /* how long to debounce card detect, in msecs */
27 u16 detect_delay; 36 u16 detect_delay;
28 37