diff mbox

[PATCHv2,1/3] dt-bindings: spi: Add DT bindings for Synquacer

Message ID 1516021559-19327-1-git-send-email-jassisinghbrar@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jassi Brar Jan. 15, 2018, 1:05 p.m. UTC
From: Jassi Brar <jaswinder.singh@linaro.org>

This patch adds documentation for Device-Tree bindings for the
Socionext Synquacer spi driver.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
 .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt

Comments

Rob Herring Jan. 15, 2018, 3:15 p.m. UTC | #1
On Mon, Jan 15, 2018 at 7:05 AM,  <jassisinghbrar@gmail.com> wrote:
> From: Jassi Brar <jaswinder.singh@linaro.org>
>
> This patch adds documentation for Device-Tree bindings for the
> Socionext Synquacer spi driver.
>
> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
> ---
>  .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt
>
> diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
> new file mode 100644
> index 0000000..d013cfd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
> @@ -0,0 +1,24 @@
> +* Socionext Synquacer HS-SPI bindings
> +
> +Required Properties:
> +- compatible: should be "socionext,synquacer-spi"
> +- reg: physical base address of the controller and length of memory mapped
> +       region.
> +- clocks: Must contain an entry for rate source clock(s).
> +- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK

Huh? The clock binding should reflect all clocks connected to a block,
not a selection of which one you want to use.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jassi Brar Jan. 15, 2018, 3:53 p.m. UTC | #2
On Mon, Jan 15, 2018 at 8:45 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Mon, Jan 15, 2018 at 7:05 AM,  <jassisinghbrar@gmail.com> wrote:
>> From: Jassi Brar <jaswinder.singh@linaro.org>
>>
>> This patch adds documentation for Device-Tree bindings for the
>> Socionext Synquacer spi driver.
>>
>> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>> ---
>>  .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>
>> diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>> new file mode 100644
>> index 0000000..d013cfd
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>> @@ -0,0 +1,24 @@
>> +* Socionext Synquacer HS-SPI bindings
>> +
>> +Required Properties:
>> +- compatible: should be "socionext,synquacer-spi"
>> +- reg: physical base address of the controller and length of memory mapped
>> +       region.
>> +- clocks: Must contain an entry for rate source clock(s).
>> +- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK
>
> Huh? The clock binding should reflect all clocks connected to a block,
> not a selection of which one you want to use.
>
Both the clocks are internal to the block and derived from the same source.
Instead of defining a new "use-ipclk" property, the driver uses the
clock-names to choose the appropriate divider.
I am open to any better option.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Jan. 15, 2018, 5:17 p.m. UTC | #3
On Mon, Jan 15, 2018 at 9:53 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
> On Mon, Jan 15, 2018 at 8:45 PM, Rob Herring <robh+dt@kernel.org> wrote:
>> On Mon, Jan 15, 2018 at 7:05 AM,  <jassisinghbrar@gmail.com> wrote:
>>> From: Jassi Brar <jaswinder.singh@linaro.org>
>>>
>>> This patch adds documentation for Device-Tree bindings for the
>>> Socionext Synquacer spi driver.
>>>
>>> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>>> ---
>>>  .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
>>>  1 file changed, 24 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>> new file mode 100644
>>> index 0000000..d013cfd
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>> @@ -0,0 +1,24 @@
>>> +* Socionext Synquacer HS-SPI bindings
>>> +
>>> +Required Properties:
>>> +- compatible: should be "socionext,synquacer-spi"
>>> +- reg: physical base address of the controller and length of memory mapped
>>> +       region.
>>> +- clocks: Must contain an entry for rate source clock(s).
>>> +- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK
>>
>> Huh? The clock binding should reflect all clocks connected to a block,
>> not a selection of which one you want to use.
>>
> Both the clocks are internal to the block and derived from the same source.
> Instead of defining a new "use-ipclk" property, the driver uses the
> clock-names to choose the appropriate divider.
> I am open to any better option.

If one is preferred, then why not always use it? Or how does one
decide which clock to use?

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jassi Brar Jan. 16, 2018, 3:29 a.m. UTC | #4
On Mon, Jan 15, 2018 at 10:47 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Mon, Jan 15, 2018 at 9:53 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
>> On Mon, Jan 15, 2018 at 8:45 PM, Rob Herring <robh+dt@kernel.org> wrote:
>>> On Mon, Jan 15, 2018 at 7:05 AM,  <jassisinghbrar@gmail.com> wrote:
>>>> From: Jassi Brar <jaswinder.singh@linaro.org>
>>>>
>>>> This patch adds documentation for Device-Tree bindings for the
>>>> Socionext Synquacer spi driver.
>>>>
>>>> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>>>> ---
>>>>  .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
>>>>  1 file changed, 24 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>> new file mode 100644
>>>> index 0000000..d013cfd
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>> @@ -0,0 +1,24 @@
>>>> +* Socionext Synquacer HS-SPI bindings
>>>> +
>>>> +Required Properties:
>>>> +- compatible: should be "socionext,synquacer-spi"
>>>> +- reg: physical base address of the controller and length of memory mapped
>>>> +       region.
>>>> +- clocks: Must contain an entry for rate source clock(s).
>>>> +- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK
>>>
>>> Huh? The clock binding should reflect all clocks connected to a block,
>>> not a selection of which one you want to use.
>>>
>> Both the clocks are internal to the block and derived from the same source.
>> Instead of defining a new "use-ipclk" property, the driver uses the
>> clock-names to choose the appropriate divider.
>> I am open to any better option.
>
> If one is preferred, then why not always use it? Or how does one
> decide which clock to use?
>
A slight correction, there is a mux inside the block which selects
clock from two input ports (iPCLK and iHCLK) and send that to the
divider. Depending upon the spi slave speed requirements the platform
may choose to connect either PCLK or HCLK (or maybe both but switching
is said to be not feasible without block reset and DT can't suggest
switch in runtime so we ask DT to provide only the source clock).

Now the idea dawns that DT provide both clocks and the driver select
from the mux looking at speed requirements of the slave at runtime.
However, then, there will be a wide range of speeds that both could
provide. Not to forget the block drives 4 slaves and optimising speed
for one could potentially break other slaves. Practically the h/w
designer would have already thought of speed requirements of the
slaves and made sure that port is populated .... the driver could
simple count upon that good design.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Trent Piepho Jan. 16, 2018, 8:02 p.m. UTC | #5
T24gVHVlLCAyMDE4LTAxLTE2IGF0IDA4OjU5ICswNTMwLCBKYXNzaSBCcmFyIHdyb3RlOg0KPiBP
biBNb24sIEphbiAxNSwgMjAxOCBhdCAxMDo0NyBQTSwgUm9iIEhlcnJpbmcgPHJvYmgrZHRAa2Vy
bmVsLm9yZz4gd3JvdGU6DQo+ID4gT24gTW9uLCBKYW4gMTUsIDIwMTggYXQgOTo1MyBBTSwgSmFz
c2kgQnJhciA8amFzc2lzaW5naGJyYXJAZ21haWwuY29tPiB3cm90ZToNCj4gPiA+IE9uIE1vbiwg
SmFuIDE1LCAyMDE4IGF0IDg6NDUgUE0sIFJvYiBIZXJyaW5nIDxyb2JoK2R0QGtlcm5lbC5vcmc+
IHdyb3RlOg0KPiA+ID4gPiBPbiBNb24sIEphbiAxNSwgMjAxOCBhdCA3OjA1IEFNLCAgPGphc3Np
c2luZ2hicmFyQGdtYWlsLmNvbT4gd3JvdGU6DQo+ID4gPiA+ID4gDQo+ID4gPiA+ID4gKy0gY2xv
Y2tzOiBNdXN0IGNvbnRhaW4gYW4gZW50cnkgZm9yIHJhdGUgc291cmNlIGNsb2NrKHMpLg0KPiA+
ID4gPiA+ICstIGNsb2NrLW5hbWVzOiBTaGFsbCBiZSAiaUhDTEsiIG9yICJpUENMSyIuIGlIQ0xL
IGlzIHByZWZlcnJlZCBvdmVyIGlQQ0xLDQo+ID4gPiA+IA0KPiA+ID4gPiBIdWg/IFRoZSBjbG9j
ayBiaW5kaW5nIHNob3VsZCByZWZsZWN0IGFsbCBjbG9ja3MgY29ubmVjdGVkIHRvIGEgYmxvY2ss
DQo+ID4gPiA+IG5vdCBhIHNlbGVjdGlvbiBvZiB3aGlj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
b2NrLCBzb3VuZHMgcmF0aGVyIGRpZmZpY3VsdC4NCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jassi Brar Jan. 17, 2018, 10 a.m. UTC | #6
On Mon, Jan 15, 2018 at 10:47 PM, Rob Herring <robh+dt@kernel.org> wrote:
> On Mon, Jan 15, 2018 at 9:53 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
>> On Mon, Jan 15, 2018 at 8:45 PM, Rob Herring <robh+dt@kernel.org> wrote:
>>> On Mon, Jan 15, 2018 at 7:05 AM,  <jassisinghbrar@gmail.com> wrote:
>>>> From: Jassi Brar <jaswinder.singh@linaro.org>
>>>>
>>>> This patch adds documentation for Device-Tree bindings for the
>>>> Socionext Synquacer spi driver.
>>>>
>>>> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>>>> ---
>>>>  .../devicetree/bindings/spi/spi-synquacer.txt      | 24 ++++++++++++++++++++++
>>>>  1 file changed, 24 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>> new file mode 100644
>>>> index 0000000..d013cfd
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
>>>> @@ -0,0 +1,24 @@
>>>> +* Socionext Synquacer HS-SPI bindings
>>>> +
>>>> +Required Properties:
>>>> +- compatible: should be "socionext,synquacer-spi"
>>>> +- reg: physical base address of the controller and length of memory mapped
>>>> +       region.
>>>> +- clocks: Must contain an entry for rate source clock(s).
>>>> +- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK
>>>
>>> Huh? The clock binding should reflect all clocks connected to a block,
>>> not a selection of which one you want to use.
>>>
>> Both the clocks are internal to the block and derived from the same source.
>> Instead of defining a new "use-ipclk" property, the driver uses the
>> clock-names to choose the appropriate divider.
>> I am open to any better option.
>
> If one is preferred, then why not always use it? Or how does one
> decide which clock to use?
>
So I got my native speaker friend to interpret the Japanese datasheet.

The iHCLK clocks the whole block and can also be the source for
internal dividers. An external, optional, source iPCLK is also
provided for producing lower (Fpclk < Fhclk) rates from the dividers.
That is, iHCLK is always needed, while iPCLK can be provided if that
is to be fed to the dividers.

So the dt bindings should define one required clock (iHCLK) and
another optional clock (iPCLK). The driver would use iPCLK if
provided, otherwise the default iHCLK.

Will update DT and driver for next submission.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Jan. 17, 2018, 11:18 a.m. UTC | #7
On Tue, Jan 16, 2018 at 08:02:06PM +0000, Trent Piepho wrote:
> On Tue, 2018-01-16 at 08:59 +0530, Jassi Brar wrote:

> > Now the idea dawns that DT provide both clocks and the driver select
> > from the mux looking at speed requirements of the slave at runtime.

> add this feature at some point.  It might be simpler to just prefer
> HCLK if both are there.  The idea being that the DT should describe the
> hardware rather than tell the driver what to do.

Or only try one if the other fails to give something.

> Speed can be changed on a xfer by xfer basis on a single message to a
> single slave.  Trying to switch clocks during a message, if it requires
> resetting the whole block, sounds rather difficult.

In practice that's so vanishingly rare it's probably not worth worrying
about.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-synquacer.txt b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
new file mode 100644
index 0000000..d013cfd
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-synquacer.txt
@@ -0,0 +1,24 @@ 
+* Socionext Synquacer HS-SPI bindings
+
+Required Properties:
+- compatible: should be "socionext,synquacer-spi"
+- reg: physical base address of the controller and length of memory mapped
+       region.
+- clocks: Must contain an entry for rate source clock(s).
+- clock-names: Shall be "iHCLK" or "iPCLK". iHCLK is preferred over iPCLK
+
+Optional Properties:
+- num-cs: total number of chipselects
+- socionext,use-rtm: boolean, if required to use "retimed clock" for RX
+- socionext,set-aces: boolean, if same active clock edges field to be set.
+
+Example:
+
+	spi0: spi@ff110000 {
+		compatible = "socionext,synquacer-spi";
+		reg = <0xff110000 0x1000>;
+		clocks = <&clk_fip006_spi>;
+		clock-names = "iHCLK";
+		socionext,use-rtm;
+		socionext,set-aces;
+	};