diff --git a/arch/arm64/boot/dts/apple/t6040-j614s.dts b/arch/arm64/boot/dts/apple/t6040-j614s.dts index 2d4bd56b1ba99..4873f5f6d9f3e 100644 --- a/arch/arm64/boot/dts/apple/t6040-j614s.dts +++ b/arch/arm64/boot/dts/apple/t6040-j614s.dts @@ -98,121 +98,4 @@ status = "disabled"; }; -/* - * USB4/Thunderbolt on all three Type-C ports: typec0 (left back, ACIO0), - * typec1 (left front, ACIO1) and typec2 (right, ACIO2), as on the J616s: the - * J614s ADT has the same acio0-2, dart-acio0-2 and acio-cpu0-2. The loader - * hands each router its router, adapter and NHI tuning and its DROM over. No - * PCIe tunnels yet: host-to-host (XDomain, thunderbolt-net) and USB4 links - * only. - */ -&pmgr_cio { - status = "okay"; -}; - -&ps_atc0_cio { - status = "okay"; -}; - -&ps_atc0_pcie { - status = "okay"; -}; - -&ps_atc0_cio_pcie { - status = "okay"; -}; - -&ps_atc0_cio_usb { - status = "okay"; -}; - -&usb4_0_mbox { - status = "okay"; -}; - -&usb4_0_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_0_dart { - /* ADT dart-acio0 vm-base: the NHI addresses its rings below 1 TiB + 4 GiB. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_0_nhi { - status = "okay"; -}; - -&ps_atc1_cio { - status = "okay"; -}; - -&ps_atc1_pcie { - status = "okay"; -}; - -&ps_atc1_cio_pcie { - status = "okay"; -}; - -&ps_atc1_cio_usb { - status = "okay"; -}; - -&usb4_1_mbox { - status = "okay"; -}; - -&usb4_1_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_1_dart { - /* The same DVA window as the ACIO0 router DART. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_1_nhi { - status = "okay"; -}; - -&ps_atc2_cio { - status = "okay"; -}; - -&ps_atc2_pcie { - status = "okay"; -}; - -&ps_atc2_cio_pcie { - status = "okay"; -}; - -&ps_atc2_cio_usb { - status = "okay"; -}; - -&usb4_2_mbox { - status = "okay"; -}; - -&usb4_2_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_2_dart { - /* The same DVA window as the ACIO0 router DART. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_2_nhi { - status = "okay"; -}; - #include "t6040-j614s-extdisp-hdmi.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi index 1bffe53b5ec83..9d0c2a0b88d0a 100644 --- a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi +++ b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi @@ -36,18 +36,7 @@ /delete-property/ apple,always-on; }; -/* tipd switches the PHY into DP alt mode through the connector graph. */ -&atcphy0 { - mode-switch; -}; - -&atcphy1 { - mode-switch; -}; - -&atcphy2 { - mode-switch; -}; +/* The PHYs are the connectors' mode switches: see t6040-usb4-typec.dtsi. */ /* * Type-C display routes through the display fabric, as T6030 and J700: diff --git a/arch/arm64/boot/dts/apple/t6040-j616s.dts b/arch/arm64/boot/dts/apple/t6040-j616s.dts index e81fb8b6b5d0d..ccd11ef695907 100644 --- a/arch/arm64/boot/dts/apple/t6040-j616s.dts +++ b/arch/arm64/boot/dts/apple/t6040-j616s.dts @@ -229,121 +229,6 @@ status = "okay"; }; -/* - * USB4/Thunderbolt on all three Type-C ports: typec0 (left back, ACIO0), - * typec1 (left front, ACIO1) and typec2 (right, ACIO2). The loader hands - * each router its router, adapter and NHI tuning and its DROM over. No PCIe - * tunnels yet: host-to-host (XDomain, thunderbolt-net) and USB4 links only. - */ -&pmgr_cio { - status = "okay"; -}; - -&ps_atc0_cio { - status = "okay"; -}; - -&ps_atc0_pcie { - status = "okay"; -}; - -&ps_atc0_cio_pcie { - status = "okay"; -}; - -&ps_atc0_cio_usb { - status = "okay"; -}; - -&usb4_0_mbox { - status = "okay"; -}; - -&usb4_0_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_0_dart { - /* ADT dart-acio0 vm-base: the NHI addresses its rings below 1 TiB + 4 GiB. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_0_nhi { - status = "okay"; -}; - -&ps_atc1_cio { - status = "okay"; -}; - -&ps_atc1_pcie { - status = "okay"; -}; - -&ps_atc1_cio_pcie { - status = "okay"; -}; - -&ps_atc1_cio_usb { - status = "okay"; -}; - -&usb4_1_mbox { - status = "okay"; -}; - -&usb4_1_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_1_dart { - /* The same DVA window as the ACIO0 router DART. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_1_nhi { - status = "okay"; -}; - -&ps_atc2_cio { - status = "okay"; -}; - -&ps_atc2_pcie { - status = "okay"; -}; - -&ps_atc2_cio_pcie { - status = "okay"; -}; - -&ps_atc2_cio_usb { - status = "okay"; -}; - -&usb4_2_mbox { - status = "okay"; -}; - -&usb4_2_acio { - /delete-property/ apple,pcie-tunnel; - status = "okay"; -}; - -&usb4_2_dart { - /* The same DVA window as the ACIO0 router DART. */ - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; -}; - -&usb4_2_nhi { - status = "okay"; -}; - /* * The internal PCIe controller (Wi-Fi/Bluetooth, SD reader) needs APCIE_GP, * APCIE_SYS_GP and APCIE_PHY_SW on top of the always-on ANS/APCIE_ST* diff --git a/arch/arm64/boot/dts/apple/t6040-j773s.dts b/arch/arm64/boot/dts/apple/t6040-j773s.dts index 003cbefd8ba55..f2ed069d4a74b 100644 --- a/arch/arm64/boot/dts/apple/t6040-j773s.dts +++ b/arch/arm64/boot/dts/apple/t6040-j773s.dts @@ -797,6 +797,7 @@ #include "t6040-j773s-usb3.dtsi" #include "t6040-j773s-usb-front.dtsi" +#include "t604x-usb4-typec.dtsi" /* The video encoder, its DARTs and its power domains. */ &ps_venc0_sys { diff --git a/arch/arm64/boot/dts/apple/t6040-pmgr.dtsi b/arch/arm64/boot/dts/apple/t6040-pmgr.dtsi index 75650445572b1..ab4118990166c 100644 --- a/arch/arm64/boot/dts/apple/t6040-pmgr.dtsi +++ b/arch/arm64/boot/dts/apple/t6040-pmgr.dtsi @@ -1091,166 +1091,6 @@ status = "disabled"; }; - ps_atc0_cio: power-controller@398 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x398 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc0_cio"; - power-domains = <&ps_atc0_common>; - status = "disabled"; - }; - - ps_atc0_pcie: power-controller@3a0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3a0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc0_pcie"; - power-domains = <&ps_atc0_common>; - status = "disabled"; - }; - - ps_atc0_cio_pcie: power-controller@3a8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3a8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc0_cio_pcie"; - power-domains = <&ps_atc0_cio>; - status = "disabled"; - }; - - ps_atc0_cio_usb: power-controller@3b0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3b0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc0_cio_usb"; - power-domains = <&ps_atc0_cio>; - status = "disabled"; - }; - - ps_atc1_cio: power-controller@3c0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3c0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc1_cio"; - power-domains = <&ps_atc1_common>; - status = "disabled"; - }; - - ps_atc1_pcie: power-controller@3c8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3c8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc1_pcie"; - power-domains = <&ps_atc1_common>; - status = "disabled"; - }; - - ps_atc1_cio_pcie: power-controller@3d0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3d0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc1_cio_pcie"; - power-domains = <&ps_atc1_cio>; - status = "disabled"; - }; - - ps_atc1_cio_usb: power-controller@3d8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3d8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc1_cio_usb"; - power-domains = <&ps_atc1_cio>; - status = "disabled"; - }; - - ps_atc2_cio: power-controller@3e8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3e8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc2_cio"; - power-domains = <&ps_atc2_common>; - status = "disabled"; - }; - - ps_atc2_pcie: power-controller@3f0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3f0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc2_pcie"; - power-domains = <&ps_atc2_common>; - status = "disabled"; - }; - - ps_atc2_cio_pcie: power-controller@3f8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x3f8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc2_cio_pcie"; - power-domains = <&ps_atc2_cio>; - status = "disabled"; - }; - - ps_atc2_cio_usb: power-controller@400 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x400 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc2_cio_usb"; - power-domains = <&ps_atc2_cio>; - status = "disabled"; - }; - - ps_atc3_cio: power-controller@420 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x420 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_cio"; - power-domains = <&ps_atc3_common>; - status = "disabled"; - }; - - ps_atc3_pcie: power-controller@428 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x428 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_pcie"; - power-domains = <&ps_atc3_common>; - status = "disabled"; - }; - - ps_atc3_cio_pcie: power-controller@430 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x430 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_cio_pcie"; - power-domains = <&ps_atc3_cio>; - status = "disabled"; - }; - - ps_atc3_cio_usb: power-controller@438 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x438 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_cio_usb"; - power-domains = <&ps_atc3_cio>; - status = "disabled"; - }; - ps_fab5_soc: power-controller@440 { compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; reg = <0x440 4>; diff --git a/arch/arm64/boot/dts/apple/t6040.dtsi b/arch/arm64/boot/dts/apple/t6040.dtsi index 27fc991fdcc96..207fc545d490b 100644 --- a/arch/arm64/boot/dts/apple/t6040.dtsi +++ b/arch/arm64/boot/dts/apple/t6040.dtsi @@ -459,55 +459,6 @@ apple,sw-drain; status = "disabled"; }; - - /* ACIO 0 remains disabled until its host-router handoff is supported. */ - usb4_0_mbox: mailbox@381108000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x81108000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - power-domains = <&ps_atc0_cio>; - status = "disabled"; - }; - - /* ACIO 1 remains disabled until its host-router handoff is supported. */ - usb4_1_mbox: mailbox@389108000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x89108000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - power-domains = <&ps_atc1_cio>; - status = "disabled"; - }; - - /* ACIO 2 remains disabled until its host-router handoff is supported. */ - usb4_2_mbox: mailbox@391108000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x91108000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - power-domains = <&ps_atc2_cio>; - status = "disabled"; - }; - }; &avd { @@ -672,5 +623,3 @@ 0x504824000 0x504824004 0x5003c0000 0x5003e4000>; }; - -#include "t6040-usb4.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6041-j575c-usb4.dtsi b/arch/arm64/boot/dts/apple/t6041-j575c-usb4.dtsi new file mode 100644 index 0000000000000..d4a9754b6b9cd --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j575c-usb4.dtsi @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Mac Studio (M4 Max) USB4/Thunderbolt on the fourth back Type-C port. + * + * ATC0-2 have the routers of t604x-usb4.dtsi, linked to typec0-2 by + * t604x-usb4-typec.dtsi. The J575c also wires a fourth router, behind ATC3 + * (ADT acio3, dart-acio3, acio-cpu3, apciec3, dart-apciec3): the same + * blocks as ACIO0-2, 0x8000000 above ACIO2, with their own interrupts. Its + * port controller hpm3 (back left, typec3) names acio3 as its router. The + * laptops use ATC3 for HDMI and have no acio3. + */ + +/ { + aliases { + usb4-3-acio = &usb4_3_acio; + usb4-3-nhi = &usb4_3_nhi; + usb4-3-pcie = &usb4_3_pcie; + usb4-3-pcie-adapter = &usb4_3_acio; + }; + + /* ADT acio-cpu3: the mailbox of the router's coprocessor. */ + usb4_3_mbox: mailbox@399108000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x99108000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_atc3_cio>; + }; + + usb4_3_acio: cio@399ac0000 { + compatible = "apple,t6040-usb4-acio"; + reg = <0x3 0x99ac0000 0x0 0xc000>, + <0x3 0x99080000 0x0 0x26000>, + <0x3 0x99e44000 0x0 0x4000>, + <0x3 0x99100000 0x0 0x4000>; + reg-names = "rc", "sram", "pcie-adapter", "cpu"; + interrupt-parent = <&aic>; + interrupts = ; + interrupt-names = "sram-parity"; + mboxes = <&usb4_3_mbox>; + resets = <&cio_reset 3>; + pinctrl-names = "lstx"; + pinctrl-0 = <&usb4_3_lstx_pins>; + lstx-gpios = <&pinctrl_aop 55 GPIO_ACTIVE_HIGH>; + power-domains = <&ps_atc3_cio>, <&ps_atc3_cio_pcie>, + <&ps_atc3_cio_usb>, <&ps_atc3_pcie>; + thunderbolt-switch; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x3 0x98000000 0x2000000>; + nonposted-mmio; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + usb4_3_acio_tbt: endpoint { + remote-endpoint = <&typec3_con_tbt>; + }; + }; + }; + + usb4_3_dart: iommu@1a80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x1a80000 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + /* ADT dart-acio3 vm-base: NHI rings below 1 TiB + 4 GiB. */ + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + }; + + usb4_3_nhi: nhi@1f00000 { + compatible = "apple,t6040-usb4-nhi"; + reg = <0x1f00000 0x100000>; + reg-names = "nhi"; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + interrupt-names = "txring0", "txring1", "txring2", "txring3", + "txring4", "txring5", "txring6", "txring7", + "txring8", "txring9", "txring10", "txring11", + "rxring0", "rxring1", "rxring2", "rxring3", + "rxring4", "rxring5", "rxring6", "rxring7", + "rxring8", "rxring9", "rxring10", "rxring11"; + iommus = <&usb4_3_dart 0>, <&usb4_3_dart 1>, + <&usb4_3_dart 2>, <&usb4_3_dart 3>, + <&usb4_3_dart 4>, <&usb4_3_dart 5>, + <&usb4_3_dart 6>, <&usb4_3_dart 7>, + <&usb4_3_dart 8>, <&usb4_3_dart 9>, + <&usb4_3_dart 10>, <&usb4_3_dart 11>, + <&usb4_3_dart 16>, <&usb4_3_dart 17>, + <&usb4_3_dart 18>, <&usb4_3_dart 19>, + <&usb4_3_dart 20>, <&usb4_3_dart 21>, + <&usb4_3_dart 22>, <&usb4_3_dart 23>, + <&usb4_3_dart 24>, <&usb4_3_dart 25>, + <&usb4_3_dart 26>, <&usb4_3_dart 27>; + /* To be filled by the loader. */ + apple,thunderbolt-drom = [00]; + }; + }; + + /* Not used yet: the routers run without PCIe tunnels. */ + usb4_3_pcie_tunnel: usb4-pcie-tunnel-3 { + #address-cells = <2>; + #size-cells = <2>; + ranges; + nonposted-mmio; + status = "disabled"; + + apciec3_dart: iommu@39c000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x9c000000 0x0 0x20000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + status = "disabled"; + }; + + usb4_3_pcie: pcie@1c80000000 { + compatible = "apple,t6040-pciec"; + device_type = "pci"; + reg = <0x1c 0x80000000 0x0 0x10000000>, + <0x3 0x9c034000 0x0 0x4000>, + <0x3 0x9c020000 0x0 0x8000>, + <0x3 0x9c038000 0x0 0x4000>, + <0x3 0x9c060000 0x0 0x4000>, + <0x3 0x98020000 0x0 0x4000>, + <0x3 0x9c02c000 0x0 0x4000>, + <0x3 0x9c028000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "fabric", "debug", + "ioa", "ltssm", "intr2axi"; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + ; + interrupt-names = "port", "intx-a", "intx-b", "intx-c", + "intx-d", "parity"; + power-domains = <&ps_atc3_pcie>; + msi-controller; + msi-parent = <&usb4_3_pcie>; + msi-ranges = <&aic AIC_IRQ 2199 IRQ_TYPE_EDGE_RISING 32>; + apple,msi-vector-base = <0x80>; + iommu-map = <0x0 &apciec3_dart 0x0 0x100>; + iommu-map-mask = <0xff>; + bus-range = <0x0 0x80>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x43000000 0x14 0x0 0x14 0x0 0x2 0x0>, + <0x02000000 0x0 0x100000 0x16 0x100000 0x0 0x3ff00000>, + <0x42000000 0x0 0x40000000 0x16 0x40000000 0x0 0x40000000>; + status = "disabled"; + + usb4_3_pcie_port: pci@0,0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + external-facing; + #address-cells = <3>; + #size-cells = <2>; + ranges; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &usb4_3_pcie_port 0 0 0 0>, + <0 0 0 2 &usb4_3_pcie_port 0 0 0 1>, + <0 0 0 3 &usb4_3_pcie_port 0 0 0 2>, + <0 0 0 4 &usb4_3_pcie_port 0 0 0 3>; + }; + }; + }; +}; + +&pinctrl_aop { + /* ADT acio3 gpio-lstx. */ + usb4_3_lstx_pins: usb4-3-lstx-pins { + pinmux = ; + }; +}; + +&ps_atc3_cio { + status = "okay"; +}; + +&ps_atc3_pcie { + status = "okay"; +}; + +&ps_atc3_cio_pcie { + status = "okay"; +}; + +&ps_atc3_cio_usb { + status = "okay"; +}; + +&typec3 { + ports { + port@2 { + reg = <2>; + typec3_con_tbt: endpoint { + remote-endpoint = <&usb4_3_acio_tbt>; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6041-j575c.dts b/arch/arm64/boot/dts/apple/t6041-j575c.dts index 75be806091fcf..43955ab49c822 100644 --- a/arch/arm64/boot/dts/apple/t6041-j575c.dts +++ b/arch/arm64/boot/dts/apple/t6041-j575c.dts @@ -2024,6 +2024,8 @@ #include "t6041-j575c-usbc.dtsi" #include "t6041-j575c-usbc-dcpext2.dtsi" #include "t6041-j575c-hdmi.dtsi" +#include "t604x-usb4-typec.dtsi" +#include "t6041-j575c-usb4.dtsi" /* Not described: the SEP (no Touch ID sensor). */ diff --git a/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi b/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi index 8e2b49a4567ea..e7be6ac813eb8 100644 --- a/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi +++ b/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi @@ -2902,3 +2902,10 @@ &jpeg1 { status = "okay"; }; + +/* + * USB4/Thunderbolt on all three Type-C ports: the routers are enabled in + * t604x-usb4.dtsi. hpm0 (left back), hpm1 (left front) and hpm2 (right) + * name acio0, acio1 and acio2 as their routers, as on the J614s/J616s. + */ +#include "t604x-usb4-typec.dtsi" diff --git a/arch/arm64/boot/dts/apple/t604x-j614-j616-usb4.dtsi b/arch/arm64/boot/dts/apple/t604x-j614-j616-usb4.dtsi deleted file mode 100644 index ec32ca4bf9c03..0000000000000 --- a/arch/arm64/boot/dts/apple/t604x-j614-j616-usb4.dtsi +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR MIT -/* - * MacBook Pro (14-inch and 16-inch, M4 Pro) USB4/Thunderbolt: each Type-C - * port's connector is linked to the USB4 router behind the same ATC PHY - * (ADT acioN atc-phy-parent = atc-phyN): typec0 (left back) to ACIO0, - * typec1 (left front) to ACIO1, typec2 (right) to ACIO2. The routers stay - * disabled, and a port controller skips a link to a disabled router, so this - * changes nothing until a board enables them. - */ - -&usb4_0_acio_tbt { - remote-endpoint = <&typec0_con_tbt>; -}; - -&usb4_1_acio_tbt { - remote-endpoint = <&typec1_con_tbt>; -}; - -&usb4_2_acio_tbt { - remote-endpoint = <&typec2_con_tbt>; -}; - -&typec0 { - ports { - port@2 { - reg = <2>; - typec0_con_tbt: endpoint { - remote-endpoint = <&usb4_0_acio_tbt>; - }; - }; - }; -}; - -&typec1 { - ports { - port@2 { - reg = <2>; - typec1_con_tbt: endpoint { - remote-endpoint = <&usb4_1_acio_tbt>; - }; - }; - }; -}; - -&typec2 { - ports { - port@2 { - reg = <2>; - typec2_con_tbt: endpoint { - remote-endpoint = <&usb4_2_acio_tbt>; - }; - }; - }; -}; diff --git a/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi b/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi index 75df37d6053a6..f3a4907428928 100644 --- a/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi +++ b/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi @@ -3481,4 +3481,4 @@ status = "okay"; }; -#include "t604x-j614-j616-usb4.dtsi" +#include "t604x-usb4-typec.dtsi" diff --git a/arch/arm64/boot/dts/apple/t604x-pmgr.dtsi b/arch/arm64/boot/dts/apple/t604x-pmgr.dtsi index 977818bca2ec3..455e1d8d11550 100644 --- a/arch/arm64/boot/dts/apple/t604x-pmgr.dtsi +++ b/arch/arm64/boot/dts/apple/t604x-pmgr.dtsi @@ -533,6 +533,173 @@ }; }; +/* + * The USB4 router (CIO) and PCIe-C domains of each ATC, children of its + * ATCn_COMMON. The J614s, J616s, J773s, J614c, J616c and J575c ADTs list + * them at the same offsets. t604x-usb4.dtsi enables the ATC0-2 ones. + */ +&pmgr_aux { + ps_atc0_cio: power-controller@398 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x398 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc0_cio"; + power-domains = <&ps_atc0_common>; + status = "disabled"; + }; + + ps_atc0_pcie: power-controller@3a0 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3a0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc0_pcie"; + power-domains = <&ps_atc0_common>; + status = "disabled"; + }; + + ps_atc0_cio_pcie: power-controller@3a8 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3a8 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc0_cio_pcie"; + power-domains = <&ps_atc0_cio>; + status = "disabled"; + }; + + ps_atc0_cio_usb: power-controller@3b0 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3b0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc0_cio_usb"; + power-domains = <&ps_atc0_cio>; + status = "disabled"; + }; + + ps_atc1_cio: power-controller@3c0 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3c0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc1_cio"; + power-domains = <&ps_atc1_common>; + status = "disabled"; + }; + + ps_atc1_pcie: power-controller@3c8 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3c8 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc1_pcie"; + power-domains = <&ps_atc1_common>; + status = "disabled"; + }; + + ps_atc1_cio_pcie: power-controller@3d0 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3d0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc1_cio_pcie"; + power-domains = <&ps_atc1_cio>; + status = "disabled"; + }; + + ps_atc1_cio_usb: power-controller@3d8 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3d8 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc1_cio_usb"; + power-domains = <&ps_atc1_cio>; + status = "disabled"; + }; + + ps_atc2_cio: power-controller@3e8 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3e8 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc2_cio"; + power-domains = <&ps_atc2_common>; + status = "disabled"; + }; + + ps_atc2_pcie: power-controller@3f0 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3f0 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc2_pcie"; + power-domains = <&ps_atc2_common>; + status = "disabled"; + }; + + ps_atc2_cio_pcie: power-controller@3f8 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x3f8 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc2_cio_pcie"; + power-domains = <&ps_atc2_cio>; + status = "disabled"; + }; + + ps_atc2_cio_usb: power-controller@400 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x400 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc2_cio_usb"; + power-domains = <&ps_atc2_cio>; + status = "disabled"; + }; + + ps_atc3_cio: power-controller@420 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x420 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc3_cio"; + power-domains = <&ps_atc3_common>; + status = "disabled"; + }; + + ps_atc3_pcie: power-controller@428 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x428 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc3_pcie"; + power-domains = <&ps_atc3_common>; + status = "disabled"; + }; + + ps_atc3_cio_pcie: power-controller@430 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x430 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc3_cio_pcie"; + power-domains = <&ps_atc3_cio>; + status = "disabled"; + }; + + ps_atc3_cio_usb: power-controller@438 { + compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; + reg = <0x438 4>; + #power-domain-cells = <0>; + #reset-cells = <0>; + label = "atc3_cio_usb"; + power-domains = <&ps_atc3_cio>; + status = "disabled"; + }; +}; + &pmgr_ane { ps_ane_mpm: power-controller@0 { compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; diff --git a/arch/arm64/boot/dts/apple/t604x-usb4-typec.dtsi b/arch/arm64/boot/dts/apple/t604x-usb4-typec.dtsi new file mode 100644 index 0000000000000..0a28467e4ad2b --- /dev/null +++ b/arch/arm64/boot/dts/apple/t604x-usb4-typec.dtsi @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * M4 Pro and M4 Max (T6040/T6041) USB4/Thunderbolt: each Type-C port's + * connector is linked to the USB4 router behind the same ATC PHY. On every + * T604x board the ADT pairs acioN with atc-phyN (atc-phy-parent) and with + * the port controller whose acio-parent is acioN, and the boards name that + * connector typecN: + * MacBook Pro 14/16 (J614s, J616s, J614c, J616c): typec0 left back, + * typec1 left front, typec2 right; + * Mac mini (J773s): typec0 back middle, typec1 back left, typec2 back + * right; + * Mac Studio (J575c): typec0 back right, typec1 back right middle, + * typec2 back left middle (its fourth router, ACIO3, is linked in + * t6041-j575c-usb4.dtsi). + * A port controller skips a link to a disabled router. + * + * Each ATC PHY is its connector's mode switch: the port controller switches + * it between USB3, DP alt mode and USB4/Thunderbolt through the connector + * graph, and finds it by this property. + */ + +&atcphy0 { + mode-switch; +}; + +&atcphy1 { + mode-switch; +}; + +&atcphy2 { + mode-switch; +}; + +&usb4_0_acio_tbt { + remote-endpoint = <&typec0_con_tbt>; +}; + +&usb4_1_acio_tbt { + remote-endpoint = <&typec1_con_tbt>; +}; + +&usb4_2_acio_tbt { + remote-endpoint = <&typec2_con_tbt>; +}; + +&typec0 { + ports { + port@2 { + reg = <2>; + typec0_con_tbt: endpoint { + remote-endpoint = <&usb4_0_acio_tbt>; + }; + }; + }; +}; + +&typec1 { + ports { + port@2 { + reg = <2>; + typec1_con_tbt: endpoint { + remote-endpoint = <&usb4_1_acio_tbt>; + }; + }; + }; +}; + +&typec2 { + ports { + port@2 { + reg = <2>; + typec2_con_tbt: endpoint { + remote-endpoint = <&usb4_2_acio_tbt>; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6040-usb4.dtsi b/arch/arm64/boot/dts/apple/t604x-usb4.dtsi similarity index 83% rename from arch/arm64/boot/dts/apple/t6040-usb4.dtsi rename to arch/arm64/boot/dts/apple/t604x-usb4.dtsi index cd3b2c21aca7a..8b662a2368c41 100644 --- a/arch/arm64/boot/dts/apple/t6040-usb4.dtsi +++ b/arch/arm64/boot/dts/apple/t604x-usb4.dtsi @@ -1,8 +1,17 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * T6040 USB4/PCIe-C resource description. + * T6040/T6041 USB4/PCIe-C resource description: the routers behind ATC0-2. * - * Every node is disabled here; a board enables the routers it has qualified. + * The M4 Pro and M4 Max have the same ACIO, NHI, DART, mailbox and PCIe-C + * blocks behind ATC0-2, at the same addresses and interrupts, and every + * board of both (J614s, J616s, J773s, J614c, J616c, J575c) wires ACIO0-2 to + * three of its Thunderbolt ports. So the routers, their DARTs and NHIs, + * mailboxes and power domains are enabled here; t604x-usb4-typec.dtsi links + * them to the board's Type-C connectors. The loader hands each router its + * router, adapter and NHI tuning and its DROM over. No PCIe tunnels yet: the + * routers carry no apple,pcie-tunnel link, so only host-to-host (XDomain, + * thunderbolt-net) and USB4 links come up, and the tunnel nodes stay + * disabled. */ / { @@ -21,6 +30,52 @@ usb4-2-pcie-adapter = &usb4_2_acio; }; + /* ADT acio-cpuN: the mailbox of each router's coprocessor. */ + usb4_0_mbox: mailbox@381108000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x81108000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_atc0_cio>; + status = "okay"; + }; + + usb4_1_mbox: mailbox@389108000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x89108000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_atc1_cio>; + status = "okay"; + }; + + usb4_2_mbox: mailbox@391108000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x91108000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_atc2_cio>; + status = "okay"; + }; + usb4_0_acio: cio@381ac0000 { compatible = "apple,t6040-usb4-acio"; reg = <0x3 0x81ac0000 0x0 0xc000>, @@ -39,12 +94,11 @@ power-domains = <&ps_atc0_cio>, <&ps_atc0_cio_pcie>, <&ps_atc0_cio_usb>, <&ps_atc0_pcie>; thunderbolt-switch; - apple,pcie-tunnel = <&usb4_0_pcie_tunnel>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x3 0x80000000 0x2000000>; nonposted-mmio; - status = "disabled"; + status = "okay"; ports { #address-cells = <1>; @@ -62,7 +116,9 @@ #iommu-cells = <1>; interrupt-parent = <&aic>; interrupts = ; - status = "disabled"; + /* ADT dart-acio0 vm-base: the NHI addresses its rings below 1 TiB + 4 GiB. */ + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "okay"; }; usb4_0_nhi: nhi@1f00000 { @@ -114,7 +170,7 @@ <&usb4_0_dart 26>, <&usb4_0_dart 27>; /* To be filled by the loader. */ apple,thunderbolt-drom = [00]; - status = "disabled"; + status = "okay"; }; }; @@ -136,12 +192,11 @@ power-domains = <&ps_atc1_cio>, <&ps_atc1_cio_pcie>, <&ps_atc1_cio_usb>, <&ps_atc1_pcie>; thunderbolt-switch; - apple,pcie-tunnel = <&usb4_1_pcie_tunnel>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x3 0x88000000 0x2000000>; nonposted-mmio; - status = "disabled"; + status = "okay"; ports { #address-cells = <1>; @@ -159,7 +214,9 @@ #iommu-cells = <1>; interrupt-parent = <&aic>; interrupts = ; - status = "disabled"; + /* The same DVA window as the ACIO0 router DART. */ + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "okay"; }; usb4_1_nhi: nhi@1f00000 { @@ -211,7 +268,7 @@ <&usb4_1_dart 26>, <&usb4_1_dart 27>; /* To be filled by the loader. */ apple,thunderbolt-drom = [00]; - status = "disabled"; + status = "okay"; }; }; @@ -233,12 +290,11 @@ power-domains = <&ps_atc2_cio>, <&ps_atc2_cio_pcie>, <&ps_atc2_cio_usb>, <&ps_atc2_pcie>; thunderbolt-switch; - apple,pcie-tunnel = <&usb4_2_pcie_tunnel>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x3 0x90000000 0x2000000>; nonposted-mmio; - status = "disabled"; + status = "okay"; ports { #address-cells = <1>; @@ -256,7 +312,9 @@ #iommu-cells = <1>; interrupt-parent = <&aic>; interrupts = ; - status = "disabled"; + /* The same DVA window as the ACIO0 router DART. */ + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "okay"; }; usb4_2_nhi: nhi@1f00000 { @@ -308,7 +366,7 @@ <&usb4_2_dart 26>, <&usb4_2_dart 27>; /* To be filled by the loader. */ apple,thunderbolt-drom = [00]; - status = "disabled"; + status = "okay"; }; }; @@ -533,8 +591,7 @@ #address-cells = <1>; #size-cells = <1>; reg = <0x5 0x02820000 0 0x4000>; - /* Enabled together with the routers. */ - status = "disabled"; + status = "okay"; cio_reset: reset-controller@2024 { compatible = "apple,t6041-cio-reset"; @@ -558,3 +615,52 @@ pinmux = ; }; }; + +/* The routers' power domains. */ +&ps_atc0_cio { + status = "okay"; +}; + +&ps_atc0_pcie { + status = "okay"; +}; + +&ps_atc0_cio_pcie { + status = "okay"; +}; + +&ps_atc0_cio_usb { + status = "okay"; +}; + +&ps_atc1_cio { + status = "okay"; +}; + +&ps_atc1_pcie { + status = "okay"; +}; + +&ps_atc1_cio_pcie { + status = "okay"; +}; + +&ps_atc1_cio_usb { + status = "okay"; +}; + +&ps_atc2_cio { + status = "okay"; +}; + +&ps_atc2_pcie { + status = "okay"; +}; + +&ps_atc2_cio_pcie { + status = "okay"; +}; + +&ps_atc2_cio_usb { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t604x.dtsi b/arch/arm64/boot/dts/apple/t604x.dtsi index 3484262fa7a43..4d7b38973b624 100644 --- a/arch/arm64/boot/dts/apple/t604x.dtsi +++ b/arch/arm64/boot/dts/apple/t604x.dtsi @@ -2065,3 +2065,4 @@ }; #include "t604x-pmgr.dtsi" +#include "t604x-usb4.dtsi" diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index 8e20a36cc575e..8a87725081642 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -3407,7 +3407,12 @@ static int apple_msi_init(struct apple_pcie *pcie) default: goto invalid_slice; } - } else if (of_machine_is_compatible("apple,t6040")) { + } else if (pcie->hw == &t6040_pciec_hw) { + /* + * The T6040 PCIe-C block, on the M4 Pro and M4 Max + * alike: same ECAM apertures and MSI window. The M4 + * Max Mac Studio adds a fourth router (ADT apciec3). + */ aic_base = 2071; switch (ecam.start) { case 0x1c50000000ULL: @@ -3419,6 +3424,9 @@ static int apple_msi_init(struct apple_pcie *pcie) case 0x1c70000000ULL: expected_base = 0x60; break; + case 0x1c80000000ULL: + expected_base = 0x80; + break; default: goto invalid_slice; } diff --git a/drivers/pmdomain/apple/t6041-cio-reconfig.c b/drivers/pmdomain/apple/t6041-cio-reconfig.c index a6c13b41a801d..9bfcc92b146cf 100644 --- a/drivers/pmdomain/apple/t6041-cio-reconfig.c +++ b/drivers/pmdomain/apple/t6041-cio-reconfig.c @@ -2,9 +2,13 @@ /* * Apple T6041 CIO cluster reconfiguration controller * - * The three CIO ports share one PMGR register. Each port has a request bit - * and a busy bit sixteen positions above it. Firmware waits before and after - * the read/modify/write request, with a 192 ms budget for each wait. + * The CIO ports share one PMGR register. Each port has a request bit and a + * busy bit sixteen positions above it. Firmware waits before and after the + * read/modify/write request, with a 192 ms budget for each wait. + * + * The PMGR has four of them (ADT pmgr CIO0-RECONFIG to CIO3-RECONFIG) on + * every T6040/T6041 board, whether or not the board wires the fourth router: + * the J575c does (ADT acio3), the laptops don't. */ #include @@ -18,7 +22,7 @@ #include #include -#define T6041_CIO_RECONFIG_PORTS 3 +#define T6041_CIO_RECONFIG_PORTS 4 #define T6041_CIO_RECONFIG_POLL_US 100 #define T6041_CIO_RECONFIG_TIMEOUT_US 192000