Skip to contentSkip to conversation

dt-bindings: lora: sx130x: add basic documentation

PATCH Superseded Ben Whitten 4 participants 13 messages Jan 8, 2019 – Jan 21, 2019

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 dt-bindings: lora: sx130x: add basic documentation

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx130x.yaml
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +87 -0
new file mode 100644
index 000000000000..ad263bc4e60d
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx130x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech LoRa concentrator
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  Semtech LoRa concentrator sx130x digital baseband chip is capable of
+  demodulating LoRa signals on 8 channels simultaneously.
+
+  It is typically paired with two sx125x IQ radios controlled over an
+  SPI directly from the concentrator.
+
+  The concentrator itself it controlled over SPI.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1301
+        - semtech,sx1308
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus.
+
+  reset-gpios:
+    maxItems: 1
+    description: A connection of the reset gpio line.
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the concentrator,
+      in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
+      on a number of cards.
+
+  radio-spi:
+    description: The concentrator has two radios connected which are contained
+      within the following node.
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    required:
+      - '#address-cells'
+      - '#size-cells'
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - radio-spi
+
+examples:
+  - |
+    concentrator0: lora@0 {
+      compatible = "semtech,sx1301";
+      reg = <0>;
+      reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
+      spi-max-frequency = <8000000>;
+
+      radio-spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        radio0: lora@0 {
+          compatible = "semtech,sx1257";
+          reg = <0>;
+        };
+
+        radio1: lora@1 {
+          compatible = "semtech,sx1257";
+          reg = <1>;
+        };
+      };
+    };
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/4 dt-bindings: lora: sx125x: add basic documentation

The sx125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an sx130x series concentrator however may be connected to a host directly.

Required properties include the radio number of the host or concentrator bus.

---
 .../bindings/lora/semtech,sx125x.yaml         | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx125x.yaml
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +45 -0
new file mode 100644
index 000000000000..5eadec860b70
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx125x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech IQ modulator/de-modulator transeiver
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  The sx125x family are highly integrated RF front-end to digital I and Q
+  modulator/demodulator Multi-PHY mode transceiver capable of supporting
+  multiple constant and non-constant envelope modulation schemes.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1255
+        - semtech,sx1257
+        - semtech,sx1258
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus or radio number in concentrator.
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the radio,
+      in Hz. Maximum SPI frequency is 10MHz.
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    radio0: lora@0 {
+      compatible = "semtech,sx1257";
+      reg = <0>;
+    };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 3 lines

The sx125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an sx130x series concentrator however may be connected to a host directly.

"SX125x" and "SX130x"

Quoted 22 lines

Required properties include the radio number of the host or concentrator bus.

---
 .../bindings/lora/semtech,sx125x.yaml         | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx125x.yaml
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +6 -0
new file mode 100644
index 000000000000..5eadec860b70
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx125x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 16

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +10 -0
+title: Semtech IQ modulator/de-modulator transeiver
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  The sx125x family are highly integrated RF front-end to digital I and Q
+  modulator/demodulator Multi-PHY mode transceiver capable of supporting
+  multiple constant and non-constant envelope modulation schemes.

"SX125x"

"are ... transceivers"

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 24

Quoted 8 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +8 -0
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1255
+        - semtech,sx1257
+        - semtech,sx1258

Do we need all three? Probably yes for the concentrator to make decisions?

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 28

Quoted 4 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus or radio number in concentrator.

", with radio A = 0 and radio B = 1."

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 34

Quoted 6 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +6 -0
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the radio,
+      in Hz. Maximum SPI frequency is 10MHz.

If on the concentrator's SPI bus then this is unused. You don't mark it required below, so maybe add a textual note?

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 45

Quoted 11 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    radio0: lora@0 {
+      compatible = "semtech,sx1257";
+      reg = <0>;
+    };

If you compare my sx127x implementation, should we prepare a "radio-frequency" (or "radio-center-frequency") property for the antenna, to preconfigure the driver during probe? Contents would then be <868000000>, for example.

Thanks,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#3 lore raw

RE: [PATCH lora-next 2/4] dt-bindings: lora: sx125x: add basic documentation

Hi Andreas,

Quoted 47 lines

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 3 lines

The sx125x family are IQ radio transceivers from Semtech configured over SPI, they are typically connected to an sx130x series concentrator however may be connected to a host directly.

"SX125x" and "SX130x"

Quoted 9 lines

Required properties include the radio number of the host or concentrator bus.

---
 .../bindings/lora/semtech,sx125x.yaml         | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml

Review

Quoted 2 lines
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/lora/semtech,sx125x.yaml

Quoted 10 lines

new file mode 100644
index 000000000000..5eadec860b70

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +5 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx125x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +10 -0
+
+title: Semtech IQ modulator/de-modulator transeiver
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  The sx125x family are highly integrated RF front-end to digital I and Q
+  modulator/demodulator Multi-PHY mode transceiver capable of

supporting

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 16

Quoted 1 line
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +1 -0
+  multiple constant and non-constant envelope modulation schemes.

"SX125x"

"are ... transceivers"

Quoted 10 lines

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 24

Quoted 8 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +8 -0
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1255
+        - semtech,sx1257
+        - semtech,sx1258

Do we need all three? Probably yes for the concentrator to make decisions?

We can probe the device version from the concentrator or a host, but if I recall from a previous review we should not rely on the version register for making decisions.
The version register of the SX1257 has been missed from the public datasheet (although exists) and the existing concentrator HAL does not make decisions based on the version register value.
Better to be explicit in the DT and let the driver use that.

Quoted 16 lines

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml

Quoted 5 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus or radio number in

concentrator.

", with radio A = 0 and radio B = 1."

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 34

Quoted 6 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +6 -0
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the radio,
+      in Hz. Maximum SPI frequency is 10MHz.
Quoted 2 lines

If on the concentrator's SPI bus then this is unused. You don't mark it required below, so maybe add a textual note?

As with SX130x comment, this should be covered in common SPI bindings anyone connecting directly to spi will inherit that, and then anyone using concentrator will not require it so we can drop this.

Quoted 17 lines

Documentation/devicetree/bindings/lora/semtech,sx125x.yaml line 45

Quoted 12 lines
Documentation/devicetree/bindings/lora/semtech,sx125x.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    radio0: lora@0 {
+      compatible = "semtech,sx1257";
+      reg = <0>;
+    };

If you compare my sx127x implementation, should we prepare a "radio-frequency" (or "radio-center-frequency") property for the antenna, to preconfigure the driver during probe? Contents would then be <868000000>, for example.

I don’t know the policy of configuration in DT.
Is the value a hardware property of the antenna? Could we call it "antenna-frequency" or "bandwidth" and give it a high low point? Whilst considering antenna properties we should include a gain value as that affects the radiated power at a given transmit power, food for though when we come to regulatory db.

Thanks,
Ben Whitten

#4 lore raw

PATCH 3/4 dt-bindings: lora: sx125x: add clock bindings

In reply to Ben Whitten

The sx125x consumes a 32MHz clock and if it is coupled with a sx130x concentrator may also provide a gated version of this 32MHz for the concentrator.

In the example we connect to output 0 of "txco" clock source. The radio also provides a single clock output, hence "#clock-cells = <0>", named "clk32m" for consumption by the sx130x concentrator.

---
 .../{ => net}/lora/semtech,sx125x.yaml        | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 rename Documentation/devicetree/bindings/{ => net}/lora/semtech,sx125x.yaml (67%)
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +27 -0
similarity index 67%
rename from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml
rename to Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml
index 5eadec860b70..c2fb4ac06341 100644
@@ -33,13 +33,40 @@ properties:
     description: The frequency of the SPI communication to the radio,
       in Hz. Maximum SPI frequency is 10MHz.
 
+  clocks:
+    maxItems: 1
+    description: 32MHz clock provider
+
+  clock-names:
+    items:
+      - const: txco
+
+  clock-output-names:
+    items:
+      - const: clk32m
+    description: 32MHz output clock name
+
+  '#clock-cells':
+    const: 0
+
 required:
   - compatible
   - reg
 
 examples:
   - |
