diff mbox series

[v2,03/13] dt-bindings: usb: Add binding for Cypress cypd4226 I2C driver

Message ID 20221111101509.999589-4-waynec@nvidia.com (mailing list archive)
State Superseded
Headers show
Series Enable USB host and device functions on Jetson | expand

Commit Message

Wayne Chang Nov. 11, 2022, 10:14 a.m. UTC
add device-tree binding documentation for Cypress cypd4226 type-C
controller's I2C interface. It is a standard I2C slave with GPIO
input as IRQ interface.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
---
V1 -> V2:Based on the review comments. Fix some addressed issues on
description, interrupts, cypress,firmware-build, connector, and 
additionalProperties properties. And also remove the status in the example.
 .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml

Comments

Jon Hunter Nov. 11, 2022, 2:36 p.m. UTC | #1
On 11/11/2022 10:14, Wayne Chang wrote:
> add device-tree binding documentation for Cypress cypd4226 type-C
> controller's I2C interface. It is a standard I2C slave with GPIO
> input as IRQ interface.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> ---
> V1 -> V2:Based on the review comments. Fix some addressed issues on
> description, interrupts, cypress,firmware-build, connector, and
> additionalProperties properties. And also remove the status in the example.
>   .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
>   1 file changed, 86 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> new file mode 100644
> index 000000000000..70db97e0ad31
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cypress cypd4226 UCSI I2C Type-C Controller
> +
> +maintainers:
> +  - Wayne Chang <waynec@nvidia.com>
> +
> +description:
> +  The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface type-C
> +  controller.
> +
> +properties:
> +  compatible:
> +    const: cypress,cypd4226
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +  reg:
> +    const: 0x08
> +
> +  interrupts:
> +    items:
> +      - description: cypd4226 I2C interrupt
> +
> +  cypress,firmware-build:
> +    enum:
> +      - nvidia,gpu
> +      - nvidia,jetson-agx-xavier
> +    description: |
> +      the name of the CCGx firmware built for product series.
> +      should be set one of following:
> +      - "nvidia,gpu" for the NVIDIA RTX product series
> +      - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
> +
> +patternProperties:
> +  '^connector@[0-1]+$':
> +    $ref: /schemas/connector/usb-connector.yaml#
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/tegra194-gpio.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +      #interrupt-cells = <2>;
> +
> +      ucsi-ccg@8 {
> +        compatible = "cypress,cypd4226";
> +        interrupt-parent = <&gpio_aon>;
> +        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
> +        reg = <0x08>;
> +        cypress,firmware-build = "nvidia,jetson-agx-xavier";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        ccg_typec_con0: connector@0 {
> +          compatible = "usb-c-connector";
> +          reg = <0>;
> +          label = "USB-C";
> +          data-role = "dual";
> +          port {
> +            ucsi_ccg_p0: endpoint {
> +              remote-endpoint = <&usb_role_switch0>;
> +            };
> +          };
> +        };
> +      };
> +    };


I see warnings with this change ...

Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml: 
'additionalProperties' is a required property
	hint: A schema without a "$ref" to another schema must define all 
properties and use "additionalProperties"
	from schema $id: http://devicetree.org/meta-schemas/base.yaml#


Looking at Rob's comments I believe we need ...

diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml 
b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
index 70db97e0ad31..8feafbaf9e20 100644
--- a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
+++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
@@ -43,17 +43,19 @@ properties:
  patternProperties:
    '^connector@[0-1]+$':
      $ref: /schemas/connector/usb-connector.yaml#
+    unevaluatedProperties: false
      properties:
        reg:
          maxItems: 1

-unevaluatedProperties: false

  required:
    - compatible
    - reg
    - interrupts

