Commit cd03d9a8 authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Chris Ball

mmc: omap_hsmmc: Cleanup use of cpu_is_* for debounce_clock

There really does not seem to be a need to use cpu_is_* check for getting
the debounce clock as clkdev is perfectly capable of handling situations
when certain clocks are only available on select platforms.

Also get rid of the 'got_dbclk' flag and instead use the dbclk clock
pointer to know if a valid debounce clock exists for the platform.
Signed-off-by: default avatarRajendra Nayak <rnayak@ti.com>
Signed-off-by: default avatarVenkatraman S <svenkatr@ti.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 31463b14
...@@ -170,7 +170,6 @@ struct omap_hsmmc_host { ...@@ -170,7 +170,6 @@ struct omap_hsmmc_host {
int use_dma, dma_ch; int use_dma, dma_ch;
int dma_line_tx, dma_line_rx; int dma_line_tx, dma_line_rx;
int slot_id; int slot_id;
int got_dbclk;
int response_busy; int response_busy;
int context_loss; int context_loss;
int vdd; int vdd;
...@@ -1097,7 +1096,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd) ...@@ -1097,7 +1096,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
/* Disable the clocks */ /* Disable the clocks */
pm_runtime_put_sync(host->dev); pm_runtime_put_sync(host->dev);
if (host->got_dbclk) if (host->dbclk)
clk_disable(host->dbclk); clk_disable(host->dbclk);
/* Turn the power off */ /* Turn the power off */
...@@ -1108,7 +1107,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd) ...@@ -1108,7 +1107,7 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
ret = mmc_slot(host).set_power(host->dev, host->slot_id, 1, ret = mmc_slot(host).set_power(host->dev, host->slot_id, 1,
vdd); vdd);
pm_runtime_get_sync(host->dev); pm_runtime_get_sync(host->dev);
if (host->got_dbclk) if (host->dbclk)
clk_enable(host->dbclk); clk_enable(host->dbclk);
if (ret != 0) if (ret != 0)
...@@ -1902,21 +1901,17 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) ...@@ -1902,21 +1901,17 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
omap_hsmmc_context_save(host); omap_hsmmc_context_save(host);
if (cpu_is_omap2430()) {
host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck");
/* /*
* MMC can still work without debounce clock. * MMC can still work without debounce clock.
*/ */
if (IS_ERR(host->dbclk)) if (IS_ERR(host->dbclk)) {
dev_warn(mmc_dev(host->mmc), dev_warn(mmc_dev(host->mmc), "Failed to get debounce clk\n");
"Failed to get debounce clock\n"); host->dbclk = NULL;
else } else if (clk_enable(host->dbclk) != 0) {
host->got_dbclk = 1; dev_warn(mmc_dev(host->mmc), "Failed to enable debounce clk\n");
clk_put(host->dbclk);
if (host->got_dbclk) host->dbclk = NULL;
if (clk_enable(host->dbclk) != 0)
dev_dbg(mmc_dev(host->mmc), "Enabling debounce"
" clk failed\n");
} }
/* Since we do only SG emulation, we can have as many segs /* Since we do only SG emulation, we can have as many segs
...@@ -2036,7 +2031,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) ...@@ -2036,7 +2031,7 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
pm_runtime_put_sync(host->dev); pm_runtime_put_sync(host->dev);
pm_runtime_disable(host->dev); pm_runtime_disable(host->dev);
clk_put(host->fclk); clk_put(host->fclk);
if (host->got_dbclk) { if (host->dbclk) {
clk_disable(host->dbclk); clk_disable(host->dbclk);
clk_put(host->dbclk); clk_put(host->dbclk);
} }
...@@ -2069,7 +2064,7 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev) ...@@ -2069,7 +2064,7 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
pm_runtime_put_sync(host->dev); pm_runtime_put_sync(host->dev);
pm_runtime_disable(host->dev); pm_runtime_disable(host->dev);
clk_put(host->fclk); clk_put(host->fclk);
if (host->got_dbclk) { if (host->dbclk) {
clk_disable(host->dbclk); clk_disable(host->dbclk);
clk_put(host->dbclk); clk_put(host->dbclk);
} }
...@@ -2127,7 +2122,7 @@ static int omap_hsmmc_suspend(struct device *dev) ...@@ -2127,7 +2122,7 @@ static int omap_hsmmc_suspend(struct device *dev)
OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
} }
if (host->got_dbclk) if (host->dbclk)
clk_disable(host->dbclk); clk_disable(host->dbclk);
err: err:
pm_runtime_put_sync(host->dev); pm_runtime_put_sync(host->dev);
...@@ -2148,7 +2143,7 @@ static int omap_hsmmc_resume(struct device *dev) ...@@ -2148,7 +2143,7 @@ static int omap_hsmmc_resume(struct device *dev)
pm_runtime_get_sync(host->dev); pm_runtime_get_sync(host->dev);
if (host->got_dbclk) if (host->dbclk)
clk_enable(host->dbclk); clk_enable(host->dbclk);
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment