Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312820
b: refs/heads/master
c: a660926
h: refs/heads/master
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Chris Ball committed Jul 21, 2012
1 parent 9410cf8 commit 3c54489
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 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: b289174ff70a591545a054d52ae081a75a73f085
refs/heads/master: a6609267107ecc5598b79aa353036c1f57e7257e
23 changes: 18 additions & 5 deletions trunk/drivers/mmc/host/sh_mmcif.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,19 @@ static void sh_mmcif_request(struct mmc_host *mmc, struct mmc_request *mrq)
sh_mmcif_start_cmd(host, mrq);
}

static int sh_mmcif_clk_update(struct sh_mmcif_host *host)
{
int ret = clk_enable(host->hclk);

if (!ret) {
host->clk = clk_get_rate(host->hclk);
host->mmc->f_max = host->clk / 2;
host->mmc->f_min = host->clk / 512;
}

return ret;
}

static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct sh_mmcif_host *host = mmc_priv(mmc);
Expand Down Expand Up @@ -955,7 +968,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (!host->power) {
if (p->set_pwr)
p->set_pwr(host->pd, ios->power_mode);
clk_enable(host->hclk);
sh_mmcif_clk_update(host);
pm_runtime_get_sync(&host->pd->dev);
host->power = true;
sh_mmcif_sync_reset(host);
Expand Down Expand Up @@ -1308,10 +1321,9 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "cannot get clock \"%s\": %d\n", clk_name, ret);
goto eclkget;
}
clk_enable(host->hclk);
host->clk = clk_get_rate(host->hclk);
mmc->f_max = host->clk / 2;
mmc->f_min = host->clk / 512;
ret = sh_mmcif_clk_update(host);
if (ret < 0)
goto eclkupdate;

ret = pm_runtime_resume(&pdev->dev);
if (ret < 0)
Expand Down Expand Up @@ -1353,6 +1365,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
pm_runtime_suspend(&pdev->dev);
eresume:
clk_disable(host->hclk);
eclkupdate:
clk_put(host->hclk);
eclkget:
pm_runtime_disable(&pdev->dev);
Expand Down

0 comments on commit 3c54489

Please sign in to comment.