Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308226
b: refs/heads/master
c: 52dac61
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer committed Apr 25, 2012
1 parent 4e2cc1e commit 8db78c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 529aa29e033f3bcd3346de1532e4bd5ff969fd0d
refs/heads/master: 52dac6150580f356a96b9a49715f6234fbf00d3a
42 changes: 31 additions & 11 deletions trunk/drivers/mmc/host/sdhci-esdhc-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ struct pltfm_imx_data {
u32 scratchpad;
enum imx_esdhc_type devtype;
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[] = {
Expand Down Expand Up @@ -437,7 +440,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;

Expand All @@ -458,14 +460,29 @@ 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);

host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;

Expand Down Expand Up @@ -558,8 +575,9 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
gpio_free(boarddata->wp_gpio);
no_card_detect_pin:
no_board_data:
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);
err_clk_get:
kfree(imx_data);
err_imx_data:
Expand All @@ -585,8 +603,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);
Expand Down

0 comments on commit 8db78c7

Please sign in to comment.