Commit 6fb294f7 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Ulf Hansson

mmc: tmio: move {tmio_}mmc_of_parse() to tmio_mmc_host_alloc()

mmc_of_parse() parses various DT properties and sets capability flags
accordingly.  However, drivers have no chance to run platform init
code depending on such flags because mmc_of_parse() is called from
tmio_mmc_host_probe().

Move mmc_of_parse() to tmio_mmc_host_alloc() so that drivers can
handle capabilities before mmc_add_host().  Move tmio_mmc_of_parse()
likewise.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent b21fc294
...@@ -1152,6 +1152,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, ...@@ -1152,6 +1152,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
struct mmc_host *mmc; struct mmc_host *mmc;
struct resource *res; struct resource *res;
void __iomem *ctl; void __iomem *ctl;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ctl = devm_ioremap_resource(&pdev->dev, res); ctl = devm_ioremap_resource(&pdev->dev, res);
...@@ -1170,8 +1171,20 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, ...@@ -1170,8 +1171,20 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
host->ops = tmio_mmc_ops; host->ops = tmio_mmc_ops;
mmc->ops = &host->ops; mmc->ops = &host->ops;
ret = mmc_of_parse(host->mmc);
if (ret) {
host = ERR_PTR(ret);
goto free;
}
tmio_mmc_of_parse(pdev, pdata);
platform_set_drvdata(pdev, host); platform_set_drvdata(pdev, host);
return host;
free:
mmc_free_host(mmc);
return host; return host;
} }
EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc); EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc);
...@@ -1198,15 +1211,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, ...@@ -1198,15 +1211,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
if (mmc->f_min == 0) if (mmc->f_min == 0)
return -EINVAL; return -EINVAL;
tmio_mmc_of_parse(pdev, pdata);
if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
_host->write16_hook = NULL; _host->write16_hook = NULL;
ret = mmc_of_parse(mmc);
if (ret < 0)
return ret;
_host->set_pwr = pdata->set_pwr; _host->set_pwr = pdata->set_pwr;
_host->set_clk_div = pdata->set_clk_div; _host->set_clk_div = pdata->set_clk_div;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment