aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/tmio_mmc_pio.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2013-11-20 03:30:39 -0500
committerChris Ball <chris@printf.net>2014-01-13 12:48:22 -0500
commit05fae4a7551543f10f1892f533af2d12378a4ba9 (patch)
tree59cf400c43788c5754ddcd89fe0f294ec8487ce7 /drivers/mmc/host/tmio_mmc_pio.c
parentd1a1dfb2f5dad3fbcea71b95791d525f4775cff5 (diff)
mmc: tmio: use -EPROBE_DEFER if driver can't find regulator
Current tmio driver tries to use default ocr_avail if 1) it couldn't find regulator and 2) if platform data doesn't have ocr_mask. But, there is no guarantee that regulator driver probe is faster than TMIO driver probe. TMIO driver will not use regulator in such case. By this patch, TMIO driver returns -EPROBE_DEFER if it couldn't find regulator and if platform doesn't have ocr_mask. Because, there is a possibility that regulator has not been probed, but the user expects it. This patch changes tmio_mmc_host_probe() behavior, but there is no user who has conflict. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/tmio_mmc_pio.c')
-rw-r--r--drivers/mmc/host/tmio_mmc_pio.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 6c07e70a4a45..b94cb1666295 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -944,17 +944,25 @@ static const struct mmc_host_ops tmio_mmc_ops = {
944 .enable_sdio_irq = tmio_mmc_enable_sdio_irq, 944 .enable_sdio_irq = tmio_mmc_enable_sdio_irq,
945}; 945};
946 946
947static void tmio_mmc_init_ocr(struct tmio_mmc_host *host) 947static int tmio_mmc_init_ocr(struct tmio_mmc_host *host)
948{ 948{
949 struct tmio_mmc_data *pdata = host->pdata; 949 struct tmio_mmc_data *pdata = host->pdata;
950 struct mmc_host *mmc = host->mmc; 950 struct mmc_host *mmc = host->mmc;
951 951
952 mmc_regulator_get_supply(mmc); 952 mmc_regulator_get_supply(mmc);
953 953
954 /* use ocr_mask if no regulator */
954 if (!mmc->ocr_avail) 955 if (!mmc->ocr_avail)
955 mmc->ocr_avail = pdata->ocr_mask ? : MMC_VDD_32_33 | MMC_VDD_33_34; 956 mmc->ocr_avail = pdata->ocr_mask;
956 else if (pdata->ocr_mask) 957
957 dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n"); 958 /*
959 * try again.
960 * There is possibility that regulator has not been probed
961 */
962 if (!mmc->ocr_avail)
963 return -EPROBE_DEFER;
964
965 return 0;
958} 966}
959 967
960static void tmio_mmc_of_parse(struct platform_device *pdev, 968static void tmio_mmc_of_parse(struct platform_device *pdev,
@@ -1008,6 +1016,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
1008 /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ 1016 /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
1009 _host->bus_shift = resource_size(res_ctl) >> 10; 1017 _host->bus_shift = resource_size(res_ctl) >> 10;
1010 1018
1019 ret = tmio_mmc_init_ocr(_host);
1020 if (ret < 0)
1021 goto host_free;
1022
1011 _host->ctl = ioremap(res_ctl->start, resource_size(res_ctl)); 1023 _host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));
1012 if (!_host->ctl) { 1024 if (!_host->ctl) {
1013 ret = -ENOMEM; 1025 ret = -ENOMEM;
@@ -1023,7 +1035,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
1023 mmc->max_segs; 1035 mmc->max_segs;
1024 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; 1036 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
1025 mmc->max_seg_size = mmc->max_req_size; 1037 mmc->max_seg_size = mmc->max_req_size;
1026 tmio_mmc_init_ocr(_host);
1027 1038
1028 _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || 1039 _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
1029 mmc->caps & MMC_CAP_NEEDS_POLL || 1040 mmc->caps & MMC_CAP_NEEDS_POLL ||