Skip to contentSkip to conversation

Apple SoC CIO (USB4/Thunderbolt) reset controller

PATCH Applied Sven Peter 2 participants 6 messages Oct 3 – Nov 5

Subsystems (3)
lore
Share & tools
lore

Sven Peter

author maintainer
#0 lore raw

v3 cover Apple SoC CIO (USB4/Thunderbolt) reset controller

Hi,

The CIO blocks used for USB4/Thunderbolt on Apple Silicon SoCs have a reset inside the power manager that has to be deasserted before their co-processor can be booted. On t8103 and t8112 each port comes with a dedicated register page while t600x and t602x use a single register with one request bit per port shared by all ports of a die in the middle of the PMGR MMIO region.

The first patch adds the dt-binding, the second one the driver and the last one the device tree nodes for all SoCs. This will be used by the upcoming USB4/Thunderbolt series to start the host routers before booting their co-processors.

Best,

Sven

---
Changes in v3:
- rebased on -rc1
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- dt-bindings: move the t600x example with the PMGR sub-node over to the PMGR binding itself where it can use the correct number of address
cells such that the unit address matches reg again (Conor)
- bail out of probe when no match data is available (Joshua, sashiko)
- explain why neither a read-modify-write nor a delay before polling
is required for the shared t600x register (sashiko)
- fix a copy/paste error for the M2 MMIO region in the dts change
- Link to v1: https://patch.msgid.link/[email protected]

To: Sven Peter <[email protected]>
To: Janne Grunau <[email protected]>
To: Neal Gompa <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Philipp Zabel <[email protected]>
Cc: Joshua Peisach <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Sven Peter (3):
dt-bindings: reset: Add Apple SoC CIO reset
reset: Add Apple SoC CIO reset driver
arm64: dts: apple: Add CIO reset controllers

 .../devicetree/bindings/arm/apple/apple,pmgr.yaml  |  12 ++
 .../bindings/reset/apple,t8103-cio-reset.yaml      |  61 +++++++
 MAINTAINERS                                        |   2 +
 arch/arm64/boot/dts/apple/t600x-dieX.dtsi          |   8 +-
 arch/arm64/boot/dts/apple/t602x-dieX.dtsi          |   8 +-
 arch/arm64/boot/dts/apple/t8103.dtsi               |   6 +
 arch/arm64/boot/dts/apple/t8112.dtsi               |   6 +
 drivers/reset/Kconfig                              |  10 ++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-apple-cio.c                    | 200 +++++++++++++++++++++
 10 files changed, 312 insertions(+), 2 deletions(-)

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260809-b4-cio-reset-aa3fb04bad9e

Best regards,

Signature · 1 line
Sven Peter <[email protected]>
author maintainer
#1 lore raw

PATCH v3 1/3 dt-bindings: reset: Add Apple SoC CIO reset

The CIO (USB4/Thunderbolt) blocks on Apple Silicon SoCs have a reset inside the power manager that has to be deasserted before their co-processor can be booted. On t8103 each port comes with a dedicated register page, represented as a standalone node. On t600x a single register shared by all ports of a die is located in the middle of the PMGR MMIO region instead, represented as a sub-node of the PMGR syscon.

---
 .../devicetree/bindings/arm/apple/apple,pmgr.yaml  | 12 +++++
 .../bindings/reset/apple,t8103-cio-reset.yaml      | 61 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 3 files changed, 74 insertions(+)
Documentation/devicetree/bindings/arm/apple/apple,pmgr.yaml +12 -0
index 1d2001836eb4..6429ca685b9d 100644
@@ -61,6 +61,12 @@ patternProperties:
     type: object
     $ref: /schemas/power/apple,pmgr-pwrstate.yaml#
 
+  "reset-controller@[0-9a-f]+$":
+    description:
+      Reset controller for the CIO (USB4/Thunderbolt) blocks
+    type: object
+    $ref: /schemas/reset/apple,t8103-cio-reset.yaml#
+
 required:
   - compatible
   - reg
@@ -105,6 +111,12 @@ examples:
                 label = "uart0";
                 power-domains = <&ps_uart_p>;
             };
+
+            reset-controller@13034 {
+                compatible = "apple,t6000-cio-reset";
+                reg = <0x13034 0x4>;
+                #reset-cells = <1>;
+            };
         };
 
         power-management@23d280000 {
Documentation/devicetree/bindings/reset/apple,t8103-cio-reset.yaml new file +61 -0

61 lines not on this page · raw message

MAINTAINERS +1 -0
index 3a19da74d00c..e333c7863460 100644
@@ -2654,6 +2654,7 @@ F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
 F:	Documentation/devicetree/bindings/power/apple*
 F:	Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml
 F:	Documentation/devicetree/bindings/pwm/apple,s5l-fpwm.yaml
+F:	Documentation/devicetree/bindings/reset/apple,t8103-cio-reset.yaml
 F:	Documentation/devicetree/bindings/rtc/apple,smc-rtc.yaml
 F:	Documentation/devicetree/bindings/soc/apple/apple,t6000-pmgr-misc.yaml
 F:	Documentation/devicetree/bindings/spi/apple,spi.yaml
Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH v3 2/3 reset: Add Apple SoC CIO reset driver

In reply to Sven Peter

Add a driver for the reset of the CIO (USB4/Thunderbolt) blocks on Apple Silicon SoCs which has to be deasserted before their co-processor can be booted. On t8103 each port comes with a dedicated register page while t600x uses a single register with one request bit per port shared by all ports of a die inside the PMGR MMIO region.

---
 MAINTAINERS                     |   1 +
 drivers/reset/Kconfig           |  10 ++
 drivers/reset/Makefile          |   1 +
 drivers/reset/reset-apple-cio.c | 200 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 212 insertions(+)
MAINTAINERS +1 -0
index e333c7863460..096fe7535c02 100644
@@ -2685,6 +2685,7 @@ F:	drivers/pinctrl/pinctrl-apple-gpio.c
 F:	drivers/power/reset/macsmc-reboot.c
 F:	drivers/power/supply/macsmc-power.c
 F:	drivers/pwm/pwm-apple.c
+F:	drivers/reset/reset-apple-cio.c
 F:	drivers/rtc/rtc-macsmc.c
 F:	drivers/soc/apple/*
 F:	drivers/spi/spi-apple.c
drivers/reset/Kconfig +10 -0
index 3168ab1eea88..2111d79cbdb2 100644
@@ -22,6 +22,16 @@ config RESET_A10SR
 	  This option enables support for the external reset functions for
 	  peripheral PHYs on the Altera Arria10 System Resource Chip.
 
+config RESET_APPLE_CIO
+	tristate "Apple SoC CIO block reset driver"
+	depends on ARCH_APPLE || COMPILE_TEST
+	select MFD_SYSCON
+	help
+	  This enables the reset driver for the CIO (USB4/Thunderbolt) blocks
+	  found on Apple Silicon SoCs. It is required to start the blocks
+	  before the USB4/Thunderbolt host routers inside them can be brought
+	  up by the thunderbolt driver.
+
 config RESET_ASPEED
 	tristate "ASPEED Reset Driver"
 	depends on ARCH_ASPEED || COMPILE_TEST
drivers/reset/Makefile +1 -0
index 45ad17062462..eb2b9d553d7a 100644
@@ -7,6 +7,7 @@ obj-y += starfive/
 obj-y += sti/
 obj-y += tegra/
 obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o
+obj-$(CONFIG_RESET_APPLE_CIO) += reset-apple-cio.o
 obj-$(CONFIG_RESET_ASPEED) += reset-aspeed.o
 obj-$(CONFIG_RESET_ATH79) += reset-ath79.o
 obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o
drivers/reset/reset-apple-cio.c new file +200 -0

200 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#3 lore raw

PATCH v3 3/3 arm64: dts: apple: Add CIO reset controllers

In reply to Sven Peter

Add the reset controllers used to start the CIO (USB4/Thunderbolt) blocks on t8103 and t600x. On t8103 each port comes with a dedicated register page represented as a standalone node. On t600x a single register shared by all ports of a die is located in the middle of the PMGR MMIO region and represented as a sub-node of its syscon.

---
 arch/arm64/boot/dts/apple/t600x-dieX.dtsi | 8 +++++++-
 arch/arm64/boot/dts/apple/t602x-dieX.dtsi | 8 +++++++-
 arch/arm64/boot/dts/apple/t8103.dtsi      | 6 ++++++
 arch/arm64/boot/dts/apple/t8112.dtsi      | 6 ++++++
 4 files changed, 26 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/apple/t600x-dieX.dtsi +7 -1
index 9676d5127039..5e163d756a7f 100644
@@ -28,7 +28,13 @@ DIE_NODE(pmgr): power-management@28e080000 {
 		compatible = "apple,t6000-pmgr", "apple,pmgr", "syscon", "simple-mfd";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		reg = <0x2 0x8e080000 0 0x4000>;
+		reg = <0x2 0x8e080000 0 0x1c000>;
+
+		DIE_NODE(cio_reset): reset-controller@1a034 {
+			compatible = "apple,t6000-cio-reset";
+			reg = <0x1a034 0x4>;
+			#reset-cells = <1>;
+		};
 	};
 
 	DIE_NODE(pmgr_east): power-management@28e580000 {
arch/arm64/boot/dts/apple/t602x-dieX.dtsi +7 -1
index ae3d535c5acb..fd4d572a04e7 100644
@@ -27,7 +27,13 @@ DIE_NODE(pmgr): power-management@28e080000 {
 		compatible = "apple,t6020-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		reg = <0x2 0x8e080000 0 0x8000>;
+		reg = <0x2 0x8e080000 0 0xc000>;
+
+		DIE_NODE(cio_reset): reset-controller@a02c {
+			compatible = "apple,t6020-cio-reset", "apple,t6000-cio-reset";
+			reg = <0xa02c 0x4>;
+			#reset-cells = <1>;
+		};
 	};
 
 	DIE_NODE(pmgr_south): power-management@28e680000 {
arch/arm64/boot/dts/apple/t8103.dtsi +6 -0
index 5b68bf0df4e6..985dbd8e68ca 100644
@@ -730,6 +730,12 @@ pmgr: power-management@23b700000 {
 			reg = <0x2 0x3b700000 0 0x14000>;
 		};
 
+		cio_reset: reset-controller@23b784000 {
+			compatible = "apple,t8103-cio-reset";
+			reg = <0x2 0x3b784000 0x0 0x8000>;
+			#reset-cells = <1>;
+		};
+
 		pinctrl_ap: pinctrl@23c100000 {
 			compatible = "apple,t8103-pinctrl", "apple,pinctrl";
 			reg = <0x2 0x3c100000 0x0 0x100000>;
arch/arm64/boot/dts/apple/t8112.dtsi +6 -0
index ec248ca052cb..2c3b59e05e01 100644
@@ -737,6 +737,12 @@ pmgr: power-management@23b700000 {
 			/* child nodes are added in t8103-pmgr.dtsi */
 		};
 
