Skip to content

Commit

Permalink
mmc: msm_sdcc: Lock AXI rate at 128mhz when we're using the bus
Browse files Browse the repository at this point in the history
Signed-off-by: San Mehat <san@google.com>
  • Loading branch information
San Mehat committed Nov 19, 2009
1 parent 1897c3e commit 13bc34a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions drivers/mmc/host/msm_sdcc.c
Expand Up @@ -104,6 +104,10 @@ msmsdcc_enable_clocks(struct msmsdcc_host *host, int enable)

WARN_ON(enable == host->clks_on);
if (enable) {
rc = clk_set_rate(host->eclk, 128000000);
if (rc)
dev_err(mmc_dev(host->mmc), "err locking axi\n");

rc = clk_enable(host->pclk);
if (rc)
return rc;
Expand All @@ -118,6 +122,9 @@ msmsdcc_enable_clocks(struct msmsdcc_host *host, int enable)
} else {
clk_disable(host->clk);
clk_disable(host->pclk);
rc = clk_set_rate(host->eclk, 0);
if (rc)
dev_err(mmc_dev(host->mmc), "err unlocking axi\n");
host->clks_on = 0;
}
return 0;
Expand Down Expand Up @@ -1200,10 +1207,15 @@ msmsdcc_probe(struct platform_device *pdev)
goto pclk_put;
}

/* Enable clocks */
host->eclk = clk_get(&pdev->dev, "ebi1_clk");
if (IS_ERR(host->eclk)) {
ret = PTR_ERR(host->eclk);
goto clk_put;
}

ret = msmsdcc_enable_clocks(host, 1);
if (ret)
goto clk_put;
goto eclk_put;

ret = clk_set_rate(host->clk, msmsdcc_fmin);
if (ret) {
Expand Down Expand Up @@ -1349,6 +1361,8 @@ msmsdcc_probe(struct platform_device *pdev)
free_irq(host->stat_irq, host);
clk_disable:
msmsdcc_enable_clocks(host, 0);
eclk_put:
clk_put(host->eclk);
clk_put:
clk_put(host->clk);
pclk_put:
Expand Down
1 change: 1 addition & 0 deletions drivers/mmc/host/msm_sdcc.h
Expand Up @@ -210,6 +210,7 @@ struct msmsdcc_host {
struct msmsdcc_curr_req curr;

struct mmc_host *mmc;
struct clk *eclk;
struct clk *clk; /* main MMC bus clock */
struct clk *pclk; /* SDCC peripheral bus clock */
unsigned int clks_on; /* set if clocks are enabled */
Expand Down

0 comments on commit 13bc34a

Please sign in to comment.