Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308225
b: refs/heads/master
c: 529aa29
h: refs/heads/master
i:
  308223: 0939018
v: v3
  • Loading branch information
Sascha Hauer committed Apr 25, 2012
1 parent 3746048 commit 4e2cc1e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 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: f4d40de39a23f0c39cca55ac63e1175c69c3d2f7
refs/heads/master: 529aa29e033f3bcd3346de1532e4bd5ff969fd0d
39 changes: 25 additions & 14 deletions trunk/drivers/mmc/host/mxcmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ struct mxcmci_host {
u16 rev_no;
unsigned int cmdat;

struct clk *clk;
struct clk *clk_ipg;
struct clk *clk_per;

int clock;

Expand Down Expand Up @@ -672,7 +673,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
{
unsigned int divider;
int prescaler = 0;
unsigned int clk_in = clk_get_rate(host->clk);
unsigned int clk_in = clk_get_rate(host->clk_per);

while (prescaler <= 0x800) {
for (divider = 1; divider <= 0xF; divider++) {
Expand Down Expand Up @@ -900,12 +901,20 @@ static int mxcmci_probe(struct platform_device *pdev)
host->res = r;
host->irq = irq;

host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
host->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(host->clk_ipg)) {
ret = PTR_ERR(host->clk_ipg);
goto out_iounmap;
}
clk_enable(host->clk);

host->clk_per = devm_clk_get(&pdev->dev, "per");
if (IS_ERR(host->clk_per)) {
ret = PTR_ERR(host->clk_per);
goto out_iounmap;
}

clk_prepare_enable(host->clk_per);
clk_prepare_enable(host->clk_ipg);

mxcmci_softreset(host);

Expand All @@ -917,8 +926,8 @@ static int mxcmci_probe(struct platform_device *pdev)
goto out_clk_put;
}

mmc->f_min = clk_get_rate(host->clk) >> 16;
mmc->f_max = clk_get_rate(host->clk) >> 1;
mmc->f_min = clk_get_rate(host->clk_per) >> 16;
mmc->f_max = clk_get_rate(host->clk_per) >> 1;

/* recommended in data sheet */
writew(0x2db4, host->base + MMC_REG_READ_TO);
Expand Down Expand Up @@ -967,8 +976,8 @@ static int mxcmci_probe(struct platform_device *pdev)
if (host->dma)
dma_release_channel(host->dma);
out_clk_put:
clk_disable(host->clk);
clk_put(host->clk);
clk_disable_unprepare(host->clk_per);
clk_disable_unprepare(host->clk_ipg);
out_iounmap:
iounmap(host->base);
out_free:
Expand Down Expand Up @@ -999,8 +1008,8 @@ static int mxcmci_remove(struct platform_device *pdev)
if (host->dma)
dma_release_channel(host->dma);

clk_disable(host->clk);
clk_put(host->clk);
clk_disable_unprepare(host->clk_per);
clk_disable_unprepare(host->clk_ipg);

release_mem_region(host->res->start, resource_size(host->res));

Expand All @@ -1018,7 +1027,8 @@ static int mxcmci_suspend(struct device *dev)

if (mmc)
ret = mmc_suspend_host(mmc);
clk_disable(host->clk);
clk_disable_unprepare(host->clk_per);
clk_disable_unprepare(host->clk_ipg);

return ret;
}
Expand All @@ -1029,7 +1039,8 @@ static int mxcmci_resume(struct device *dev)
struct mxcmci_host *host = mmc_priv(mmc);
int ret = 0;

clk_enable(host->clk);
clk_prepare_enable(host->clk_per);
clk_prepare_enable(host->clk_ipg);
if (mmc)
ret = mmc_resume_host(mmc);

Expand Down

0 comments on commit 4e2cc1e

Please sign in to comment.