diff options
author | Andrew Lunn <andrew@lunn.ch> | 2012-02-19 11:39:27 +0100 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-05-08 16:34:00 -0700 |
commit | f4f7561e032777cd7376800ac97352d5b1684d8f (patch) | |
tree | ec47b2eb43e0227fea2ef4ee47d70d03f02da681 /drivers/mmc | |
parent | 9c2bd504b55ce3e680ae0d3768e78c15fef3448d (diff) | |
download | linux-stable-f4f7561e032777cd7376800ac97352d5b1684d8f.tar.gz linux-stable-f4f7561e032777cd7376800ac97352d5b1684d8f.tar.bz2 linux-stable-f4f7561e032777cd7376800ac97352d5b1684d8f.zip |
ARM: Orion: SDIO: Add support for clk.
Some orion devices can gate the SDIO clock. If the clock exists,
enable/disable it as appropriate.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/mvsdio.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index eeb8cd125b0c..3b9136c1a475 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -19,6 +19,7 @@ #include <linux/dma-mapping.h> #include <linux/scatterlist.h> #include <linux/irq.h> +#include <linux/clk.h> #include <linux/gpio.h> #include <linux/mmc/host.h> @@ -51,6 +52,7 @@ struct mvsd_host { struct device *dev; struct resource *res; int irq; + struct clk *clk; int gpio_card_detect; int gpio_write_protect; }; @@ -770,6 +772,13 @@ static int __init mvsd_probe(struct platform_device *pdev) } else host->irq = irq; + /* Not all platforms can gate the clock, so it is not + an error if the clock does not exists. */ + host->clk = clk_get(&pdev->dev, NULL); + if (!IS_ERR(host->clk)) { + clk_prepare_enable(host->clk); + } + if (mvsd_data->gpio_card_detect) { ret = gpio_request(mvsd_data->gpio_card_detect, DRIVER_NAME " cd"); @@ -854,6 +863,11 @@ static int __exit mvsd_remove(struct platform_device *pdev) mvsd_power_down(host); iounmap(host->base); release_resource(host->res); + + if (!IS_ERR(host->clk)) { + clk_disable_unprepare(host->clk); + clk_put(host->clk); + } mmc_free_host(mmc); } platform_set_drvdata(pdev, NULL); |