diff options
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc-imx.c')
| -rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 51 | 
1 files changed, 40 insertions, 11 deletions
| diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0d2b082f2246..ebbe984e5d00 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -24,6 +24,7 @@  #include <linux/of.h>  #include <linux/of_device.h>  #include <linux/of_gpio.h> +#include <linux/pinctrl/consumer.h>  #include <mach/esdhc.h>  #include "sdhci-pltfm.h"  #include "sdhci-esdhc.h" @@ -68,7 +69,11 @@ struct pltfm_imx_data {  	int flags;  	u32 scratchpad;  	enum imx_esdhc_type devtype; +	struct pinctrl *pinctrl;  	struct esdhc_platform_data boarddata; +	struct clk *clk_ipg; +	struct clk *clk_ahb; +	struct clk *clk_per;  };  static struct platform_device_id imx_esdhc_devtype[] = { @@ -437,7 +442,6 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)  	struct sdhci_pltfm_host *pltfm_host;  	struct sdhci_host *host;  	struct esdhc_platform_data *boarddata; -	struct clk *clk;  	int err;  	struct pltfm_imx_data *imx_data; @@ -458,14 +462,35 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)  	imx_data->devtype = pdev->id_entry->driver_data;  	pltfm_host->priv = imx_data; -	clk = clk_get(mmc_dev(host->mmc), NULL); -	if (IS_ERR(clk)) { -		dev_err(mmc_dev(host->mmc), "clk err\n"); -		err = PTR_ERR(clk); +	imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); +	if (IS_ERR(imx_data->clk_ipg)) { +		err = PTR_ERR(imx_data->clk_ipg);  		goto err_clk_get;  	} -	clk_prepare_enable(clk); -	pltfm_host->clk = clk; + +	imx_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); +	if (IS_ERR(imx_data->clk_ahb)) { +		err = PTR_ERR(imx_data->clk_ahb); +		goto err_clk_get; +	} + +	imx_data->clk_per = devm_clk_get(&pdev->dev, "per"); +	if (IS_ERR(imx_data->clk_per)) { +		err = PTR_ERR(imx_data->clk_per); +		goto err_clk_get; +	} + +	pltfm_host->clk = imx_data->clk_per; + +	clk_prepare_enable(imx_data->clk_per); +	clk_prepare_enable(imx_data->clk_ipg); +	clk_prepare_enable(imx_data->clk_ahb); + +	imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev); +	if (IS_ERR(imx_data->pinctrl)) { +		err = PTR_ERR(imx_data->pinctrl); +		goto pin_err; +	}  	host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; @@ -558,8 +583,10 @@ no_card_detect_irq:  		gpio_free(boarddata->wp_gpio);  no_card_detect_pin:  no_board_data: -	clk_disable_unprepare(pltfm_host->clk); -	clk_put(pltfm_host->clk); +pin_err: +	clk_disable_unprepare(imx_data->clk_per); +	clk_disable_unprepare(imx_data->clk_ipg); +	clk_disable_unprepare(imx_data->clk_ahb);  err_clk_get:  	kfree(imx_data);  err_imx_data: @@ -585,8 +612,10 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev)  		gpio_free(boarddata->cd_gpio);  	} -	clk_disable_unprepare(pltfm_host->clk); -	clk_put(pltfm_host->clk); +	clk_disable_unprepare(imx_data->clk_per); +	clk_disable_unprepare(imx_data->clk_ipg); +	clk_disable_unprepare(imx_data->clk_ahb); +  	kfree(imx_data);  	sdhci_pltfm_free(pdev); |