* [PATCH] spi/spi-xilinx: Add clock support
@ 2016-03-08 8:42 Shubhrajyoti Datta
[not found] ` <1457426528-15247-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-08 8:42 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, Shubhrajyoti Datta
Add basic clock support. The clocks are requested at probe
and released at remove.
Signed-off-by: Shubhrajyoti Datta <shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
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 linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] spi/spi-xilinx: Add clock support
[not found] ` <1457426528-15247-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2016-03-08 18:02 ` Sören Brinkmann
2016-03-09 2:42 ` Mark Brown
2016-03-09 9:07 ` Lars-Peter Clausen
2 siblings, 0 replies; 5+ messages in thread
From: Sören Brinkmann @ 2016-03-08 18:02 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, Shubhrajyoti Datta
On Tue, 2016-03-08 at 14:12:08 +0530, Shubhrajyoti Datta wrote:
> Add basic clock support. The clocks are requested at probe
> and released at remove.
>
> Signed-off-by: Shubhrajyoti Datta <shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
Acked-by: Sören Brinkmann <soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
Though, the DT bindings need to be updated accordingly.
Sören
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi/spi-xilinx: Add clock support
[not found] ` <1457426528-15247-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-08 18:02 ` Sören Brinkmann
@ 2016-03-09 2:42 ` Mark Brown
[not found] ` <20160309024200.GD3898-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-09 9:07 ` Lars-Peter Clausen
2 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2016-03-09 2:42 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA, Shubhrajyoti Datta
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
On Tue, Mar 08, 2016 at 02:12:08PM +0530, Shubhrajyoti Datta wrote:
> + 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);
> + }
This changes the DT binding but does not update the binding document.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] spi/spi-xilinx: Add clock support
[not found] ` <20160309024200.GD3898-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2016-03-09 8:53 ` Shubhrajyoti Datta
0 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-09 8:53 UTC (permalink / raw)
To: Mark Brown
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Soren Brinkmann, Michal Simek
> -----Original Message-----
> From: Mark Brown [mailto:broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org]
> Sent: Wednesday, March 09, 2016 8:12 AM
> To: Shubhrajyoti Datta
> Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Soren Brinkmann; Michal Simek; Shubhrajyoti
> Datta
> Subject: Re: [PATCH] spi/spi-xilinx: Add clock support
>
> On Tue, Mar 08, 2016 at 02:12:08PM +0530, Shubhrajyoti Datta wrote:
>
> > + 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);
> > + }
>
> This changes the DT binding but does not update the binding document.
Thanks for review fixed in v2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi/spi-xilinx: Add clock support
[not found] ` <1457426528-15247-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-08 18:02 ` Sören Brinkmann
2016-03-09 2:42 ` Mark Brown
@ 2016-03-09 9:07 ` Lars-Peter Clausen
2 siblings, 0 replies; 5+ messages in thread
From: Lars-Peter Clausen @ 2016-03-09 9:07 UTC (permalink / raw)
To: Shubhrajyoti Datta, linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, Shubhrajyoti Datta
On 03/08/2016 09:42 AM, Shubhrajyoti Datta wrote:
> Add basic clock support. The clocks are requested at probe
> and released at remove.
>
> Signed-off-by: Shubhrajyoti Datta <shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> ---
> 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);
Considering that the core has multiple clock inputs this should specify
which clock you are referencing here.
Also this breaks existing devicetrees which do not specify the clock...
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-09 9:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08 8:42 [PATCH] spi/spi-xilinx: Add clock support Shubhrajyoti Datta
[not found] ` <1457426528-15247-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-08 18:02 ` Sören Brinkmann
2016-03-09 2:42 ` Mark Brown
[not found] ` <20160309024200.GD3898-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-09 8:53 ` Shubhrajyoti Datta
2016-03-09 9:07 ` Lars-Peter Clausen
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).