Re: [RFC PATCH 6/7] dt-bindings: motion: Add adi,tmc5240 bindings

David Lechner
2025-02-28T22:38:54Z

On 2/27/25 10:28 AM, David Jander wrote:
> Add device-tree bindings for Analog Devices TMC5240 stepper controllers.
>
> Signed-off-by: David Jander <david@protonic.nl>
> ---
> .../bindings/motion/adi,tmc5240.yaml | 60 +++++++++++++++++++
> 1 file changed, 60 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/motion/adi,tmc5240.yaml
>
> diff --git a/Documentation/devicetree/bindings/motion/adi,tmc5240.yaml b/Documentation/devicetree/bindings/motion/adi,tmc5240.yaml
> new file mode 100644
> index 000000000000..3364f9dfccb1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/motion/adi,tmc5240.yaml
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/motion/adi,tmc5240.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices TMC5240 Stepper Motor controller
> +
> +maintainers:
> + - David Jander <david@protonic>
> +
> +description: |
> + Stepper motor controller with motion engine and SPI interface.

Please include a link to the datasheet.

> +
> +properties:
> + compatible:
> + enum:
> + - adi,tmc5240
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1

I assume that this is the overvoltage output (OV pin). Would be nice to have
a description here saying that. There are also NAO and DIAG0/1 output pins, so
it's a bit ambiguous otherwise.

> +
> + enable-supply:
> + description: Optional external enable supply to control SLEEPn pin. Can
> + be shared between several controllers.
> +

This doesn't look like a supply, but krzk already discussed that. But there
should be actual power supplies: vs-supply, vdd1v8-supply, vcc-io-supply. And
a reference voltage supply: iref-supply

And if there are any pins would make sense to connect to a gpio, we can add
those even if the driver doesn't use it currently.

> + clocks:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - clocks
> +
> +allOf:
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
> + - $ref: /schemas/motion/common.yaml#

If we need to know about what is connected to the output of a motor controller
I would expect it to be done with child node for each output. That way each
output can be unique, if needed. Basically, similar to iio/adc.yaml is used to
provide common properties for channel@ child nodes on iio devices.

> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + motor@0 {

motor-controller@ or actuator-controller@

The chip is the controller/driver, it is not a motor.

> + compatible = "adi,tmc5240";
> + reg = <0>;
> + interrupts-extended = <&gpiok 7 0>;
> + clocks = <&clock_tmc5240>;
> + enable-supply = <&stpsleepn>;
> + spi-max-frequency = <1000000>;
> + };
> + };
> +