+		cio_reset: reset-controller@23b790000 {
+			compatible = "apple,t8112-cio-reset", "apple,t8103-cio-reset";
+			reg = <0x2 0x3b790000 0x0 0x8000>;
+			#reset-cells = <1>;
+		};
+
 		pinctrl_ap: pinctrl@23c100000 {
 			compatible = "apple,t8112-pinctrl", "apple,pinctrl";
 			reg = <0x2 0x3c100000 0x0 0x100000>;
Signature · 1 line
2.55.0
maintainer
#4 lore raw
In reply to Sven Peter
Quoted 10 lines · Sven Peter

Hi,

The CIO blocks used for USB4/Thunderbolt on Apple Silicon SoCs have a reset inside the power manager that has to be deasserted before their co-processor can be booted. On t8103 and t8112 each port comes with a dedicated register page while t600x and t602x use a single register with one request bit per port shared by all ports of a die in the middle of the PMGR MMIO region.

[...]

Partially applied to reset/test, thanks!

[1/3] dt-bindings: reset: Add Apple SoC CIO reset

      https://git.kernel.org/pub/scm/linux/kernel/git/pza/linux.git/commit/?id=5b428d8ecf10
[2/3] reset: Add Apple SoC CIO reset driver
      https://git.kernel.org/pub/scm/linux/kernel/git/pza/linux.git/commit/?id=6547df06b982

regards
Philipp

author maintainer Applied
#5 lore raw

Re: (subset) [PATCH v3 0/3] Apple SoC CIO (USB4/Thunderbolt) reset controller

In reply to Sven Peter
Quoted 8 lines · Sven Peter

The CIO blocks used for USB4/Thunderbolt on Apple Silicon SoCs have a reset inside the power manager that has to be deasserted before their co-processor can be booted. On t8103 and t8112 each port comes with a dedicated register page while t600x and t602x use a single register with one request bit per port shared by all ports of a die in the middle of the PMGR MMIO region.

[...]

Applied to [email protected]:AsahiLinux/linux.git (apple-soc/dt-7.5), thanks!

[3/3] arm64: dts: apple: Add CIO reset controllers

      https://github.com/AsahiLinux/linux/commit/9055977102a4

Best regards,

Signature · 1 line
Sven Peter <[email protected]>