linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shubhrajyoti Datta <shubhrajyoti.datta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
To: <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: <soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	<broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Shubhrajyoti Datta
	<shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
Subject: [PATCHv2 2/3] spi/spi-xilinx:  Add clock support
Date: Wed, 9 Mar 2016 14:17:21 +0530	[thread overview]
Message-ID: <1457513242-11202-2-git-send-email-shubhraj@xilinx.com> (raw)
In-Reply-To: <1457513242-11202-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

Add basic clock support. The clocks are requested at probe
and released at remove.

Acked-by: Sören Brinkmann <soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Shubhrajyoti Datta <shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
v2 changes
Add ack

 drivers/spi/spi-xilinx.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 3009121..7e12338 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -21,6 +21,7 @@
 #include <linux/spi/spi_bitbang.h>
 #include <linux/spi/xilinx_spi.h>
 #include <linux/io.h>
+#include <linux/clk.h>
 
 #define XILINX_SPI_MAX_CS	32
 
@@ -83,6 +84,7 @@ struct xilinx_spi {
 	struct spi_bitbang bitbang;
 	struct completion done;
 	void __iomem	*regs;	/* virt. address of the control registers */
+	struct clk *clk;
 
 	int		irq;
 
@@ -428,6 +430,15 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 		goto put_master;
 	}
 
+	xspi->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(xspi->clk)) {
+		dev_err(&pdev->dev, "input clock not found.\n");
+		return PTR_ERR(xspi->clk);
+	}
+	ret = clk_prepare_enable(xspi->clk);
+	if (ret)
+		dev_err(&pdev->dev, "Unable to enable clock.\n");
+
 	master->bus_num = pdev->id;
 	master->num_chipselect = num_cs;
 	master->dev.of_node = pdev->dev.of_node;
@@ -485,6 +496,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 
 put_master:
 	spi_master_put(master);
+	clk_disable_unprepare(xspi->clk);
 
 	return ret;
 }
@@ -503,6 +515,7 @@ static int xilinx_spi_remove(struct platform_device *pdev)
 	xspi->write_fn(0, regs_base + XIPIF_V123B_DGIER_OFFSET);
 
 	spi_master_put(xspi->bitbang.master);
+	clk_disable_unprepare(xspi->clk);
 
 	return 0;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-03-09  8:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09  8:47 [PATCHv2 1/3] bindings: spi: Add devicetree binding for spi-xilinx Shubhrajyoti Datta
     [not found] ` <1457513242-11202-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-09  8:47   ` Shubhrajyoti Datta [this message]
     [not found]     ` <1457513242-11202-2-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-10  3:29       ` [PATCHv2 2/3] spi/spi-xilinx: Add clock support Mark Brown
     [not found]         ` <20160310032948.GI3898-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-10 11:20           ` Shubhrajyoti Datta
2016-03-09  8:47   ` [PATCHv2 3/3] bindings: spi: Add clock entries for spi-xilinx Shubhrajyoti Datta
2016-03-10  3:30   ` [PATCHv2 1/3] bindings: spi: Add devicetree binding " Mark Brown
     [not found]     ` <20160310033027.GJ3898-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-17 16:43       ` Rob Herring
2016-03-17 16:46         ` Mark Brown
2016-03-10  3:39   ` Applied "spi: xilinx: Add devicetree binding for spi-xilinx" to the spi tree Mark Brown
2016-03-17 16:32   ` [PATCHv2 1/3] bindings: spi: Add devicetree binding for spi-xilinx Rob Herring

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=1457513242-11202-2-git-send-email-shubhraj@xilinx.com \
    --to=shubhrajyoti.datta-gjffaj9ahvfqt0dzr+alfa@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    --cc=shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    --cc=soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.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).