diff options
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc-imx.c')
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 365b16c230f8..ebbe984e5d00 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -71,6 +71,9 @@ struct pltfm_imx_data { | |||
71 | enum imx_esdhc_type devtype; | 71 | enum imx_esdhc_type devtype; |
72 | struct pinctrl *pinctrl; | 72 | struct pinctrl *pinctrl; |
73 | struct esdhc_platform_data boarddata; | 73 | struct esdhc_platform_data boarddata; |
74 | struct clk *clk_ipg; | ||
75 | struct clk *clk_ahb; | ||
76 | struct clk *clk_per; | ||
74 | }; | 77 | }; |
75 | 78 | ||
76 | static struct platform_device_id imx_esdhc_devtype[] = { | 79 | static struct platform_device_id imx_esdhc_devtype[] = { |
@@ -439,7 +442,6 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
439 | struct sdhci_pltfm_host *pltfm_host; | 442 | struct sdhci_pltfm_host *pltfm_host; |
440 | struct sdhci_host *host; | 443 | struct sdhci_host *host; |
441 | struct esdhc_platform_data *boarddata; | 444 | struct esdhc_platform_data *boarddata; |
442 | struct clk *clk; | ||
443 | int err; | 445 | int err; |
444 | struct pltfm_imx_data *imx_data; | 446 | struct pltfm_imx_data *imx_data; |
445 | 447 | ||
@@ -460,14 +462,29 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
460 | imx_data->devtype = pdev->id_entry->driver_data; | 462 | imx_data->devtype = pdev->id_entry->driver_data; |
461 | pltfm_host->priv = imx_data; | 463 | pltfm_host->priv = imx_data; |
462 | 464 | ||
463 | clk = clk_get(mmc_dev(host->mmc), NULL); | 465 | imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); |
464 | if (IS_ERR(clk)) { | 466 | if (IS_ERR(imx_data->clk_ipg)) { |
465 | dev_err(mmc_dev(host->mmc), "clk err\n"); | 467 | err = PTR_ERR(imx_data->clk_ipg); |
466 | err = PTR_ERR(clk); | ||
467 | goto err_clk_get; | 468 | goto err_clk_get; |
468 | } | 469 | } |
469 | clk_prepare_enable(clk); | 470 | |
470 | pltfm_host->clk = clk; | 471 | imx_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); |
472 | if (IS_ERR(imx_data->clk_ahb)) { | ||
473 | err = PTR_ERR(imx_data->clk_ahb); | ||
474 | goto err_clk_get; | ||
475 | } | ||
476 | |||
477 | imx_data->clk_per = devm_clk_get(&pdev->dev, "per"); | ||
478 | if (IS_ERR(imx_data->clk_per)) { | ||
479 | err = PTR_ERR(imx_data->clk_per); | ||
480 | goto err_clk_get; | ||
481 | } | ||
482 | |||
483 | pltfm_host->clk = imx_data->clk_per; | ||
484 | |||
485 | clk_prepare_enable(imx_data->clk_per); | ||
486 | clk_prepare_enable(imx_data->clk_ipg); | ||
487 | clk_prepare_enable(imx_data->clk_ahb); | ||
471 | 488 | ||
472 | imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | 489 | imx_data->pinctrl = devm_pinctrl_get_select_default(&pdev->dev); |
473 | if (IS_ERR(imx_data->pinctrl)) { | 490 | if (IS_ERR(imx_data->pinctrl)) { |
@@ -567,8 +584,9 @@ no_card_detect_irq: | |||
567 | no_card_detect_pin: | 584 | no_card_detect_pin: |
568 | no_board_data: | 585 | no_board_data: |
569 | pin_err: | 586 | pin_err: |
570 | clk_disable_unprepare(pltfm_host->clk); | 587 | clk_disable_unprepare(imx_data->clk_per); |
571 | clk_put(pltfm_host->clk); | 588 | clk_disable_unprepare(imx_data->clk_ipg); |
589 | clk_disable_unprepare(imx_data->clk_ahb); | ||
572 | err_clk_get: | 590 | err_clk_get: |
573 | kfree(imx_data); | 591 | kfree(imx_data); |
574 | err_imx_data: | 592 | err_imx_data: |
@@ -594,8 +612,10 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev) | |||
594 | gpio_free(boarddata->cd_gpio); | 612 | gpio_free(boarddata->cd_gpio); |
595 | } | 613 | } |
596 | 614 | ||
597 | clk_disable_unprepare(pltfm_host->clk); | 615 | clk_disable_unprepare(imx_data->clk_per); |
598 | clk_put(pltfm_host->clk); | 616 | clk_disable_unprepare(imx_data->clk_ipg); |
617 | clk_disable_unprepare(imx_data->clk_ahb); | ||
618 | |||
599 | kfree(imx_data); | 619 | kfree(imx_data); |
600 | 620 | ||
601 | sdhci_pltfm_free(pdev); | 621 | sdhci_pltfm_free(pdev); |