Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 48 additions & 6 deletions Documentation/devicetree/bindings/usb/apple,dwc3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,46 @@ description:
Apple Silicon SoCs use a Synopsys DesignWare DWC3 based controller for each of
their Type-C ports.

On T8152 the bootloader can hand a controller over already running, powered
and with the USB2 side of its ATC PHY set up for host mode. Such a controller
is described by its DWC3 core region, as a host. Its PHY reset and power
domain, and on a Type-C port its USB role switch, exist but are left to the
bootloader, so they are optional.

allOf:
- $ref: snps,dwc3-common.yaml#
- if:
properties:
compatible:
not:
contains:
const: apple,t8132-dwc3
enum:
- apple,t8132-dwc3
- apple,t8152-dwc3
then:
required:
- power-domains
- if:
properties:
compatible:
contains:
const: apple,t8152-dwc3
then:
properties:
dr_mode:
const: host
required:
- dr_mode
else:
properties:
reg:
minItems: 2
reg-names:
minItems: 2
required:
- reg-names
- resets
- usb-role-switch

$defs:
apple,tunable:
Expand Down Expand Up @@ -56,16 +85,17 @@ properties:
- const: apple,t8103-dwc3
- const: apple,t8103-dwc3
- const: apple,t8132-dwc3
- const: apple,t8152-dwc3

reg:
minItems: 2
minItems: 1
items:
- description: Core DWC3 region
- description: Apple-specific DWC3 region
- description: Controller configuration block (T6040)

reg-names:
minItems: 2
minItems: 1
items:
- const: dwc3-core
- const: dwc3-apple
Expand Down Expand Up @@ -106,11 +136,8 @@ properties:
required:
- compatible
- reg
- reg-names
- interrupts
- iommus
- resets
- usb-role-switch

unevaluatedProperties: false

Expand All @@ -131,3 +158,18 @@ examples:

usb-role-switch;
};

- |
#include <dt-bindings/interrupt-controller/apple-aic.h>
#include <dt-bindings/interrupt-controller/irq.h>

usb@82430000 {
compatible = "apple,t8152-dwc3";
reg = <0x82430000 0xcd00>;
interrupts = <AIC_IRQ 1763 IRQ_TYPE_LEVEL_HIGH>;
iommus = <&dwc3_2_dart_0 0>, <&dwc3_2_dart_1 1>;
dr_mode = "host";
maximum-speed = "high-speed";
snps,dis_u2_susphy_quirk;
snps,dis_u3_susphy_quirk;
};
70 changes: 70 additions & 0 deletions arch/arm64/boot/dts/apple/t8152-j873-usb.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* J873g USB2 host bring-up: usb-drd1 (back-left port) and usb-drd2
* (front ports via the on-board hub).
* The loader powers the controllers and sets up the USB2 side of their ATC
* PHYs for host mode before Linux starts (there is no T8152 USB power-domain,
* ATC PHY or Type-C support yet).
* The controllers are described by their DWC3 core region, as hosts behind
* their two DARTs (apple,t8152-dwc3); their PHY reset and power domain, and on
* the Type-C port the role switch, exist but are left to the loader.
* Resources are from the 26A434 ADT: dart-usb1/2, usb-drd1/2.
*
* dart-usb1 and dart-usb2 each have two DART instances (ADT reg[0] and
* reg[1], 0xc000 each, sharing one interrupt). t8152-peripherals.dtsi lists
* both windows on one node (dwc3_1_dart, dwc3_2_dart), but the DART driver
* drives one instance per node and the binding reads a second reg entry as
* DAPF or auxiliary registers. Keep instance 0 on the shared node, with its
* own window only, and describe instance 1 as a node of its own.
*/

&dwc3_1_dart {
reg = <0x4 0x0b020000 0x0 0xc000>;
status = "okay";
};

&dwc3_2_dart {
reg = <0x3 0x83020000 0x0 0xc000>;
status = "okay";
};

/ {
soc {
dwc3_1_dart_1: iommu@40b040000 {
compatible = "apple,t8152-dart", "apple,t8110-dart";
reg = <0x4 0x0b040000 0x0 0xc000>;
interrupts = <AIC_IRQ 1679 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

usb1: usb@40a430000 {
compatible = "apple,t8152-dwc3";
reg = <0x4 0x0a430000 0x0 0xcd00>;
interrupts = <AIC_IRQ 1692 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "host";
maximum-speed = "high-speed";
iommus = <&dwc3_1_dart 0>, <&dwc3_1_dart_1 1>;
snps,dis_u2_susphy_quirk;
snps,dis_u3_susphy_quirk;
};

dwc3_2_dart_1: iommu@383040000 {
compatible = "apple,t8152-dart", "apple,t8110-dart";
reg = <0x3 0x83040000 0x0 0xc000>;
interrupts = <AIC_IRQ 1750 IRQ_TYPE_LEVEL_HIGH>;
#iommu-cells = <1>;
};

/* usb-drd2: on-board VL822 hub behind the two front USB-C ports. */
usb2: usb@382430000 {
compatible = "apple,t8152-dwc3";
reg = <0x3 0x82430000 0x0 0xcd00>;
interrupts = <AIC_IRQ 1763 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "host";
maximum-speed = "high-speed";
iommus = <&dwc3_2_dart 0>, <&dwc3_2_dart_1 1>;
snps,dis_u2_susphy_quirk;
snps,dis_u3_susphy_quirk;
};
};
};
17 changes: 2 additions & 15 deletions arch/arm64/boot/dts/apple/t8152-j873g.dts
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,6 @@
<0x4 0x3040000 0x0 0xc000>;
};

/* Retain the register view published by this board's live hardware capture. */
&dwc3_1_dart {
reg = <0x4 0xb020000 0x0 0xc000>,
<0x4 0xb040000 0x0 0xc000>;
};

/* Retain the register view published by this board's live hardware capture. */
&dwc3_3_dart {
reg = <0x4 0x13020000 0x0 0xc000>,
Expand Down Expand Up @@ -500,18 +494,11 @@
<0x3 0xa0000000 0x0 0x8000>;
};

/* Unexposed chassis port instances remain described and disabled. */

/* Retain the register view published by this board's live hardware capture. */
&dwc3_2_dart {
reg = <0x3 0x83020000 0x0 0xc000>,
<0x3 0x83040000 0x0 0xc000>;
};

/*
* The J873g fragments enable and refine nodes of t8152-peripherals.dtsi
* (the apcie port 2 and dart-sbr DARTs), so they come after it.
* (the USB, apcie port 2 and dart-sbr DARTs), so they come after it.
*/
#include "t8152-j873-nvme.dtsi"
#include "t8152-j873-usb.dtsi"
#include "t8152-j873-ethernet.dtsi"
#include "t8152-j873-audio.dtsi"
4 changes: 4 additions & 0 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,10 @@ static const struct of_device_id of_dwc3_match[] = {
{
.compatible = "synopsys,dwc3"
},
{
/* Handed over in host mode by the bootloader, see apple,dwc3.yaml */
.compatible = "apple,t8152-dwc3"
},
{ },
};
MODULE_DEVICE_TABLE(of, of_dwc3_match);
Expand Down
Loading