+    tcxo: dummy32m {
+      compatible = "fixed-clock";
+      clock-frequency = <32000000>;
+      clock-output-names = "tcxo";
+      #clock-cells = <0>;
+    };
+
     radio0: lora@0 {
       compatible = "semtech,sx1257";
       reg = <0>;
+      clocks = <&tcxo 0>;
+      clock-names = "tcxo";
+      clock-output-names = "clk32m";
+      #clock-cells = <0>;
     };
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH lora-next 3/4] dt-bindings: lora: sx125x: add clock bindings

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 3 lines

The sx125x consumes a 32MHz clock and if it is coupled with a sx130x concentrator may also provide a gated version of this 32MHz for the concentrator.

"SX125x", "SX130x", "32 MHz"

Quoted 4 lines

In the example we connect to output 0 of "txco" clock source. The radio also provides a single clock output, hence "#clock-cells = <0>", named "clk32m" for consumption by the sx130x concentrator.

No, as pointed out before, output 0 with #clock-cells = <0> is wrong! Either it's 1 and then you can use a single-cell index, or it's 0, in which case that's the next (invalid) clock.

Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml

Quoted 11 lines
---
 .../{ => net}/lora/semtech,sx125x.yaml        | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 rename Documentation/devicetree/bindings/{ => net}/lora/semtech,sx125x.yaml (67%)
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +0 -0
similarity index 67%
rename from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml
rename to Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml

In wrong patch?

Quoted 4 lines

index 5eadec860b70..c2fb4ac06341 100644

Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml properties: · line 42

Quoted 10 lines
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +7 -0
@@ -33,13 +33,40 @@ properties:
     description: The frequency of the SPI communication to the radio,
       in Hz. Maximum SPI frequency is 10MHz.
 
+  clocks:
+    maxItems: 1
+    description: 32MHz clock provider
+
+  clock-names:
+    items:
+      - const: txco

The name TCXO and 32 MHz appear to come from the SX1301 manual's reference example?

In the SX1257 manual I see XTA/XTB connected to an XTAL, and CLK_IN. Both CLK_IN and CLK_OUT are documented as 36 MHz (page 8). In table 2-4 (page 11) however FXOSC is 32 to 36 MHz, typically 36 MHz; FCLK_IN also has a range of 32 to 36 MHz there. So I guess we should be having two named clocks here and be more permissive in the description?

While getting into the hairy details of clock names, we should also prepare optional properties for supply voltages, in case they come from some PMIC that needs a regulator drifer. By my count there's 7 inputs:
VBAT1/2/3, VR_PA, VR_ANA1/2, VR_DIG. Do we need a named -supply property for each?

Quoted 16 lines
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +10 -0
+
+  clock-output-names:
+    items:
+      - const: clk32m
+    description: 32MHz output clock name
+
+  '#clock-cells':
+    const: 0
+
 required:
   - compatible
   - reg
 
 examples:
   - |
+    tcxo: dummy32m {

Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml properties: · line 68

Quoted 10 lines
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +7 -0
+      compatible = "fixed-clock";
+      clock-frequency = <32000000>;
+      clock-output-names = "tcxo";
+      #clock-cells = <0>;
+    };
+
     radio0: lora@0 {
       compatible = "semtech,sx1257";
       reg = <0>;
+      clocks = <&tcxo 0>;

just <&tcxo>

Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml properties: · line 72

Quoted 5 lines
Documentation/devicetree/bindings/net/lora/semtech,sx125x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx125x.yaml +3 -0
+      clock-names = "tcxo";
+      clock-output-names = "clk32m";
+      #clock-cells = <0>;
     };

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#6 lore raw

PATCH 4/4 dt-bindings: lora: sx130x: add clock bindings

In reply to Ben Whitten

The sx130x family consumes two clocks, a 32MHz clock provided by a connected IQ transceiver, and a 133MHz high speed clock.

