Commit 87788577 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Toy

If the platform device has a clock associated with the tmio-mmc device,

use it.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Magnus Damm <damm@opensource.se>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Philip Langdale <philipl@overt.org>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: pHilipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c8ebd528
......@@ -32,6 +32,7 @@
#include <linux/mmc/host.h>
#include <linux/mfd/core.h>
#include <linux/mfd/tmio.h>
#include <linux/clk.h>
#include "tmio_mmc.h"
......@@ -57,10 +58,18 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
msleep(10);
if (!IS_ERR(host->clk) && host->clk_is_running) {
clk_disable(host->clk);
host->clk_is_running = false;
}
}
static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
{
if (!IS_ERR(host->clk) && !host->clk_is_running &&
!clk_enable(host->clk))
host->clk_is_running = true;
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
msleep(10);
......@@ -567,6 +576,11 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
goto unmap_cnf;
}
host->clk = clk_get(&dev->dev, pdata->clk_name);
if (!IS_ERR(host->clk) && !clk_enable(host->clk))
host->clk_is_running = true;
/* Enable the MMC/SD Control registers */
sd_config_write16(host, CNF_CMD, SDCREN);
sd_config_write32(host, CNF_CTL_BASE,
......@@ -608,6 +622,11 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
return 0;
unmap_cnf:
if (!IS_ERR(host->clk)) {
clk_disable(host->clk);
host->clk_is_running = false;
clk_put(host->clk);
}
if (host->cnf)
iounmap(host->cnf);
unmap_ctl:
......@@ -632,6 +651,8 @@ static int __devexit tmio_mmc_remove(struct platform_device *dev)
if (host->cnf)
iounmap(host->cnf);
mmc_free_host(mmc);
if (!IS_ERR(host->clk))
clk_put(host->clk);
}
return 0;
......
......@@ -108,6 +108,7 @@
sd_ctrl_write32((host), CTL_STATUS, mask); \
} while (0)
struct clk;
struct tmio_mmc_host {
void __iomem *cnf;
......@@ -117,6 +118,8 @@ struct tmio_mmc_host {
struct mmc_request *mrq;
struct mmc_data *data;
struct mmc_host *mmc;
struct clk *clk;
bool clk_is_running;
int irq;
/* pio related stuff */
......
......@@ -23,6 +23,7 @@
*/
struct tmio_mmc_data {
const unsigned int hclk;
const char *clk_name;
};
/*
......
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