diff --git a/arch/arm64/boot/dts/apple/t6050-ane.dtsi b/arch/arm64/boot/dts/apple/t6050-ane.dtsi new file mode 100644 index 0000000000000..aaf2fb2d9a6d2 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-ane.dtsi @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The T6050 Neural Engine (ane0 in t6050-peripherals.dtsi), for any board + * that includes this after t6050-peripherals.dtsi. iBoot preloads the + * personalized firmware (ADT ane0 segment-ranges, TEXT 0xc0000 and DATA + * 0x2ac000 bytes). The boot loader fills the two reservations from that + * boot's ADT, renames them to their physical addresses and enables them; a + * boot without that hand-off leaves ane0 disabled, and the ANE driver leaves + * the engine off unless the preloaded firmware is one it knows. + * + * This describes die 0's engine only. The second die of an M5 Ultra has its + * own engine, DARTs and power state, which are not described yet. + */ + +#ifndef __T6050_ANE_DTSI__ +#define __T6050_ANE_DTSI__ + +/ { + reserved-memory { + ane_fw_text: ane-firmware-text@0 { + compatible = "apple,asc-mem"; + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + + ane_fw_data: ane-firmware-data@0 { + compatible = "apple,asc-mem"; + reg = <0 0 0 0>; + no-map; + status = "disabled"; + }; + }; +}; + +&ane0 { + memory-region = <&ane_fw_text>, <&ane_fw_data>; + memory-region-names = "firmware-text", "firmware-data"; + status = "okay"; +}; + +&ane0_dart { + status = "okay"; +}; + +&ane0_dart1 { + status = "okay"; +}; + +&ane0_dart2 { + status = "okay"; +}; + +&ps_ane_sys { + status = "okay"; +}; + +/* + * ANE_SYS's parents in the ADT power tree are FAB8_SOC and FAB9_SOC, and + * FAB8_SOC's is FAB0_PIOGW. The firmware keeps these fabrics up (the Secure + * Enclave and the camera sit behind them too), so Linux only holds a vote on + * them and never switches them. A board that already enables them for its + * Secure Enclave or camera ends up with the same nodes. + */ +&ps_fab0_piogw { + apple,firmware-owned; + status = "okay"; +}; + +&ps_fab8_soc { + apple,firmware-owned; + status = "okay"; +}; + +&ps_fab9_soc { + apple,firmware-owned; + status = "okay"; +}; + +#endif /* __T6050_ANE_DTSI__ */ diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index f6da08c085819..c4019d39bd763 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -12,6 +12,9 @@ * Copyright The Asahi Linux Contributors */ +/* The Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + /dts-v1/; #define T6050_J714C diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi index fcad9b25534bb..afed4c2477fef 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi @@ -1,48 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * The Neural Engine of the J714s and the J716c, which share its layout. iBoot - * preloads the personalized firmware (ADT ane0 segment-ranges, TEXT 0xc0000 and - * DATA 0x2ac000 bytes). The boot loader fills the two reservations from that - * boot's ADT, renames them to their physical addresses and enables them; until - * then the ANE driver leaves the engine off. + * The Neural Engine is described for every T6050 board in t6050-ane.dtsi. + * This name is kept for board files that still include it. */ -/ { - reserved-memory { - ane_fw_text: ane-firmware-text@0 { - compatible = "apple,asc-mem"; - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - - ane_fw_data: ane-firmware-data@0 { - compatible = "apple,asc-mem"; - reg = <0 0 0 0>; - no-map; - status = "disabled"; - }; - }; -}; - -&ane0 { - memory-region = <&ane_fw_text>, <&ane_fw_data>; - memory-region-names = "firmware-text", "firmware-data"; - status = "okay"; -}; - -&ane0_dart { - status = "okay"; -}; - -&ane0_dart1 { - status = "okay"; -}; - -&ane0_dart2 { - status = "okay"; -}; - -&ps_ane_sys { - status = "okay"; -}; +#include "t6050-ane.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 7f8f6313c77c3..5edd1b6a83470 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -674,7 +674,7 @@ #include "t6050-j714s-dpaudio.dtsi" /* The Neural Engine, started only after the boot loader's preload hand-off */ -#include "t6050-j714s-ane.dtsi" +#include "t6050-ane.dtsi" /* * The port controllers: the sleep's command rules, a reset and more probe tries after a failed * probe, and for the USB-C ports LOCK's key, the board number reversed ("417J"; their debug mode diff --git a/arch/arm64/boot/dts/apple/t6050-j716s.dts b/arch/arm64/boot/dts/apple/t6050-j716s.dts index 1db9d021fae9c..b868598d38159 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716s.dts @@ -13,6 +13,9 @@ * Copyright The Asahi Linux Contributors */ +/* The Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + /dts-v1/; #include diff --git a/arch/arm64/boot/dts/apple/t6050-j873s.dts b/arch/arm64/boot/dts/apple/t6050-j873s.dts index 3ed8c503ebdc5..63937997822c2 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -13,6 +13,9 @@ * Copyright The Asahi Linux Contributors */ +/* The Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + /dts-v1/; #include "t6050-max.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-k116c.dts b/arch/arm64/boot/dts/apple/t6050-k116c.dts index 4cc28acf5043b..302ade662d62e 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 Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + /* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ #define T6050_ATC2_USB4_ROUTER /* ADT /arm-io/acio1: the left-front port's USB4/Thunderbolt router (t6050-k114-usb.dtsi) */ diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index db902593e3f38..6e94d4ad67ada 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 Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + /* ADT /arm-io/acio2: the right port's USB4/Thunderbolt router */ #define T6050_ATC2_USB4_ROUTER /* ADT /arm-io/acio1: the left-front port's USB4/Thunderbolt router (t6050-k114-usb.dtsi) */ diff --git a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi index 81f3c92a8aab7..7f90f8841dc87 100644 --- a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi @@ -3769,3 +3769,11 @@ status = "disabled"; }; }; + +/* + * The Neural Engine's firmware reservations and enables. A board whose engine + * is described defines T6050_ANE before including this file. + */ +#ifdef T6050_ANE +#include "t6050-ane.dtsi" +#endif