In the example we connect the concentrator to output 0 of a fixed clock providing the 133MHz high speed clock, and we connect to output 0 of a connected transceiver 32MHz clock.

The connected radios are both fed from output 0 of a fixed 32MHz clock, with only one being the clock source back with one output to the sx130x concentrator.

---
 .../{ => net}/lora/semtech,sx130x.yaml        | 39 ++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
 rename Documentation/devicetree/bindings/{ => net}/lora/semtech,sx130x.yaml (62%)
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +38 -1
similarity index 62%
rename from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml
rename to Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml
index ad263bc4e60d..23a096ca2912 100644
@@ -15,7 +15,8 @@ description: |
   demodulating LoRa signals on 8 channels simultaneously.
 
   It is typically paired with two sx125x IQ radios controlled over an
-  SPI directly from the concentrator.
+  SPI directly from the concentrator. One of the radios will provide
+  a 32MHz clock back into the concentrator.
 
   The concentrator itself it controlled over SPI.
 
@@ -41,6 +42,20 @@ properties:
       in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
       on a number of cards.
 
+  clocks:
+    maxItems: 2
+    items:
+      - description: 32MHz clock provider
+      - description: 133MHz high speed clock provider
+    description: The chip requires two clock inputs; A 32MHz clock at CMOS
+      level which is provided from a connected radio.
+      And a 133MHz high speed clock at CMOS level provided by an oscillator.
+
+  clock-names:
+    items:
+      - const: clk32m
+      - const: clkhs
+
   radio-spi:
     description: The concentrator has two radios connected which are contained
       within the following node.
@@ -64,11 +79,27 @@ required:
 
 examples:
   - |
+    tcxo: dummy32m {
+      compatible = "fixed-clock";
+      clock-frequency = <32000000>;
+      clock-output-names = "tcxo";
+      #clock-cells = <0>;
+    };
+
+    clkhs: dummy133m {
+      compatible = "fixed-clock";
+      clock-frequency = <133000000>;
+      clock-output-names = "clkhs";
+      #clock-cells = <0>;
+    };
+
     concentrator0: lora@0 {
       compatible = "semtech,sx1301";
       reg = <0>;
       reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
       spi-max-frequency = <8000000>;
+      clocks = <&radio1 0>, <&clkhs 0>;
+      clock-names = "clk32m", "clkhs";
 
       radio-spi {
         #address-cells = <1>;
@@ -77,11 +108,17 @@ examples:
         radio0: lora@0 {
           compatible = "semtech,sx1257";
           reg = <0>;
+          clocks = <&tcxo 0>;
+          clock-names = "tcxo";
         };
 
         radio1: lora@1 {
           compatible = "semtech,sx1257";
           reg = <1>;
+          clocks = <&tcxo 0>;
+          clock-names = "tcxo";
+          clock-output-names = "clk32m";
+          #clock-cells = <0>;
         };
       };
     };
Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH lora-next 4/4] dt-bindings: lora: sx130x: add clock bindings

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 10 lines

The sx130x family consumes two clocks, a 32MHz clock provided by a connected IQ transceiver, and a 133MHz high speed clock.

In the example we connect the concentrator to output 0 of a fixed clock providing the 133MHz high speed clock, and we connect to output 0 of a connected transceiver 32MHz clock.

The connected radios are both fed from output 0 of a fixed 32MHz clock, with only one being the clock source back with one output to the sx130x concentrator.

No, no, no... See below.

Quoted 15 lines
---
 .../{ => net}/lora/semtech,sx130x.yaml        | 39 ++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
 rename Documentation/devicetree/bindings/{ => net}/lora/semtech,sx130x.yaml (62%)
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +0 -0
similarity index 62%
rename from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml
rename to Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml
index ad263bc4e60d..23a096ca2912 100644

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml description: | · line 19

Quoted 6 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +2 -1
@@ -15,7 +15,8 @@ description: |
   demodulating LoRa signals on 8 channels simultaneously.
 
   It is typically paired with two sx125x IQ radios controlled over an
-  SPI directly from the concentrator.
+  SPI directly from the concentrator. One of the radios will provide
+  a 32MHz clock back into the concentrator.

The SX125x does not seem to document the frequency of the output clock, so I assume it's pass-through of whatever went in, and 32 MHz seems correct for the SX130x input side.

Quoted 9 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +2 -0
   The concentrator itself it controlled over SPI.
 
@@ -41,6 +42,20 @@ properties:
       in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
       on a number of cards.
 
+  clocks:
+    maxItems: 2

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml properties: · line 56

Quoted 10 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +10 -0
+    items:
+      - description: 32MHz clock provider
+      - description: 133MHz high speed clock provider
+    description: The chip requires two clock inputs; A 32MHz clock at CMOS
+      level which is provided from a connected radio.
+      And a 133MHz high speed clock at CMOS level provided by an oscillator.
+
+  clock-names:
+    items:
+      - const: clk32m

The pin is called CLK32M; in the specs there's XTAL32F/XTAL32T.

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml properties: · line 57

Quoted 1 line
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +1 -0
+      - const: clkhs

The pin is called CLKHS; in the specs it's HSC_F.

So I assume both names are good, but wanted to double-check.

Quoted 18 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +11 -0
+
   radio-spi:
     description: The concentrator has two radios connected which are contained
       within the following node.
@@ -64,11 +79,27 @@ required:
 
 examples:
   - |
+    tcxo: dummy32m {
+      compatible = "fixed-clock";
+      clock-frequency = <32000000>;
+      clock-output-names = "tcxo";
+      #clock-cells = <0>;
+    };
+
+    clkhs: dummy133m {
+      compatible = "fixed-clock";
+      clock-frequency = <133000000>;

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml required: · line 101

Quoted 10 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +5 -0
+      clock-output-names = "clkhs";
+      #clock-cells = <0>;
+    };
+
     concentrator0: lora@0 {
       compatible = "semtech,sx1301";
       reg = <0>;
       reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
       spi-max-frequency = <8000000>;
+      clocks = <&radio1 0>, <&clkhs 0>;

Once again, this is wrong use of #clock-cells: <&radio1>, <&clkhs> Otherwise you have four clocks, and your "clkhs" will be <0>.

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml examples: · line 111

Quoted 9 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +2 -0
+      clock-names = "clk32m", "clkhs";
 
       radio-spi {
         #address-cells = <1>;
@@ -77,11 +108,17 @@ examples:
         radio0: lora@0 {
           compatible = "semtech,sx1257";
           reg = <0>;
+          clocks = <&tcxo 0>;

Ditto, <&tcxo>.

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml examples: · line 118

Quoted 7 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +2 -0
+          clock-names = "tcxo";
         };
 
         radio1: lora@1 {
           compatible = "semtech,sx1257";
           reg = <1>;
+          clocks = <&tcxo 0>;

<&tcxo>

Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml examples: · line 124

Quoted 6 lines
Documentation/devicetree/bindings/net/lora/semtech,sx130x.yaml renamed from Documentation/devicetree/bindings/lora/semtech,sx130x.yaml +3 -0
+          clock-names = "tcxo";
+          clock-output-names = "clk32m";
+          #clock-cells = <0>;
         };
       };
     };

This example may need to be updated to use a fixed-clock instead of the radio'S output, due to unsolved clk provider implementation problems that will render the example unusable.

Same as for the radio, we should also prepare optional regulator inputs. There's at least 1.8 V and 3.3 V supplies here.

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#8 lore raw
In reply to Ben Whitten

Hi Ben,

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 10 lines

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

Patch 3/4 moves this to net/lora/, which I think is more appropriate.

Quoted 11 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
new file mode 100644
index 000000000000..ad263bc4e60d
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx130x.yaml#

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech LoRa concentrator
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  Semtech LoRa concentrator sx130x digital baseband chip is capable of

SX130x or SX1301/SX1308, to distinguish from driver name sx130x and to avoid ambiguities of which x is a wildcard.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 17

Quoted 3 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +3 -0
+  demodulating LoRa signals on 8 channels simultaneously.
+
+  It is typically paired with two sx125x IQ radios controlled over an

Ditto, SX125x

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+  SPI directly from the concentrator.
+
+  The concentrator itself it controlled over SPI.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1301
+        - semtech,sx1308

We should only list both if we expect differences between the two models. Otherwise SX1308 can reuse the SX1301 compatible. If we want to mark it up just in case then rearranging the above to be a sequence of "semtech,sx1308", "semtech,sx1301" would be an alternative.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 31

Quoted 4 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus.

Is this mandatory now or not with maxItems?

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 35

Quoted 4 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
+
+  reset-gpios:
+    maxItems: 1
+    description: A connection of the reset gpio line.

This needs to be optional, which I think the maxItems syntax says unlike the commit message?
On an mPCIe card you won't have such a GPIO, for instance. We do a Soft Reset, so it's not functionally mandatory.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 42

Quoted 7 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +7 -0
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the concentrator,
+      in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
+      on a number of cards.

Do we really need to describe this here? It should be covered in the common SPI bindings, and only applies to SPI bus, not USB picoGW.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 46

Quoted 4 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
+
+  radio-spi:
+    description: The concentrator has two radios connected which are contained
+      within the following node.

"can have"

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 57

Quoted 11 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +11 -0
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    required:
+      - '#address-cells'
+      - '#size-cells'

I'm pretty sure that Rob would like to have a compatible here, even if unneeded in our Linux driver?

BTW if someone has better naming suggestions than "radio-spi"... I just wanted to avoid having it in the main node directly, in case we need other sub-nodes, too.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 62

Quoted 5 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+  - reset-gpios

Must be optional.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 63

Quoted 1 line
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +1 -0
+  - radio-spi

Should be optional. (Driver needs it today, but that's another problem.)

Quoted 14 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +14 -0
+
+examples:
+  - |
+    concentrator0: lora@0 {
+      compatible = "semtech,sx1301";
+      reg = <0>;
+      reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
+      spi-max-frequency = <8000000>;
+
+      radio-spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        radio0: lora@0 {

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+          compatible = "semtech,sx1257";
+          reg = <0>;
+        };
+
+        radio1: lora@1 {
+          compatible = "semtech,sx1257";
+          reg = <1>;
+        };
+      };
+    };

Thanks for looking into this,

Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#9 lore raw

Hi Andreas,

Quoted 6 lines

Am 08.01.19 um 09:41 schrieb Ben Whitten:

Quoted 5 lines

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

Quoted 8 lines
Quoted 5 lines
---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

Patch 3/4 moves this to net/lora/, which I think is more appropriate.

Agreed, I think it was a change merged into the wrong commits by mistake

Quoted 32 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

Quoted 9 lines

new file mode 100644
index 000000000000..ad263bc4e60d

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx130x.yaml#

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech LoRa concentrator
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  Semtech LoRa concentrator sx130x digital baseband chip is capable of

SX130x or SX1301/SX1308, to distinguish from driver name sx130x and to avoid ambiguities of which x is a wildcard.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 17

Quoted 3 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +3 -0
+  demodulating LoRa signals on 8 channels simultaneously.
+
+  It is typically paired with two sx125x IQ radios controlled over an

Ditto, SX125x

Quoted 15 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+  SPI directly from the concentrator.
+
+  The concentrator itself it controlled over SPI.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1301
+        - semtech,sx1308

We should only list both if we expect differences between the two models. Otherwise SX1308 can reuse the SX1301 compatible. If we want to mark it up just in case then rearranging the above to be a sequence of "semtech,sx1308", "semtech,sx1301" would be an alternative.

It was my understanding that we should name each device that is compatible, avoiding wildcard 'x' in compatible names. This allows the device tree to be more accurate to the hardware that it is describing.

I do not expect there to be much difference, but there may be some that I am unaware of.

