diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index 2909e86fc426e..ff202d0d0ec0c 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -15,6 +15,8 @@ /dts-v1/; #define T6050_J714C +/* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ +#define T6050_ATC2_USB4_ROUTER #include #include "t6050-max.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 3ed3baaf05fd5..23475ad163f58 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -14,6 +14,8 @@ /dts-v1/; #define T6050_J714S +/* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ +#define T6050_ATC2_USB4_ROUTER #include #include "t6050-max.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j716c.dts b/arch/arm64/boot/dts/apple/t6050-j716c.dts index 36575c200d534..679e9f2f78856 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716c.dts @@ -14,6 +14,8 @@ /dts-v1/; #define T6050_J716C +/* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ +#define T6050_ATC2_USB4_ROUTER #include "t6050-max.dtsi" #include "hwmon-fan-dual.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-k114c-gpu.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-k116-gpu.dtsi similarity index 58% rename from arch/arm64/boot/dts/apple/t6050-k114c-gpu.dtsi rename to arch/arm64/boot/dts/apple/t6050-k114-k116-gpu.dtsi index ceec5b22d2ae7..9270842379086 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114c-gpu.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-k114-k116-gpu.dtsi @@ -1,12 +1,14 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * K114c (M5 Max, G17C) GPU, for the boot loader's GPU handoff. Everything here - * stays disabled: the loader checks the ADT and the live GPU firmware build, - * fills the GPU reservations, then enables the power states, both mailboxes and - * the GPU, the GPU last. A loader that refuses leaves the GPU off. + * The GPU of the K114c, K114s, K116s and K116c (ADT /arm-io/sgx "gpu,t6050"), for the boot + * loader's GPU hand-off. It is the GPU half of t6050-j714s-gpu-panel.dtsi: the four boards' + * ADTs have the J714s's sgx, gfx-asc and gfx1-asc. * - * Same layout as t6050-j714s-gpu-panel.dtsi; the GPU is G17C and, in the ADT, - * sgx and both GPU ASCs are the same as on the M5 Pro. + * Everything here stays disabled: the loader checks the ADT and the live GPU firmware build, + * fills the six reservations, then enables the GPU PMGR, GPX, AFR, GFX, both mailboxes and the + * GPU, the GPU last. A loader that refuses leaves the GPU off and the rest of the boot as it is. + * + * arm-io's ranges add 0x2_0000_0000 to the ADT's 0x21_xxxx_xxxx bus addresses. */ / { @@ -16,7 +18,12 @@ }; reserved-memory { - /* Filled and enabled by the loader from the ADT */ + /* + * Filled and enabled by the loader from the ADT: sgx gpu-region-*, + * gfx-shared-region-*, gfx-shared-l2-region-* and gfx-handoff-* (the UAT + * ranges), the GPU ASCs' __TEXT (fw-text) and gfx-data-base to the end of + * gfx1-data-shared-ro (fw-data). iBoot places them; they differ per Mac. + */ gpu_fw_text: gpu-fw-text { reg = <0 0 0 0>; no-map; @@ -61,9 +68,9 @@ &{/soc} { /* - * ADT gfx-asc and gfx1-asc at their physical windows: the wrapper, the - * 8-byte iop-vbar, and their second and third interrupts (send-empty, - * recv-not-empty), as T8140/T8142. + * ADT gfx-asc: reg 0x21_02600000 + 0x88000 (wrapper), 0x21_02050000 + 8 (iop-vbar); + * interrupts [2798, 2797, 2800, 2799], of which the second and third are send-empty + * and recv-not-empty; role "GFX"; power-gates [614] (GFX_ASC). */ gfx_mbox: mailbox@2302600000 { compatible = "apple,t6050-j775d-ascwrap-v6"; @@ -79,6 +86,11 @@ status = "disabled"; }; + /* + * ADT gfx1-asc: reg 0x21_02e00000 + 0x88000, 0x21_02850000 (ADT size 0x60000; the + * driver uses the first 8 bytes); interrupts [2802, 2801, 2804, 2803]; role "GFX1"; + * power-gates [657] (GFX_ASC1). + */ gfx1_mbox: mailbox@2302e00000 { compatible = "apple,t6050-j775d-ascwrap-v6"; reg = <0x23 0x2e00000 0x0 0x88000>, @@ -94,7 +106,10 @@ }; }; -/* The ADT marks GPX and AFR, GFX's parents, critical. */ +/* + * ADT pmgr devices GPX (id 359, +0x0), AFR (id 360, +0x100) and GFX (id 362, +0x110) in the + * GPU PMGR. The ADT marks GPX and AFR, GFX's parents, critical; GFX not. + */ &ps_gpx { apple,always-on; }; @@ -112,8 +127,9 @@ }; &sgx { + /* What the loader checks and drivers/gpu/drm/asahi binds */ compatible = "apple,agx-g17s"; - /* ADT sgx reg[0]; the driver maps the first 16 MiB as "sgx" */ + /* ADT sgx reg[0] 0x21_00000000 + 0x3fdc000; the driver maps the first 16 MiB as "sgx" */ reg = <0x23 0x0 0x0 0x3fdc000>; reg-names = "sgx"; /delete-property/ interrupts; diff --git a/arch/arm64/boot/dts/apple/t6050-k114-k116-usb.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-k116-usb.dtsi new file mode 100644 index 0000000000000..87b16d9a0429a --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-k114-k116-usb.dtsi @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The K114c, K114s, K116c and K116s USB-C ports ATC1 (left-front) and ATC2 (right): + * USB 2/3 and the PD controllers. A board file includes this after + * t6050-peripherals.dtsi, which describes nub-spmi-a1 for these boards. + * + * From the boards' ADT, the same on all four: + * ATC0 usb-drd0 left-back hpm0 nub-spmi-a0 0x0c (the boot link's debug port, not described) + * ATC1 usb-drd1 left-front hpm1 nub-spmi-a0 0x0a, port-number 2, acio-parent acio1 + * ATC2 usb-drd2 right hpm2 nub-spmi-a1 0x0c, port-number 3, acio-parent acio2 + * hpm5 nub-spmi-a0 0x08 (MagSafe, not a USB-C connector) + * The PD controllers are SN201202x. The USB4/Thunderbolt routers (acio1, acio2) and the + * DisplayPort routes are not described here; the PHYs run in USB mode. The combo PHY driver + * leaves ATC0 alone on purpose (apple,port-index 0). + * + * The boot loader fills the PHYs' tunables from the ADT through the atcphy aliases. + */ +/ { + aliases { + atcphy1 = &atc1_phy; + atcphy2 = &atc2_phy; + }; +}; + +/* ==== The left-front USB-C port (ATC1) ==== */ +&nub_spmi_a0 { + status = "okay"; + + hpm1: usb-pd@a { + compatible = "apple,sn201202x"; + reg = <0xa SPMI_USID>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C Left-front"; + power-role = "dual"; + data-role = "dual"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + hpm1_hs: endpoint { + remote-endpoint = <&usb_drd1_hs>; + }; + }; + + port@1 { + reg = <1>; + hpm1_ss: endpoint { + remote-endpoint = <&atc1_phy_ep>; + }; + }; + }; + }; + }; +}; + +&atc1_phy_mbox { + status = "okay"; +}; + +&atc1_phy { + status = "okay"; + + port { + atc1_phy_ep: endpoint { + remote-endpoint = <&hpm1_ss>; + }; + }; +}; + +&usb_drd1 { + status = "okay"; + + port { + usb_drd1_hs: endpoint { + remote-endpoint = <&hpm1_hs>; + }; + }; +}; + +&usb_drd1_dart_0 { + status = "okay"; +}; + +&usb_drd1_dart_1 { + status = "okay"; +}; + +/* + * ==== The right USB-C port (ATC2) ==== + * + * The HPM is on its own bus, nub-spmi-a1, and nothing hands the port off, so the power + * domains, the PHY mailbox, the PHY, the DWC3 and its DARTs are enabled outright. The driver + * polls the generation 4 bus and refuses an interrupt on it. + */ +&ps_atc2_common { + status = "okay"; +}; + +&ps_atc2_usb_aon { + status = "okay"; +}; + +&ps_atc2_phymxwrap { + status = "okay"; +}; + +&ps_atc2_usb { + status = "okay"; +}; + +&atc2_phy_mbox { + status = "okay"; +}; + +&atc2_phy { + status = "okay"; + + port { + atc2_phy_ep: endpoint { + remote-endpoint = <&hpm2_ss>; + }; + }; +}; + +&usb_drd2 { + status = "okay"; + + port { + usb_drd2_hs: endpoint { + remote-endpoint = <&hpm2_hs>; + }; + }; +}; + +&usb_drd2_dart_0 { + status = "okay"; +}; + +&usb_drd2_dart_1 { + status = "okay"; +}; + +&nub_spmi_a1 { + /delete-property/ interrupts; + status = "okay"; + + hpm2: usb-pd@c { + compatible = "apple,sn201202x"; + reg = <0xc SPMI_USID>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C Right"; + power-role = "dual"; + data-role = "dual"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + hpm2_hs: endpoint { + remote-endpoint = <&usb_drd2_hs>; + }; + }; + + port@1 { + reg = <1>; + hpm2_ss: endpoint { + remote-endpoint = <&atc2_phy_ep>; + }; + }; + }; + }; + }; +}; + +/* PCIe port 0's power states, used by pcie0 and dart_apcie0 (see t6050-k114-k116.dtsi) */ +&ps_fab6_soc { + apple,firmware-owned; + status = "okay"; +}; + +&ps_apcie_gp { + apple,firmware-owned; + status = "okay"; +}; + +&ps_apcie_sys_gp { + apple,firmware-owned; + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi index 70502c23beffb..d26d2621b38a0 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi @@ -35,6 +35,9 @@ aliases { serial0 = &dockchannel; + /* The boot loader fills the N1's factory addresses through these */ + wifi0 = &n1_alpha; + bluetooth0 = &n1_beta; }; chosen { @@ -80,35 +83,14 @@ }; }; -/* ATC1, ATC3 and the PD controller buses nub-spmi-a0 and -a2: not yet described for these boards */ -&nub_spmi_a0 { - status = "disabled"; -}; - +/* + * ATC3 and the PD controller bus nub-spmi-a2: not described for these boards. The + * USB-C ports ATC1 and ATC2 are in t6050-k114-k116-usb.dtsi. + */ &nub_spmi_a2 { status = "disabled"; }; -&atc1_phy_mbox { - status = "disabled"; -}; - -&atc1_phy { - status = "disabled"; -}; - -&usb_drd1 { - status = "disabled"; -}; - -&usb_drd1_dart_0 { - status = "disabled"; -}; - -&usb_drd1_dart_1 { - status = "disabled"; -}; - &atc3_phy_mbox { status = "disabled"; }; @@ -139,23 +121,81 @@ /* * As on J716c, where reading pin 112 takes an SError, only the pins a node - * here names are exposed, and none is yet. The N1 on PCIe port 0 needs its - * board's platform ID, which the static ADT does not carry, so the port and - * its PERST# pin stay unused for now. + * names are exposed: 80, PCIe port 0's PERST#, and 134 and 139, the jack + * codec's interrupt and reset. A board that names more pins replaces the list. */ &pinctrl_ap { - gpio-reserved-ranges = <0 221>; + gpio-reserved-ranges = <0 80>, <81 53>, <135 4>, <140 81>; }; /* - * The K114s N1 needs its own platform ID (its ADT /chosen board-id << 16 | 0x6050) - * before the port can be described. aura's T6050 hand-off still wants the host's - * iommu-map to mark the ports as it found them, so carry it with the host disabled. + * PCIe port 0: the N1 (Wi-Fi and Bluetooth), the same on all four boards and + * laid out as on J716c: the boot loader trains the link and keeps power, + * clocks, the PHY and PERST; Linux owns the routing, MSI and the DART. The + * port stays disabled until the loader trains it. From the boards' ADT: + * apcie0 gives port 0's registers and IRQ 1523, pci-bridge0's PERST# is GPIO + * 80, and the N1's three functions are on DART streams 1-3. + * + * The board file defines, before including this file, the N1's personalized + * firmware (T6050_K_N1_FIRMWARE) and its ADT /chosen board-id + * (T6050_K_BOARD_ID). The N1's platform ID is board-id << 16 | chip 0x6050. + * aura's T6050 hand-off wants the host's iommu-map to mark the ports as it + * found them. */ &pcie0 { iommu-map = <0x100 &dart_apcie0 1 3>; bus-range = <0 4>; - status = "disabled"; + status = "okay"; + reg = <0x1c 0xb0000000 0x0 0x10000000>, + <0x4 0x14000000 0x0 0x4000>, + <0x4 0x10028000 0x0 0x8000>, + <0x4 0x17010000 0x0 0x4000>, + <0x4 0x10024000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "phy0", "intr2axi0"; + interrupts = ; + interrupt-names = "port0"; + + port00: pci@0,0 { + device_type = "pci"; + reg = <0x0 0 0 0 0>; + bus-range = <1 1>; + apple,link-trained-by-bootloader; + /* PERST#, driven only by the root-port reset after the N1's ROM stage */ + reset-gpios = <&pinctrl_ap 80 GPIO_ACTIVE_LOW>; + status = "disabled"; + + #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 &port00 0 0 0 0>, + <0 0 0 2 &port00 0 0 0 1>, + <0 0 0 3 &port00 0 0 0 2>, + <0 0 0 4 &port00 0 0 0 3>; + + n1_control: control@0,0 { + compatible = "pci106b,1900"; + reg = <0x10000 0x0 0x0 0x0 0x0>; + firmware-name = T6050_K_N1_FIRMWARE; + apple,centauri-platform-id = <((T6050_K_BOARD_ID << 16) | 0x6050)>; + apple,centauri-protocol = <27>; + }; + + n1_alpha: wifi@0,1 { + compatible = "pci106b,1902"; + reg = <0x10100 0x0 0x0 0x0 0x0>; + local-mac-address = [00 00 00 00 00 00]; + }; + + n1_beta: bluetooth@0,2 { + compatible = "pci106b,1903"; + reg = <0x10200 0x0 0x0 0x0 0x0>; + local-bd-address = [00 00 00 00 00 00]; + }; + }; }; /* These boards' SMC fan and power keys are not yet checked */ @@ -266,3 +306,15 @@ &smc_pcio { apple,output-commands = /bits/ 64 <0x001a000000000000 0x000f000000800000 0x011c000000010000>; }; + +/* + * Port 0's power: the ADT's apcie0 power-gates are APCIE_GP (137), APCIE_SYS_GP (143) and the + * fabric; APCIE_SYS_GP sits on APCIE_GP and FAB6_SOC. Its DART (dart-apcie0, which the N1 uses + * through the host's iommu-map) takes APCIE_SYS_GP, as the T600x/T602x PCIe DARTs do. The loader + * trains port 0 and keeps it powered for the hand-off, so these stay firmware-owned + * (enabled in t6050-k114-k116-usb.dtsi, which boards include after t6050-peripherals.dtsi). + */ +&dart_apcie0 { + power-domains = <&ps_apcie_sys_gp>; +}; + diff --git a/arch/arm64/boot/dts/apple/t6050-k114-usb.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-usb.dtsi new file mode 100644 index 0000000000000..24184a4e505ce --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-k114-usb.dtsi @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The 14-inch K boards' ports beyond t6050-k114-k116-usb.dtsi: the MagSafe 3 PD controller + * on nub-spmi-a0 and ATC2's USB4/Thunderbolt router with its PCIe tunnel. The live K114s ADT + * (27.2) and the K114c's have the same nodes and values here, phandles aside. + * + * Included after t6050-k114-k116-usb.dtsi. t6050-max.dtsi describes the ATC2 router for the + * boards that define T6050_K114C or T6050_K114S before including it. + */ + +/* + * nub-spmi-a0's generation 4 fault queue: ADT reg[1] 0x8a184000 + 0x4000, which macOS empties + * when the controller starts. + */ +&nub_spmi_a0 { + reg = <0x2 0x8a188000 0x0 0x4000>, + <0x2 0x8a184000 0x0 0x4000>; + + /* + * The MagSafe 3 port's PD controller (ADT hpm5, port-type 0x11). It has no USB data + * path, so it gets no connector node; tipd registers a Type-C port and a power supply + * for it. Its ADT features-supported is <3>, "Power In" only: no liquid detection. + */ + hpm5: usb-pd@8 { + compatible = "apple,sn201202x"; + reg = <0x8 SPMI_USID>; + apple,no-liquid-detection; + }; +}; + +/* + * The right port's USB4/Thunderbolt router (acio2) and PCIe tunnel; the DisplayPort route + * is not described. + */ +#include "t6050-max-atc2-router.dtsi" + +/* + * The host DROM from the ADT (/arm-io/acio2 thunderbolt-drom, the same on the K114c and the + * K114s); the boot loader replaces it + */ +&acio2_nhi { + apple,thunderbolt-drom = [fd 02 00 00 00 00 00 00 00 90 19 c3 8c 00 5c 00 + 00 00 00 00 00 00 08 81 82 02 82 00 00 00 08 82 + 92 01 82 00 00 00 03 83 20 08 84 00 00 00 00 00 + 00 08 85 00 00 00 00 00 00 05 86 09 01 00 08 87 + 00 00 00 00 00 00 05 88 09 01 00 05 89 09 01 00 + 05 8a 09 01 00 0e 01 41 70 70 6c 65 2c 20 49 6e + 63 2e 00 06 02 69 4f 53 00 00 00 00]; +}; + +/* The right router's suppliers, disabled in the inventory (as t6050-j714s-display.dtsi enables them) */ +&ps_atc2_cio { + status = "okay"; +}; + +&ps_atc2_cio_pcie { + status = "okay"; +}; + +&ps_atc2_cio_usb { + status = "okay"; +}; + +&ps_atc2_cio_auss { + status = "okay"; +}; + +&ps_atc2_pcie { + status = "okay"; +}; + +/* + * The router and its mailbox are on, with all five domains and the PCIe tunnel, whether or not + * t6050-max.dtsi leaves acio2 disabled and without the fifth domain for boards outside its list. + */ +&acio2_mbox { + status = "okay"; +}; + +&acio2 { + status = "okay"; + power-domains = <&ps_atc2_cio>, <&ps_atc2_cio_pcie>, + <&ps_atc2_cio_usb>, <&ps_atc2_cio_auss>, <&ps_atc2_pcie>; + apple,pcie-tunnel = <&acio2_pcie_tunnel>; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-k114.dtsi b/arch/arm64/boot/dts/apple/t6050-k114.dtsi new file mode 100644 index 0000000000000..a895eebe32f03 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-k114.dtsi @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The 14-inch K boards' chassis (K114c, M5 Max, and K114s, M5 Pro): what their ADTs describe + * alike beyond what t6050-k114-k116.dtsi shares with the 16-inch boards. The live K114s ADT + * (27.2) and the K114c's have the same nodes and values here, phandles aside. + * + * The speaker amps are left to the board: they need a qualified speaker protection, which + * the K114s does not have. + * + * Included after t6050-peripherals.dtsi. + */ + +/* + * The Neural Engine (ADT ane0, "ane,t8132exclave", firmware pre-loaded by iBoot), started only + * after the boot loader's preload hand-off + */ +#include "t6050-j714s-ane.dtsi" + +/* + * ANE_SYS's declared suppliers are the fabric domains: enabled the way + * the J714s enables them (t6050-j714s.dts for fab8/fab0, + * t6050-j716c-isp.dtsi for fab9). Left disabled they never register a + * provider and the enabled ps_ane_sys defers forever, taking ane0 and its + * three DARTs with it. + */ +&ps_fab0_piogw { + apple,firmware-owned; + status = "okay"; +}; + +&ps_fab8_soc { + apple,firmware-owned; + status = "okay"; +}; + +&ps_fab9_soc { + /delete-property/ power-domains; + apple,no-auto-pm; + apple,firmware-owned; + status = "okay"; +}; + +/* + * Pin 112's register takes an SError when read, so only the pins a node names are + * exposed: 80 (PCIe port 0's PERST#); 106 and 107, the speaker amps' interrupt and + * shutdown line (ADT audio-speaker, used only where a board describes the amps); + * 134 and 139, the jack codec's interrupt and reset; 136 and 137, the speaker ID. + */ +&pinctrl_ap { + gpio-reserved-ranges = <0 80>, <81 25>, <108 26>, <135 1>, <138 1>, <140 81>; +}; + +/* + * The CS42L84 headphone codec (ADT /arm-io/i2c2/audio-codec-output): its reset line + * is AP pin 139, driven high to run the codec, and its interrupt AP pin 134, level + * low. + */ +&i2c2 { + status = "okay"; + + jack_codec: codec@4b { + compatible = "cirrus,cs42l84"; + reg = <0x4b>; + reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; + interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; + #sound-dai-cells = <0>; + sound-name-prefix = "Jack"; + }; +}; + +/ { + sound { + /* + * The headphone jack only. The speaker amps and the "Speaker" link are not + * described here: no speaker protection is qualified for this chassis + * (speakerguardd refuses it), and the K114 entry has the speakers off. + */ + compatible = "apple,k114-macaudio", "apple,macaudio"; + model = "MacBook Pro K114"; + /* ADT audio-speaker function-speaker-id0 and -id1 */ + speaker-id-gpios = <&pinctrl_ap 136 GPIO_ACTIVE_HIGH>, + <&pinctrl_ap 137 GPIO_ACTIVE_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + + dai-link@0 { + reg = <0>; + link-name = "Headphone Jack"; + + cpu { + sound-dai = <&aop_audio 0>; + }; + + codec { + sound-dai = <&jack_codec>; + }; + }; + }; +}; + +/* The AOP, booted through its setup port, with its sensor and audio services. */ +&aop_mbox { + status = "okay"; +}; + +&aop_setup_mbox { + status = "okay"; +}; + +&aop_dart { + status = "okay"; +}; + +&aop { + status = "okay"; +}; + +/* + * The microphone array: ADT audio-hp-mic, three microphones on leap-s RX0 through the + * proxy ADMAC (Linux channel 1, as on J813), captured by the AOP audio service's own card. + */ +&admac_base_ns { + status = "okay"; +}; + +&admac_ec_proxy { + status = "okay"; +}; + +&aop_audio { + apple,chassis-name = "K114"; + apple,machine-kind = "MacBook Pro"; + dmas = <&admac_base_ns 4>, <&admac_base_ns 5>, + <&admac_base_ns 0>, <&admac_base_ns 1>, + <&admac_ec_proxy 1>; + dma-names = "cout", "cin", "spkr", "sense", "hpai"; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-k114c.dts b/arch/arm64/boot/dts/apple/t6050-k114c.dts index 8371621eb8391..7550e9838e9a3 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114c.dts +++ b/arch/arm64/boot/dts/apple/t6050-k114c.dts @@ -12,6 +12,11 @@ /* Defined before the includes: t6050-max.dtsi guards the ATC2 router on it. */ #define T6050_K114C +/* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ +#define T6050_ATC2_USB4_ROUTER +/* The N1's firmware and this board's ADT board-id, for t6050-k114-k116.dtsi */ +#define T6050_K_N1_FIRMWARE "apple/centauri/k114c-ftab.bin" +#define T6050_K_BOARD_ID 0x04 #include "t6050-k114-k116.dtsi" / { @@ -25,199 +30,16 @@ #include "t6050-peripherals.dtsi" -/* The Neural Engine, started only after the boot loader's preload hand-off */ -#include "t6050-j714s-ane.dtsi" - -/* - * ANE_SYS's declared suppliers are the fabric domains: enabled here the way - * the J714s enables them (t6050-j714s.dts for fab8/fab0, - * t6050-j716c-isp.dtsi for fab9). Left disabled they never register a - * provider and the enabled ps_ane_sys defers forever, taking ane0 and its - * three DARTs with it. - */ -&ps_fab0_piogw { - apple,firmware-owned; - status = "okay"; -}; - -&ps_fab8_soc { - apple,firmware-owned; - status = "okay"; -}; - -&ps_fab9_soc { - /delete-property/ power-domains; - apple,no-auto-pm; - apple,firmware-owned; - status = "okay"; -}; - / { aliases { - /* kboot fills the N1's factory addresses from /chosen through these */ - wifi0 = &n1_alpha; - bluetooth0 = &n1_beta; nvram = &nvram; }; }; /* - * PCIe port 0: the N1 (Wi-Fi and Bluetooth), laid out as on J716c: the boot - * loader trains the link and keeps power, clocks, the PHY and PERST; Linux owns - * the routing, MSI and the DART. The port stays disabled until the loader - * trains it. - */ -&pcie0 { - reg = <0x1c 0xb0000000 0x0 0x10000000>, - <0x4 0x14000000 0x0 0x4000>, - <0x4 0x10028000 0x0 0x8000>, - <0x4 0x17010000 0x0 0x4000>, - <0x4 0x10024000 0x0 0x4000>, - <0x4 0x11028000 0x0 0x8000>, - <0x4 0x17014000 0x0 0x4000>, - <0x4 0x11024000 0x0 0x4000>, - <0x4 0x17020000 0x0 0x4000>; - reg-names = "config", "rc", "port0", "phy0", "intr2axi0", "port1", "phy1", "intr2axi1", - "phy-shared"; - interrupts = , - ; - interrupt-names = "port0", "port1"; - - /* The N1's three functions are on DART streams 1-3 */ - iommu-map = <0x100 &dart_apcie0 1 3>, - <0x200 &dart_apcie1 1 1>; - bus-range = <0 4>; - /* dart_apcie1 probes only once port 1 is up: the host must not wait for it */ - post-init-providers = <&dart_apcie1>; - status = "okay"; - - port00: pci@0,0 { - device_type = "pci"; - reg = <0x0 0 0 0 0>; - bus-range = <1 1>; - apple,link-trained-by-bootloader; - /* PERST#, driven only by the root-port reset after the N1's ROM stage */ - reset-gpios = <&pinctrl_ap 80 GPIO_ACTIVE_LOW>; - status = "disabled"; - - #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 &port00 0 0 0 0>, - <0 0 0 2 &port00 0 0 0 1>, - <0 0 0 3 &port00 0 0 0 2>, - <0 0 0 4 &port00 0 0 0 3>; - - /* platform ID (board 0x04 << 16) | chip 0x6050 */ - n1_control: control@0,0 { - compatible = "pci106b,1900"; - reg = <0x10000 0x0 0x0 0x0 0x0>; - firmware-name = "apple/centauri/k114c-ftab.bin"; - apple,centauri-platform-id = <0x00046050>; - apple,centauri-protocol = <27>; - }; - - n1_alpha: wifi@0,1 { - compatible = "pci106b,1902"; - reg = <0x10100 0x0 0x0 0x0 0x0>; - local-mac-address = [00 00 00 00 00 00]; - }; - - n1_beta: bluetooth@0,2 { - compatible = "pci106b,1903"; - reg = <0x10200 0x0 0x0 0x0 0x0>; - local-bd-address = [00 00 00 00 00 00]; - }; - }; - - /* - * PCIe port 1: the SD card reader (ADT pci-bridge1/pcie-sdreader, a GL9755), as on - * J714s. The boot loader leaves it down, so the kernel trains it: power is the SMC - * pcIO output of function-sd_pwr_en (index 3 below), PERST# GPIO 81, IRQ 1531. It is - * on stream 1 of dart-apcie1. The link tunables are pci-bridge1's, as on port 0. - */ - port01: pci@1,0 { - device_type = "pci"; - reg = <0x800 0 0 0 0>; - bus-range = <2 2>; - apple,link-trained-by-bootloader; - pwren-gpios = <&smc_pcio 3 GPIO_ACTIVE_HIGH>; - reset-gpios = <&pinctrl_ap 81 GPIO_ACTIVE_LOW>; - apple,apcie-config-tunables = <0x140 4 0x1 0x1>, - <0x144 4 0xffffff 0x253770>, - <0x8a8 4 0x1 0x1>, - <0x8ac 4 0x1 0x1>; - apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, - <0x194 4 0x2 0x2>, - <0xb80 4 0x7f3f3f 0x7f1e1e>, - <0xb88 4 0x7f3f3f 0x7f1e1e>; - apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, - <0x890 4 0x3000000 0x0>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x1000000>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x2000000>, - <0x8a8 4 0xffff0f 0x1>; - - #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 &port01 0 0 0 0>, - <0 0 0 2 &port01 0 0 0 1>, - <0 0 0 3 &port01 0 0 0 2>, - <0 0 0 4 &port01 0 0 0 3>; - - /* The GL9755; card detect and write protect active high (ADT *-polarity = 1) */ - sdhci0: mmc@0,0 { - compatible = "pci17a0,9755"; - reg = <0x20000 0x0 0x0 0x0 0x0>; - cd-inverted; - wp-inverted; - }; - }; -}; - -/* - * Pin 112's register takes an SError when read, so only the pins a node here - * names are exposed: 80 and 81 (PCIe ports 0 and 1's PERST#); 106 and 107, the speaker - * amps' interrupt and shutdown line; 134 and 139, the jack codec's interrupt and - * reset; 136 and 137, the speaker ID. - */ -&pinctrl_ap { - gpio-reserved-ranges = <0 80>, <82 24>, <108 26>, <135 1>, <138 1>, <140 81>; -}; - -/* It answers only once port 1's root complex is up: pcie-apple then enables it */ -&dart_apcie1 { - apple,manual-availability; - status = "okay"; -}; - -/* - * The board's pcIO outputs (t6050-k114-k116.dtsi lists indices 0 to 2), plus index 3, - * sd_pwr_en pKW8('pcIO', 0x0, 0x190000): ADT pcie-sdreader function-sd_pwr_en. - */ -&smc_pcio { - apple,output-commands = /bits/ 64 <0x001a000000000000 0x000f000000800000 - 0x011c000000010000 0x0019000000000000>; -}; - -#include "t6050-k114c-gpu.dtsi" - -/* - * Sound through the AOP, as on J813: its audio service runs the serializers, the - * CS42L84 headphone jack on admac-base-ns TX2/RX2 and the six SN012776 speaker amps - * on TX0, their voltage and current sense on RX0 (ADT iop-audio-controller). + * The speakers, through the AOP as on J813: the six SN012776 speaker amps on admac-base-ns + * TX0, their voltage and current sense on RX0 (ADT iop-audio-controller). The jack, the + * card and the AOP are the chassis' (t6050-k114.dtsi). * * The amps (ADT /arm-io/i2c1/audio-speaker* and /arm-io/i2c3/audio-speaker*) share * one shutdown line, AP pin 107 (function-reset of the first), and one fault @@ -330,385 +152,178 @@ }; }; -/* - * The CS42L84 headphone codec (ADT /arm-io/i2c2/audio-codec-output): its reset line - * is AP pin 139, driven high to run the codec, and its interrupt AP pin 134, level - * low. - */ -&i2c2 { - status = "okay"; - - jack_codec: codec@4b { - compatible = "cirrus,cs42l84"; - reg = <0x4b>; - reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; - interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; - #sound-dai-cells = <0>; - sound-name-prefix = "Jack"; - }; -}; +/* The 14-inch chassis: the Neural Engine, pins, the jack, the card and the AOP */ +#include "t6050-k114.dtsi" -/ { - sound { - compatible = "apple,j714-macaudio", "apple,macaudio"; - model = "MacBook Pro K114"; - /* ADT audio-speaker function-speaker-id0 and -id1 */ - speaker-id-gpios = <&pinctrl_ap 136 GPIO_ACTIVE_HIGH>, - <&pinctrl_ap 137 GPIO_ACTIVE_HIGH>; - #address-cells = <1>; - #size-cells = <0>; - - dai-link@0 { - reg = <0>; - link-name = "Headphone Jack"; - - cpu { - sound-dai = <&aop_audio 0>; - }; +/* The GPU, handed over by the boot loader */ +#include "t6050-k114-k116-gpu.dtsi" - codec { - sound-dai = <&jack_codec>; - }; +/* + * The K114c keeps J714's card with its speakers, at the J714's safe level. The + * chassis' K114 entry (t6050-k114.dtsi) has the jack only. + */ +&{/sound} { + compatible = "apple,j714-macaudio", "apple,macaudio"; + + dai-link@1 { + reg = <1>; + link-name = "Speaker"; + /* + * Codecs in ADT speaker-config order, so that macaudio gives them + * playback slots 0-5 as macOS does (left channels in slots 0, 2 + * and 4, right in 1, 3 and 5). The idle masks are the ADT + * amp-tx-zd-config rows 0 and 1: left woofer 1 drives zeros in the + * right amps' sense slots, right woofer 1 in the left amps'. + */ + dai-tdm-idle-mode-0 = "zero"; + dai-tdm-slot-tx-idle-mask-0 = <0xfff0f0f0>; + dai-tdm-idle-mode-1 = "zero"; + dai-tdm-slot-tx-idle-mask-1 = <0xff0f0f0f>; + + cpu { + sound-dai = <&aop_audio 3>; }; - dai-link@1 { - reg = <1>; - link-name = "Speaker"; - /* - * Codecs in ADT speaker-config order, so that macaudio gives them - * playback slots 0-5 as macOS does (left channels in slots 0, 2 - * and 4, right in 1, 3 and 5). The idle masks are the ADT - * amp-tx-zd-config rows 0 and 1: left woofer 1 drives zeros in the - * right amps' sense slots, right woofer 1 in the left amps'. - */ - dai-tdm-idle-mode-0 = "zero"; - dai-tdm-slot-tx-idle-mask-0 = <0xfff0f0f0>; - dai-tdm-idle-mode-1 = "zero"; - dai-tdm-slot-tx-idle-mask-1 = <0xff0f0f0f>; - - cpu { - sound-dai = <&aop_audio 3>; - }; - - codec { - sound-dai = <&speaker_left_woof1>, <&speaker_right_woof1>, - <&speaker_left_woof2>, <&speaker_right_woof2>, - <&speaker_left_tweet>, <&speaker_right_tweet>; - }; + codec { + sound-dai = <&speaker_left_woof1>, <&speaker_right_woof1>, + <&speaker_left_woof2>, <&speaker_right_woof2>, + <&speaker_left_tweet>, <&speaker_right_tweet>; }; }; }; -/* The AOP, booted through its setup port, with its sensor and audio services. */ -&aop_mbox { - status = "okay"; -}; - -&aop_setup_mbox { - status = "okay"; -}; - -&aop_dart { - status = "okay"; -}; - -&aop { - status = "okay"; -}; - /* - * The microphone array: ADT audio-hp-mic, three microphones on leap-s RX0 through the - * proxy ADMAC (Linux channel 1, as on J813), captured by the AOP audio service's own card. + * The USB-C ports ATC1 and ATC2, as on the other K boards (t6050-k114-k116-usb.dtsi), then the + * 14-inch chassis' MagSafe 3 PD controller and the right port's USB4/Thunderbolt router + * (t6050-k114-usb.dtsi). */ -&admac_base_ns { - status = "okay"; -}; - -&admac_ec_proxy { - status = "okay"; -}; - -&aop_audio { - apple,chassis-name = "K114"; - apple,machine-kind = "MacBook Pro"; - dmas = <&admac_base_ns 4>, <&admac_base_ns 5>, - <&admac_base_ns 0>, <&admac_base_ns 1>, - <&admac_ec_proxy 1>; - dma-names = "cout", "cin", "spkr", "sense", "hpai"; -}; +#include "t6050-k114-k116-usb.dtsi" +#include "t6050-k114-usb.dtsi" /* - * ==== The left-front USB-C port (ATC1) ==== - * - * ADT /arm-io/nub-spmi-a0/hpm1 (SN201202x, SPMI address 0xa, port-number 2, port-location - * "left-front", acio-parent acio1), with atc-phy1, usb-drd1 and dart-usb1. The K114cAP ADT - * has the same hpm0, hpm1, hpm5, atc-phy and usb-drd nodes as the J714cAP one, so this is the - * J714c port block. The ATC1 template nodes of t6050-dieX.dtsi are enabled here; the boards - * sharing t6050-k114-k116.dtsi keep them disabled. The port's USB4/Thunderbolt router - * (/arm-io/acio1) and its DisplayPort routes are not described; the PHY runs in USB mode. - * - * The left-back port (ATC0, hpm0) is the boot link's debug port; the combo PHY driver - * excludes it on purpose (apple,port-index 0). + * The boot NOR. spi-nor reads the part's JEDEC ID itself. The partition is + * read-only: no program or erase reaches the flash until a later change lifts it. */ -/ { - aliases { - atcphy1 = &atc1_phy; - }; -}; - -&nub_spmi_a0 { - status = "okay"; - /* reg[1]: the generation 4 fault queue, which macOS empties when the controller starts */ - reg = <0x2 0x8a188000 0x0 0x4000>, - <0x2 0x8a184000 0x0 0x4000>; - - hpm1: usb-pd@a { - compatible = "apple,sn201202x"; - reg = <0xa SPMI_USID>; - - connector { - compatible = "usb-c-connector"; - label = "USB-C Left-front"; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - hpm1_hs: endpoint { - remote-endpoint = <&usb_drd1_hs>; - }; - }; - - port@1 { - reg = <1>; - hpm1_ss: endpoint { - remote-endpoint = <&atc1_phy_ep>; - }; - }; - }; - }; - }; - - /* - * The MagSafe 3 port's PD controller (ADT hpm5, port-type 0x11). It has no USB data - * path, so it gets no connector node; tipd registers a Type-C port and a power supply - * for it. Its ADT features-supported is <3>, "Power In" only: no liquid detection. - */ - hpm5: usb-pd@8 { - compatible = "apple,sn201202x"; - reg = <0x8 SPMI_USID>; - apple,no-liquid-detection; - }; -}; - -&atc1_phy_mbox { - status = "okay"; -}; - -&atc1_phy { +&qspi { status = "okay"; - port { - atc1_phy_ep: endpoint { - remote-endpoint = <&hpm1_ss>; - }; - }; -}; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; -&usb_drd1 { - status = "okay"; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - port { - usb_drd1_hs: endpoint { - remote-endpoint = <&hpm1_hs>; + nvram: partition@700000 { + label = "nvram"; + reg = <0x700000 0xc0000>; + read-only; + }; }; }; }; -&usb_drd1_dart_0 { - status = "okay"; -}; - -&usb_drd1_dart_1 { - status = "okay"; -}; - /* - * ==== The right USB-C port (ATC2) ==== - * - * ADT /arm-io/nub-spmi-a1/hpm2 (SN201202x, SPMI address 0xc, port-number 3, port-location - * "right", acio-parent acio2), with atc-phy2, usb-drd2 and dart-usb2. The HPM is on its own - * bus, nub-spmi-a1, and nothing hands the port off, so the power domains, the PHY mailbox, the - * PHY, the DWC3 and its DARTs are enabled outright, as t6050-max-atc2.dtsi does for the J714c - * and J716c. Its USB4/Thunderbolt router (acio2) and PCIe tunnel are - * t6050-max-atc2-router.dtsi, included below; the DisplayPort route is not described. + * PCIe port 1: the SD card reader, this board's own beside the shared port 0 + * (t6050-k114-k116.dtsi): its registers, interrupt and DART stream 1 of dart-apcie1. */ -/ { - aliases { - atcphy2 = &atc2_phy; - }; -}; - -&ps_atc2_common { - status = "okay"; -}; - -&ps_atc2_usb_aon { - status = "okay"; -}; - -&ps_atc2_phymxwrap { - status = "okay"; -}; - -&ps_atc2_usb { - status = "okay"; -}; - -&atc2_phy_mbox { - status = "okay"; -}; - -&atc2_phy { - status = "okay"; - - port { - atc2_phy_ep: endpoint { - remote-endpoint = <&hpm2_ss>; - }; - }; -}; - -&usb_drd2 { - status = "okay"; +&pcie0 { + reg = <0x1c 0xb0000000 0x0 0x10000000>, + <0x4 0x14000000 0x0 0x4000>, + <0x4 0x10028000 0x0 0x8000>, + <0x4 0x17010000 0x0 0x4000>, + <0x4 0x10024000 0x0 0x4000>, + <0x4 0x11028000 0x0 0x8000>, + <0x4 0x17014000 0x0 0x4000>, + <0x4 0x11024000 0x0 0x4000>, + <0x4 0x17020000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "phy0", "intr2axi0", "port1", "phy1", "intr2axi1", + "phy-shared"; + interrupts = , + ; + interrupt-names = "port0", "port1"; + iommu-map = <0x100 &dart_apcie0 1 3>, + <0x200 &dart_apcie1 1 1>; + /* dart_apcie1 probes only once port 1 is up: the host must not wait for it */ + post-init-providers = <&dart_apcie1>; - port { - usb_drd2_hs: endpoint { - remote-endpoint = <&hpm2_hs>; - }; - }; -}; + /* + * PCIe port 1: the SD card reader (ADT pci-bridge1/pcie-sdreader, a GL9755), as on + * J714s. The boot loader leaves it down, so the kernel trains it: power is the SMC + * pcIO output of function-sd_pwr_en (index 3 below), PERST# GPIO 81, IRQ 1531. It is + * on stream 1 of dart-apcie1. The link tunables are pci-bridge1's, as on port 0. + */ + port01: pci@1,0 { + device_type = "pci"; + reg = <0x800 0 0 0 0>; + bus-range = <2 2>; + apple,link-trained-by-bootloader; + pwren-gpios = <&smc_pcio 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&pinctrl_ap 81 GPIO_ACTIVE_LOW>; + apple,apcie-config-tunables = <0x140 4 0x1 0x1>, + <0x144 4 0xffffff 0x253770>, + <0x8a8 4 0x1 0x1>, + <0x8ac 4 0x1 0x1>; + apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, + <0x194 4 0x2 0x2>, + <0xb80 4 0x7f3f3f 0x7f1e1e>, + <0xb88 4 0x7f3f3f 0x7f1e1e>; + apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, + <0x890 4 0x3000000 0x0>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x1000000>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x2000000>, + <0x8a8 4 0xffff0f 0x1>; -&usb_drd2_dart_0 { - status = "okay"; -}; + #address-cells = <3>; + #size-cells = <2>; + ranges; -&usb_drd2_dart_1 { - status = "okay"; -}; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &port01 0 0 0 0>, + <0 0 0 2 &port01 0 0 0 1>, + <0 0 0 3 &port01 0 0 0 2>, + <0 0 0 4 &port01 0 0 0 3>; -&nub_spmi_a1 { - status = "okay"; - /* the driver polls the PD controllers and refuses an interrupt on this bus */ - /delete-property/ interrupts; - - hpm2: usb-pd@c { - compatible = "apple,sn201202x"; - reg = <0xc SPMI_USID>; - - connector { - compatible = "usb-c-connector"; - label = "USB-C Right"; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - hpm2_hs: endpoint { - remote-endpoint = <&usb_drd2_hs>; - }; - }; - - port@1 { - reg = <1>; - hpm2_ss: endpoint { - remote-endpoint = <&atc2_phy_ep>; - }; - }; - }; + /* The GL9755; card detect and write protect active high (ADT *-polarity = 1) */ + sdhci0: mmc@0,0 { + compatible = "pci17a0,9755"; + reg = <0x20000 0x0 0x0 0x0 0x0>; + cd-inverted; + wp-inverted; }; }; }; -#include "t6050-max-atc2-router.dtsi" - -/* The host DROM from the K114cAP ADT (/arm-io/acio2 thunderbolt-drom); the boot loader replaces it */ -&acio2_nhi { - apple,thunderbolt-drom = [fd 02 00 00 00 00 00 00 00 90 19 c3 8c 00 5c 00 - 00 00 00 00 00 00 08 81 82 02 82 00 00 00 08 82 - 92 01 82 00 00 00 03 83 20 08 84 00 00 00 00 00 - 00 08 85 00 00 00 00 00 00 05 86 09 01 00 08 87 - 00 00 00 00 00 00 05 88 09 01 00 05 89 09 01 00 - 05 8a 09 01 00 0e 01 41 70 70 6c 65 2c 20 49 6e - 63 2e 00 06 02 69 4f 53 00 00 00 00]; -}; - -/* The right router's suppliers, disabled in the inventory (as t6050-j714s-display.dtsi enables them) */ -&ps_atc2_cio { - status = "okay"; -}; - -&ps_atc2_cio_pcie { - status = "okay"; -}; - -&ps_atc2_cio_usb { - status = "okay"; -}; - -&ps_atc2_cio_auss { - status = "okay"; -}; - -&ps_atc2_pcie { - status = "okay"; -}; - /* - * The router and its mailbox are on, with all five domains and the PCIe tunnel, whether or not - * t6050-max.dtsi leaves acio2 disabled and without the fifth domain for boards outside its list. + * Pin 112's register takes an SError when read, so only the pins a node here + * names are exposed: 80 and 81 (PCIe ports 0 and 1's PERST#); 106 and 107, the speaker + * amps' interrupt and shutdown line; 134 and 139, the jack codec's interrupt and + * reset; 136 and 137, the speaker ID. */ -&acio2_mbox { - status = "okay"; +&pinctrl_ap { + gpio-reserved-ranges = <0 80>, <82 24>, <108 26>, <135 1>, <138 1>, <140 81>; }; -&acio2 { +/* It answers only once port 1's root complex is up: pcie-apple then enables it */ +&dart_apcie1 { + apple,manual-availability; status = "okay"; - power-domains = <&ps_atc2_cio>, <&ps_atc2_cio_pcie>, - <&ps_atc2_cio_usb>, <&ps_atc2_cio_auss>, <&ps_atc2_pcie>; - apple,pcie-tunnel = <&acio2_pcie_tunnel>; }; /* - * The boot NOR. spi-nor reads the part's JEDEC ID itself. The partition is - * read-only: no program or erase reaches the flash until a later change lifts it. + * The board's pcIO outputs (t6050-k114-k116.dtsi lists indices 0 to 2), plus index 3, + * sd_pwr_en pKW8('pcIO', 0x0, 0x190000): ADT pcie-sdreader function-sd_pwr_en. */ -&qspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - nvram: partition@700000 { - label = "nvram"; - reg = <0x700000 0xc0000>; - read-only; - }; - }; - }; +&smc_pcio { + apple,output-commands = /bits/ 64 <0x001a000000000000 0x000f000000800000 + 0x011c000000010000 0x0019000000000000>; }; diff --git a/arch/arm64/boot/dts/apple/t6050-k114s.dts b/arch/arm64/boot/dts/apple/t6050-k114s.dts index 2b88e99a6d993..41059929b296e 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k114s.dts @@ -10,6 +10,13 @@ * Copyright The Asahi Linux Contributors */ +/* Defined before the includes, which select this board's blocks on it. */ +#define T6050_K114S +/* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ +#define T6050_ATC2_USB4_ROUTER +/* The N1's firmware and this board's ADT board-id, for t6050-k114-k116.dtsi */ +#define T6050_K_N1_FIRMWARE "apple/centauri/k114s-ftab.bin" +#define T6050_K_BOARD_ID 0x14 #include "t6050-k114-k116.dtsi" / { @@ -21,9 +28,14 @@ firmware-name = "apple/tpmtfw-k114s.bin"; }; -#define T6050_K114S #include "t6050-peripherals.dtsi" +/* The 14-inch chassis: the Neural Engine, pins, the jack, the card and the AOP; no speakers */ +#include "t6050-k114.dtsi" + +/* The GPU, handed over by the boot loader */ +#include "t6050-k114-k116-gpu.dtsi" + / { aliases { /* asahi-bless and the boot loader find the NVRAM partition by this alias */ @@ -60,3 +72,11 @@ }; }; }; + +/* + * The USB-C ports ATC1 and ATC2, as on the other K boards (t6050-k114-k116-usb.dtsi), then the + * 14-inch chassis' MagSafe 3 PD controller and the right port's USB4/Thunderbolt router + * (t6050-k114-usb.dtsi). + */ +#include "t6050-k114-k116-usb.dtsi" +#include "t6050-k114-usb.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-k116c.dts b/arch/arm64/boot/dts/apple/t6050-k116c.dts index ff9e875fb1951..40bfec8ab72a8 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116c.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116c.dts @@ -9,6 +9,9 @@ * Copyright The Asahi Linux Contributors */ +/* The N1's firmware and this board's ADT board-id, for t6050-k114-k116.dtsi */ +#define T6050_K_N1_FIRMWARE "apple/centauri/k116c-ftab.bin" +#define T6050_K_BOARD_ID 0x06 #include "t6050-k114-k116.dtsi" / { @@ -22,3 +25,9 @@ #define T6050_K116C #include "t6050-peripherals.dtsi" + +/* The GPU, handed over by the boot loader */ +#include "t6050-k114-k116-gpu.dtsi" + +/* The USB-C ports ATC1 and ATC2, as on the other K boards */ +#include "t6050-k114-k116-usb.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-k116s-gpu.dtsi b/arch/arm64/boot/dts/apple/t6050-k116s-gpu.dtsi deleted file mode 100644 index 7bc349759028d..0000000000000 --- a/arch/arm64/boot/dts/apple/t6050-k116s-gpu.dtsi +++ /dev/null @@ -1,155 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR MIT -/* - * K116s GPU (AGX G17S, ADT /arm-io/sgx "gpu,t6050") for the boot loader hand-off. - * - * It is the GPU half of t6050-j714s-gpu-panel.dtsi (integration/aurora 06c3db9c3752); the - * K116s tree already has its own display half. Everything stays disabled: a loader with the - * G17S hand-off fills the six reservations from the ADT and enables the GPU PMGR, GPX, AFR, - * GFX, both mailboxes and the GPU, the GPU last. Without such a loader (the enrolled aura - * 58d65df0 has none for this layout) this file changes nothing at run time except the two - * always-on marks, which sit on disabled nodes. - * - * Every value below was checked against the K116s 27.2 ADT. arm-io ranges add 0x2_0000_0000 - * to the 0x21_xxxx_xxxx bus addresses (bus 0x20_2000_0000 -> parent 0x22_2000_0000). - */ - -/ { - aliases { - /* The loader finds the GPU through this alias */ - gpu = &sgx; - }; - - reserved-memory { - /* - * Filled and enabled by the loader from the ADT. K116s 27.2 values, for - * reference only (never hard-code: iBoot places them): - * gpu-fw-text 0x100_00ff8000 + 0xa4000 gfx-asc __TEXT 0x50000, then - * gfx1-asc __TEXT 0x54000 at - * 0x100_01048000 - * gpu-fw-data 0x100_0251c000 + 0x184000 sgx gfx-data-base .. end of - * gfx1-data-shared-ro - * uat-ttbs 0x10f_fffa8000 + 0x4000 sgx gpu-region-base/-size - * uat-pagetables 0x10f_fff28000 + 0x80000 sgx gfx-shared-region-* - * uat-l2-pagetables 0x10f_fff24000 + 0x4000 sgx gfx-shared-l2-region-* - * uat-handoff 0x10f_fff20000 + 0x4000 sgx gfx-handoff-* - * The four UAT ranges are the J714s's (aura ec204ea50b5d message); the firmware - * segments differ (J714s 27.0: fw-text 0x100_00fd4000, fw-data 0x100_024f4000). - */ - gpu_fw_text: gpu-fw-text { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - gpu_fw_data: gpu-fw-data { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - uat_ttbs: uat-ttbs { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - uat_pagetables: uat-pagetables { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - uat_l2_pagetables: uat-l2-pagetables { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - uat_handoff: uat-handoff { - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - }; -}; - -/* The inventory ASC nodes; the mailboxes below describe the same windows. */ -/delete-node/ &gfx_asc; -/delete-node/ &gfx1_asc; - -&{/soc} { - /* - * ADT gfx-asc: reg 0x21_02600000 + 0x88000 (wrapper), 0x21_02050000 + 8 (iop-vbar); - * interrupts [2798, 2797, 2800, 2799], of which the second and third are send-empty - * and recv-not-empty; role "GFX"; power-gates [614] = GFX_ASC. As J714s. - */ - gfx_mbox: mailbox@2302600000 { - compatible = "apple,t6050-j775d-ascwrap-v6"; - reg = <0x23 0x2600000 0x0 0x88000>, - <0x23 0x2050000 0x0 0x8>; - reg-names = "wrapper", "iop-vbar"; - interrupts = , - ; - interrupt-names = "send-empty", "recv-not-empty"; - apple,firmware-role = "GFX"; - power-domains = <&ps_gfx>; - #mbox-cells = <0>; - status = "disabled"; - }; - - /* - * ADT gfx1-asc: reg 0x21_02e00000 + 0x88000, 0x21_02850000 (ADT size 0x60000; the - * driver uses the first 8 bytes as on J714s); interrupts [2802, 2801, 2804, 2803]; - * role "GFX1"; power-gates [657] = GFX_ASC1. - */ - gfx1_mbox: mailbox@2302e00000 { - compatible = "apple,t6050-j775d-ascwrap-v6"; - reg = <0x23 0x2e00000 0x0 0x88000>, - <0x23 0x2850000 0x0 0x8>; - reg-names = "wrapper", "iop-vbar"; - interrupts = , - ; - interrupt-names = "send-empty", "recv-not-empty"; - apple,firmware-role = "GFX1"; - power-domains = <&ps_gfx>; - #mbox-cells = <0>; - status = "disabled"; - }; -}; - -/* - * ADT pmgr devices: GPX (id 359, reg +0x0), AFR (id 360, +0x100) and GFX (id 362, +0x110) - * in the GPU PMGR (pmgr reg[51] 0x21_00e80000). The K116s ADT marks GPX and AFR critical, - * GFX not, as the J714s file states for its board. - */ -&ps_gpx { - apple,always-on; -}; - -&ps_afr { - apple,always-on; -}; - -&sgx { - /* - * "apple,agx-g17s" is what the loader checks and the driver binds - * (drivers/gpu/drm/asahi/driver.rs). The driver uses the J714 tables for it, - * 5 mV below this unit's ADT voltages at eight of the fourteen states. - */ - compatible = "apple,agx-g17s"; - /* ADT sgx reg[0] 0x21_00000000 + 0x3fdc000; the driver maps the first 16 MiB as "sgx" */ - reg = <0x23 0x0 0x0 0x3fdc000>; - reg-names = "sgx"; - /delete-property/ interrupts; - mboxes = <&gfx_mbox>, <&gfx1_mbox>; - memory-region = <&uat_ttbs>, <&uat_pagetables>, <&uat_handoff>, - <&gpu_fw_data>, <&uat_l2_pagetables>, <&gpu_fw_text>; - memory-region-names = "ttbs", "pagetables", "handoff", "fw-data", - "l2-pagetables", "fw-text"; - /* - * As t6050-j714s.dts: the GPU on the PMP's GFX report entry (report@f, on ps_gfx), - * so the PMP is told the GPU is on only while it is powered. The K116s already - * runs the PMP with its report (t6050-k116s.dts &pmp0_report). - */ - power-domains = <&pmp0_gfx>; -}; diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index 56cf949d10413..26f4bce4362db 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -9,6 +9,9 @@ * Copyright The Asahi Linux Contributors */ +/* The N1's firmware and this board's ADT board-id, for t6050-k114-k116.dtsi */ +#define T6050_K_N1_FIRMWARE "apple/centauri/k116s-ftab.bin" +#define T6050_K_BOARD_ID 0x16 #include "t6050-k114-k116.dtsi" / { @@ -25,9 +28,6 @@ / { aliases { - /* The loader fills the N1's factory addresses through these */ - wifi0 = &n1_alpha; - bluetooth0 = &n1_beta; /* the boot loader reserves the SEP firmware and adds its manifests through this alias */ sep = &sep; }; @@ -44,10 +44,7 @@ }; /* - * PCIe port 0: the N1 (Wi-Fi and Bluetooth), laid out as on J714s. ADT apcie0 - * gives port 0's registers and IRQ 1523, pci-bridge0's PERST# is GPIO 80, and - * the N1's three functions are on DART streams 1-3. The platform ID is this - * board's ADT /chosen board-id (0x16) << 16 | chip 0x6050. + * PCIe port 0, the N1, is in t6050-k114-k116.dtsi. * * PCIe port 1: the SD card reader (ADT apcie0/pci-bridge1/pcie-sdreader, a * GL9755), as on J714s. The boot loader leaves the port down, so the kernel @@ -86,52 +83,8 @@ interrupt-names = "port0", "port1"; iommu-map = <0x100 &dart_apcie0 1 3>, <0x200 &apcie1_dart 1 1>; - bus-range = <0 4>; /* apcie1_dart probes only once port 1 is up: the host must not wait for it */ post-init-providers = <&apcie1_dart>; - status = "okay"; - - port00: pci@0,0 { - device_type = "pci"; - reg = <0x0 0 0 0 0>; - bus-range = <1 1>; - apple,link-trained-by-bootloader; - /* PERST#: ADT pci-bridge0 function-perst, GPIO 80 */ - reset-gpios = <&pinctrl_ap 80 GPIO_ACTIVE_LOW>; - status = "disabled"; - - #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 &port00 0 0 0 0>, - <0 0 0 2 &port00 0 0 0 1>, - <0 0 0 3 &port00 0 0 0 2>, - <0 0 0 4 &port00 0 0 0 3>; - - n1_control: control@0,0 { - compatible = "pci106b,1900"; - reg = <0x10000 0x0 0x0 0x0 0x0>; - firmware-name = "apple/centauri/k116s-ftab.bin"; - apple,centauri-platform-id = <0x00166050>; - apple,centauri-protocol = <27>; - }; - - n1_alpha: wifi@0,1 { - compatible = "pci106b,1902"; - reg = <0x10100 0x0 0x0 0x0 0x0>; - local-mac-address = [00 00 00 00 00 00]; - }; - - n1_beta: bluetooth@0,2 { - compatible = "pci106b,1903"; - reg = <0x10200 0x0 0x0 0x0 0x0>; - local-bd-address = [00 00 00 00 00 00]; - }; - }; port01: pci@1,0 { device_type = "pci"; @@ -193,172 +146,6 @@ status = "okay"; }; -/* - * Type-C, from the ADT (as on J714s): - * ATC0 usb-drd0 left-back hpm0 nub-spmi-a0 0x0c (the debug port, not described) - * ATC1 usb-drd1 left-front hpm1 nub-spmi-a0 0x0a - * ATC2 usb-drd2 right hpm2 nub-spmi-a1 0x0c - * hpm5 nub-spmi-a0 0x08 (MagSafe, not a USB-C connector) - */ - -/* Left-front port (ATC1): the SN201202x hpm1 and the connector graph */ -&nub_spmi_a0 { - status = "okay"; - - hpm1: usb-pd@a { - compatible = "apple,sn201202x"; - reg = <0xa SPMI_USID>; - - typec1: connector { - compatible = "usb-c-connector"; - label = "USB-C Left-front"; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - typec1_hs: endpoint { - remote-endpoint = <&usb_drd1_hs>; - }; - }; - - port@1 { - reg = <1>; - typec1_ss: endpoint { - remote-endpoint = <&atc1_phy_typec>; - }; - }; - }; - }; - }; -}; - -&atc1_phy_mbox { - status = "okay"; -}; - -&atc1_phy { - status = "okay"; - - port { - atc1_phy_typec: endpoint { - remote-endpoint = <&typec1_ss>; - }; - }; -}; - -&usb_drd1 { - status = "okay"; - - port { - usb_drd1_hs: endpoint { - remote-endpoint = <&typec1_hs>; - }; - }; -}; - -&usb_drd1_dart_0 { - status = "okay"; -}; - -&usb_drd1_dart_1 { - status = "okay"; -}; - -/* - * Right port (ATC2): hpm2 on nub-spmi-a1, USB only (dcpext0's DisplayPort route - * through ATC2 stays off). The driver polls the generation 4 bus and refuses an - * interrupt, so it takes the first register window only, as on J714s. - */ -&nub_spmi_a1 { - reg = <0x2 0x8a1a8000 0x0 0x4000>; - /delete-property/ interrupts; - status = "okay"; - - hpm2: usb-pd@c { - compatible = "apple,sn201202x"; - reg = <0xc SPMI_USID>; - - typec2: connector { - compatible = "usb-c-connector"; - label = "USB-C Right"; - power-role = "dual"; - data-role = "dual"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - typec2_hs: endpoint { - remote-endpoint = <&usb_drd2_hs>; - }; - }; - - port@1 { - reg = <1>; - typec2_ss: endpoint { - remote-endpoint = <&atc2_phy_typec>; - }; - }; - }; - }; - }; -}; - -&ps_atc2_common { - status = "okay"; -}; - -&ps_atc2_usb_aon { - status = "okay"; -}; - -&ps_atc2_phymxwrap { - status = "okay"; -}; - -&ps_atc2_usb { - status = "okay"; -}; - -&atc2_phy_mbox { - status = "okay"; -}; - -&atc2_phy { - status = "okay"; - - port { - atc2_phy_typec: endpoint { - remote-endpoint = <&typec2_ss>; - }; - }; -}; - -&usb_drd2 { - status = "okay"; - - port { - usb_drd2_hs: endpoint { - remote-endpoint = <&typec2_hs>; - }; - }; -}; - -&usb_drd2_dart_0 { - status = "okay"; -}; - -&usb_drd2_dart_1 { - status = "okay"; -}; - /* * SMC sensors, as on J714s: every readable float T* key is discovered through * apple,discover-temperatures in t6050-die0.dtsi, so the shared temperature @@ -471,12 +258,20 @@ / { aliases { keyboard = &keyboard; - /* The loader fills the PHYs' tunables from the ADT through these */ - atcphy1 = &atc1_phy; - atcphy2 = &atc2_phy; }; }; +/* The USB-C ports ATC1 and ATC2, as on the other K boards */ +#include "t6050-k114-k116-usb.dtsi" + +/* + * Right port (ATC2): nub-spmi-a1 takes the first register window only, as on + * J714s. + */ +&nub_spmi_a1 { + reg = <0x2 0x8a1a8000 0x0 0x4000>; +}; + /* * The PMP (ADT pmp0, /chosen, /arm-io/pmgr), as on the J714s: iBoot loads its firmware and * the driver starts it with these boot arguments and the firmware properties in the tunables @@ -813,7 +608,16 @@ dma-names = "cout", "cin", "spkr", "sense", "hpai"; }; /* The GPU, handed over by the boot loader */ -#include "t6050-k116s-gpu.dtsi" +#include "t6050-k114-k116-gpu.dtsi" + +/* + * As t6050-j714s.dts: the GPU on the PMP's GFX report entry (report@f, on ps_gfx), so the PMP + * is told the GPU is on only while it is powered. This board runs the PMP with its report + * (&pmp0_report above). + */ +&sgx { + power-domains = <&pmp0_gfx>; +}; /* * The camera: the T6050 ISP as J716c and J714s describe it. From the K116sAP ADT (27.2): diff --git a/arch/arm64/boot/dts/apple/t6050-max.dtsi b/arch/arm64/boot/dts/apple/t6050-max.dtsi index 922b83b01d057..b1a95aa559a5e 100644 --- a/arch/arm64/boot/dts/apple/t6050-max.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-max.dtsi @@ -219,7 +219,8 @@ #endif }; -#if defined(T6050_J714C) || defined(T6050_J714S) || defined(T6050_J716C) || defined(T6050_K114C) +/* Boards whose ADT has ATC2's USB4 router (acio2) define T6050_ATC2_USB4_ROUTER. */ +#ifdef T6050_ATC2_USB4_ROUTER /* * ATC2's USB4/Thunderbolt router (ADT /arm-io/acio2, acio-cpu2 and dart-acio2), powered per * connection: the PHY enters CIO mode, then the router's domains come on (ATC2_CIO, _PCIE, _USB, @@ -456,7 +457,6 @@ reg-names = "config", "rc", "port0", "fabric", "debug", "ltssm", "intr2axi"; /* The port's: link events and INTx */ interrupts = ; - interrupt-names = "port0"; power-domains = <&ps_atc2_pcie>; /* No boot loader hands the port over: the kernel cold-initializes it. */ apple,pciec-kernel-init; diff --git a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi index c7a6178d27371..9c8f5441a94a3 100644 --- a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi @@ -1617,7 +1617,8 @@ status = "disabled"; }; -#if !defined(T6050_J714C) && !defined(T6050_J714S) && !defined(T6050_J716C) && !defined(T6050_K114C) +/* With ATC2's USB4 router, t6050-max.dtsi describes this DART with the router instead. */ +#ifndef T6050_ATC2_USB4_ROUTER apciec2_dart: iommu@384000000 { compatible = "apple,t6050-dart", "apple,t8110-dart"; reg = <0x3 0x84000000 0x0 0x20000>;