diff mbox

[v2,4/5] spi: dw: document device tree binding

Message ID 211f8d2101fff1790526f7dff766d0d9efff9280.1390723880.git.baruch@tkos.co.il (mailing list archive)
State Accepted
Commit 20e5ea191524b482e1b4aa12b5ff4684717f44b8
Headers show

Commit Message

Baruch Siach Jan. 26, 2014, 8:14 a.m. UTC
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 Documentation/devicetree/bindings/spi/spi-dw.txt | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-dw.txt

Comments

Mark Brown Jan. 27, 2014, 7:08 p.m. UTC | #1
On Sun, Jan 26, 2014 at 10:14:35AM +0200, Baruch Siach wrote:

> +Required properties:

> +- num-cs: see spi-bus.txt

Why is this mandatory, in the code it was optional?  One or the other
ought to be updated.
Baruch Siach Jan. 27, 2014, 7:18 p.m. UTC | #2
Hi Mark,

On Mon, Jan 27, 2014 at 07:08:39PM +0000, Mark Brown wrote:
> On Sun, Jan 26, 2014 at 10:14:35AM +0200, Baruch Siach wrote:
> 
> > +Required properties:
> 
> > +- num-cs: see spi-bus.txt
> 
> Why is this mandatory, in the code it was optional?  One or the other
> ought to be updated.

The code defaults to 4. I guess that's what the hardware this code was tested 
on had. But this default doesn't make much sense in the general case. Anyway, 
for backwards compatibility I'll document this property as optional, note that 
the default is 4, and recommend to add this property anyway. Does this sound 
reasonable?

baruch
Mark Brown Jan. 27, 2014, 7:22 p.m. UTC | #3
On Mon, Jan 27, 2014 at 09:18:10PM +0200, Baruch Siach wrote:
> On Mon, Jan 27, 2014 at 07:08:39PM +0000, Mark Brown wrote:
> > On Sun, Jan 26, 2014 at 10:14:35AM +0200, Baruch Siach wrote:

> > > +Required properties:

> > > +- num-cs: see spi-bus.txt

> > Why is this mandatory, in the code it was optional?  One or the other
> > ought to be updated.

> The code defaults to 4. I guess that's what the hardware this code was tested 
> on had. But this default doesn't make much sense in the general case. Anyway, 
> for backwards compatibility I'll document this property as optional, note that 
> the default is 4, and recommend to add this property anyway. Does this sound 
> reasonable?

This is a new binding, why would it have to be backwards compatible with
anything?
Baruch Siach Jan. 28, 2014, 4:53 a.m. UTC | #4
Hi Mark,

On Mon, Jan 27, 2014 at 07:22:51PM +0000, Mark Brown wrote:
> On Mon, Jan 27, 2014 at 09:18:10PM +0200, Baruch Siach wrote:
> > On Mon, Jan 27, 2014 at 07:08:39PM +0000, Mark Brown wrote:
> > > On Sun, Jan 26, 2014 at 10:14:35AM +0200, Baruch Siach wrote:
> 
> > > > +Required properties:
> 
> > > > +- num-cs: see spi-bus.txt
> 
> > > Why is this mandatory, in the code it was optional?  One or the other
> > > ought to be updated.
> 
> > The code defaults to 4. I guess that's what the hardware this code was tested 
> > on had. But this default doesn't make much sense in the general case. Anyway, 
> > for backwards compatibility I'll document this property as optional, note that 
> > the default is 4, and recommend to add this property anyway. Does this sound 
> > reasonable?
> 
> This is a new binding, why would it have to be backwards compatible with
> anything?

I meant driver compatibility. I used to work that way, and should continue 
doing so in non-DT environment. I suggest to make num-cs mandatory for DT, but 
keep the existing behaviour for non-DT. I'll update the code then.

baruch
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-dw.txt b/Documentation/devicetree/bindings/spi/spi-dw.txt
new file mode 100644
index 000000000000..7b63ed601990
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-dw.txt
@@ -0,0 +1,24 @@ 
+Synopsys DesignWare SPI master
+
+Required properties:
+- compatible: should be "snps,designware-spi"
+- #address-cells: see spi-bus.txt
+- #size-cells: see spi-bus.txt
+- reg: address and length of the spi master registers
+- interrupts: should contain one interrupt
+- clocks: spi clock phandle
+- num-cs: see spi-bus.txt
+
+Optional properties:
+- cs-gpios: see spi-bus.txt
+
+Example:
+
+spi: spi@4020a000 {
+	compatible = "snps,designware-spi";
+	interrupts = <11 1>;
+	reg = <0x4020a000 0x1000>;
+	clocks = <&pclk>;
+	num-cs = <2>;
+	cs-gpios = <&banka 0 0>;
+};