Not sure I follow here, do you wish for the order to be flipped if we do want to state every device? I see that example-schema does indeed have entries in reverse.

Quoted 7 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus.

Is this mandatory now or not with maxItems?

min/maxItems is implied if you have a list but for our chipselect we have no list. I followed child-node-example.yaml in yaml-bindings and trivial-devices.yaml in being explicit and stating it be one element and making reg required.

Quoted 10 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 35

Quoted 5 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +4 -0
+
+  reset-gpios:
+    maxItems: 1
+    description: A connection of the reset gpio line.

This needs to be optional, which I think the maxItems syntax says unlike the commit message?
On an mPCIe card you won't have such a GPIO, for instance. We do a Soft Reset, so it's not functionally mandatory.

I'll drop this from required and from the commit message.

Quoted 10 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 42

Quoted 7 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +7 -0
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the concentrator,
+      in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
+      on a number of cards.

Do we really need to describe this here? It should be covered in the common SPI bindings, and only applies to SPI bus, not USB picoGW.

True, I'll drop this.

Quoted 24 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

Quoted 4 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +3 -0
+
+  radio-spi:
+    description: The concentrator has two radios connected which are

contained

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 46

Quoted 1 line
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +1 -0
+      within the following node.

"can have"

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 57

Quoted 11 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +11 -0
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    required:
+      - '#address-cells'
+      - '#size-cells'

I'm pretty sure that Rob would like to have a compatible here, even if unneeded in our Linux driver?

Quoted 3 lines

BTW if someone has better naming suggestions than "radio-spi"... I just wanted to avoid having it in the main node directly, in case we need other sub-nodes, too.

Just like ahb and apb it makes sense to separate the bus from the device An alternative could be "transceiver-bus" or "radio-bus" as the fact its spi is masked away anyway.
What would it's compatible string be, match the node name? Would the sx130x_radio bus type match against it?

Quoted 40 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 62

Quoted 6 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+  - reset-gpios

Must be optional.

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 63

Quoted 1 line
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +1 -0
+  - radio-spi

Should be optional. (Driver needs it today, but that's another problem.)

Quoted 14 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +14 -0
+
+examples:
+  - |
+    concentrator0: lora@0 {
+      compatible = "semtech,sx1301";
+      reg = <0>;
+      reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
+      spi-max-frequency = <8000000>;
+
+      radio-spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        radio0: lora@0 {

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+          compatible = "semtech,sx1257";
+          reg = <0>;
+        };
+
+        radio1: lora@1 {
+          compatible = "semtech,sx1257";
+          reg = <1>;
+        };
+      };
+    };

Thanks for looking into this,

Quoted 2 lines

Andreas

Thanks,
Ben Whitten

maintainer
#10 lore raw
In reply to Ben Whitten
Quoted 10 lines · Ben Whitten

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

A schema binding. Yay!

Quoted 17 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
new file mode 100644
index 000000000000..ad263bc4e60d
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx130x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech LoRa concentrator
+
+maintainers:
+  - Andreas Färber <[email protected]>

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+  - Ben Whitten <[email protected]>
+
+description: |
+  Semtech LoRa concentrator sx130x digital baseband chip is capable of
+  demodulating LoRa signals on 8 channels simultaneously.
+
+  It is typically paired with two sx125x IQ radios controlled over an
+  SPI directly from the concentrator.
+
+  The concentrator itself it controlled over SPI.

s/it/is/

Quoted 14 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +14 -0
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1301
+        - semtech,sx1308
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus.
+
+  reset-gpios:
+    maxItems: 1

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+    description: A connection of the reset gpio line.
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the concentrator,
+      in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
+      on a number of cards.
+
+  radio-spi:

child nodes should have 'type: object'

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 53

Quoted 9 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +9 -0
+    description: The concentrator has two radios connected which are contained
+      within the following node.
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0

You need the grandchildren here too to define 'reg' should be 0-8. You'll need to use 'patternProperties' since there's a unit-address.

You could maybe get rid of the radio-spi node. You don't need it unless you wanted to add other types of child nodes.

Quoted 37 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +34 -0
+
+    required:
+      - '#address-cells'
+      - '#size-cells'
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - radio-spi
+
+examples:
+  - |
+    concentrator0: lora@0 {
+      compatible = "semtech,sx1301";
+      reg = <0>;
+      reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
+      spi-max-frequency = <8000000>;
+
+      radio-spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        radio0: lora@0 {
+          compatible = "semtech,sx1257";
+          reg = <0>;
+        };
+
+        radio1: lora@1 {
+          compatible = "semtech,sx1257";
+          reg = <1>;
+        };
+      };
+    };
Signature · 1 line
2.17.1
maintainer
#11 lore raw
Quoted 15 lines · Rob Herring
Quoted 10 lines · Ben Whitten

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx130x.yaml

A schema binding. Yay!

Quoted 1 line
Quoted 7 lines

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 1

Quoted 7 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +1 -0
new file mode 100644
index 000000000000..ad263bc4e60d
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0

Also, I'd like new bindings to be dual GPL-2.0 and BSD-2-Clause if you don't mind. This will make it easier to move the schema out of the kernel if/when we ever do that.

Rob

maintainer
#12 lore raw
In reply to Ben Whitten
Quoted 73 lines · Ben Whitten

Add basic documentation in YAML format for the sx130x series concentrators from Semtech.
Required is; the location on the SPI bus, the reset gpio and the node for downstream IQ radios, typically sx125x.

---
 .../bindings/lora/semtech,sx130x.yaml         | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/lora/semtech,sx130x.yaml
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +56 -0
new file mode 100644
index 000000000000..ad263bc4e60d
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/lora/semtech,sx130x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Semtech LoRa concentrator
+
+maintainers:
+  - Andreas Färber <[email protected]>
+  - Ben Whitten <[email protected]>
+
+description: |
+  Semtech LoRa concentrator sx130x digital baseband chip is capable of
+  demodulating LoRa signals on 8 channels simultaneously.
+
+  It is typically paired with two sx125x IQ radios controlled over an
+  SPI directly from the concentrator.
+
+  The concentrator itself it controlled over SPI.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - semtech,sx1301
+        - semtech,sx1308
+
+  reg:
+    maxItems: 1
+    description: The chip select on the SPI bus.
+
+  reset-gpios:
+    maxItems: 1
+    description: A connection of the reset gpio line.
+
+  spi-max-frequency:
+    maximum: 10000000
+    default: 8000000
+    description: The frequency of the SPI communication to the concentrator,
+      in Hz. Maximum SPI frequency is 10MHz although 8MHz is typically used
+      on a number of cards.
+
+  radio-spi:
+    description: The concentrator has two radios connected which are contained
+      within the following node.
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    required:
+      - '#address-cells'

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 66

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+      - '#size-cells'
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - radio-spi
+
+examples:
+  - |

One more comment. Make sure you "build" the schema with 'dt_binding_check' target. That builds the examples.

It is also checked by a CI job and the status is added to patchwork[1]. (Though it didn't work correctly for this one and I just fixed it.)

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 67

Quoted 1 line
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +1 -0
+    concentrator0: lora@0 {

This example doesn't build because there's an expectation of the top level nodes being MMIO if there's a reg prop. You just need to wrap this in a parent node representing a spi controller:

spi {
#address-cells = <1>;
#size-cells = <0>;

...

};

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+      compatible = "semtech,sx1301";
+      reg = <0>;
+      reset-gpios = <&pioB 27 GPIO_ACTIVE_HIGH>;
+      spi-max-frequency = <8000000>;
+
+      radio-spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        radio0: lora@0 {

Documentation/devicetree/bindings/lora/semtech,sx130x.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/lora/semtech,sx130x.yaml new file +10 -0
+          compatible = "semtech,sx1257";
+          reg = <0>;
+        };
+
+        radio1: lora@1 {
+          compatible = "semtech,sx1257";
+          reg = <1>;
+        };
+      };
+    };

[1] https://patchwork.ozlabs.org/patch/1021773/