aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2016-06-29 09:24:15 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-07-25 04:34:33 -0400
commit52f5336db2d6c32a807ca37cc1c45060a88a2506 (patch)
treea1c99e04cc2a33bd55903b3cb8905f876031b06f /drivers/mmc/host/sdhci.c
parentd3940f2747960b2e0b82f59c447190e1e960d76f (diff)
mmc: sdhci: Split sdhci_add_host()
Split sdhci-add_host() in order to further our objective to make sdhci into a library. The split divides code that sets up mmc and sdhci parameters, from code that actually activates things - such as tasklet initialization, requesting the irq, and adding (and starting) the host. This gives drivers an opportunity to change various settings before committing to start the host. Drivers can continue to call sdhci_add_host() but drivers that want to take advantage of the split instead call sdhci_setup_host() followed by __sdhci_add_host(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7009c862ca9b..22061faf7fa4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2833,7 +2833,7 @@ static int sdhci_set_dma_mask(struct sdhci_host *host)
2833 return ret; 2833 return ret;
2834} 2834}
2835 2835
2836int sdhci_add_host(struct sdhci_host *host) 2836int sdhci_setup_host(struct sdhci_host *host)
2837{ 2837{
2838 struct mmc_host *mmc; 2838 struct mmc_host *mmc;
2839 u32 caps[2] = {0, 0}; 2839 u32 caps[2] = {0, 0};
@@ -3314,6 +3314,28 @@ int sdhci_add_host(struct sdhci_host *host)
3314 */ 3314 */
3315 mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535; 3315 mmc->max_blk_count = (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535;
3316 3316
3317 return 0;
3318
3319unreg:
3320 if (!IS_ERR(mmc->supply.vqmmc))
3321 regulator_disable(mmc->supply.vqmmc);
3322undma:
3323 if (host->align_buffer)
3324 dma_free_coherent(mmc_dev(mmc), host->align_buffer_sz +
3325 host->adma_table_sz, host->align_buffer,
3326 host->align_addr);
3327 host->adma_table = NULL;
3328 host->align_buffer = NULL;
3329
3330 return ret;
3331}
3332EXPORT_SYMBOL_GPL(sdhci_setup_host);
3333
3334int __sdhci_add_host(struct sdhci_host *host)
3335{
3336 struct mmc_host *mmc = host->mmc;
3337 int ret;
3338
3317 /* 3339 /*
3318 * Init tasklets. 3340 * Init tasklets.
3319 */ 3341 */
@@ -3370,10 +3392,10 @@ unirq:
3370 free_irq(host->irq, host); 3392 free_irq(host->irq, host);
3371untasklet: 3393untasklet:
3372 tasklet_kill(&host->finish_tasklet); 3394 tasklet_kill(&host->finish_tasklet);
3373unreg: 3395
3374 if (!IS_ERR(mmc->supply.vqmmc)) 3396 if (!IS_ERR(mmc->supply.vqmmc))
3375 regulator_disable(mmc->supply.vqmmc); 3397 regulator_disable(mmc->supply.vqmmc);
3376undma: 3398
3377 if (host->align_buffer) 3399 if (host->align_buffer)
3378 dma_free_coherent(mmc_dev(mmc), host->align_buffer_sz + 3400 dma_free_coherent(mmc_dev(mmc), host->align_buffer_sz +
3379 host->adma_table_sz, host->align_buffer, 3401 host->adma_table_sz, host->align_buffer,
@@ -3383,7 +3405,18 @@ undma:
3383 3405
3384 return ret; 3406 return ret;
3385} 3407}
3408EXPORT_SYMBOL_GPL(__sdhci_add_host);
3409
3410int sdhci_add_host(struct sdhci_host *host)
3411{
3412 int ret;
3413
3414 ret = sdhci_setup_host(host);
3415 if (ret)
3416 return ret;
3386 3417
3418 return __sdhci_add_host(host);
3419}
3387EXPORT_SYMBOL_GPL(sdhci_add_host); 3420EXPORT_SYMBOL_GPL(sdhci_add_host);
3388 3421
3389void sdhci_remove_host(struct sdhci_host *host, int dead) 3422void sdhci_remove_host(struct sdhci_host *host, int dead)