diff options
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
| -rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 90 | 
1 files changed, 24 insertions, 66 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index f9ac3bb5d617..24ebc9a8de89 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -32,7 +32,6 @@  #include <linux/of_irq.h>  #include <linux/of_gpio.h>  #include <linux/of_device.h> -#include <linux/omap-dmaengine.h>  #include <linux/mmc/host.h>  #include <linux/mmc/core.h>  #include <linux/mmc/mmc.h> @@ -351,15 +350,14 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,  	return 0;  } -static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) +static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on, +				int vdd)  { -	struct omap_hsmmc_host *host = -		platform_get_drvdata(to_platform_device(dev));  	struct mmc_host *mmc = host->mmc;  	int ret = 0;  	if (mmc_pdata(host)->set_power) -		return mmc_pdata(host)->set_power(dev, power_on, vdd); +		return mmc_pdata(host)->set_power(host->dev, power_on, vdd);  	/*  	 * If we don't see a Vcc regulator, assume it's a fixed @@ -369,7 +367,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)  		return 0;  	if (mmc_pdata(host)->before_set_reg) -		mmc_pdata(host)->before_set_reg(dev, power_on, vdd); +		mmc_pdata(host)->before_set_reg(host->dev, power_on, vdd);  	ret = omap_hsmmc_set_pbias(host, false, 0);  	if (ret) @@ -403,7 +401,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)  	}  	if (mmc_pdata(host)->after_set_reg) -		mmc_pdata(host)->after_set_reg(dev, power_on, vdd); +		mmc_pdata(host)->after_set_reg(host->dev, power_on, vdd);  	return 0; @@ -968,8 +966,6 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req  		return;  	host->mrq = NULL;  	mmc_request_done(host->mmc, mrq); -	pm_runtime_mark_last_busy(host->dev); -	pm_runtime_put_autosuspend(host->dev);  }  /* @@ -1250,17 +1246,15 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)  	int ret;  	/* Disable the clocks */ -	pm_runtime_put_sync(host->dev);  	if (host->dbclk)  		clk_disable_unprepare(host->dbclk);  	/* Turn the power off */ -	ret = omap_hsmmc_set_power(host->dev, 0, 0); +	ret = omap_hsmmc_set_power(host, 0, 0);  	/* Turn the power ON with given VDD 1.8 or 3.0v */  	if (!ret) -		ret = omap_hsmmc_set_power(host->dev, 1, vdd); -	pm_runtime_get_sync(host->dev); +		ret = omap_hsmmc_set_power(host, 1, vdd);  	if (host->dbclk)  		clk_prepare_enable(host->dbclk); @@ -1368,8 +1362,6 @@ static void omap_hsmmc_dma_callback(void *param)  		host->mrq = NULL;  		mmc_request_done(host->mmc, mrq); -		pm_runtime_mark_last_busy(host->dev); -		pm_runtime_put_autosuspend(host->dev);  	}  } @@ -1602,7 +1594,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)  	BUG_ON(host->req_in_progress);  	BUG_ON(host->dma_ch != -1); -	pm_runtime_get_sync(host->dev);  	if (host->protect_card) {  		if (host->reqs_blocked < 3) {  			/* @@ -1619,8 +1610,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)  			req->data->error = -EBADF;  		req->cmd->retries = 0;  		mmc_request_done(mmc, req); -		pm_runtime_mark_last_busy(host->dev); -		pm_runtime_put_autosuspend(host->dev);  		return;  	} else if (host->reqs_blocked)  		host->reqs_blocked = 0; @@ -1634,8 +1623,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)  			req->data->error = err;  		host->mrq = NULL;  		mmc_request_done(mmc, req); -		pm_runtime_mark_last_busy(host->dev); -		pm_runtime_put_autosuspend(host->dev);  		return;  	}  	if (req->sbc && !(host->flags & AUTO_CMD23)) { @@ -1653,15 +1640,13 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)  	struct omap_hsmmc_host *host = mmc_priv(mmc);  	int do_send_init_stream = 0; -	pm_runtime_get_sync(host->dev); -  	if (ios->power_mode != host->power_mode) {  		switch (ios->power_mode) {  		case MMC_POWER_OFF: -			omap_hsmmc_set_power(host->dev, 0, 0); +			omap_hsmmc_set_power(host, 0, 0);  			break;  		case MMC_POWER_UP: -			omap_hsmmc_set_power(host->dev, 1, ios->vdd); +			omap_hsmmc_set_power(host, 1, ios->vdd);  			break;  		case MMC_POWER_ON:  			do_send_init_stream = 1; @@ -1698,8 +1683,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)  		send_init_stream(host);  	omap_hsmmc_set_bus_mode(host); - -	pm_runtime_put_autosuspend(host->dev);  }  static int omap_hsmmc_get_cd(struct mmc_host *mmc) @@ -1962,13 +1945,17 @@ MODULE_DEVICE_TABLE(of, omap_mmc_of_match);  static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)  { -	struct omap_hsmmc_platform_data *pdata; +	struct omap_hsmmc_platform_data *pdata, *legacy;  	struct device_node *np = dev->of_node;  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);  	if (!pdata)  		return ERR_PTR(-ENOMEM); /* out of memory */ +	legacy = dev_get_platdata(dev); +	if (legacy && legacy->name) +		pdata->name = legacy->name; +  	if (of_find_property(np, "ti,dual-volt", NULL))  		pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT; @@ -2005,8 +1992,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)  	struct resource *res;  	int ret, irq;  	const struct of_device_id *match; -	dma_cap_mask_t mask; -	unsigned tx_req, rx_req;  	const struct omap_mmc_of_data *data;  	void __iomem *base; @@ -2136,44 +2121,17 @@ static int omap_hsmmc_probe(struct platform_device *pdev)  	omap_hsmmc_conf_bus_power(host); -	if (!pdev->dev.of_node) { -		res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); -		if (!res) { -			dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n"); -			ret = -ENXIO; -			goto err_irq; -		} -		tx_req = res->start; - -		res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); -		if (!res) { -			dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n"); -			ret = -ENXIO; -			goto err_irq; -		} -		rx_req = res->start; -	} - -	dma_cap_zero(mask); -	dma_cap_set(DMA_SLAVE, mask); - -	host->rx_chan = -		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, -						 &rx_req, &pdev->dev, "rx"); - -	if (!host->rx_chan) { -		dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel\n"); -		ret = -ENXIO; +	host->rx_chan = dma_request_chan(&pdev->dev, "rx"); +	if (IS_ERR(host->rx_chan)) { +		dev_err(mmc_dev(host->mmc), "RX DMA channel request failed\n"); +		ret = PTR_ERR(host->rx_chan);  		goto err_irq;  	} -	host->tx_chan = -		dma_request_slave_channel_compat(mask, omap_dma_filter_fn, -						 &tx_req, &pdev->dev, "tx"); - -	if (!host->tx_chan) { -		dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel\n"); -		ret = -ENXIO; +	host->tx_chan = dma_request_chan(&pdev->dev, "tx"); +	if (IS_ERR(host->tx_chan)) { +		dev_err(mmc_dev(host->mmc), "TX DMA channel request failed\n"); +		ret = PTR_ERR(host->tx_chan);  		goto err_irq;  	} @@ -2231,9 +2189,9 @@ err_slot_name:  	mmc_remove_host(mmc);  err_irq:  	device_init_wakeup(&pdev->dev, false); -	if (host->tx_chan) +	if (!IS_ERR_OR_NULL(host->tx_chan))  		dma_release_channel(host->tx_chan); -	if (host->rx_chan) +	if (!IS_ERR_OR_NULL(host->rx_chan))  		dma_release_channel(host->rx_chan);  	pm_runtime_dont_use_autosuspend(host->dev);  	pm_runtime_put_sync(host->dev);  | 
