devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	gregkh@linuxfoundation.org, jun.li@nxp.com
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH] dt-bindings: usb: typec-tcpci: convert to DT schema format
Date: Mon, 27 Mar 2023 09:41:06 +0200	[thread overview]
Message-ID: <5675373c-af4f-906f-9906-7853a85f8ed6@linaro.org> (raw)
In-Reply-To: <20230323065824.3857573-1-peng.fan@oss.nxp.com>

On 23/03/2023 07:58, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Convert the binding to DT schema format. The default speed is HS,
> so add a dummy port@0 in the example.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> 
> V1:
>  The default speed is HS, so port@0 is not added for some device tree,
>  however the usb-c-connector requires port@0. Not sure we should drop
>  the required port@0 from usb-c-connector schema or add a dummy port@0
>  for tcpci as what this patch does.

imx8mq-librem5-devkit has full port@0 so just use similar approach.

> 
>  .../devicetree/bindings/usb/typec-tcpci.txt   | 49 ------------
>  .../devicetree/bindings/usb/typec-tcpci.yaml  | 80 +++++++++++++++++++
>  2 files changed, 80 insertions(+), 49 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/usb/typec-tcpci.txt
>  create mode 100644 Documentation/devicetree/bindings/usb/typec-tcpci.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/typec-tcpci.txt b/Documentation/devicetree/bindings/usb/typec-tcpci.txt
> deleted file mode 100644
> index 2082522b1c32..000000000000
> --- a/Documentation/devicetree/bindings/usb/typec-tcpci.txt
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -TCPCI(Typec port cotroller interface) binding
> ----------------------------------------------
> -
> -Required properties:
> -- compatible:       should be set one of following:
> -		    - "nxp,ptn5110" for NXP USB PD TCPC PHY IC ptn5110.
> -
> -- reg:              the i2c slave address of typec port controller device.
> -- interrupt-parent: the phandle to the interrupt controller which provides
> -                    the interrupt.
> -- interrupts:       interrupt specification for tcpci alert.
> -
> -Required sub-node:
> -- connector: The "usb-c-connector" attached to the tcpci chip, the bindings
> -  of connector node are specified in
> -  Documentation/devicetree/bindings/connector/usb-connector.yaml
> -
> -Example:
> -
> -ptn5110@50 {
> -	compatible = "nxp,ptn5110";
> -	reg = <0x50>;
> -	interrupt-parent = <&gpio3>;
> -	interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
> -
> -	usb_con: connector {
> -		compatible = "usb-c-connector";
> -		label = "USB-C";
> -		data-role = "dual";
> -		power-role = "dual";
> -		try-power-role = "sink";
> -		source-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)>;
> -		sink-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_USB_COMM)
> -			     PDO_VAR(5000, 12000, 2000)>;
> -		op-sink-microwatt = <10000000>;
> -
> -		ports {
> -			#address-cells = <1>;
> -			#size-cells = <0>;
> -
> -			port@1 {
> -				reg = <1>;
> -				usb_con_ss: endpoint {
> -					remote-endpoint = <&usb3_data_ss>;
> -				};
> -			};
> -		};
> -	};
> -};
> diff --git a/Documentation/devicetree/bindings/usb/typec-tcpci.yaml b/Documentation/devicetree/bindings/usb/typec-tcpci.yaml
> new file mode 100644
> index 000000000000..067d3b032e3d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/typec-tcpci.yaml

Is this a binding for PTN5110 or for generic tcpci? Looks like the
first, thus name should be rather device specific, so nxp,ptn5110.
Specially that there are other tcpci chips in separate bindings.

> @@ -0,0 +1,80 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/typec-tcpci.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TCPCI(Typec port cotroller interface)

Also title should be changed to device specific.

> +
> +maintainers:
> +  - Li Jun <jun.li@nxp.com>
> +
> +properties:
> +  compatible:
> +    const: nxp,ptn5110
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  port:
> +    description: This port is used for usb role switch.
> +    $ref: /schemas/graph.yaml#/properties/port

I don't think
> +
> +  connector:
> +    type: object
> +    $ref: /schemas/connector/usb-connector.yaml#
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - connector
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/usb/pd.h>
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        ptn5110@50 {

tcpci or actually more popular: usb-typec

> +            compatible = "nxp,ptn5110";
> +            reg = <0x50>;
> +            interrupt-parent = <&gpio3>;


Best regards,
Krzysztof


  reply	other threads:[~2023-03-27  7:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  6:58 [PATCH] dt-bindings: usb: typec-tcpci: convert to DT schema format Peng Fan (OSS)
2023-03-27  7:41 ` Krzysztof Kozlowski [this message]
2023-03-28  9:24   ` Jun Li
2023-03-28 10:43     ` Krzysztof Kozlowski
2023-03-29  7:16       ` Jun Li
2023-03-29  7:24         ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5675373c-af4f-906f-9906-7853a85f8ed6@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).