aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmc_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/mmc_spi.c')
-rw-r--r--drivers/mmc/host/mmc_spi.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 35508584ac2a..41cc63360e43 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1126,16 +1126,28 @@ static int mmc_spi_get_ro(struct mmc_host *mmc)
1126 struct mmc_spi_host *host = mmc_priv(mmc); 1126 struct mmc_spi_host *host = mmc_priv(mmc);
1127 1127
1128 if (host->pdata && host->pdata->get_ro) 1128 if (host->pdata && host->pdata->get_ro)
1129 return host->pdata->get_ro(mmc->parent); 1129 return !!host->pdata->get_ro(mmc->parent);
1130 /* board doesn't support read only detection; assume writeable */ 1130 /*
1131 return 0; 1131 * Board doesn't support read only detection; let the mmc core
1132 * decide what to do.
1133 */
1134 return -ENOSYS;
1132} 1135}
1133 1136
1137static int mmc_spi_get_cd(struct mmc_host *mmc)
1138{
1139 struct mmc_spi_host *host = mmc_priv(mmc);
1140
1141 if (host->pdata && host->pdata->get_cd)
1142 return !!host->pdata->get_cd(mmc->parent);
1143 return -ENOSYS;
1144}
1134 1145
1135static const struct mmc_host_ops mmc_spi_ops = { 1146static const struct mmc_host_ops mmc_spi_ops = {
1136 .request = mmc_spi_request, 1147 .request = mmc_spi_request,
1137 .set_ios = mmc_spi_set_ios, 1148 .set_ios = mmc_spi_set_ios,
1138 .get_ro = mmc_spi_get_ro, 1149 .get_ro = mmc_spi_get_ro,
1150 .get_cd = mmc_spi_get_cd,
1139}; 1151};
1140 1152
1141 1153
@@ -1240,10 +1252,7 @@ static int mmc_spi_probe(struct spi_device *spi)
1240 mmc->ops = &mmc_spi_ops; 1252 mmc->ops = &mmc_spi_ops;
1241 mmc->max_blk_size = MMC_SPI_BLOCKSIZE; 1253 mmc->max_blk_size = MMC_SPI_BLOCKSIZE;
1242 1254
1243 /* As long as we keep track of the number of successfully 1255 mmc->caps = MMC_CAP_SPI;
1244 * transmitted blocks, we're good for multiwrite.
1245 */
1246 mmc->caps = MMC_CAP_SPI | MMC_CAP_MULTIWRITE;
1247 1256
1248 /* SPI doesn't need the lowspeed device identification thing for 1257 /* SPI doesn't need the lowspeed device identification thing for
1249 * MMC or SD cards, since it never comes up in open drain mode. 1258 * MMC or SD cards, since it never comes up in open drain mode.
@@ -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: