mbox series

[V9,0/6] Add device-tree support for Cypress CYPD4226

Message ID 20230127151041.65751-1-jonathanh@nvidia.com
Headers show
Series Add device-tree support for Cypress CYPD4226 | expand

Message

Jon Hunter Jan. 27, 2023, 3:10 p.m. UTC
Add device-tree support for Cypress CYPD4226 Type-C controller and
enable for the Jetson AGX Orin board. This series is derived from the
series to enable USB host and device support for Jetson AGX Orin [0].
I have split this out from that series because it was getting quite
big.

[0] https://lore.kernel.org/linux-tegra/20221114124053.1873316-1-waynec@nvidia.com/

Jon Hunter (2):
  arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin
  arm64: defconfig: Enable UCSI support

Wayne Chang (4):
  dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  i2c: nvidia-gpu: Add ACPI property to align with device-tree
  usb: typec: ucsi_ccg: Add OF support
  i2c: nvidia-gpu: Remove ccgx,firmware-build property

 .../bindings/usb/cypress,cypd4226.yaml        | 92 +++++++++++++++++++
 .../nvidia/tegra234-p3737-0000+p3701-0000.dts | 14 +++
 arch/arm64/configs/defconfig                  |  2 +
 drivers/i2c/busses/i2c-nvidia-gpu.c           |  4 +-
 drivers/usb/typec/ucsi/ucsi_ccg.c             | 22 ++++-
 5 files changed, 128 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml

Comments

Krzysztof Kozlowski Jan. 28, 2023, 10:29 a.m. UTC | #1
On 27/01/2023 16:10, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Add the device-tree binding documentation for Cypress cypd4226 dual
> Type-C controller.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V9: added 'unevaluatedProperties' and 'additionalProperties'
> V8: removed 'additionalProperties'
> V7: updated example to use 'typec' for the node name
> V6: no changes
> V5: updated subject and updated binding to use 'firmware-name'.
> V4: no changes
> V3: fix additionalProperties warning on new schema
> V2: based on the review comments. Fix some addressed issues on

Thanks, this is looking good, although few more questions popped up
while comparing it with other bindings.

(...)

> +  firmware-name:
> +    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]+$':

How many connectors do you expect/support? 1111 is valid? I guess you
wanted only [01]?

> +    $ref: /schemas/connector/usb-connector.yaml#
> +    unevaluatedProperties: false
> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts

I would assume that at least one connector is required (oneOf: required:).

> +
> +additionalProperties: false
> +
> +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>;
> +
> +      typec@8 {
> +        compatible = "cypress,cypd4226";
> +        reg = <0x08>;
> +        interrupt-parent = <&gpio_aon>;
> +        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
> +        firmware-name = "nvidia,jetson-agx-xavier";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        connector@0 {
> +          compatible = "usb-c-connector";
> +          reg = <0>;
> +          label = "USB-C";
> +          data-role = "dual";
> +          ports {
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            port@0 {
> +              reg = <0>;
> +              endpoint {
> +                remote-endpoint = <&usb_role_switch0>;
> +              };
> +            };
> +          };
> +        };
> +      };
> +    };

Best regards,
Krzysztof
Jon Hunter Jan. 30, 2023, 9:10 p.m. UTC | #2
On 28/01/2023 10:29, Krzysztof Kozlowski wrote:

...

>> +    $ref: /schemas/connector/usb-connector.yaml#
>> +    unevaluatedProperties: false
>> +    properties:
>> +      reg:
>> +        maxItems: 1
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
> 
> I would assume that at least one connector is required (oneOf: required:).


I have been looking at this and wondered if we need the 'oneOf' in this 
case? Shouldn't we just add 'connector@0' to the required properties?

At first I added ...

oneOf:
     - required:
         - connector@0
     - required:
         - connector@1

But this is not correct, because the above will cause warnings if both 
connector@0 and connector@1 are present.

Jon