diff mbox series

[v2,1/2] dt-bindings: usb: Add Apple dwc3 bindings

Message ID 20211108170946.49689-1-sven@svenpeter.dev (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] dt-bindings: usb: Add Apple dwc3 bindings | expand

Commit Message

Sven Peter Nov. 8, 2021, 5:09 p.m. UTC
Apple Silicon SoCs such as the M1 have multiple USB controllers based on
the Synopsys DesignWare USB3 controller.
References to the ATC PHY required for SuperSpeed are left out for now
until support has been upstreamed as well.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
v1 -> v2:
 - added apple,dwc3 bindings instead of a property for the reset quirk
   as requested by robh

I think I have to use GPL-2.0 for this binding since it's based
on and references snps,dwc3.yaml which is also only GPL-2.0.
Otherwise I'd be fine with the usual GPL/BSD dual license as well.

 .../devicetree/bindings/usb/apple,dwc3.yaml   | 64 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/apple,dwc3.yaml

Comments

Rob Herring Nov. 29, 2021, 1:27 a.m. UTC | #1
On Mon, Nov 08, 2021 at 06:09:45PM +0100, Sven Peter wrote:
> Apple Silicon SoCs such as the M1 have multiple USB controllers based on
> the Synopsys DesignWare USB3 controller.
> References to the ATC PHY required for SuperSpeed are left out for now
> until support has been upstreamed as well.
> 
> Signed-off-by: Sven Peter <sven@svenpeter.dev>
> ---
> v1 -> v2:
>  - added apple,dwc3 bindings instead of a property for the reset quirk
>    as requested by robh
> 
> I think I have to use GPL-2.0 for this binding since it's based
> on and references snps,dwc3.yaml which is also only GPL-2.0.
> Otherwise I'd be fine with the usual GPL/BSD dual license as well.
> 
>  .../devicetree/bindings/usb/apple,dwc3.yaml   | 64 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 65 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/apple,dwc3.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/apple,dwc3.yaml b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
> new file mode 100644
> index 000000000000..fb3b3489e6b2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
> @@ -0,0 +1,64 @@
> +# SPDX-License-Identifier: GPL-2.0

Dual license please.

> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/apple,dwc3.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Apple Silicon DWC3 USB controller
> +
> +maintainers:
> +  - Sven Peter <sven@svenpeter.dev>
> +
> +description:
> +  On Apple Silicon SoCs such as the M1 each Type-C port has a corresponding
> +  USB controller based on the Synopsys DesignWare USB3 controller.
> +
> +  The common content of this binding is defined in snps,dwc3.yaml.
> +
> +allOf:
> +  - $ref: snps,dwc3.yaml#
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        const: apple,dwc3

This needs to list all possible compatibles except snps,dwc3 so the 
schema is applied for any incorrect mixture of compatibles.

> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - apple,t8103-dwc3
> +          - apple,t6000-dwc3
> +      - const: apple,dwc3
> +      - const: snps,dwc3
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/apple-aic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    usb@82280000 {
> +      compatible = "apple,t8103-dwc3", "apple,dwc3", "snps,dwc3";
> +      reg = <0x82280000 0x10000>;
> +      interrupts = <AIC_IRQ 777 IRQ_TYPE_LEVEL_HIGH>;
> +
> +      dr_mode = "otg";
> +      usb-role-switch;
> +      role-switch-default-mode = "host";
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3b79fd441dde..03e7cc48877a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1724,6 +1724,7 @@ T:	git https://github.com/AsahiLinux/linux.git
>  F:	Documentation/devicetree/bindings/arm/apple.yaml
>  F:	Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
>  F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
> +F:	Documentation/devicetree/bindings/usb/apple,dwc3.yaml
>  F:	arch/arm64/boot/dts/apple/
>  F:	drivers/irqchip/irq-apple-aic.c
>  F:	include/dt-bindings/interrupt-controller/apple-aic.h
> -- 
> 2.25.1
> 
>
Sven Peter Nov. 29, 2021, 10:34 p.m. UTC | #2
Hi,

Thanks for the review!

On Mon, Nov 29, 2021, at 02:27, Rob Herring wrote:
> On Mon, Nov 08, 2021 at 06:09:45PM +0100, Sven Peter wrote:
>> Apple Silicon SoCs such as the M1 have multiple USB controllers based on
>> the Synopsys DesignWare USB3 controller.
>> References to the ATC PHY required for SuperSpeed are left out for now
>> until support has been upstreamed as well.
>> 
>> Signed-off-by: Sven Peter <sven@svenpeter.dev>
>> ---
>> v1 -> v2:
>>  - added apple,dwc3 bindings instead of a property for the reset quirk
>>    as requested by robh
>> 
>> I think I have to use GPL-2.0 for this binding since it's based
>> on and references snps,dwc3.yaml which is also only GPL-2.0.
>> Otherwise I'd be fine with the usual GPL/BSD dual license as well.
>> 
>>  .../devicetree/bindings/usb/apple,dwc3.yaml   | 64 +++++++++++++++++++
>>  MAINTAINERS                                   |  1 +
>>  2 files changed, 65 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/usb/apple,dwc3.yaml
>> 
>> diff --git a/Documentation/devicetree/bindings/usb/apple,dwc3.yaml b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
>> new file mode 100644
>> index 000000000000..fb3b3489e6b2
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
>> @@ -0,0 +1,64 @@
>> +# SPDX-License-Identifier: GPL-2.0
>
> Dual license please.

I'd like to but I'm not sure if I can do that. This binding is based on
snps,dwc3.yaml and rockchip,dwc3.yaml which are both only GPL-2.0.

>
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/usb/apple,dwc3.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Apple Silicon DWC3 USB controller
>> +
>> +maintainers:
>> +  - Sven Peter <sven@svenpeter.dev>
>> +
>> +description:
>> +  On Apple Silicon SoCs such as the M1 each Type-C port has a corresponding
>> +  USB controller based on the Synopsys DesignWare USB3 controller.
>> +
>> +  The common content of this binding is defined in snps,dwc3.yaml.
>> +
>> +allOf:
>> +  - $ref: snps,dwc3.yaml#
>> +
>> +select:
>> +  properties:
>> +    compatible:
>> +      contains:
>> +        const: apple,dwc3
>
> This needs to list all possible compatibles except snps,dwc3 so the 
> schema is applied for any incorrect mixture of compatibles.

Makes sense, will do that for the next version.



Thanks,

Sven
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/apple,dwc3.yaml b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
new file mode 100644
index 000000000000..fb3b3489e6b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/apple,dwc3.yaml
@@ -0,0 +1,64 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/apple,dwc3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple Silicon DWC3 USB controller
+
+maintainers:
+  - Sven Peter <sven@svenpeter.dev>
+
+description:
+  On Apple Silicon SoCs such as the M1 each Type-C port has a corresponding
+  USB controller based on the Synopsys DesignWare USB3 controller.
+
+  The common content of this binding is defined in snps,dwc3.yaml.
+
+allOf:
+  - $ref: snps,dwc3.yaml#
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: apple,dwc3
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - apple,t8103-dwc3
+          - apple,t6000-dwc3
+      - const: apple,dwc3
+      - const: snps,dwc3
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/apple-aic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    usb@82280000 {
+      compatible = "apple,t8103-dwc3", "apple,dwc3", "snps,dwc3";
+      reg = <0x82280000 0x10000>;
+      interrupts = <AIC_IRQ 777 IRQ_TYPE_LEVEL_HIGH>;
+
+      dr_mode = "otg";
+      usb-role-switch;
+      role-switch-default-mode = "host";
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 3b79fd441dde..03e7cc48877a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1724,6 +1724,7 @@  T:	git https://github.com/AsahiLinux/linux.git
 F:	Documentation/devicetree/bindings/arm/apple.yaml
 F:	Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
 F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
+F:	Documentation/devicetree/bindings/usb/apple,dwc3.yaml
 F:	arch/arm64/boot/dts/apple/
 F:	drivers/irqchip/irq-apple-aic.c
 F:	include/dt-bindings/interrupt-controller/apple-aic.h