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 000000000000..aaf2fb2d9a6d --- /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 cf1d62c690fc..eadbc185ca48 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 788acc71ead5..afed4c2477fe 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-ane.dtsi @@ -1,47 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * The J714s Neural Engine. 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 383ec08bedbe..d705db465325 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -712,7 +712,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" #include "t6050-j714s-sleep.dtsi" #include "t6050-j714s-sleep-soc.dtsi" #include "t6050-j714s-sleep-adt.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j716s.dts b/arch/arm64/boot/dts/apple/t6050-j716s.dts index 43747a4ce6be..3957c3130cf3 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 0a7976e50230..e211df02d6ee 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -11,6 +11,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-k114s.dts b/arch/arm64/boot/dts/apple/t6050-k114s.dts index caa609babef0..b40d9239b5e4 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k114s.dts @@ -9,6 +9,9 @@ * Copyright The Asahi Linux Contributors */ +/* The Neural Engine (t6050-ane.dtsi, through t6050-peripherals.dtsi) */ +#define T6050_ANE + #include "t6050-k114-k116.dtsi" / { diff --git a/arch/arm64/boot/dts/apple/t6050-k116c.dts b/arch/arm64/boot/dts/apple/t6050-k116c.dts index ff9e875fb195..8da0c8c9ebf0 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 + #include "t6050-k114-k116.dtsi" / { diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index fe6468edc72c..d49b8d4f7292 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 + #include "t6050-k114-k116.dtsi" / { diff --git a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi index 488f3c3ee6d6..7eb10bb03d4c 100644 --- a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi @@ -3355,6 +3355,7 @@ compatible = "apple,t6050-dart", "apple,t8110-dart"; reg = <0x5 0x9800000 0x0 0xc000>, <0x5 0x9810000 0x0 0x4000>; + reg-names = "dart", "dapf"; interrupts = ; #iommu-cells = <1>; power-domains = <&ps_ane_sys>; @@ -3702,3 +3703,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