+additionalProperties: false
+
Wayne Chang Nov. 14, 2022, 12:01 p.m. UTC | #2
On 11/11/22 22:36, Jon Hunter wrote:
> 
> On 11/11/2022 10:14, Wayne Chang wrote:
>> add device-tree binding documentation for Cypress cypd4226 type-C
>> controller's I2C interface. It is a standard I2C slave with GPIO
>> input as IRQ interface.
>>
>> Signed-off-by: Wayne Chang <waynec@nvidia.com>
>> ---
>> V1 -> V2:Based on the review comments. Fix some addressed issues on
>> description, interrupts, cypress,firmware-build, connector, and
>> additionalProperties properties. And also remove the status in the 
>> example.
>>   .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
>>   1 file changed, 86 insertions(+)
>>   create mode 100644 
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml 
>> b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
>> new file mode 100644
>> index 000000000000..70db97e0ad31
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
>> @@ -0,0 +1,86 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Cypress cypd4226 UCSI I2C Type-C Controller
>> +
>> +maintainers:
>> +  - Wayne Chang <waynec@nvidia.com>
>> +
>> +description:
>> +  The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface 
>> type-C
>> +  controller.
>> +
>> +properties:
>> +  compatible:
>> +    const: cypress,cypd4226
>> +
>> +  '#address-cells':
>> +    const: 1
>> +
>> +  '#size-cells':
>> +    const: 0
>> +
>> +  reg:
>> +    const: 0x08
>> +
>> +  interrupts:
>> +    items:
>> +      - description: cypd4226 I2C interrupt
>> +
>> +  cypress,firmware-build:
>> +    enum:
>> +      - nvidia,gpu
>> +      - nvidia,jetson-agx-xavier
>> +    description: |
>> +      the name of the CCGx firmware built for product series.
>> +      should be set one of following:
>> +      - "nvidia,gpu" for the NVIDIA RTX product series
>> +      - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
>> +
>> +patternProperties:
>> +  '^connector@[0-1]+$':
>> +    $ref: /schemas/connector/usb-connector.yaml#
>> +    properties:
>> +      reg:
>> +        maxItems: 1
>> +
>> +unevaluatedProperties: false
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/gpio/tegra194-gpio.h>
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    i2c {
>> +      #address-cells = <1>;
>> +      #size-cells = <0>;
>> +      #interrupt-cells = <2>;
>> +
>> +      ucsi-ccg@8 {
>> +        compatible = "cypress,cypd4226";
>> +        interrupt-parent = <&gpio_aon>;
>> +        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
>> +        reg = <0x08>;
>> +        cypress,firmware-build = "nvidia,jetson-agx-xavier";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        ccg_typec_con0: connector@0 {
>> +          compatible = "usb-c-connector";
>> +          reg = <0>;
>> +          label = "USB-C";
>> +          data-role = "dual";
>> +          port {
>> +            ucsi_ccg_p0: endpoint {
>> +              remote-endpoint = <&usb_role_switch0>;
>> +            };
>> +          };
>> +        };
>> +      };
>> +    };
> 
> 
> I see warnings with this change ...
> 
> Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml: 
> 'additionalProperties' is a required property
>      hint: A schema without a "$ref" to another schema must define all 
> properties and use "additionalProperties"
>      from schema $id: http://devicetree.org/meta-schemas/base.yaml#
> 
> 
> Looking at Rob's comments I believe we need ...
> 
> diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml 
> b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> index 70db97e0ad31..8feafbaf9e20 100644
> --- a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> +++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> @@ -43,17 +43,19 @@ properties:
>   patternProperties:
>     '^connector@[0-1]+$':
>       $ref: /schemas/connector/usb-connector.yaml#
> +    unevaluatedProperties: false
>       properties:
>         reg:
>           maxItems: 1
> 
> -unevaluatedProperties: false
> 
>   required:
>     - compatible
>     - reg
>     - interrupts
> 
> +additionalProperties: false
> +
> 

Thanks for the review.
Somehow I do not get the warnings in local test.
I'll apply the change into the next patch series.

thanks,
Wayne.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
new file mode 100644
index 000000000000..70db97e0ad31
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
@@ -0,0 +1,86 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cypress cypd4226 UCSI I2C Type-C Controller
+
+maintainers:
+  - Wayne Chang <waynec@nvidia.com>
+
+description:
+  The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface type-C
+  controller.
+
+properties:
+  compatible:
+    const: cypress,cypd4226
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  reg:
+    const: 0x08
+
+  interrupts:
+    items:
+      - description: cypd4226 I2C interrupt
+
+  cypress,firmware-build:
+    enum:
+      - nvidia,gpu
+      - nvidia,jetson-agx-xavier
+    description: |
+      the name of the CCGx firmware built for product series.
+      should be set one of following:
+      - "nvidia,gpu" for the NVIDIA RTX product series
+      - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
+
+patternProperties:
+  '^connector@[0-1]+$':
+    $ref: /schemas/connector/usb-connector.yaml#
+    properties:
+      reg:
+        maxItems: 1
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/gpio/tegra194-gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      #interrupt-cells = <2>;
+
+      ucsi-ccg@8 {
+        compatible = "cypress,cypd4226";
+        interrupt-parent = <&gpio_aon>;
+        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
+        reg = <0x08>;
+        cypress,firmware-build = "nvidia,jetson-agx-xavier";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        ccg_typec_con0: connector@0 {
+          compatible = "usb-c-connector";
+          reg = <0>;
+          label = "USB-C";
+          data-role = "dual";
+          port {
+            ucsi_ccg_p0: endpoint {
+              remote-endpoint = <&usb_role_switch0>;
+            };
+          };
+        };
+      };
+    };