Re: [PATCH 2/2] dt-bindings: serial: Convert slave-device bindings to json-schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 3, 2020 at 7:43 AM Geert Uytterhoeven
<geert+renesas@xxxxxxxxx> wrote:
>
> Convert the serial slave-device Device Tree binding documentation to
> json-schema, and incorporate it into the generic serial bindings.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> ---
>  .../devicetree/bindings/serial/serial.yaml    | 53 +++++++++++++++++++
>  .../bindings/serial/slave-device.txt          | 45 ----------------
>  MAINTAINERS                                   |  2 +-
>  3 files changed, 54 insertions(+), 46 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/serial/slave-device.txt
>
> diff --git a/Documentation/devicetree/bindings/serial/serial.yaml b/Documentation/devicetree/bindings/serial/serial.yaml
> index d408335319f00215..7381966449b62deb 100644
> --- a/Documentation/devicetree/bindings/serial/serial.yaml
> +++ b/Documentation/devicetree/bindings/serial/serial.yaml
> @@ -7,6 +7,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#";
>  title: Serial Interface Generic DT Bindings
>
>  maintainers:
> +  - Rob Herring <robh@xxxxxxxxxx>
>    - Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
>  description:
> @@ -59,6 +60,45 @@ properties:
>        "rts-gpios" above, unless support is provided to switch between modes
>        dynamically.
>
> +patternProperties:
> +  "^(bluetooth|ethernet|gnss|nfc|wifi)$":

A bit fragile, but okay. There's also some serial attached board
control micro-controllers. See the Zodiac i.MX board "rave-sp" node.

The only other way I've come up to handle this is:

".*":
  if:
    type: object
  then:
    ...

> +    type: object
> +
> +    description:
> +      Serial attached devices shall be a child node of the host UART device the
> +      slave device is attached to. It is expected that the attached device is
> +      the only child node of the UART device. The slave device node name shall
> +      reflect the generic type of device for the node.
> +
> +    properties:
> +      compatible:
> +        description:
> +          Compatible of the device connnected to the serial port.

typo

> +
> +      max-speed:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description:
> +          The maximum baud rate the device operates at. This should only be
> +          present if the maximum is less than the slave device can support. For
> +          example, a particular board has some signal quality issue or the host
> +          processor can't support higher baud rates.
> +
> +      current-speed:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description: |
> +          The current baud rate the device operates at. This should only be
> +          present in case a driver has no chance to know the baud rate of the
> +          slave device.
> +          Examples:
> +            * device supports auto-baud
> +            * the rate is setup by a bootloader and there is no way to reset
> +              the device
> +            * device baud rate is configured by its firmware but there is no
> +              way to request the actual settings
> +
> +    required:
> +      - compatible
> +
>  examples:
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> @@ -93,3 +133,16 @@ examples:
>              power-domains = <&pd_a3sp>;
>              uart-has-rtscts;
>      };
> +
> +  - |
> +    serial@1234 {
> +            compatible = "ns16550a";
> +            reg = <0x1234 0x20>;
> +            interrupts = <1>;
> +
> +            bluetooth {
> +                    compatible = "brcm,bcm43341-bt";
> +                    interrupt-parent = <&gpio>;
> +                    interrupts = <10>;
> +            };
> +    };
> diff --git a/Documentation/devicetree/bindings/serial/slave-device.txt b/Documentation/devicetree/bindings/serial/slave-device.txt
> deleted file mode 100644
> index 40110e0196209fde..0000000000000000
> --- a/Documentation/devicetree/bindings/serial/slave-device.txt
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -Serial Slave Device DT binding
> -
> -This documents the binding structure and common properties for serial
> -attached devices. Common examples include Bluetooth, WiFi, NFC and GPS
> -devices.
> -
> -Serial attached devices shall be a child node of the host UART device the
> -slave device is attached to. It is expected that the attached device is
> -the only child node of the UART device. The slave device node name shall
> -reflect the generic type of device for the node.
> -
> -Required Properties:
> -
> -- compatible   : A string reflecting the vendor and specific device the node
> -                 represents.
> -
> -Optional Properties:
> -
> -- max-speed    : The maximum baud rate the device operates at. This should
> -                 only be present if the maximum is less than the slave device
> -                 can support. For example, a particular board has some signal
> -                 quality issue or the host processor can't support higher
> -                 baud rates.
> -- current-speed        : The current baud rate the device operates at. This should
> -                 only be present in case a driver has no chance to know
> -                 the baud rate of the slave device.
> -                 Examples:
> -                   * device supports auto-baud
> -                   * the rate is setup by a bootloader and there is no
> -                     way to reset the device
> -                   * device baud rate is configured by its firmware but
> -                     there is no way to request the actual settings
> -
> -Example:
> -
> -serial@1234 {
> -       compatible = "ns16550a";
> -       interrupts = <1>;
> -
> -       bluetooth {
> -               compatible = "brcm,bcm43341-bt";
> -               interrupt-parent = <&gpio>;
> -               interrupts = <10>;
> -       };
> -};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 59c14ee9a917a794..5f5d074c7b3927a5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15034,7 +15034,7 @@ SERIAL DEVICE BUS
>  M:     Rob Herring <robh@xxxxxxxxxx>
>  L:     linux-serial@xxxxxxxxxxxxxxx
>  S:     Maintained
> -F:     Documentation/devicetree/bindings/serial/slave-device.txt
> +F:     Documentation/devicetree/bindings/serial/serial.yaml
>  F:     drivers/tty/serdev/
>  F:     include/linux/serdev.h
>
> --
> 2.17.1
>



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux