From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] spi i.MX: do not depend on grouped clocks
Date: Thu, 8 Mar 2012 22:42:29 +0100 [thread overview]
Message-ID: <1331242949-22780-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1331242949-22780-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/spi/spi-imx.c | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index c6e697f..dc32976 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -79,13 +79,20 @@ struct spi_imx_devtype_data {
enum spi_imx_devtype devtype;
};
+enum {
+ CLK_PER,
+ CLK_IPG,
+};
+static const char *clknames[] = {"per", "ipg"};
+#define NUM_CLOCKS ARRAY_SIZE(clknames)
+
struct spi_imx_data {
struct spi_bitbang bitbang;
struct completion xfer_done;
void *base;
int irq;
- struct clk *clk;
+ struct clk *clk[NUM_CLOCKS];
unsigned long spi_clk;
unsigned int count;
@@ -846,15 +853,16 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
goto out_iounmap;
}
- spi_imx->clk = clk_get(&pdev->dev, NULL);
- if (IS_ERR(spi_imx->clk)) {
+ ret = clk_get_array(&pdev->dev, spi_imx->clk, clknames, NUM_CLOCKS, 1);
+ if (ret) {
dev_err(&pdev->dev, "unable to get clock\n");
- ret = PTR_ERR(spi_imx->clk);
goto out_free_irq;
}
- clk_enable(spi_imx->clk);
- spi_imx->spi_clk = clk_get_rate(spi_imx->clk);
+ clk_prepare_enable(spi_imx->clk[CLK_IPG]);
+ clk_prepare_enable(spi_imx->clk[CLK_PER]);
+
+ spi_imx->spi_clk = clk_get_rate(spi_imx->clk[CLK_PER]);
spi_imx->devtype_data->reset(spi_imx);
@@ -872,8 +880,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
return ret;
out_clk_put:
- clk_disable(spi_imx->clk);
- clk_put(spi_imx->clk);
+ clk_disable_unprepare(spi_imx->clk[CLK_PER]);
+ clk_disable_unprepare(spi_imx->clk[CLK_IPG]);
+ clk_put_array(spi_imx->clk, NUM_CLOCKS);
out_free_irq:
free_irq(spi_imx->irq, spi_imx);
out_iounmap:
@@ -901,8 +910,9 @@ static int __devexit spi_imx_remove(struct platform_device *pdev)
spi_bitbang_stop(&spi_imx->bitbang);
writel(0, spi_imx->base + MXC_CSPICTRL);
- clk_disable(spi_imx->clk);
- clk_put(spi_imx->clk);
+ clk_disable_unprepare(spi_imx->clk[CLK_PER]);
+ clk_disable_unprepare(spi_imx->clk[CLK_IPG]);
+ clk_put_array(spi_imx->clk, NUM_CLOCKS);
free_irq(spi_imx->irq, spi_imx);
iounmap(spi_imx->base);
--
1.7.9.1
next prev parent reply other threads:[~2012-03-08 21:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 21:42 [RFC] i.MX: drop secondary clocks Sascha Hauer
2012-03-08 21:42 ` [PATCH 1/2] clk: Add helper to get/put arrays of clocks Sascha Hauer
2012-03-08 21:42 ` Sascha Hauer [this message]
2012-03-09 8:03 ` [RFC] i.MX: drop secondary clocks Shawn Guo
2012-03-09 9:32 ` Lothar Waßmann
2012-03-09 10:29 ` Sascha Hauer
2012-03-09 11:47 ` Lothar Waßmann
2012-03-09 14:20 ` Richard Zhao
2012-03-09 14:22 ` Sascha Hauer
2012-03-09 14:44 ` Lothar Waßmann
2012-03-09 16:09 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331242949-22780-3-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).