* [PATCHv3 1/2] spi/spi-xilinx: Add clock support
@ 2016-03-10 12:11 Shubhrajyoti Datta
[not found] ` <1457611865-40120-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-10 12:11 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, lars-Qo5EllUWu/uELgA04lAiVw,
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>
---
v3 changes:
Do not fail probe if no clock is given
Add a clk name
Fix some space errors
drivers/spi/spi-xilinx.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 3009121..426ce12 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,22 @@ static int xilinx_spi_probe(struct platform_device *pdev)
goto put_master;
}
+ xspi->clk = devm_clk_get(&pdev->dev, "spi_fclk");
+ if (IS_ERR(xspi->clk)) {
+ if (PTR_ERR(xspi->clk) == -ENOENT) {
+ xspi->clk = NULL;
+ } else {
+ ret = PTR_ERR(xspi->clk);
+ goto put_master;
+ }
+ }
+
+ ret = clk_prepare_enable(xspi->clk);
+ if (ret) {
+ dev_err(&pdev->dev, "Unable to enable clock.\n");
+ goto put_master;
+ }
+
master->bus_num = pdev->id;
master->num_chipselect = num_cs;
master->dev.of_node = pdev->dev.of_node;
@@ -485,6 +503,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 +522,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] 6+ messages in thread
* [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
[not found] ` <1457611865-40120-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2016-03-10 12:11 ` Shubhrajyoti Datta
[not found] ` <1457611865-40120-2-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-10 12:11 UTC (permalink / raw)
To: linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, lars-Qo5EllUWu/uELgA04lAiVw,
Shubhrajyoti Datta
Add clock description for spi-xilinx
Signed-off-by: Shubhrajyoti Datta <shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
v3
Add a clock name
.../devicetree/bindings/spi/spi-xilinx.txt | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/spi/spi-xilinx.txt b/Documentation/devicetree/bindings/spi/spi-xilinx.txt
index c7b7856..71bd464 100644
--- a/Documentation/devicetree/bindings/spi/spi-xilinx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-xilinx.txt
@@ -7,6 +7,9 @@ Required properties:
- interrupts : Property with a value describing the interrupt
number.
- interrupt-parent : Must be core interrupt controller
+- clocks: Input clock specifier. Refer to common clock bindings.
+- clock-names: tuple listing input clock names.
+ Required elements: "spi_fclk"
Optional properties:
- xlnx,num-ss-bits : Number of chip selects used.
@@ -14,6 +17,8 @@ Optional properties:
Example:
axi_quad_spi@41e00000 {
compatible = "xlnx,xps-spi-2.00.a";
+ clocks = <&clkc 15>;
+ clock-names = "spi_fclk";
interrupt-parent = <&intc>;
interrupts = <0 31 1>;
reg = <0x41e00000 0x10000>;
--
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] 6+ messages in thread
* Re: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
[not found] ` <1457611865-40120-2-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2016-03-10 12:39 ` Lars-Peter Clausen
[not found] ` <56E16B1F.3050701-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-03-10 12:39 UTC (permalink / raw)
To: Shubhrajyoti Datta, linux-spi-u79uwXL29TY76Z2rM5mHXA
Cc: soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
broonie-DgEjT+Ai2ygdnm+yROfE0A, Shubhrajyoti Datta
On 03/10/2016 01:11 PM, Shubhrajyoti Datta wrote:
[...]
> @@ -7,6 +7,9 @@ Required properties:
> - interrupts : Property with a value describing the interrupt
> number.
> - interrupt-parent : Must be core interrupt controller
> +- clocks: Input clock specifier. Refer to common clock bindings.
> +- clock-names: tuple listing input clock names.
> + Required elements: "spi_fclk"
Sorry for being pedantic, but the core has two clock input "s_axi_aclk" and
"ext_spi_clk". Which one is "spi_fclk"?
- 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] 6+ messages in thread
* RE: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
[not found] ` <56E16B1F.3050701-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
@ 2016-03-11 5:20 ` Shubhrajyoti Datta
[not found] ` <4EED9C67BE3EF440A606099F8E34C5282652FCBB-4lKfpRxZ5enZMOc0yg5rMog+Gb3gawCHQz34XiSyOiE@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-11 5:20 UTC (permalink / raw)
To: Lars-Peter Clausen,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Soren Brinkmann,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Simek,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
> -----Original Message-----
> From: Lars-Peter Clausen [mailto:lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org]
> Sent: Thursday, March 10, 2016 6:10 PM
> To: Shubhrajyoti Datta; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Soren Brinkmann; devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Michal Simek;
> broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; Shubhrajyoti Datta
> Subject: Re: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
>
> On 03/10/2016 01:11 PM, Shubhrajyoti Datta wrote:
> [...]
> > @@ -7,6 +7,9 @@ Required properties:
> > - interrupts : Property with a value describing the interrupt
> > number.
> > - interrupt-parent : Must be core interrupt controller
> > +- clocks: Input clock specifier. Refer to common clock bindings.
> > +- clock-names: tuple listing input clock names.
> > + Required elements: "spi_fclk"
>
> Sorry for being pedantic, but the core has two clock input "" and
> "ext_spi_clk". Which one is "spi_fclk"?
However for all my designs I adhere to the recommendation see below both are from the same clock source.
I named it spi_fclk.
Do you think I should have 2 clocks requests on the same clock.
http://www.xilinx.com/support/documentation/ip_documentation/axi_quad_spi/v2_00_a/ds843_axi_quad_spi.pdf
page 12
15. It is recommended that the AXI4 interface clock and EXT_SPI_CLK clock originate from the same clock source.
>
> - 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] 6+ messages in thread
* Re: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
[not found] ` <4EED9C67BE3EF440A606099F8E34C5282652FCBB-4lKfpRxZ5enZMOc0yg5rMog+Gb3gawCHQz34XiSyOiE@public.gmane.org>
@ 2016-03-11 6:21 ` Sören Brinkmann
2016-03-11 6:27 ` Shubhrajyoti Datta
0 siblings, 1 reply; 6+ messages in thread
From: Sören Brinkmann @ 2016-03-11 6:21 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: Lars-Peter Clausen,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Soren Brinkmann,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Simek,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
On Thu, 2016-03-10 at 21:20:39 -0800, Shubhrajyoti Datta wrote:
>
>
> > -----Original Message-----
> > From: Lars-Peter Clausen [mailto:lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org]
> > Sent: Thursday, March 10, 2016 6:10 PM
> > To: Shubhrajyoti Datta; linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Cc: Soren Brinkmann; devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Michal Simek;
> > broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; Shubhrajyoti Datta
> > Subject: Re: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
> >
> > On 03/10/2016 01:11 PM, Shubhrajyoti Datta wrote:
> > [...]
> > > @@ -7,6 +7,9 @@ Required properties:
> > > - interrupts : Property with a value describing the interrupt
> > > number.
> > > - interrupt-parent : Must be core interrupt controller
> > > +- clocks: Input clock specifier. Refer to common clock bindings.
> > > +- clock-names: tuple listing input clock names.
> > > + Required elements: "spi_fclk"
> >
> > Sorry for being pedantic, but the core has two clock input "" and
> > "ext_spi_clk". Which one is "spi_fclk"?
>
> However for all my designs I adhere to the recommendation see below both are from the same clock source.
> I named it spi_fclk.
>
> Do you think I should have 2 clocks requests on the same clock.
>
>
> http://www.xilinx.com/support/documentation/ip_documentation/axi_quad_spi/v2_00_a/ds843_axi_quad_spi.pdf
>
> page 12
>
> 15. It is recommended that the AXI4 interface clock and EXT_SPI_CLK clock originate from the same clock source.
If they can be separate they should both be modeled in the CCF. There is
no issue of them coming from the same source.
Also, the name should map to the name from the spec, as Lars pointed out
already. You should not invent new names for clocks that are clearly
defined in the data sheet.
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] 6+ messages in thread
* RE: [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx
2016-03-11 6:21 ` Sören Brinkmann
@ 2016-03-11 6:27 ` Shubhrajyoti Datta
0 siblings, 0 replies; 6+ messages in thread
From: Shubhrajyoti Datta @ 2016-03-11 6:27 UTC (permalink / raw)
Cc: Lars-Peter Clausen,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Soren Brinkmann,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Simek,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 867 bytes --]
>
> If they can be separate they should both be modeled in the CCF. There is no
> issue of them coming from the same source.
> Also, the name should map to the name from the spec, as Lars pointed out
> already. You should not invent new names for clocks that are clearly defined
> in the data sheet.
Will fix in the next version
>
> Sören
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±²¢Ø^nr¡ö¦zË\x1aëh¨èÚ&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br ê+Ê+zf£¢·h§~Ûiÿûàz¹\x1e®w¥¢¸?¨èÚ&¢)ߢ^[f
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-11 6:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 12:11 [PATCHv3 1/2] spi/spi-xilinx: Add clock support Shubhrajyoti Datta
[not found] ` <1457611865-40120-1-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-10 12:11 ` [PATCHv3 2/2] bindings: spi: Add clock entries for spi-xilinx Shubhrajyoti Datta
[not found] ` <1457611865-40120-2-git-send-email-shubhraj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2016-03-10 12:39 ` Lars-Peter Clausen
[not found] ` <56E16B1F.3050701-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2016-03-11 5:20 ` Shubhrajyoti Datta
[not found] ` <4EED9C67BE3EF440A606099F8E34C5282652FCBB-4lKfpRxZ5enZMOc0yg5rMog+Gb3gawCHQz34XiSyOiE@public.gmane.org>
2016-03-11 6:21 ` Sören Brinkmann
2016-03-11 6:27 ` Shubhrajyoti Datta
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).