usb: dt-bindings: ti,twlxxxx-usb: convert to DT schema
Subsystems (2)
PATCH v4 1/1 usb: dt-bindings: ti,twlxxxx-usb: convert to DT schema
Convert the legacy TXT binding for the TWL4030/6030 USB module to the modern YAML DT schema format. This adds formal validation and improves documentation using a conditional schema.
---
Changes in v4:
- This patch is split from larger series per maintainer feedback.
- v3 link:
https://lore.kernel.org/all/[email protected]/
- Removed i2c node as it wasn't required by the old binding file.
- Updated node names to 'usb' and 'usb-phy' in the examples to follow generic naming conventions per the Device Tree specification.
- Replaced raw interrupt values with standard defines for clarity.
- Improved formatting in the examples for clarity and consistency.
Changes in v3:
- No changes.
Changes in v2:
- Added '#phy-cells' property to support PHY framework integration.
--- .../bindings/usb/ti,twlxxxx-usb.yaml | 116 ++++++++++++++++++ .../devicetree/bindings/usb/twlxxxx-usb.txt | 43 ------- 2 files changed, 116 insertions(+), 43 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml delete mode 100644 Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +116 -0
@@ -0,0 +1,116 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/ti,twlxxxx-usb.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments TWL4030/6030 USB PHY and Comparator + +maintainers: + - Peter Ujfalusi <[email protected]> + +description: | + Bindings for the USB PHY and comparator module found within the + TWL4030 and TWL6030 family of companion chips. + + TWL6030: USB COMPARATOR + TWL4030: USB COMPARATOR & PHY + + If a sibling node is compatible with "ti,twl4030-bci", the driver for + that node will query this device for USB power status. + +properties: + compatible: + enum: + - ti,twl4030-usb + - ti,twl6030-usb + + interrupts: + description: | + Interrupts for ID and VBUS events. + For "ti,twl6030-usb", two interrupts must be specified: + - The first is the OTG interrupt for ID events (host mode). + - The second is the USB interrupt for VBUS events (device mode). + For "ti,twl4030-usb", one or two interrupts can be specified: + - The first is the OTG interrupt for both ID and VBUS events. + - The second is optional. + minItems: 1 + maxItems: 2 + + usb-supply: + description: + Phandle to the VUSB regulator. For TWL6030, this should be the 'vusb' + regulator. For TWL6032 subclass, it should be the 'ldousb' regulator. + + usb1v5-supply: + description: Phandle to the VUSB1V5 regulator (for TWL4030). + + usb1v8-supply: + description: Phandle to the VUSB1V8 regulator (for TWL4030). + + usb3v1-supply: + description: Phandle to the USB3V1 regulator (for TWL4030). + + usb_mode: + description: | + The mode used by the PHY (TWL4030 ONLY) to connect to the controller: + 1: ULPI mode + 2: CEA2011_3PIN mode + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + + '#phy-cells': + const: 0 + +required: + - compatible + - interrupts + +additionalProperties: false + +if: + properties: + compatible: + contains: + const: ti,twl6030-usb +then: + required: + - usb-supply + properties: + interrupts: + minItems: 2 +else: + required: + - usb1v5-supply + - usb1v8-supply + - usb3v1-supply + - usb_mode + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + usb-phy{ + compatible = "ti,twl4030-usb"; + + // 1 interrupt: OTG (ID & VBUS events) + interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + + usb1v5-supply = <®_vusb1v5>; + usb1v8-supply = <®_vusb1v8>; + usb3v1-supply = <®_vusb3v1>; + usb_mode = <1>; + + #phy-cells = <0>; + }; + - | + usb{ + compatible = "ti,twl6030-usb"; + + // 2 interrupts: OTG & USB + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>, <10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + + usb-supply = <®_vusb>; + };
Documentation/devicetree/bindings/usb/twlxxxx-usb.txt deleted +0 -43
43 lines not on this page · raw message
Signature · 1 line
2.39.5
Quoted 9 lines · Jihed Chaibi
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +9
-0+additionalProperties: false + +if: + properties: + compatible: + contains: + const: ti,twl6030-usb +then: + required:
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml line 87
Quoted 10 lines
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +10
-0+ - usb-supply + properties: + interrupts: + minItems: 2 +else: + required: + - usb1v5-supply + - usb1v8-supply + - usb3v1-supply + - usb_mode
I think this should be just two bindings. Half of the properties are different.
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml line 91
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +4
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h>
You do not use this header.
Review
Quoted 2 lines
(quoted diff) +2
-0+ + usb-phy{
Missing space {
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml line 96
Quoted 3 lines
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +3
-0+ compatible = "ti,twl4030-usb"; + + // 1 interrupt: OTG (ID & VBUS events)
Drop comments, schema defines what is here.
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml line 105
Quoted 9 lines
Documentation/devicetree/bindings/usb/ti,twlxxxx-usb.yaml new file +9
-0+ interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + + usb1v5-supply = <®_vusb1v5>; + usb1v8-supply = <®_vusb1v8>; + usb3v1-supply = <®_vusb3v1>; + usb_mode = <1>; + + #phy-cells = <0>;
Best regards,
Krzysztof