Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: pawell@cadence.com
Cc: Peter Chen <peter.chen@kernel.org>,
	Roger Quadros <rogerq@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/2] dt-bindings: usb: cdns3: Add no_drd property
Date: Wed, 13 May 2026 19:59:06 +0100	[thread overview]
Message-ID: <20260513-unhappily-thicken-e6350001c2a1@spud> (raw)
In-Reply-To: <20260513-b4-no_drd_config-v6-1-e7789cd0e581@cadence.com>

[-- Attachment #1: Type: text/plain, Size: 5771 bytes --]

On Wed, May 13, 2026 at 01:44:19PM +0200, Pawel Laszczak via B4 Relay wrote:
> From: Pawel Laszczak <pawell@cadence.com>
> 
> Introduce a new boolean property 'no_drd' for Cadence USBSS/USBSSP
> controllers to support hardware configurations where the Dual-Role
> Device (DRD) register block is missing or inaccessible.
> 
> When 'no_drd' is present:
> - The 'otg' register and interrupt resources are not required.
> - The 'reg' and 'interrupts' properties are restricted to 2 items
>   (host and device).
> - 'dr_mode' must be explicitly set to either 'host' or 'peripheral'.
> 
> When 'no_drd' is absent, the binding maintains backward compatibility
> by requiring all 3 resource sets (otg, host, dev).
> 
> To achieve this, the schema is updated with an if-then-else logic
> and 'reg-names'/'interrupt-names' use enums to allow flexible
> ordering during validation.
> 
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
> v6:
> - Fixed validation error for 'interrupt-names' by correcting
>   the items definition.
> - Adjusted 'minItems'/'maxItems' to properly support the optional
>  'wakeup' interrupt.
> - Fixed 'too long' schema error in examples.
> 
> v5:
> - Implemented strict conditional validation using if-then-else logic.
> - Enforced 2 register/interrupt items and required 'dr_mode'
>   (host or peripheral) when 'no_drd' is present.
> - Enforced the standard 3 register/interrupt items (otg, host, dev)
>   when 'no_drd' is absent to ensure backward compatibility.
> - Updated 'reg-names' and 'interrupt-names' to use enums in the main
>   properties section to support flexible resource ordering during
>   validation.
> ---
> ---
>  .../devicetree/bindings/usb/cdns,usb3.yaml         | 70 +++++++++++++++++++---
>  1 file changed, 61 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/cdns,usb3.yaml b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
> index 2d95fb7321af..717892a05dcd 100644
> --- a/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
> +++ b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
> @@ -20,19 +20,21 @@ properties:
>      const: cdns,usb3
>  
>    reg:
> +    minItems: 2
>      items:
>        - description: OTG controller registers
>        - description: XHCI Host controller registers
>        - description: DEVICE controller registers

This is not accurate anymore, given you're allowing no otg registers for
the no_drd case. Probably should have both items lists here, one for
each configuration.

>  
>    reg-names:
> +    minItems: 2
>      items:
> -      - const: otg
> -      - const: xhci
> -      - const: dev
> +      - enum: [ otg, xhci, dev ]
> +      - enum: [ otg, xhci, dev ]
> +      - enum: [ otg, xhci, dev ]

If you delete the -, you can get away with only having one instance of
the enum. You'd need to set maxItems: 3 though.

>  
>    interrupts:
> -    minItems: 3
> +    minItems: 2
>      items:
>        - description: XHCI host controller interrupt
>        - description: Device controller interrupt
> @@ -41,12 +43,12 @@ properties:
>                       cleared by xhci core, this interrupt is optional
>  
>    interrupt-names:
> -    minItems: 3
> +    minItems: 2
>      items:
> -      - const: host
> -      - const: peripheral
> -      - const: otg
> -      - const: wakeup
> +      - enum: [ host, peripheral, otg, wakeup ]
> +      - enum: [ host, peripheral, otg, wakeup ]
> +      - enum: [ host, peripheral, otg, wakeup ]
> +      - enum: [ host, peripheral, otg, wakeup ]

I don't understand this. otg and wakeup are the ones you're making
optional, so this list could remain as it was?

>  
>    port:
>      $ref: /schemas/graph.yaml#/properties/port
> @@ -79,6 +81,13 @@ properties:
>      description: Enable resetting of PHY if Rx fail is detected
>      type: boolean
>  
> +  no_drd:

On v1, I mistakenly thought this was a common property, but seems to not
be. In that case, replace the _ with a - and add a vendor prefix.

> +    description:
> +      Indicates that the Dual-Role Device (DRD) register block is not
> +      implemented or is inaccessible. In this case, the controller
> +      must operate in a fixed peripheral or host mode.
> +    type: boolean
> +
>  dependencies:
>    port: [ usb-role-switch ]
>  
> @@ -93,6 +102,49 @@ allOf:
>    - $ref: usb-drd.yaml#
>    - $ref: usb-xhci.yaml#
>  
> +  - if:

> +      properties:
> +        no_drd: true

Drop this, it's not needed. "required: - no_drd" does it for you.

> +      required:
> +        - no_drd

> +    then:
> +      required:
> +        - dr_mode

And drop this too.

pw-bot: changes-requested

Thanks,
Conor.

> +      properties:
> +        reg:
> +          maxItems: 2
> +        reg-names:
> +          items:
> +            - const: xhci
> +            - const: dev
> +        interrupts:
> +          maxItems: 2
> +        interrupt-names:
> +          items:
> +            - const: host
> +            - const: peripheral
> +        dr_mode:
> +          enum: [host, peripheral]
> +    else:
> +      properties:
> +        reg:
> +          minItems: 3
> +        reg-names:
> +          items:
> +            - const: otg
> +            - const: xhci
> +            - const: dev
> +        interrupts:
> +          minItems: 3
> +          maxItems: 4
> +        interrupt-names:
> +          minItems: 3
> +          items:
> +            - const: host
> +            - const: peripheral
> +            - const: otg
> +            - const: wakeup
> +
>  unevaluatedProperties: false
>  
>  examples:
> 
> -- 
> 2.43.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-05-13 18:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 11:44 [PATCH v6 0/2] usb: cdns3: support configurations without DRD block Pawel Laszczak via B4 Relay
2026-05-13 11:44 ` [PATCH v6 1/2] dt-bindings: usb: cdns3: Add no_drd property Pawel Laszczak via B4 Relay
2026-05-13 18:59   ` Conor Dooley [this message]
2026-05-13 11:44 ` [PATCH v6 2/2] usb: cdnsp: Add support for device-only configuration Pawel Laszczak via B4 Relay

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=20260513-unhappily-thicken-e6350001c2a1@spud \
    --to=conor@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=robh@kernel.org \
    --cc=rogerq@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