diff --git a/Documentation/admin-guide/media/apple-jpeg.rst b/Documentation/admin-guide/media/apple-jpeg.rst index 35cca8b11d9de..f1d1faffc6a39 100644 --- a/Documentation/admin-guide/media/apple-jpeg.rst +++ b/Documentation/admin-guide/media/apple-jpeg.rst @@ -8,7 +8,7 @@ Apple JPEG scaffold This driver provides a common platform and V4L2 memory-to-memory scaffold for the Apple T6041 and T8140 JPEG engines. Each DT platform device owns one independent m2m scheduler, with formats and VB2 queues allocated per open file. -T6041's nodes reside in ``t6040.dtsi`` in this source tree. All JPEG engine +T6041's nodes reside in ``t604x.dtsi`` in this source tree. All JPEG engine nodes and the new T8140 DART remain disabled. SoC DART defaults are disabled; existing board overrides are preserved. In particular, J700 already enables its first JPEG DART independently of the disabled codec engines. diff --git a/Documentation/devicetree/bindings/dma/apple,admac.yaml b/Documentation/devicetree/bindings/dma/apple,admac.yaml index 26a953ed9edb2..64d80cd5f4bcd 100644 --- a/Documentation/devicetree/bindings/dma/apple,admac.yaml +++ b/Documentation/devicetree/bindings/dma/apple,admac.yaml @@ -80,6 +80,8 @@ properties: instances share firmware-owned AOP DART roots and use windows assigned to their own streams. If absent, the DART allocation aperture applies. + nonposted-mmio: true + power-domains: maxItems: 1 diff --git a/Documentation/devicetree/bindings/gpu/apple,agx.yaml b/Documentation/devicetree/bindings/gpu/apple,agx.yaml index 2004c43d42b1d..9b5dc5b51241e 100644 --- a/Documentation/devicetree/bindings/gpu/apple,agx.yaml +++ b/Documentation/devicetree/bindings/gpu/apple,agx.yaml @@ -18,6 +18,7 @@ properties: - apple,agx-g14g - apple,agx-g14s - apple,agx-t6040 + - apple,agx-t6041 - apple,agx-t8132 - apple,agx-t8140 - items: @@ -309,6 +310,15 @@ allOf: apple,afr-leak-coef: minItems: 1 maxItems: 1 + - if: + properties: + compatible: + contains: + enum: + - apple,agx-t6040 + - apple,agx-t6041 + then: + properties: reg: items: - description: GFX coprocessor control registers @@ -356,6 +366,7 @@ allOf: contains: enum: - apple,agx-t6040 + - apple,agx-t6041 - apple,agx-t8132 - apple,agx-t8140 then: diff --git a/Documentation/devicetree/bindings/i2c/apple,i2c.yaml b/Documentation/devicetree/bindings/i2c/apple,i2c.yaml index 4033dc59a944c..5c827af153cb5 100644 --- a/Documentation/devicetree/bindings/i2c/apple,i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/apple,i2c.yaml @@ -60,6 +60,8 @@ properties: used. This frequency is generated by dividing the reference clock. Allowed values are between ref_clk/(16*4) and ref_clk/(16*255). + nonposted-mmio: true + power-domains: maxItems: 1 diff --git a/Documentation/devicetree/bindings/iommu/apple,dart.yaml b/Documentation/devicetree/bindings/iommu/apple,dart.yaml index 5bfb6577927a0..350e077e779b4 100644 --- a/Documentation/devicetree/bindings/iommu/apple,dart.yaml +++ b/Documentation/devicetree/bindings/iommu/apple,dart.yaml @@ -82,6 +82,8 @@ properties: describe the stream ID followed by the 64-bit base and length of its device-visible DMA window. + nonposted-mmio: true + power-domains: maxItems: 1 diff --git a/Documentation/devicetree/bindings/media/apple,avd.yaml b/Documentation/devicetree/bindings/media/apple,avd.yaml index 4c3c045e69764..de4101dfb50f7 100644 --- a/Documentation/devicetree/bindings/media/apple,avd.yaml +++ b/Documentation/devicetree/bindings/media/apple,avd.yaml @@ -20,6 +20,10 @@ properties: - apple,t6030-avd - apple,t6031-avd - const: apple,t8122-avd + - items: + - const: apple,t6041-max-avd + - const: apple,t6041-avd + - const: apple,t8132-avd - items: - const: apple,t6041-avd - const: apple,t8132-avd diff --git a/Documentation/devicetree/bindings/mfd/apple,smc.yaml b/Documentation/devicetree/bindings/mfd/apple,smc.yaml index 89ecdb0f47067..c90df16e9b974 100644 --- a/Documentation/devicetree/bindings/mfd/apple,smc.yaml +++ b/Documentation/devicetree/bindings/mfd/apple,smc.yaml @@ -49,6 +49,9 @@ properties: gpio: $ref: /schemas/gpio/apple,smc-gpio.yaml + gpio-low: + $ref: /schemas/gpio/apple,smc-gpio.yaml + reboot: $ref: /schemas/power/reset/apple,smc-reboot.yaml diff --git a/Documentation/devicetree/bindings/soc/apple/apple,t6041-aop.yaml b/Documentation/devicetree/bindings/soc/apple/apple,t6041-aop.yaml index 2ffb6e44a5b21..786bd7b1993c0 100644 --- a/Documentation/devicetree/bindings/soc/apple/apple,t6041-aop.yaml +++ b/Documentation/devicetree/bindings/soc/apple/apple,t6041-aop.yaml @@ -48,6 +48,8 @@ properties: mbox-names: const: mbox + nonposted-mmio: true + iommus: maxItems: 1 diff --git a/arch/arm64/boot/dts/apple/Makefile b/arch/arm64/boot/dts/apple/Makefile index c7487bcac3d35..52b15f4bdb8cb 100644 --- a/arch/arm64/boot/dts/apple/Makefile +++ b/arch/arm64/boot/dts/apple/Makefile @@ -97,6 +97,7 @@ dtb-$(CONFIG_ARCH_APPLE) += t6034-j516m.dtb dtb-$(CONFIG_ARCH_APPLE) += t6040-j614s.dtb dtb-$(CONFIG_ARCH_APPLE) += t6040-j616s.dtb dtb-$(CONFIG_ARCH_APPLE) += t6040-j616s-tether.dtb +dtb-$(CONFIG_ARCH_APPLE) += t6041-j616c.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j413.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j415.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j473.dtb diff --git a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-hdmi.dtsi b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-hdmi.dtsi index f471f9332e939..f828c64d3ccf3 100644 --- a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-hdmi.dtsi +++ b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-hdmi.dtsi @@ -36,11 +36,6 @@ &ps_dispext0_sys { power-domains = <&pmp_dispext0>; - status = "disabled"; -}; - -&ps_dispext0_fe { - status = "disabled"; }; &ps_dispext0_cpu { @@ -51,57 +46,20 @@ * virtual DISPEXT0-CPU-V; the last real register of the chain is FE. */ /delete-property/ apple,always-on; - status = "disabled"; -}; - -&ps_atc3_common { - status = "disabled"; -}; - -&ps_atc3_common_dp { - status = "disabled"; -}; - -&ps_atc3_usb_aon { - status = "disabled"; -}; - -&ps_atc3_phymxwrap { - status = "disabled"; -}; - -&pmgr_mini { - /* ADT ATC3_USB: +0x148, parents ATC3_COMMON and ATC3_USB_AON; the crossbar's domain as on T6030 */ - ps_atc3_usb: power-controller@148 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x148 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_usb"; - power-domains = <&ps_atc3_common>, <&ps_atc3_usb_aon>; - status = "disabled"; - }; -}; - -&pinctrl_aop { - status = "disabled"; }; &dcpext0_dart { /* in the DISPEXT0 block: powered (after the PMP request) before probing */ power-domains = <&ps_dispext0_fe>; - status = "disabled"; }; &dispext0_dart { /* in the DISPEXT0 block: powered (after the PMP request) before probing */ power-domains = <&ps_dispext0_fe>; - status = "disabled"; }; &dcpext0_mbox { power-domains = <&ps_dispext0_fe>; - status = "disabled"; }; &dcpext0 { @@ -111,186 +69,16 @@ * without apple,iomfb-surfaces apple-dcp's probe fails with -EINVAL. */ apple,iomfb-surfaces = <1 1 0 0>; - status = "disabled"; -}; - -&atcphy3_mbox { - status = "disabled"; -}; - -&atcphy3_xbar { - power-domains = <&ps_atc3_usb>; - status = "disabled"; }; /* * atcphy3 apply_tunables tables (aciophy_phy_init mode 3), from this machine's ADT /arm-io/atc-phy3 * (privateartifacts/omarchy-m4-unit/adt.bin): AXI2AF converted entry by entry; every other table is * byte-identical to atc-phy0 in the ADT, so the atcphy0 values of t6040-j616s-usb3.dtsi are reused - * (AUS40CMN_SHM differs: 0x50). Only the first six (axi2af..lane1) are applied in DP mode. + * (AUS40CMN_SHM differs: 0x50). Only the first six (axi2af..lane1) are applied in DP mode; those + * are in t604x-extdisp.dtsi, as J616c has the same values. */ &atcphy3 { - /* ATC3 ADT tunable_ATC0AXI2AF (port-specific), entries */ - apple,tunable-axi2af = - <0x0 0x800000ff 0x80000025>, - <0x4 0x80ff00ff 0x80250003>, - <0x8 0x80ff00ff 0x80250003>, - <0xc 0x80ff00ff 0x80250005>, - <0x10 0x80ff00ff 0x80250003>, - <0x14 0x80ff00ff 0x80250003>, - <0x18 0x80ff00ff 0x80250003>, - <0x1c 0x80ff00ff 0x80250003>, - <0x20 0x800000ff 0x8000001e>, - <0x24 0x800000ff 0x8000004a>, - <0x28 0x80ff00ff 0x804a0006>, - <0x2c 0x80ff00ff 0x804a0006>, - <0x30 0x80ff00ff 0x804a0006>, - <0x34 0x80ff00ff 0x804a0006>, - <0x38 0x80ff00ff 0x804a0006>, - <0x3c 0x80ff00ff 0x804a0006>, - <0x40 0x800000ff 0x8000001e>, - <0x44 0x800000ff 0x8000001e>, - <0x48 0x800000ff 0x8000001e>, - <0x100 0x000000ff 0x000000ff>, - <0x108 0xffff0006 0x00100000>, - <0x304 0x3f3f0000 0x04040000>, - <0x308 0x000fffff 0x00001681>, - <0x30c 0x000fffff 0x00001680>, - <0x310 0x70000fff 0x000001e0>, - <0x314 0xf0000fff 0x800001e0>, - <0x318 0x70000fff 0x000001e0>, - <0x31c 0xf0000fff 0x800001e0>, - <0x320 0x70000fff 0x000005a0>, - <0x324 0xf0000fff 0x800005a0>, - <0x328 0x70000fff 0x000005a0>, - <0x32c 0xf0000fff 0x800005a0>, - <0x330 0x70000fff 0x000005a0>, - <0x334 0xf0000fff 0x800005a0>, - <0x338 0x70000fff 0x000005a0>, - <0x33c 0x70000fff 0x000005a0>, - <0x340 0x70000fff 0x000005a0>, - <0x344 0x70000fff 0x000005a0>, - <0x348 0x70000fff 0x000005a0>, - <0x34c 0x70000fff 0x000005a0>, - <0x350 0x70000fff 0x000005a0>, - <0x358 0xffffffff 0x0000ffff>, - <0x35c 0xffffffff 0x0000ffff>, - <0x408 0xffff0020 0x00210020>, - <0x40c 0x000fffff 0x00001681>, - <0x410 0x000fffff 0x00001680>, - <0x414 0x70000fff 0x000001e0>, - <0x418 0x70000fff 0x000001e0>, - <0x41c 0x70000fff 0x000001e0>, - <0x420 0x70000fff 0x000001e0>, - <0x424 0x70000fff 0x000005a0>, - <0x428 0x70000fff 0x000005a0>, - <0x42c 0x70000fff 0x000005a0>, - <0x430 0x70000fff 0x000005a0>, - <0x434 0x70000fff 0x000005a0>, - <0x438 0x70000fff 0x000005a0>, - <0x43c 0x70000fff 0x000005a0>, - <0x440 0x70000fff 0x000005a0>, - <0x444 0x70000fff 0x000005a0>, - <0x448 0x70000fff 0x000005a0>, - <0x44c 0x70000fff 0x000005a0>, - <0x450 0x70000fff 0x000005a0>, - <0x454 0x70000fff 0x000005a0>, - <0x948 0x07ff07ff 0x00280000>, - <0xa48 0x07ff07ff 0x00400040>, - <0xb48 0x07ff07ff 0x00b8010e>, - <0xc48 0x07ff07ff 0x00400020>, - <0xd48 0x07ff07ff 0x008a008a>, - <0x1000 0xffffffff 0x7fffffff>, - <0x4008 0x00000001 0x00000001>, - <0x400c 0x00000001 0x00000001>, - <0x4014 0x00000001 0x00000001>, - <0x4018 0x00000001 0x00000000>, - <0x401c 0x00000001 0x00000001>; - /* the remaining tables equal atc-phy0 in the ADT, except AUS40CMN_SHM (0x50) */ - apple,tunable-fabric = - <0x4 0x003f003f 0x00200020>, - <0xc 0x000000f1 0x000000a1>, - <0x10 0x0000801f 0x00000004>, - <0x18 0x003f003f 0x00200020>, - <0x20 0x000000f1 0x000000a1>, - <0x24 0x0000801f 0x00000004>, - <0x2c 0x00ff00ff 0x00960096>, - <0x34 0x000000f1 0x00000071>, - <0x38 0x0000801f 0x00000004>, - <0x40 0x0000003f 0x00000020>, - <0x48 0x0000801f 0x00000004>, - <0x50 0x007f007f 0x00450045>, - <0x58 0x0000801f 0x00000004>, - <0x60 0x0000003f 0x00000020>, - <0x68 0x0000801f 0x00000004>, - <0x70 0x00000001 0x00000001>, - <0x74 0x0000801f 0x00000004>, - <0x7c 0x007f007f 0x00400040>, - <0x80 0x000000f1 0x00000011>, - <0x84 0x00000001 0x00000001>, - <0x88 0x00000001 0x00000001>, - <0x8c 0x0000801f 0x00000004>, - <0x94 0x001f001f 0x00100010>, - <0x98 0x000000f1 0x00000011>, - <0x9c 0x0000801f 0x00000004>, - <0xa4 0x000000ff 0x000000e0>, - <0xa8 0x0000801f 0x00000004>, - <0xb0 0x0000003f 0x00000020>, - <0xb8 0x0000801f 0x00000004>, - <0xc0 0x0000003f 0x00000020>, - <0xc8 0x0000801f 0x00000004>, - <0xd0 0x001f001f 0x00100010>, - <0xd8 0x00000001 0x00000001>, - <0xdc 0x00000001 0x00000001>, - <0xe0 0x0000801f 0x00000004>, - <0xe8 0x0000000f 0x00000008>, - <0xec 0x0000801f 0x00000004>, - <0xf4 0xffffffff 0x01010101>, - <0xf8 0x0000801f 0x00000004>, - <0x100 0x00000001 0x00000001>, - <0x104 0x00000001 0x00000001>, - <0x108 0x0000801f 0x00000004>, - <0x110 0x0000801f 0x00000004>, - <0x118 0x0000801f 0x00000004>, - <0x120 0x00000001 0x00000001>, - <0x124 0x00000001 0x00000001>, - <0x128 0x0000801f 0x00000004>, - <0x130 0xffffffff 0x01010101>, - <0x134 0x0000801f 0x00000004>, - <0x13c 0x00000001 0x00000001>, - <0x140 0x00000001 0x00000001>, - <0x144 0x0000801f 0x00000004>, - <0x14c 0x00000001 0x00000001>, - <0x150 0x00000001 0x00000001>, - <0x154 0x0000801f 0x00000004>, - <0x15c 0x0000801f 0x00000004>, - <0x164 0xffffffff 0x01010101>, - <0x168 0x0000ffff 0x00000101>, - <0x16c 0x0000801f 0x00000004>, - <0x174 0x00000001 0x00000001>, - <0x178 0x00000001 0x00000001>, - <0x17c 0x0000801f 0x00000004>, - <0x184 0x00000001 0x00000001>, - <0x188 0x00000001 0x00000001>, - <0x18c 0x0000801f 0x00000004>; - apple,tunable-common-cfg = - <0x8 0x00000001 0x00000001>; - apple,tunable-axi2af-lioa = - <0x28 0x0000fe2f 0x00000000>, - <0x2c 0x00000007 0x00000000>, - <0x30 0x0000007f 0x00000000>, - <0x34 0x000000ff 0x00000000>, - <0x58 0x0000010b 0x00000000>; - apple,tunable-lane0 = - <0xd094 0x00080000 0x00080000>, - <0xd098 0x00080000 0x00080000>, - <0xd0a4 0x00800000 0x00800000>, - <0xd0a8 0x00200000 0x00200000>; - apple,tunable-lane1 = - <0x1d094 0x00080000 0x00080000>, - <0x1d098 0x00080000 0x00080000>, - <0x1d0a4 0x00800000 0x00800000>, - <0x1d0a8 0x00200000 0x00200000>; apple,tunable-aus40cmn-shm = <0xa04 0x0000007c 0x00000050>; apple,tunable-auspll = 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 fb151f79ecd5b..47995f1bc8e7b 100644 --- a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi +++ b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi @@ -24,51 +24,21 @@ /* * DISPEXT1_SYS sits on FAB7_SOC (ADT pmgr device id2 134, pmgr_aux 0x488, parent - * FAB6_SOC, off at boot), which t6040-pmgr.dtsi does not describe. m4.62 enabled + * FAB6_SOC, off at boot), which t604x-pmgr.dtsi does not describe. m4.62 enabled * DISPEXT1_SYS without it and the first DCPEXT1 register access (its DART) reset * the SoC. DISPEXT0_SYS's parent FAB2_SOC is on anyway through ATC0..2_COMMON. */ -&pmgr_aux { - ps_fab7_soc: power-controller@488 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x488 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "fab7_soc"; - power-domains = <&ps_fab6_soc>; - status = "disabled"; - }; +&ps_fab7_soc { + power-domains = <&ps_fab6_soc>; }; &ps_dispext1_sys { power-domains = <&ps_fab7_soc>, <&pmp_dispext1>; - status = "disabled"; -}; - -&ps_dispext1_fe { - status = "disabled"; }; &ps_dispext1_cpu { /* NEVER enable: ADT no_ps, as DISPEXT0_CPU (its register read resets the SoC). */ /delete-property/ apple,always-on; - status = "disabled"; -}; - -/* The per-ATC crossbars of the Type-C ports: the ATC USB domain, as atcphy3's. */ -&atcphy0_xbar { - power-domains = <&ps_atc0_usb>; - status = "disabled"; -}; - -&atcphy1_xbar { - power-domains = <&ps_atc1_usb>; - status = "disabled"; -}; - -&atcphy2_xbar { - power-domains = <&ps_atc2_usb>; - status = "disabled"; }; /* tipd switches the PHY into DP alt mode through the connector graph. */ diff --git a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp.dtsi b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp.dtsi index ef7f9afb47028..ea6f2d508e273 100644 --- a/arch/arm64/boot/dts/apple/t6040-j616s-extdisp.dtsi +++ b/arch/arm64/boot/dts/apple/t6040-j616s-extdisp.dtsi @@ -19,317 +19,6 @@ * mem-loader.dtsi). */ -/ { - pinctrl_aop: pinctrl@510824000 { - compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; - reg = <0x5 0x10824000 0x0 0x4000>; - - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&pinctrl_aop 0 0 85>; - apple,npins = <85>; - - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - , - , - ; - status = "disabled"; - }; - - dispext0_dart: iommu@3a2300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0xa2300000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext0_dart: iommu@3a2340000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0xa2340000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext0: dcp@3a2e00000 { - compatible = "apple,t6041-dcpext", "apple,dcpext"; - reg = <0x3 0xa2e00000 0x0 0x4000>, - <0x3 0xa0000000 0x0 0x4000000>, - <0x3 0xa2240000 0x0 0x10000>, - <0x3 0xa23a8000 0x0 0x4000>, - <0x3 0xa2800000 0x0 0x800000>; - reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; - mboxes = <&dcpext0_mbox>; - mbox-names = "mbox"; - iommus = <&dcpext0_dart 23>; - /* guessed: the internal DCP uses 0x20000, J700 DISPEXT0 is +0x8000 */ - apple,bw-scratch = <&pmgr_dcp 0 4 0x28000>; - /* firmware Disp_Index, the dual-pipe endpoint ID */ - apple,dcp-endpoint = <1>; - /* the only pipe that can be the primary of a two-pipe display */ - apple,typec-hybrid-first; - status = "disabled"; - - dispext0_piodma: piodma { - iommus = <&dispext0_dart 16>; - }; - }; - - dcpext0_mbox: mailbox@3a2e08000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0xa2e08000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - dispext1_dart: iommu@602300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x6 0x02300000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext1_dart: iommu@602340000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x6 0x02340000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext1: dcp@602e00000 { - compatible = "apple,t6041-dcpext", "apple,dcpext"; - reg = <0x6 0x02e00000 0x0 0x4000>, - <0x6 0x00000000 0x0 0x4000000>, - <0x6 0x02240000 0x0 0x10000>, - <0x6 0x023a8000 0x0 0x4000>, - <0x6 0x02800000 0x0 0x800000>; - reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; - mboxes = <&dcpext1_mbox>; - mbox-names = "mbox"; - iommus = <&dcpext1_dart 23>; - /* guessed, as dcpext0 */ - apple,bw-scratch = <&pmgr_dcp 0 4 0x30000>; - apple,dcp-endpoint = <2>; - status = "disabled"; - - dispext1_piodma: piodma { - iommus = <&dispext1_dart 16>; - }; - }; - - dcpext1_mbox: mailbox@602e08000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x6 0x02e08000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - /* ATC3: the HDMI converter's fixed DP PHY; no USB controller, no pipehandler. */ - atcphy3: phy@39aa90000 { - compatible = "apple,t6040-atcphy"; - reg = <0x3 0x9aa90000 0x0 0x4000>, - <0x3 0x9a800000 0x0 0x4000>, - <0x3 0x9b000000 0x0 0x30000>, - <0x3 0x9b200000 0x0 0x4000>, - <0x3 0x9b140000 0x0 0x4000>, - <0x3 0x9b0c0000 0x0 0x10000>, - <0x3 0x98000000 0x0 0x8000>, - <0x3 0x98020000 0x0 0x4000>, - <0x3 0x9b244000 0x0 0x4000>, - <0x3 0x9b250000 0x0 0x4000>; - reg-names = "bank0", "bank1", "core", "cfg", "cpu", "cpu-data", - "axi2af", "axi2af-lioa", "fabric", "common-cfg"; - #phy-cells = <1>; - power-domains = <&ps_atc3_common_dp>; - mboxes = <&atcphy3_mbox>; - mbox-names = "phy-cpu"; - nonposted-mmio; - status = "disabled"; - }; - - atcphy3_mbox: mailbox@39b148000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x9b148000 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_phymxwrap>; - status = "disabled"; - }; - - /* Display crossbars (ADT atcN-dpxbar, atc-dpxbar,t604x): no driver yet. */ - atcphy0_xbar: mux@38324c000 { - compatible = "apple,t6041-display-crossbar"; - reg = <0x3 0x8324c000 0x0 0x4000>; - #mux-control-cells = <1>; - status = "disabled"; - }; - - atcphy1_xbar: mux@38b24c000 { - compatible = "apple,t6041-display-crossbar"; - reg = <0x3 0x8b24c000 0x0 0x4000>; - #mux-control-cells = <1>; - status = "disabled"; - }; - - atcphy2_xbar: mux@39324c000 { - compatible = "apple,t6041-display-crossbar"; - reg = <0x3 0x9324c000 0x0 0x4000>; - #mux-control-cells = <1>; - status = "disabled"; - }; - - atcphy3_xbar: mux@39b24c000 { - compatible = "apple,t6041-display-crossbar"; - reg = <0x3 0x9b24c000 0x0 0x4000>; - #mux-control-cells = <1>; - status = "disabled"; - }; -}; - -/* - * PMGR domains from the ADT device table (+16 offset, +19 block; block 0 = - * pmgr_aux, block 3 = pmgr_mini; checked against the ATC0 nodes). Disabled - * so the pwrstate driver does not touch them yet: DISPEXT0/1 run the - * firmware iBoot loaded, and an always-on domain that happens to be off - * would be powered on by the driver. - */ -&pmgr_aux { - ps_dispext0_sys: power-controller@340 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x340 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext0_sys"; - status = "disabled"; - }; - - ps_dispext0_fe: power-controller@348 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x348 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext0_fe"; - power-domains = <&ps_dispext0_sys>; - status = "disabled"; - }; - - ps_dispext0_cpu: power-controller@350 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x350 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext0_cpu"; - power-domains = <&ps_dispext0_fe>; - apple,always-on; - status = "disabled"; - }; - - ps_atc3_common: power-controller@408 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x408 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_common"; - apple,always-on; - status = "disabled"; - }; - - ps_dispext1_sys: power-controller@490 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x490 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext1_sys"; - status = "disabled"; - }; - - ps_dispext1_fe: power-controller@498 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x498 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext1_fe"; - power-domains = <&ps_dispext1_sys>; - status = "disabled"; - }; - - ps_dispext1_cpu: power-controller@4a0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x4a0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "dispext1_cpu"; - power-domains = <&ps_dispext1_fe>; - apple,always-on; - status = "disabled"; - }; -}; - -&pmgr_mini { - ps_atc3_common_dp: power-controller@b8 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0xb8 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_common_dp"; - power-domains = <&ps_atc3_phymxwrap>; - status = "disabled"; - }; - - ps_atc3_usb_aon: power-controller@e0 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0xe0 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_usb_aon"; - apple,always-on; - status = "disabled"; - }; - - ps_atc3_phymxwrap: power-controller@168 { - compatible = "apple,t6041-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate"; - reg = <0x168 4>; - #power-domain-cells = <0>; - #reset-cells = <0>; - label = "atc3_phymxwrap"; - power-domains = <&ps_atc3_common>, <&ps_atc3_usb_aon>; - status = "disabled"; - }; -}; - /* * HDMI port (disabled with dcpext0): converter power SMC gP0f/gP1a (as on * the M3 Pro J514s), HPD on AOP GPIO 0x24. The converter's reset (gP10), diff --git a/arch/arm64/boot/dts/apple/t6040.dtsi b/arch/arm64/boot/dts/apple/t6040.dtsi index 8625894da6ea4..38dc7888509fd 100644 --- a/arch/arm64/boot/dts/apple/t6040.dtsi +++ b/arch/arm64/boot/dts/apple/t6040.dtsi @@ -2,2440 +2,22 @@ /* * Apple T6040 "M4 Pro" SoC * - * Unit addresses are the Apple Device Tree's /arm-io addresses plus the - * 0x2_00000000 arm-io base. The nodes sit at the root, not under a - * simple-bus: the boot loader edits several of them by path. The blocks - * known to need non-posted writes carry nonposted-mmio themselves. - * * Copyright The Asahi Linux Contributors */ -#include -#include -#include -#include -#include -#include - -/ { - #address-cells = <2>; - #size-cells = <2>; - - cpuidle: cpuidle { - compatible = "apple,t6041-cpuidle"; - status = "disabled"; - }; - - cpus { - #address-cells = <2>; - #size-cells = <0>; - - /* - * The clusters are MPIDR Aff1, which are also the L2 groups. - * capacity-dmips-mhz comes from pinned single-core throughput - * at the lowest p-state (E 1018 MHz, P 1257 MHz): E/P is 0.652 - * per MHz, so E 668 and P 1024. - */ - cpu-map { - cluster0 { - core0 { - cpu = <&cpu_e0>; - }; - core1 { - cpu = <&cpu_e1>; - }; - core2 { - cpu = <&cpu_e2>; - }; - core3 { - cpu = <&cpu_e3>; - }; - }; - - cluster1 { - core0 { - cpu = <&cpu_p00>; - }; - core1 { - cpu = <&cpu_p01>; - }; - core2 { - cpu = <&cpu_p02>; - }; - core3 { - cpu = <&cpu_p03>; - }; - core4 { - cpu = <&cpu_p04>; - }; - }; - - cluster2 { - core0 { - cpu = <&cpu_p10>; - }; - core1 { - cpu = <&cpu_p11>; - }; - core2 { - cpu = <&cpu_p12>; - }; - core3 { - cpu = <&cpu_p13>; - }; - core4 { - cpu = <&cpu_p14>; - }; - }; - }; - - cpu_e0: cpu@0 { - compatible = "apple,brava-e"; - device_type = "cpu"; - reg = <0x0 0x0>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_e>; - operating-points-v2 = <&opp_e>; - capacity-dmips-mhz = <668>; - performance-domains = <&cpufreq_e>; - #cooling-cells = <2>; - }; - - cpu_e1: cpu@1 { - compatible = "apple,brava-e"; - device_type = "cpu"; - reg = <0x0 0x1>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_e>; - operating-points-v2 = <&opp_e>; - capacity-dmips-mhz = <668>; - performance-domains = <&cpufreq_e>; - #cooling-cells = <2>; - }; - - cpu_e2: cpu@2 { - compatible = "apple,brava-e"; - device_type = "cpu"; - reg = <0x0 0x2>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_e>; - operating-points-v2 = <&opp_e>; - capacity-dmips-mhz = <668>; - performance-domains = <&cpufreq_e>; - #cooling-cells = <2>; - }; - - cpu_e3: cpu@3 { - compatible = "apple,brava-e"; - device_type = "cpu"; - reg = <0x0 0x3>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_e>; - operating-points-v2 = <&opp_e>; - capacity-dmips-mhz = <668>; - performance-domains = <&cpufreq_e>; - #cooling-cells = <2>; - }; - - /* The boot CPU: the boot loader enters the kernel on it. */ - cpu_p00: cpu@10100 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10100>; - next-level-cache = <&l2_cache_p0>; - operating-points-v2 = <&opp_p0>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p0>; - #cooling-cells = <2>; - }; - - cpu_p01: cpu@10101 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10101>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p0>; - operating-points-v2 = <&opp_p0>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p0>; - #cooling-cells = <2>; - }; - - cpu_p02: cpu@10102 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10102>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p0>; - operating-points-v2 = <&opp_p0>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p0>; - #cooling-cells = <2>; - }; - - cpu_p03: cpu@10103 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10103>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p0>; - operating-points-v2 = <&opp_p0>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p0>; - #cooling-cells = <2>; - }; - - cpu_p04: cpu@10104 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10104>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p0>; - operating-points-v2 = <&opp_p0>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p0>; - #cooling-cells = <2>; - }; - - cpu_p10: cpu@10200 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10200>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p1>; - operating-points-v2 = <&opp_p1>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p1>; - #cooling-cells = <2>; - }; - - cpu_p11: cpu@10201 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10201>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p1>; - operating-points-v2 = <&opp_p1>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p1>; - #cooling-cells = <2>; - }; - - cpu_p12: cpu@10202 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10202>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p1>; - operating-points-v2 = <&opp_p1>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p1>; - #cooling-cells = <2>; - }; - - cpu_p13: cpu@10203 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10203>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p1>; - operating-points-v2 = <&opp_p1>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p1>; - #cooling-cells = <2>; - }; - - cpu_p14: cpu@10204 { - compatible = "apple,brava-p"; - device_type = "cpu"; - reg = <0x0 0x10204>; - enable-method = "spin-table"; - cpu-release-addr = <0 0>; /* To be filled by loader */ - next-level-cache = <&l2_cache_p1>; - operating-points-v2 = <&opp_p1>; - capacity-dmips-mhz = <1024>; - performance-domains = <&cpufreq_p1>; - #cooling-cells = <2>; - }; - }; - - l2_cache_e: l2-cache-cluster0 { - compatible = "cache"; - cache-level = <2>; - cache-unified; - cache-size = <0x400000>; - }; - - l2_cache_p0: l2-cache-cluster1 { - compatible = "cache"; - cache-level = <2>; - cache-unified; - cache-size = <0x1000000>; - }; - - l2_cache_p1: l2-cache-cluster2 { - compatible = "cache"; - cache-level = <2>; - cache-unified; - cache-size = <0x1000000>; - }; - - /* - * DVFS states from the ADT: /arm-io/pmgr voltage-states1-sram (E), - * voltage-states5-sram (P0) and voltage-states13-sram (P1), word 0 - * in kHz. opp-level is the hardware p-state. Each P cluster has its - * own table even though the frequencies are the same: opp-shared - * means one clock domain per table. - * - * opp-microwatt is the power of one busy core, measured on a J616s - * from the SMC core-rail meters (P0 PR0b, P1 PP0b, E PP2b) with the - * cluster pinned at each state. The P values follow a k * V^2 * f + c - * fit to the sweep, because the PMP's die-temperature limit clips the - * two top states within seconds. One busy E core does not register on - * its meter below 2352 MHz, so the E values are the idle cluster plus - * a quarter of the four-core increase. - */ - opp_e: opp-table-e { - compatible = "operating-points-v2"; - opp-shared; - - opp01 { - opp-hz = /bits/ 64 <1020000000>; - opp-level = <1>; - opp-microwatt = <81900>; - }; - opp02 { - opp-hz = /bits/ 64 <1404000000>; - opp-level = <2>; - opp-microwatt = <133100>; - }; - opp03 { - opp-hz = /bits/ 64 <1788000000>; - opp-level = <3>; - opp-microwatt = <209400>; - }; - opp04 { - opp-hz = /bits/ 64 <2112000000>; - opp-level = <4>; - opp-microwatt = <301400>; - }; - opp05 { - opp-hz = /bits/ 64 <2352000000>; - opp-level = <5>; - opp-microwatt = <383900>; - }; - opp06 { - opp-hz = /bits/ 64 <2532000000>; - opp-level = <6>; - opp-microwatt = <478500>; - }; - opp07 { - opp-hz = /bits/ 64 <2592000000>; - opp-level = <7>; - opp-microwatt = <531000>; - }; - }; - - opp_p0: opp-table-p0 { - compatible = "operating-points-v2"; - opp-shared; - - opp01 { - opp-hz = /bits/ 64 <1260000000>; - opp-level = <1>; - opp-microwatt = <513000>; - }; - opp02 { - opp-hz = /bits/ 64 <1512000000>; - opp-level = <2>; - opp-microwatt = <715000>; - }; - opp03 { - opp-hz = /bits/ 64 <1800000000>; - opp-level = <3>; - opp-microwatt = <907500>; - }; - opp04 { - opp-hz = /bits/ 64 <2088000000>; - opp-level = <4>; - opp-microwatt = <1158200>; - }; - opp05 { - opp-hz = /bits/ 64 <2352000000>; - opp-level = <5>; - opp-microwatt = <1494500>; - }; - opp06 { - opp-hz = /bits/ 64 <2616000000>; - opp-level = <6>; - opp-microwatt = <1782600>; - }; - opp07 { - opp-hz = /bits/ 64 <2868000000>; - opp-level = <7>; - opp-microwatt = <2209600>; - }; - opp08 { - opp-hz = /bits/ 64 <3096000000>; - opp-level = <8>; - opp-microwatt = <2636700>; - }; - opp09 { - opp-hz = /bits/ 64 <3300000000>; - opp-level = <9>; - opp-microwatt = <3247200>; - }; - opp10 { - opp-hz = /bits/ 64 <3468000000>; - opp-level = <10>; - opp-microwatt = <3668700>; - }; - opp11 { - opp-hz = /bits/ 64 <3624000000>; - opp-level = <11>; - opp-microwatt = <4128200>; - }; - opp12 { - opp-hz = /bits/ 64 <3756000000>; - opp-level = <12>; - opp-microwatt = <4819300>; - }; - opp13 { - opp-hz = /bits/ 64 <3852000000>; - opp-level = <13>; - opp-microwatt = <4977700>; - }; - opp14 { - opp-hz = /bits/ 64 <3924000000>; - opp-level = <14>; - opp-microwatt = <5315900>; - }; - opp15 { - opp-hz = /bits/ 64 <3996000000>; - opp-level = <15>; - opp-microwatt = <5575900>; - }; - opp16 { - opp-hz = /bits/ 64 <4044000000>; - opp-level = <16>; - opp-microwatt = <5773400>; - }; - opp17 { - opp-hz = /bits/ 64 <4104000000>; - opp-level = <17>; - opp-microwatt = <5969200>; - }; - opp18 { - opp-hz = /bits/ 64 <4416000000>; - opp-level = <18>; - opp-microwatt = <8274900>; - }; - opp19 { - opp-hz = /bits/ 64 <4512000000>; - opp-level = <19>; - opp-microwatt = <9256900>; - }; - }; - - opp_p1: opp-table-p1 { - compatible = "operating-points-v2"; - opp-shared; - - opp01 { - opp-hz = /bits/ 64 <1260000000>; - opp-level = <1>; - opp-microwatt = <561800>; - }; - opp02 { - opp-hz = /bits/ 64 <1512000000>; - opp-level = <2>; - opp-microwatt = <772500>; - }; - opp03 { - opp-hz = /bits/ 64 <1800000000>; - opp-level = <3>; - opp-microwatt = <988900>; - }; - opp04 { - opp-hz = /bits/ 64 <2088000000>; - opp-level = <4>; - opp-microwatt = <1302300>; - }; - opp05 { - opp-hz = /bits/ 64 <2352000000>; - opp-level = <5>; - opp-microwatt = <1644100>; - }; - opp06 { - opp-hz = /bits/ 64 <2616000000>; - opp-level = <6>; - opp-microwatt = <2003700>; - }; - opp07 { - opp-hz = /bits/ 64 <2868000000>; - opp-level = <7>; - opp-microwatt = <2349000>; - }; - opp08 { - opp-hz = /bits/ 64 <3096000000>; - opp-level = <8>; - opp-microwatt = <2723000>; - }; - opp09 { - opp-hz = /bits/ 64 <3300000000>; - opp-level = <9>; - opp-microwatt = <3333200>; - }; - opp10 { - opp-hz = /bits/ 64 <3468000000>; - opp-level = <10>; - opp-microwatt = <3711900>; - }; - opp11 { - opp-hz = /bits/ 64 <3624000000>; - opp-level = <11>; - opp-microwatt = <4129900>; - }; - opp12 { - opp-hz = /bits/ 64 <3756000000>; - opp-level = <12>; - opp-microwatt = <4666300>; - }; - opp13 { - opp-hz = /bits/ 64 <3852000000>; - opp-level = <13>; - opp-microwatt = <4881000>; - }; - opp14 { - opp-hz = /bits/ 64 <3924000000>; - opp-level = <14>; - opp-microwatt = <5176700>; - }; - opp15 { - opp-hz = /bits/ 64 <3996000000>; - opp-level = <15>; - opp-microwatt = <5306500>; - }; - opp16 { - opp-hz = /bits/ 64 <4044000000>; - opp-level = <16>; - opp-microwatt = <5618900>; - }; - opp17 { - opp-hz = /bits/ 64 <4104000000>; - opp-level = <17>; - opp-microwatt = <5843100>; - }; - opp18 { - opp-hz = /bits/ 64 <4416000000>; - opp-level = <18>; - opp-microwatt = <8075300>; - }; - opp19 { - opp-hz = /bits/ 64 <4512000000>; - opp-level = <19>; - opp-microwatt = <8949200>; - }; - }; - - timer { - compatible = "arm,armv8-timer"; - interrupt-parent = <&aic>; - interrupt-names = "phys", "virt", "hyp-phys", "hyp-virt"; - interrupts = , - , - , - ; - }; - - pmu { - compatible = "apple,t6040-pmu"; - interrupt-parent = <&aic>; - /* The AIC raises both clusters' PMU FIQs as this one. */ - interrupts = ; - }; - - /* The 24 MHz reference clock (ADT clock-ids 4) of the I2C, PWM and watchdog blocks */ - clkref: clock-ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <24000000>; - clock-output-names = "clkref"; - }; - - /* - * Display component master. It has no registers; the boot loader - * enables it with the DCP when it hands the display over. - */ - display: display-subsystem { - compatible = "apple,display-subsystem"; - iommus = <&disp0_dart 0>; - status = "disabled"; - }; - - cpufreq_e: cpufreq@210e20000 { - compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; - reg = <0x2 0x10e20000 0x0 0x1000>; - nonposted-mmio; - #performance-domain-cells = <0>; - /* PMP fast die-temperature effort, byte 0 of FAST-DIE-CE */ - apple,fast-die-effort = <&pmp_report 0>; - }; - - cpufreq_p0: cpufreq@211e20000 { - compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; - reg = <0x2 0x11e20000 0x0 0x1000>; - nonposted-mmio; - #performance-domain-cells = <0>; - apple,fast-die-effort = <&pmp_report 1>; - }; - - cpufreq_p1: cpufreq@212e20000 { - compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; - reg = <0x2 0x12e20000 0x0 0x1000>; - nonposted-mmio; - #performance-domain-cells = <0>; - apple,fast-die-effort = <&pmp_report 2>; - }; - - /* - * System level cache planes: four AMCCs with four planes each. - * Allocation waits for the display, which takes over the scan-out DMA - * the boot loader left running. - */ - mcc: memory-controller@220000000 { - compatible = "apple,t6041-mcc", "apple,t8140-mcc"; - reg = <0x2 0x20000000 0x0 0x4000>, - <0x2 0x20040000 0x0 0x4000>, - <0x2 0x20080000 0x0 0x4000>, - <0x2 0x200c0000 0x0 0x4000>, - <0x2 0x22000000 0x0 0x4000>, - <0x2 0x22040000 0x0 0x4000>, - <0x2 0x22080000 0x0 0x4000>, - <0x2 0x220c0000 0x0 0x4000>, - <0x2 0x24000000 0x0 0x4000>, - <0x2 0x24040000 0x0 0x4000>, - <0x2 0x24080000 0x0 0x4000>, - <0x2 0x240c0000 0x0 0x4000>, - <0x2 0x26000000 0x0 0x4000>, - <0x2 0x26040000 0x0 0x4000>, - <0x2 0x26080000 0x0 0x4000>, - <0x2 0x260c0000 0x0 0x4000>; - nonposted-mmio; - apple,boot-dma-devices = <&display>; - status = "disabled"; - }; - - /* - * The decoder firmware programs the T8122/T8132 register family, so - * the driver binds through its T8132 entry. The ADT gives the whole - * block (0x2_80000000, 0x1404000); the windows follow the T6030/T8140 - * layout, with the CM3 SRAM between its code and the mailbox. - */ - avd: avd@280000000 { - compatible = "apple,t6041-avd", "apple,t8132-avd"; - reg = <0x2 0x81080000 0x0 0x14000>, - <0x2 0x81094000 0x0 0x14000>, - <0x2 0x810a8000 0x0 0x4000>, - <0x2 0x81100000 0x0 0x10000>; - reg-names = "code", "sram", "mbox", "ctrl"; - interrupt-parent = <&aic>; - interrupts = , - ; - power-domains = <&ps_avd_sys>, <&pmc_soc_max>; - power-domain-names = "core", "perf"; - resets = <&ps_avd_sys>; - iommus = <&avd_dart 0>; - }; - - avd_dart: iommu@281020000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x2 0x81020000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_avd_sys>; - }; - - /* Named after its sgx range: the coprocessor range is the mailbox node's too. */ - gpu: gpu@288000000 { - compatible = "apple,agx-t6040"; - reg = <0x2 0x8a600000 0x0 0x88000>, - <0x2 0x88000000 0x0 0x3758000>; - reg-names = "asc", "sgx"; - mboxes = <&gfx_mbox>; - power-domains = <&pmp_gfx>; - apple,clpc = <&clpc>; - status = "disabled"; - }; - - pmgr_gfx: power-management@288e80000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x2 0x88e80000 0x0 0x4000>; - /* child nodes are added in t6040-pmgr.dtsi */ - }; - - gfx_mbox: mailbox@28a600000 { - compatible = "apple,t6040-ascwrap-v6"; - reg = <0x2 0x8a600000 0x0 0x88000>, - <0x2 0x8a050000 0x0 0x8>; - reg-names = "wrapper", "iop-vbar"; - interrupt-parent = <&aic>; - interrupts = , - ; - interrupt-names = "send-empty", "recv-not-empty"; - apple,firmware-role = "GFX"; - power-domains = <&ps_gfx>; - #mbox-cells = <0>; - status = "disabled"; - }; - - disp0_dart: iommu@402300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x02300000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcp_dart: iommu@402340000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x02340000 0x0 0x20000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcp: dcp@402e00000 { - compatible = "apple,t6041-dcp", "apple,dcp"; - reg = <0x4 0x02e00000 0x0 0x4000>, - <0x4 0x00000000 0x0 0x4000000>, - <0x4 0x02240000 0x0 0x10000>, - <0x4 0x023a8000 0x0 0x4000>, - <0x4 0x02800000 0x0 0x800000>; - reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; - mboxes = <&dcp_mbox>; - mbox-names = "mbox"; - iommus = <&dcp_dart 23>; - apple,bw-scratch = <&pmgr_dcp 0 4 0x20000>; - apple,iomfb-surfaces = <1 1 0 0>; - /* the boot loader describes the piodma's regions with 2+2 cells */ - #address-cells = <2>; - #size-cells = <2>; - /* enabled once the boot loader has handed the display over */ - status = "disabled"; - - disp0_piodma: piodma { - iommus = <&disp0_dart 16>; - }; - }; - - dcp_mbox: mailbox@402e08000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x4 0x02e08000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - /* - * iBoot hands over a running SEP. Keep Linux off its DART at boot; - * apple_sep enables it when the driver binds. The SEP only accepts - * IOVAs in the window iBoot programmed (ADT vm-base 0x10000004000, - * vm-size 0x3ff00000), which carries the BIT(40) alias the DART - * translates. - */ - sep_dart: iommu@404c80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x04c80000 0x0 0x20000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - apple,dma-range = /bits/ 64 <0x10000004000 0x3ff00000>; - apple,dma-offset = /bits/ 64 <0x0>; - status = "disabled"; - }; - - sep: sep@406600000 { - compatible = "apple,sep"; - reg = <0x4 0x06600000 0x0 0x88000>; - mboxes = <&sep_mbox>; - mbox-names = "mbox"; - iommus = <&sep_dart 0>; - power-domains = <&ps_sep>; - status = "disabled"; - }; - - sep_mbox: mailbox@406608000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x4 0x06608000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - ans_mbox: mailbox@409608000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x4 0x09608000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - power-domains = <&ps_ans>; - #mbox-cells = <0>; - status = "disabled"; - }; - - ans_sart: sart@40dc50000 { - compatible = "apple,t6041-sart", "apple,t6000-sart"; - reg = <0x4 0x0dc50000 0x0 0xc000>; - power-domains = <&ps_ans>; - status = "disabled"; - }; - - pcie_dart: iommu@410000000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x10000000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - /* iBoot leaves the I2C gates on and the pins muxed to I2C. */ - i2c1: i2c@429014000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x29014000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c1_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c1>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c2: i2c@429018000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x29018000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c2_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c2>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c3: i2c@42901c000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x2901c000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c3_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c3>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c4: i2c@429020000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x29020000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c4>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c6: i2c@429028000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x29028000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c6_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c6>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c8: i2c@429030000 { - compatible = "apple,t6041-i2c", "apple,t8103-i2c"; - reg = <0x4 0x29030000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - pinctrl-0 = <&i2c8_pins>; - pinctrl-names = "default"; - power-domains = <&ps_i2c8>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - fpwm0: pwm@429040000 { - compatible = "apple,t6041-fpwm", "apple,s5l-fpwm"; - reg = <0x4 0x29040000 0x0 0x4000>; - clocks = <&clkref>; - power-domains = <&ps_fpwm0>; - #pwm-cells = <2>; - status = "disabled"; - }; - - /* - * Touch ID. iBoot leaves the pads muxed and the controller uses its - * native chip select, so there is no pinctrl here. - */ - spi2: spi@429108000 { - compatible = "apple,t6041-spi", "apple,t8103-spi"; - reg = <0x4 0x29108000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - clocks = <&clkref>; - power-domains = <&ps_spi2>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - - mesa: fingerprint@0 { - compatible = "apple,mesa-fingerprint"; - reg = <0>; - spi-max-frequency = <8000000>; - spi-cpol; - status = "disabled"; - }; - }; - - nvme: nvme@44dcc0000 { - compatible = "apple,t6041-nvme-ans2"; - reg = <0x4 0x4dcc0000 0x0 0x10000>, - <0x4 0x09600000 0x0 0x4000>, - <0x4 0x0dcc0000 0x0 0x60000>; - reg-names = "nvme", "ans", "nvmmu"; - interrupt-parent = <&aic>; - interrupts = ; - mboxes = <&ans_mbox>; - apple,sart = <&ans_sart>; - power-domains = <&ps_ans>, <&ps_apcie_sys_st0>, - <&ps_apcie_sys_st1>; - power-domain-names = "ans", "apcie0", "apcie1"; - resets = <&ps_ans>; - status = "disabled"; - }; - - /* - * PMP (power management coprocessor). iBoot locks its DART (PROTECT - * 0x1e7, SIDs 0 and 1 translating): apple-dart adopts iBoot's SID 0 - * table and leaves SID 1 alone. apple,dma-range keeps Linux's IOVAs - * in the ADT window (vm-base 0x100_0000_0000, 64 GiB). The DART's - * second ADT range is the SoC's shared clock-protection block, not - * part of the DART. - */ - pmp_dart: iommu@500300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x00300000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - power-domains = <&ps_pmp>; - status = "disabled"; - }; - - /* - * Report (PTD) region: reads 16 bytes per entry at +0x0, writes 8 - * bytes per entry at +0x10000. Entries are PMP soc-devices; every - * entry reads 0 while the PMP is stopped. - */ - pmp_report: pmp-report@5003c0000 { - compatible = "apple,t6041-pmp-v2-report"; - reg = <0x5 0x003c0000 0x0 0x20000>; - nonposted-mmio; - power-domains = <&ps_pms_sram>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - - /* The CPU clusters, for their fast die-temperature loops */ - report@a { - compatible = "apple,t6041-pmp-v2-report-entry", - "apple,t6000-pmp-v2-report-entry"; - reg = <0xa>; - label = "pmp-eacc0"; - #power-domain-cells = <0>; - apple,always-on; - }; - - report@b { - compatible = "apple,t6041-pmp-v2-report-entry", - "apple,t6000-pmp-v2-report-entry"; - reg = <0xb>; - label = "pmp-pacc0"; - #power-domain-cells = <0>; - apple,always-on; - }; - - report@c { - compatible = "apple,t6041-pmp-v2-report-entry", - "apple,t6000-pmp-v2-report-entry"; - reg = <0xc>; - label = "pmp-pacc1"; - #power-domain-cells = <0>; - apple,always-on; - }; - - /* - * The GPU (soc-device 13). Without it the running PMP treats - * the GPU as off and holds it at its lowest state, but claiming - * it while nothing powers the GPU crashes the PMP firmware - * (SError) right after it starts. It sits on the GPU's own - * power state. The GPU consumer takes this domain, so the request - * follows the GFX domain's power lifetime. - */ - pmp_gfx: report@d { - compatible = "apple,t6041-pmp-v2-report-entry", - "apple,t6000-pmp-v2-report-entry"; - reg = <0xd>; - label = "pmp-gfx"; - #power-domain-cells = <0>; - power-domains = <&ps_gfx>; - }; - }; - - /* - * The boot loader adds the per-unit properties (board, DRAM) and the - * firmware tunables the driver needs before it starts the PMP. - */ - pmp: pmp@500700000 { - compatible = "apple,t6041-pmp-v2", "apple,t6000-pmp-v2"; - reg = <0x5 0x00700000 0x0 0xe0000>, - <0x5 0x00e00000 0x0 0x4000>; - reg-names = "pmp", "asc"; - mboxes = <&pmp_mbox>; - mbox-names = "mbox"; - iommus = <&pmp_dart 0>; - power-domains = <&ps_pmp>; - apple,pmc = <1>; - apple,pmc-pmgr = <0x3f>; - status = "disabled"; - }; - - pmp_mbox: mailbox@500e08000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x5 0x00e08000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - power-domains = <&ps_pmp>, <&ps_pms_sram>; - #mbox-cells = <0>; - status = "disabled"; - }; - - pmgr: power-management@502280000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x5 0x02280000 0x0 0x4000>; - /* child nodes are added in t6040-pmgr.dtsi */ - }; - - pmgr_ane: power-management@50228c000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - reg = <0x5 0x0228c000 0x0 0x4000>; - #address-cells = <1>; - #size-cells = <1>; - }; - - pmgr_disp: power-management@502290000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - reg = <0x5 0x02290000 0x0 0x4000>; - #address-cells = <1>; - #size-cells = <1>; - }; - - pmgr_venc: power-management@502808000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - reg = <0x5 0x02808000 0x0 0x4000>; - #address-cells = <1>; - #size-cells = <1>; - }; - - pmgr_isp: power-management@502284000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x5 0x02284000 0x0 0x4000>; - /* child nodes are added in t6040-pmgr.dtsi */ - }; - - aic: interrupt-controller@502400000 { - compatible = "apple,t6041-aic3", "apple,t8122-aic3"; - #interrupt-cells = <3>; - interrupt-controller; - reg = <0x5 0x02400000 0x0 0x184000>, - <0x5 0x02440000 0x0 0x4>; - reg-names = "core", "event"; - }; - - pmgr_aux: power-management@502800000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x5 0x02800000 0x0 0x4000>; - /* child nodes are added in t6040-pmgr.dtsi */ - }; - - /* - * The PMGR range the DCP driver hands to its firmware; apple,bw-scratch - * points into it. - */ - pmgr_dcp: power-management@504800000 { - reg = <0x5 0x04800000 0x0 0xbc000>; - reg-names = "dcp-fw-pmgr"; - #apple,bw-scratch-cells = <3>; - }; - - /* - * PMC voter interface: the floor word of agent a at "voters" + - * 0x4000 * a, the floors the PMC honours and the rail enable words - * at "rails". Both lie inside pmgr_dcp's range, which the DCP driver - * only hands to its firmware, so the two do not conflict; "rails" - * comes first so that this node's unit address differs from - * pmgr_dcp's. - * Static voters are the PMP (0), CLPC (1) and AP (3). The PMP votes - * the DCS and fabric for memory clients other than the CPUs, the GPU - * among them; without its agent, GPU work runs at a low DCS - * state unless a CPU is busy. iBoot leaves the PMP's floor at the top - * DCS state, so its agent must stay off while the PMP does not run: - * apple,pmp holds off the PMC until the PMP driver has bound, and - * unbinds the PMC first. - */ - pmc: power-management@5048aa000 { - compatible = "apple,t6041-pmc"; - reg = <0x5 0x048aa000 0x0 0x3000>, - <0x5 0x04800000 0x0 0x10000>; - reg-names = "rails", "voters"; - nonposted-mmio; - #address-cells = <1>; - #size-cells = <0>; - apple,pmp = <&pmp>; - apple,static-voters = <0 1 3>; - status = "disabled"; - - clpc: performance-controller@1 { - compatible = "apple,t6041-clpc"; - reg = <1>; - - }; - - /* - * The SoC rail at its highest state. The video encoder runs on - * the fabric clock and encodes at less than half speed below it. - */ - pmc_soc_max: floor-soc-max { - label = "soc-max"; - #power-domain-cells = <0>; - apple,rail = <1>; - apple,level = <2>; - }; - }; - - /* - * The always-on GPIO bank (ADT /arm-io/nub-gpio0, 61 pins). Its power - * state is in the always-on PMGR. - */ - pinctrl_nub: pinctrl@5081e4000 { - compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; - reg = <0x5 0x081e4000 0x0 0x4000>; - power-domains = <&ps_nub_gpio>; - - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&pinctrl_nub 0 0 61>; - apple,npins = <61>; - - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - , - , - ; - status = "disabled"; - }; - - pmgr_mini: power-management@508300000 { - compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x5 0x08300000 0x0 0x4000>; - /* child nodes are added in t6040-pmgr.dtsi */ - }; - - /* - * The driver arms the reset only when userspace opens /dev/watchdog - * or the firmware left it running; it also provides restart. - */ - wdt: watchdog@50836c000 { - compatible = "apple,t6041-wdt", "apple,t8103-wdt"; - reg = <0x5 0x0836c000 0x0 0x4000>; - clocks = <&clkref>; - interrupt-parent = <&aic>; - interrupts = ; - }; - - nub_spmi0: spmi@509014000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09014000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - #interrupt-cells = <2>; - interrupt-controller; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - - pmic@e { - compatible = "apple,abbey-pmic", "apple,spmi-nvmem"; - reg = <0xe SPMI_USID>; - - pmu_rtc: rtc { - compatible = "apple,t6041-pmu-rtc"; - interrupt-parent = <&nub_spmi0>; - interrupts = <2 IRQ_TYPE_EDGE_RISING>; - nvmem-cells = <&rtc_offset>; - nvmem-cell-names = "rtc_offset"; - wakeup-source; - }; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - rtc_offset: rtc-offset@2100 { - reg = <0x2100 0x6>; - }; - - boot_stage: boot-stage@f801 { - reg = <0xf801 0x1>; - }; - - boot_error_count: boot-error-count@f802,0 { - reg = <0xf802 0x1>; - bits = <0 4>; - }; - - panic_count: panic-count@f802,4 { - reg = <0xf802 0x1>; - bits = <4 4>; - }; - - shutdown_flag: shutdown-flag@f80f,3 { - reg = <0xf80f 0x1>; - bits = <3 1>; - }; - }; - }; - }; - - smc: smc@50c600000 { - compatible = "apple,t6041-smc", "apple,t8103-smc"; - reg = <0x5 0x0c600000 0x0 0x4000>, - <0x5 0x0de70000 0x0 0x100000>; - reg-names = "smc", "sram"; - mboxes = <&smc_mbox>; - status = "disabled"; - - smc_gpio: gpio { - compatible = "apple,smc-gpio"; - gpio-controller; - #gpio-cells = <2>; - }; - - smc_hwmon: hwmon { - compatible = "apple,smc-hwmon"; - #thermal-sensor-cells = <1>; - }; - - smc_reboot: reboot { - compatible = "apple,smc-reboot"; - nvmem-cells = <&shutdown_flag>, <&boot_stage>, - <&boot_error_count>, <&panic_count>; - nvmem-cell-names = "shutdown_flag", "boot_stage", - "boot_error_count", "panic_count"; - }; - - smc_rtc: rtc { - compatible = "apple,smc-rtc"; - nvmem-cells = <&rtc_offset>; - nvmem-cell-names = "rtc_offset"; - }; - }; - - smc_mbox: mailbox@50c608000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x5 0x0c608000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - /* - * AOP (always-on processor). The boot loader loads its RTKit firmware - * and leaves it stopped; Linux starts it. - */ - aop: aop@510600000 { - compatible = "apple,t6041-aop"; - reg = <0x5 0x10c10000 0x0 0x2e0000>, - <0x5 0x10600000 0x0 0x88000>, - <0x5 0x10050000 0x0 0x4000>, - <0x5 0x08328000 0x0 0x24>; - reg-names = "firmware", "asc", "asc-aux", "config"; - mboxes = <&aop_mbox>; - mbox-names = "mbox"; - iommus = <&aop_dart 0>; - status = "disabled"; - - /* - * "dma" is the microphones' LEAP ADMAC channel; "spkr" and - * "sense" are the speaker stream's base-ns ADMAC channels 0 and - * 1 (ADT audio-speaker dma-channels), "cout" and "cin" the - * headphone jack's channels 4 and 5 (TX2 and RX2, ADT - * audio-codec-output and audio-codec-input). - */ - aop_audio: audio { - compatible = "apple,t6041-aop-audio", "apple,t6030-aop-audio"; - dmas = <&admac0 1>, <&admac1 0>, <&admac1 1>, <&admac1 4>, - <&admac1 5>; - dma-names = "dma", "spkr", "sense", "cout", "cin"; - #sound-dai-cells = <1>; - }; - - aop_als: als { - compatible = "apple,t6041-aop-als", "apple,aop-als"; - }; - - aop_las: las { - compatible = "apple,t6041-aop-las", "apple,aop-las"; - }; - - /* The calibration properties come from the bootloader. */ - aop_accel: accel { - compatible = "apple,t6041-aop-accel", "apple,aop-accel"; - }; - - aop_gyro: gyro { - compatible = "apple,t6041-aop-gyro", "apple,aop-gyro"; - }; - }; - - /* ADT lists the interrupts as 1, 0, 3, 2 of the block: send-empty is the lowest. */ - aop_mbox: mailbox@510608000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x5 0x10608000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - aop_dart: iommu@510f00000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x10f00000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - /* The audio fabric's ADMACs: admac-leap-ns (DART stream 10) and admac-base-ns (stream 8) */ - admac0: dma-controller@513300000 { - compatible = "apple,t6041-admac", "apple,t8132-admac"; - reg = <0x5 0x13300000 0x0 0x34000>; - #dma-cells = <1>; - dma-channels = <18>; - /* the ADT gives the first of the four outputs */ - interrupts-extended = <&aic AIC_IRQ 757 IRQ_TYPE_LEVEL_HIGH>, - <0>, <0>, <0>; - iommus = <&aop_dart 10>; - status = "disabled"; - }; - - admac1: dma-controller@513800000 { - compatible = "apple,t6041-admac", "apple,t8132-admac"; - reg = <0x5 0x13800000 0x0 0x34000>; - #dma-cells = <1>; - dma-channels = <13>; - /* the ADT gives the first of the four outputs */ - interrupts-extended = <&aic AIC_IRQ 754 IRQ_TYPE_LEVEL_HIGH>, - <0>, <0>, <0>; - iommus = <&aop_dart 8>; - status = "disabled"; - }; - - mtp: mtp@514600000 { - compatible = "apple,t6041-mtp", "apple,t6041-rtk-helper-asc4", - "apple,mtp", "apple,rtk-helper-asc4"; - reg = <0x5 0x14600000 0x0 0x4000>; - reg-names = "asc"; - mboxes = <&mtp_mbox>; - iommus = <&mtp_dart 0>; - #helper-cells = <0>; - status = "disabled"; - }; - - mtp_mbox: mailbox@514608000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x5 0x14608000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - status = "disabled"; - }; - - mtp_dart: iommu@514800000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x14800000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - /* ADT "remap": streams 1 2 3 are stream 0 */ - apple,remap-streams = <1 0>, <2 0>, <3 0>; - status = "disabled"; - }; - - mtp_dockchannel: fifo@514b14000 { - compatible = "apple,t6041-dockchannel", "apple,dockchannel"; - reg = <0x5 0x14b14000 0x0 0x1000>; - reg-names = "irq"; - interrupt-parent = <&aic>; - interrupts = ; - - ranges = <0x0 0x5 0x14b28000 0x10000>; - nonposted-mmio; - #address-cells = <1>; - #size-cells = <1>; - - interrupt-controller; - #interrupt-cells = <2>; - status = "disabled"; - - mtp_hid: input@0 { - compatible = "apple,t6041-dockchannel-hid", "apple,dockchannel-hid"; - reg = <0x0000 0x1000>, - <0x4000 0x1000>, - <0x8000 0x1000>, - <0xc000 0x1000>; - reg-names = "rmt-config", "rmt-data", "config", "data"; - iommus = <&mtp_dart 0>; - interrupt-parent = <&mtp_dockchannel>; - interrupts = <2 IRQ_TYPE_LEVEL_HIGH>, - <3 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "tx", "rx"; - apple,fifo-size = <0x800>; - apple,helper-cpu = <&mtp>; - }; - }; - - pinctrl: pinctrl@51c000000 { - compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; - reg = <0x5 0x1c000000 0x0 0x4000>; - - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&pinctrl 0 0 200>; - apple,npins = <200>; - - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - , - , - ; - status = "disabled"; - - /* I2C is function 1 (ADT gpio-iic_scl/sda) */ - i2c1_pins: i2c1-pins { - pinmux = , - ; - }; - - i2c2_pins: i2c2-pins { - pinmux = , - ; - }; - - i2c3_pins: i2c3-pins { - pinmux = , - ; - }; - - i2c4_pins: i2c4-pins { - pinmux = , - ; - }; - - i2c6_pins: i2c6-pins { - pinmux = , - ; - }; - - i2c8_pins: i2c8-pins { - pinmux = , - ; - }; - }; - - /* - * ISP (ADT isp0, firmware loaded by iBoot). "coproc" is the - * coprocessor up to its control block; "mbox", "gpio" and "mbox2" are - * the interrupt words, the firmware handshake words and the doorbell - * of its mailbox at +0x2924000. The first of the ADT's four - * interrupts carries the mailbox. - */ - isp: isp@580000000 { - compatible = "apple,t6041-isp", "apple,isp"; - reg = <0x5 0x80000000 0x0 0x1604000>, - <0x5 0x82924000 0x0 0x40>, - <0x5 0x829241d0 0x0 0x20>, - <0x5 0x82924464 0x0 0x10>; - reg-names = "coproc", "mbox", "gpio", "mbox2"; - interrupt-parent = <&aic>; - interrupts = ; - iommus = <&isp_dart0 0>, <&isp_dart1 0>, <&isp_dart2 0>; - power-domains = <&ps_isp_sys>, <&ps_isp_cpu>, <&ps_isp_fe>, - <&ps_isp_dprx>, <&ps_isp_secure>, <&ps_isp_be>, - <&ps_isp_clr>, <&ps_ispsens0>; - /* the shared memory window above the firmware's 32 MiB */ - apple,dart-vm-size = /bits/ 64 <0xde600000>; - status = "disabled"; - }; - - /* - * ADT dart-isp0: three instances on one interrupt; ADT "remap": streams - * 1, 6, 7, 10 and 11 are stream 0. - */ - isp_dart0: iommu@5828c0000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x828c0000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_isp_sys>; - apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; - status = "disabled"; - }; - - isp_dart1: iommu@5828e0000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x828e0000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_isp_sys>; - apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; - status = "disabled"; - }; - - isp_dart2: iommu@582900000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x82900000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_isp_sys>; - apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; - status = "disabled"; - }; - - /* - * The three Type-C ports (ADT usb-drdN, atc-phyN, dart-usbN, - * acio-phy-cpuN) and the SPMI buses of their PD controllers. - */ - nub_spmi_a0: spmi@509188000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09188000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - #interrupt-cells = <2>; - interrupt-controller; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_nub_spmi_a0>; - status = "disabled"; - }; - - nub_spmi_a1: spmi@509198000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09198000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - #interrupt-cells = <2>; - interrupt-controller; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_nub_spmi_a1>; - status = "disabled"; - }; - - atcphy0: phy@382a90000 { - compatible = "apple,t6040-atcphy"; - reg = <0x3 0x82a90000 0x0 0x4000>, - <0x3 0x82800000 0x0 0x4000>, - <0x3 0x82a84000 0x0 0x4000>, - <0x3 0x83000000 0x0 0x30000>, - <0x3 0x83200000 0x0 0x4000>, - <0x3 0x83140000 0x0 0x4000>, - <0x3 0x830c0000 0x0 0x10000>, - <0x3 0x80000000 0x0 0x8000>, - <0x3 0x80020000 0x0 0x4000>, - <0x3 0x83244000 0x0 0x4000>, - <0x3 0x83250000 0x0 0x4000>; - reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", - "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; - #phy-cells = <1>; - #reset-cells = <0>; - power-domains = <&ps_atc0_common_dp>; - mboxes = <&atcphy0_mbox>; - mbox-names = "phy-cpu"; - nonposted-mmio; - orientation-switch; - status = "disabled"; - }; - - atcphy0_mbox: mailbox@383148000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x83148000 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_phymxwrap>; - status = "disabled"; - }; - - usb_drd0_dart_0: iommu@382f00000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x82f00000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc0_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; +#include "t604x.dtsi" - usb_drd0_dart_1: iommu@382f80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x82f80000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc0_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; - - usb_drd0: usb@382280000 { - compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; - reg = <0x3 0x82280000 0x0 0xcd00>, - <0x3 0x8228cd00 0x0 0x3200>, - <0x3 0x82200000 0x0 0x4000>; - reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; - interrupt-parent = <&aic>; - interrupts = ; - /* - * A role switch rather than a fixed host: the PD controller - * resets the eUSB2 repeater on every connect, so the PHY and - * the core start after the attach and stop on detach. - */ - dr_mode = "otg"; - usb-role-switch; - role-switch-default-mode = "host"; - iommus = <&usb_drd0_dart_0 0>, <&usb_drd0_dart_1 1>; - power-domains = <&ps_atc0_usb>; - resets = <&atcphy0>; - phys = <&atcphy0 PHY_TYPE_USB2>, <&atcphy0 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; - status = "disabled"; - }; - - atcphy1: phy@38aa90000 { - compatible = "apple,t6040-atcphy"; - reg = <0x3 0x8aa90000 0x0 0x4000>, - <0x3 0x8a800000 0x0 0x4000>, - <0x3 0x8aa84000 0x0 0x4000>, - <0x3 0x8b000000 0x0 0x30000>, - <0x3 0x8b200000 0x0 0x4000>, - <0x3 0x8b140000 0x0 0x4000>, - <0x3 0x8b0c0000 0x0 0x10000>, - <0x3 0x88000000 0x0 0x8000>, - <0x3 0x88020000 0x0 0x4000>, - <0x3 0x8b244000 0x0 0x4000>, - <0x3 0x8b250000 0x0 0x4000>; - reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", - "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; - #phy-cells = <1>; - #reset-cells = <0>; - power-domains = <&ps_atc1_common_dp>; - mboxes = <&atcphy1_mbox>; - mbox-names = "phy-cpu"; - nonposted-mmio; - orientation-switch; - status = "disabled"; - }; - - atcphy1_mbox: mailbox@38b148000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x8b148000 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_phymxwrap>; - status = "disabled"; - }; - - usb_drd1_dart_0: iommu@38af00000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x8af00000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc1_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; - - usb_drd1_dart_1: iommu@38af80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x8af80000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc1_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; - - usb_drd1: usb@38a280000 { - compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; - reg = <0x3 0x8a280000 0x0 0xcd00>, - <0x3 0x8a28cd00 0x0 0x3200>, - <0x3 0x8a200000 0x0 0x4000>; - reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; - interrupt-parent = <&aic>; - interrupts = ; - /* - * A role switch rather than a fixed host: the PD controller - * resets the eUSB2 repeater on every connect, so the PHY and - * the core start after the attach and stop on detach. - */ - dr_mode = "otg"; - usb-role-switch; - role-switch-default-mode = "host"; - iommus = <&usb_drd1_dart_0 0>, <&usb_drd1_dart_1 1>; - power-domains = <&ps_atc1_usb>; - resets = <&atcphy1>; - phys = <&atcphy1 PHY_TYPE_USB2>, <&atcphy1 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; - status = "disabled"; - }; - - atcphy2: phy@392a90000 { - compatible = "apple,t6040-atcphy"; - reg = <0x3 0x92a90000 0x0 0x4000>, - <0x3 0x92800000 0x0 0x4000>, - <0x3 0x92a84000 0x0 0x4000>, - <0x3 0x93000000 0x0 0x30000>, - <0x3 0x93200000 0x0 0x4000>, - <0x3 0x93140000 0x0 0x4000>, - <0x3 0x930c0000 0x0 0x10000>, - <0x3 0x90000000 0x0 0x8000>, - <0x3 0x90020000 0x0 0x4000>, - <0x3 0x93244000 0x0 0x4000>, - <0x3 0x93250000 0x0 0x4000>; - reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", - "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; - #phy-cells = <1>; - #reset-cells = <0>; - power-domains = <&ps_atc2_common_dp>; - mboxes = <&atcphy2_mbox>; - mbox-names = "phy-cpu"; - nonposted-mmio; - orientation-switch; - status = "disabled"; - }; - - atcphy2_mbox: mailbox@393148000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x3 0x93148000 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_phymxwrap>; - status = "disabled"; - }; - - usb_drd2_dart_0: iommu@392f00000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x92f00000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc2_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; - - usb_drd2_dart_1: iommu@392f80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x92f80000 0x0 0xc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_atc2_usb>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "disabled"; - }; - - usb_drd2: usb@392280000 { - compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; - reg = <0x3 0x92280000 0x0 0xcd00>, - <0x3 0x9228cd00 0x0 0x3200>, - <0x3 0x92200000 0x0 0x4000>; - reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; - interrupt-parent = <&aic>; - interrupts = ; - /* - * A role switch rather than a fixed host: the PD controller - * resets the eUSB2 repeater on every connect, so the PHY and - * the core start after the attach and stop on detach. - */ - dr_mode = "otg"; - usb-role-switch; - role-switch-default-mode = "host"; - iommus = <&usb_drd2_dart_0 0>, <&usb_drd2_dart_1 1>; - power-domains = <&ps_atc2_usb>; - resets = <&atcphy2>; - phys = <&atcphy2 PHY_TYPE_USB2>, <&atcphy2 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; - status = "disabled"; - }; - /* Additional DARTs; enabled together with their DMA consumers. */ - ave0_dart1: iommu@283080000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x2 0x83080000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x00004000 0x0 0xffffc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_venc0_sys>; - status = "disabled"; - }; - - ave0_dart0: iommu@2830a0000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x2 0x830a0000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x00004000 0x0 0xffffc000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_venc0_sys>; - status = "disabled"; - }; - - apr0_dart: iommu@301020000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x01020000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_scodec>; - status = "disabled"; - }; - - apciec0_dart: iommu@384000000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x84000000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - apciec1_dart: iommu@38c000000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x8c000000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - apciec2_dart: iommu@394000000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x94000000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dispext0_dart: iommu@3a2300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0xa2300000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext0_dart: iommu@3a2340000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0xa2340000 0x0 0x20000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - apcie1_dart: iommu@411000000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x11000000 0x0 0x20000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - sio_dart: iommu@429060000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x29060000 0x0 0x20000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x1c000 0x2ff 0xfffe4000>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_sio>; - status = "disabled"; - }; - - ane0_dart0: iommu@485800000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x85800000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_ane_sys>; - /* Include firmware identity MMIO pages below the preload DVAs. */ - apple,dma-range = <0x0 0x0 0x400 0x0>; - status = "disabled"; - }; - - ane0_dart1: iommu@485820000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x85820000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_ane_sys>; - /* Include firmware identity MMIO pages below the preload DVAs. */ - apple,dma-range = <0x0 0x0 0x400 0x0>; - status = "disabled"; - }; - - ane0_dart2: iommu@485840000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x85840000 0x0 0xc000>; - #iommu-cells = <1>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_ane_sys>; - /* Include firmware identity MMIO pages below the preload DVAs. */ - apple,dma-range = <0x0 0x0 0x400 0x0>; - status = "disabled"; - }; - - jpeg0: jpeg@487000000 { - compatible = "apple,t6041-jpeg"; - reg = <0x4 0x87000000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - iommus = <&jpeg0_dart 0>; - power-domains = <&ps_jpg>; - apple,dma-range = /bits/ 64 <0x10000000000 0x100000000>; - status = "disabled"; - }; - - jpeg0_dart: iommu@487020000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x87020000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_jpg>; - status = "disabled"; - }; - - jpeg1: jpeg@487060000 { - compatible = "apple,t6041-jpeg"; - reg = <0x4 0x87060000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - iommus = <&jpeg1_dart 0>; - power-domains = <&ps_jpg>; - apple,dma-range = /bits/ 64 <0x10000000000 0x100000000>; - status = "disabled"; - }; - - jpeg1_dart: iommu@487080000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x4 0x87080000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_jpg>; - status = "disabled"; - }; - - scaler0_dart: iommu@521260000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x5 0x21260000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - power-domains = <&ps_msr0>; - status = "disabled"; - }; - - dispext1_dart: iommu@602300000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x6 0x02300000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - dcpext1_dart: iommu@602340000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x6 0x02340000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x10 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; - - pinctrl_aop: pinctrl@510824000 { - compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; - reg = <0x5 0x10824000 0x0 0x4000>; - clocks = <&clkref>; - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&pinctrl_aop 0 0 85>; - apple,npins = <85>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - , - , - ; - /* Coprocessor pins and interrupt groups need an ownership handoff. */ - status = "disabled"; - }; - - pinctrl_smc: pinctrl@50c824000 { - compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; - reg = <0x5 0x0c824000 0x0 0x4000>; - clocks = <&clkref>; - gpio-controller; - #gpio-cells = <2>; - gpio-ranges = <&pinctrl_smc 0 0 24>; - apple,npins = <24>; - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - , - , - ; - /* Coprocessor pins and interrupt groups need an ownership handoff. */ - status = "disabled"; - }; - - nub_spmi1: spmi@509054000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09054000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - power-domains = <&ps_nub_spmi1>; - status = "disabled"; - }; - - nub_spmi2: spmi@509094000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09094000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - power-domains = <&ps_nub_spmi2>; - status = "disabled"; - }; - - nub_spmi3: spmi@5090d4000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x090d4000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - power-domains = <&ps_nub_spmi3>; - status = "disabled"; - }; - - nub_spmi4: spmi@509114000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x09114000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - power-domains = <&ps_nub_spmi4>; - status = "disabled"; - }; - - aop_spmi0: spmi@510914000 { - compatible = "apple,t6041-spmi", "apple,t8103-spmi"; - reg = <0x5 0x10914000 0x0 0x100>; - #address-cells = <2>; - #size-cells = <0>; - /* Shared with AOP firmware; no AP bus ownership handoff yet. */ - status = "disabled"; - }; - - /* The QSPIMC input is ADT clock 434 (200 MHz). */ - clk_200m: clock-200m { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <200000000>; - clock-output-names = "clk_200m"; - }; - - spi4: spi@429110000 { - compatible = "apple,t6041-spi", "apple,t8103-spi"; - reg = <0x4 0x29110000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - clocks = <&clkref>; - power-domains = <&ps_spi4>; - #address-cells = <1>; - #size-cells = <0>; - /* Panel/TCON control belongs to the display firmware. */ - status = "disabled"; - }; - - qspi: spi@429118000 { - compatible = "apple,t6041-qspi"; - reg = <0x4 0x29118000 0x0 0x4800>; - interrupt-parent = <&aic>; - interrupts = ; - clocks = <&clk_200m>; - power-domains = <&ps_qspi>; - #address-cells = <1>; - #size-cells = <0>; - /* Boards enable it with their flash and its nvram partition. */ - status = "disabled"; - }; - - /* The loader supplies the SIO firmware regions and protocol tables. */ - sio: dma-controller@429e00000 { - compatible = "apple,t6041-sio"; - reg = <0x4 0x29e00000 0x0 0x8000>; - dma-channels = <128>; - #dma-cells = <1>; - mboxes = <&sio_mbox>; - iommus = <&sio_dart 0>; - power-domains = <&ps_sio_cpu>; - status = "disabled"; - }; - - sio_mbox: mailbox@429e08000 { - compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; - reg = <0x4 0x29e08000 0x0 0x4000>; - interrupt-parent = <&aic>; - interrupts = , - , - , - ; - interrupt-names = "send-empty", "send-not-empty", - "recv-empty", "recv-not-empty"; - #mbox-cells = <0>; - power-domains = <&ps_sio_cpu>; - status = "disabled"; - }; - - /* - * Disabled until the H16 firmware path is proven on hardware. The - * loader fills the preload reservations and the firmware IOVAs from - * the ADT, so enabling it then only takes status = "okay" here and on - * the three DARTs. - */ - ane: ane@484000000 { - compatible = "apple,t6041-ane"; - reg = <0x4 0x84000000 0x0 0x2000000>, - <0x5 0x02280000 0x0 0x18000>, - <0x5 0x022a0000 0x0 0x4000>, - <0x5 0x003c0000 0x0 0x30000>, - <0x2 0x12000000 0x0 0xff4000>, - <0x5 0x22000000 0x0 0x2000000>, - <0x5 0x08374000 0x0 0x4000>; - reg-names = "engine", "pmgr", "aux-0", "aux-1", "aux-2", - "aux-3", "aux-4"; - interrupt-parent = <&aic>; - interrupts = ; - /* Stream 0 only: the MPM stream 11 is not given to the host. */ - iommus = <&ane0_dart0 0>, <&ane0_dart1 0>, <&ane0_dart2 0>; - power-domains = <&ps_ane_sys>, <&ps_ane_cpu>, <&ps_ane_mpm>, - <&ps_ane_td>, <&ps_ane_base>; - apple,ane-type = <0x110>; - apple,firmware-preloaded; - /* Inclusive DAPF bounds, in hardware record order. */ - apple,dapf-ranges = /bits/ 64 <0x5022803c0 0x5022803c3>, - /bits/ 64 <0x50228c000 0x50228c01b>, - /bits/ 64 <0x581668000 0x581668003>, - /bits/ 64 <0x28a668000 0x28a668003>; - /* Default firmware layout; the loader rewrites it from the ADT. */ - apple,firmware-iovas = /bits/ 64 <0x10000000000 0x100000c0000>; - /* The bootloader supplies the physical TEXT/DATA reservations. */ - status = "disabled"; - }; - - /* The video encoder stays disabled until its firmware backend is available. */ - ave: video-codec@283100000 { - compatible = "apple,t6041-ave"; - reg = <0x2 0x83100000 0x0 0x45c000>, - <0x2 0x83050000 0x0 0x4000>, - <0x2 0x83800000 0x0 0x800000>; - reg-names = "codec", "mailbox", "coproc"; - interrupt-parent = <&aic>; - interrupts = , - , - , - , - ; - power-domains = <&ps_venc0_dma>, <&ps_venc0_pipe4>, - <&ps_venc0_pipe5>, <&ps_venc0_me0>, <&ps_venc0_me1>, - <&pmc_soc_max>; - power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; - iommus = <&ave0_dart0 0>, <&ave0_dart1 0>; - status = "disabled"; - }; - - serial0: serial@429200000 { - compatible = "apple,s5l-uart"; - reg = <0x4 0x29200000 0x0 0x4000>; - reg-io-width = <4>; - interrupt-parent = <&aic>; - interrupts = ; - clocks = <&clkref>, <&clkref>; - clock-names = "uart", "clk_uart_baud0"; - power-domains = <&ps_uart0>; - status = "disabled"; - }; - - dcuart: serial@50883c000 { - compatible = "apple,dockchannel-uart"; - reg = <0x5 0x0883c000 0x0 0x4000>, - <0x5 0x08838000 0x0 0x4000>, - <0x5 0x0880c000 0x0 0x4000>; - reg-names = "data", "config", "irq"; - interrupt-parent = <&aic>; - interrupts = ; - apple,channel = <2>; - 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"; - }; - - usb4_0_dart: iommu@381a80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x81a80000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - 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"; - }; - - usb4_1_dart: iommu@389a80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x89a80000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - 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"; - }; - - usb4_2_dart: iommu@391a80000 { - compatible = "apple,t6041-dart", "apple,t8110-dart"; - reg = <0x3 0x91a80000 0x0 0xc000>; - #iommu-cells = <1>; - apple,dma-range = <0x100 0x0 0x300 0x0>; - interrupt-parent = <&aic>; - interrupts = ; - status = "disabled"; - }; +/* The M4 Pro has five cores in each P cluster. */ +/delete-node/ &cpu_p05; +/delete-node/ &cpu_p15; +&{/cpus/cpu-map/cluster1} { + /delete-node/ core5; }; -#include "t6040-pmgr.dtsi" +&{/cpus/cpu-map/cluster2} { + /delete-node/ core5; +}; /* * DRAM interface class: width and maximum rate are inferred from topology diff --git a/arch/arm64/boot/dts/apple/t6041-j616c-hdmi.dtsi b/arch/arm64/boot/dts/apple/t6041-j616c-hdmi.dtsi new file mode 100644 index 0000000000000..7bf6baf4a2f11 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j616c-hdmi.dtsi @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * HDMI output of the J616c: dcpext0, the ATC3 display crossbar, atcphy3 (a + * DP PHY without a USB controller) and the on-board DP-to-HDMI converter. + * + * Every node is disabled. No DISPEXT0 power domain is described: the chain + * runs as iBoot leaves it powered. The boot loader fills dcpext0's firmware + * memory (the data and heap regions below; the text region is the internal + * DCP's), and the display gate (drivers/soc/apple/display-gate.c) then + * enables the chain and adds dispext0's DART to the display subsystem's + * iommus. + */ + +/ { + aliases { + dcpext0 = &dcpext0; + }; + + reserved-memory { + dcpext0_data: dcpext0-data { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext0_heap: dcpext0-heap { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + }; +}; + +&dcpext0 { + /delete-property/ apple,typec-hybrid-first; + apple,iomfb-surfaces = <1 1 0 0>; + apple,connector-type = "HDMI-A"; + hdmi-hpd-gpios = <&pinctrl_aop 36 GPIO_ACTIVE_HIGH>; + hdmi-pwren-gpios = <&smc_gpio 15 GPIO_ACTIVE_HIGH>; + dp2hdmi-pwren-gpios = <&smc_gpio 26 GPIO_ACTIVE_HIGH>; + phys = <&atcphy3 PHY_TYPE_DP>; + phy-names = "dp-phy"; + mux-controls = <&atcphy3_xbar 0>; + mux-control-names = "dp-xbar"; + mux-index = <0>; + apple,dptx-phy = <3>; + memory-region = <&dcpext0_data>, <&dcpext0_heap>; + memory-region-names = "data", "heap"; +}; + +&atcphy3 { + apple,tunable-aus40cmn-shm = + <0xa04 0x0000007c 0x0000004c>; + apple,tunable-auspll = + <0x3224 0x00000c00 0x00000800>, + <0x3230 0x0000001f 0x0000000f>, + <0x3240 0x07d8007f 0x04000039>, + <0x32b0 0x0b800000 0x01800000>, + <0x32e8 0x00060001 0x00040001>, + <0x3338 0x0f800000 0x07800000>; + apple,tunable-cio4pll = + <0x3a30 0x0000001f 0x0000000f>, + <0x3a4c 0x0000fe7f 0x0000501e>, + <0x3ab0 0x00700000 0x00300000>, + <0x3ae8 0x00060000 0x00020000>; +}; diff --git a/arch/arm64/boot/dts/apple/t6041-j616c-usbc.dtsi b/arch/arm64/boot/dts/apple/t6041-j616c-usbc.dtsi new file mode 100644 index 0000000000000..4ccf897e1dd01 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j616c-usbc.dtsi @@ -0,0 +1,266 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * USB-C DisplayPort on the J616c's left-front port (typec1): dcpext1, the + * ATC1 display crossbar and atcphy1 in DP alt mode, driven by hpm1. + * + * dcpext1, its DARTs, mailbox, crossbar and Type-C route are disabled, as + * for HDMI: the display gate enables them once the boot loader has filled + * dcpext1's firmware memory. A disabled route is no mode switch, so typec1 + * then keeps USB2 and PD as before. + */ + +/ { + aliases { + dcpext1 = &dcpext1; + }; + + reserved-memory { + dcpext1_data: dcpext1-data { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext1_heap: dcpext1-heap { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + }; +}; + +&dcpext1 { + apple,iomfb-surfaces = <1 1 0 0>; + apple,connector-type = "USB-C"; + phys = <&atcphy1 PHY_TYPE_DP>; + phy-names = "typec1"; + mux-controls = <&atcphy1_xbar 0>; + mux-control-names = "typec1"; + /* indexed by route */ + apple,typec-dptx-phys = <0 1 2>; + apple,typec-mux-indices = <2 2 2>; + memory-region = <&dcpext1_data>, <&dcpext1_heap>; + memory-region-names = "data", "heap"; + + typec-routes { + #address-cells = <1>; + #size-cells = <0>; + + route@1 { + reg = <1>; + mode-switch; + status = "disabled"; + + port { + dcpext1_typec1: endpoint { + remote-endpoint = <&typec1_dcpext1>; + }; + }; + }; + }; +}; + +&typec1 { + ports { + port@1 { + reg = <1>; + typec1_con_ss: endpoint { + remote-endpoint = <&atcphy1_ss>; + }; + }; + + port@3 { + reg = <3>; + typec1_dcpext1: endpoint { + remote-endpoint = <&dcpext1_typec1>; + }; + }; + }; +}; + +&atcphy1 { + mode-switch; + orientation-switch; + + apple,tunable-axi2af = + <0x0 0x800000ff 0x8000001c>, + <0x4 0x80ff00ff 0x801b0003>, + <0x8 0x80ff00ff 0x801b0003>, + <0xc 0x80ff00ff 0x801b0005>, + <0x10 0x80ff00ff 0x801b0003>, + <0x14 0x80ff00ff 0x801b0003>, + <0x18 0x80ff00ff 0x801b0003>, + <0x1c 0x80ff00ff 0x801b0003>, + <0x20 0x800000ff 0x80000015>, + <0x24 0x800000ff 0x80000038>, + <0x28 0x80ff00ff 0x80380006>, + <0x2c 0x80ff00ff 0x80380006>, + <0x30 0x80ff00ff 0x80380006>, + <0x34 0x80ff00ff 0x80380006>, + <0x38 0x80ff00ff 0x80380006>, + <0x3c 0x80ff00ff 0x80380006>, + <0x40 0x800000ff 0x80000015>, + <0x44 0x800000ff 0x80000015>, + <0x48 0x800000ff 0x80000015>, + <0x100 0x000000ff 0x000000ff>, + <0x108 0xffff0006 0x00100000>, + <0x304 0x3f3f0000 0x04040000>, + <0x308 0x000fffff 0x00001681>, + <0x30c 0x000fffff 0x00001680>, + <0x310 0x70000fff 0x000001e0>, + <0x314 0xf0000fff 0x800001e0>, + <0x318 0x70000fff 0x000001e0>, + <0x31c 0xf0000fff 0x800001e0>, + <0x320 0x70000fff 0x000005a0>, + <0x324 0xf0000fff 0x800005a0>, + <0x328 0x70000fff 0x000005a0>, + <0x32c 0xf0000fff 0x800005a0>, + <0x330 0x70000fff 0x000005a0>, + <0x334 0xf0000fff 0x800005a0>, + <0x338 0x70000fff 0x000005a0>, + <0x33c 0x70000fff 0x000005a0>, + <0x340 0x70000fff 0x000005a0>, + <0x344 0x70000fff 0x000005a0>, + <0x348 0x70000fff 0x000005a0>, + <0x34c 0x70000fff 0x000005a0>, + <0x350 0x70000fff 0x000005a0>, + <0x358 0xffffffff 0x0000ffff>, + <0x35c 0xffffffff 0x0000ffff>, + <0x408 0xffff0020 0x00180020>, + <0x40c 0x000fffff 0x00001681>, + <0x410 0x000fffff 0x00001680>, + <0x414 0x70000fff 0x000001e0>, + <0x418 0x70000fff 0x000001e0>, + <0x41c 0x70000fff 0x000001e0>, + <0x420 0x70000fff 0x000001e0>, + <0x424 0x70000fff 0x000005a0>, + <0x428 0x70000fff 0x000005a0>, + <0x42c 0x70000fff 0x000005a0>, + <0x430 0x70000fff 0x000005a0>, + <0x434 0x70000fff 0x000005a0>, + <0x438 0x70000fff 0x000005a0>, + <0x43c 0x70000fff 0x000005a0>, + <0x440 0x70000fff 0x000005a0>, + <0x444 0x70000fff 0x000005a0>, + <0x448 0x70000fff 0x000005a0>, + <0x44c 0x70000fff 0x000005a0>, + <0x450 0x70000fff 0x000005a0>, + <0x454 0x70000fff 0x000005a0>, + <0x948 0x07ff07ff 0x00280000>, + <0xa48 0x07ff07ff 0x00400040>, + <0xb48 0x07ff07ff 0x00b8010e>, + <0xc48 0x07ff07ff 0x00400020>, + <0xd48 0x07ff07ff 0x008a008a>, + <0x1000 0xffffffff 0x7fffffff>, + <0x4008 0x00000001 0x00000001>, + <0x400c 0x00000001 0x00000001>, + <0x4014 0x00000001 0x00000001>, + <0x4018 0x00000001 0x00000000>, + <0x401c 0x00000001 0x00000001>; + apple,tunable-fabric = + <0x4 0x003f003f 0x00200020>, + <0xc 0x000000f1 0x000000a1>, + <0x10 0x0000801f 0x00000004>, + <0x18 0x003f003f 0x00200020>, + <0x20 0x000000f1 0x000000a1>, + <0x24 0x0000801f 0x00000004>, + <0x2c 0x00ff00ff 0x00960096>, + <0x34 0x000000f1 0x00000071>, + <0x38 0x0000801f 0x00000004>, + <0x40 0x0000003f 0x00000020>, + <0x48 0x0000801f 0x00000004>, + <0x50 0x007f007f 0x00450045>, + <0x58 0x0000801f 0x00000004>, + <0x60 0x0000003f 0x00000020>, + <0x68 0x0000801f 0x00000004>, + <0x70 0x00000001 0x00000001>, + <0x74 0x0000801f 0x00000004>, + <0x7c 0x007f007f 0x00400040>, + <0x80 0x000000f1 0x00000011>, + <0x84 0x00000001 0x00000001>, + <0x88 0x00000001 0x00000001>, + <0x8c 0x0000801f 0x00000004>, + <0x94 0x001f001f 0x00100010>, + <0x98 0x000000f1 0x00000011>, + <0x9c 0x0000801f 0x00000004>, + <0xa4 0x000000ff 0x000000e0>, + <0xa8 0x0000801f 0x00000004>, + <0xb0 0x0000003f 0x00000020>, + <0xb8 0x0000801f 0x00000004>, + <0xc0 0x0000003f 0x00000020>, + <0xc8 0x0000801f 0x00000004>, + <0xd0 0x001f001f 0x00100010>, + <0xd8 0x00000001 0x00000001>, + <0xdc 0x00000001 0x00000001>, + <0xe0 0x0000801f 0x00000004>, + <0xe8 0x0000000f 0x00000008>, + <0xec 0x0000801f 0x00000004>, + <0xf4 0xffffffff 0x01010101>, + <0xf8 0x0000801f 0x00000004>, + <0x100 0x00000001 0x00000001>, + <0x104 0x00000001 0x00000001>, + <0x108 0x0000801f 0x00000004>, + <0x110 0x0000801f 0x00000004>, + <0x118 0x0000801f 0x00000004>, + <0x120 0x00000001 0x00000001>, + <0x124 0x00000001 0x00000001>, + <0x128 0x0000801f 0x00000004>, + <0x130 0xffffffff 0x01010101>, + <0x134 0x0000801f 0x00000004>, + <0x13c 0x00000001 0x00000001>, + <0x140 0x00000001 0x00000001>, + <0x144 0x0000801f 0x00000004>, + <0x14c 0x00000001 0x00000001>, + <0x150 0x00000001 0x00000001>, + <0x154 0x0000801f 0x00000004>, + <0x15c 0x0000801f 0x00000004>, + <0x164 0xffffffff 0x01010101>, + <0x168 0x0000ffff 0x00000101>, + <0x16c 0x0000801f 0x00000004>, + <0x174 0x00000001 0x00000001>, + <0x178 0x00000001 0x00000001>, + <0x17c 0x0000801f 0x00000004>, + <0x184 0x00000001 0x00000001>, + <0x188 0x00000001 0x00000001>, + <0x18c 0x0000801f 0x00000004>; + apple,tunable-common-cfg = + <0x8 0x00000001 0x00000001>; + apple,tunable-axi2af-lioa = + <0x28 0x0000fe2f 0x00000000>, + <0x2c 0x00000007 0x00000000>, + <0x30 0x0000007f 0x00000000>, + <0x34 0x000000ff 0x00000000>, + <0x58 0x0000010b 0x00000000>; + apple,tunable-lane0 = + <0xd094 0x00080000 0x00080000>, + <0xd098 0x00080000 0x00080000>, + <0xd0a4 0x00800000 0x00800000>, + <0xd0a8 0x00200000 0x00200000>; + apple,tunable-lane1 = + <0x1d094 0x00080000 0x00080000>, + <0x1d098 0x00080000 0x00080000>, + <0x1d0a4 0x00800000 0x00800000>, + <0x1d0a8 0x00200000 0x00200000>; + apple,tunable-aus40cmn-shm = + <0xa04 0x0000007c 0x0000004c>; + apple,tunable-auspll = + <0x3224 0x00000c00 0x00000800>, + <0x3230 0x0000001f 0x0000000f>, + <0x3240 0x07d8007f 0x04000039>, + <0x32b0 0x0b800000 0x01800000>, + <0x32e8 0x00060001 0x00040001>, + <0x3338 0x0f800000 0x07800000>; + apple,tunable-cio4pll = + <0x3a30 0x0000001f 0x0000000f>, + <0x3a4c 0x0000fe7f 0x00004e1d>, + <0x3ab0 0x00700000 0x00300000>, + <0x3ae8 0x00060000 0x00020000>; + + port { + atcphy1_ss: endpoint { + remote-endpoint = <&typec1_con_ss>; + }; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6041-j616c.dts b/arch/arm64/boot/dts/apple/t6041-j616c.dts new file mode 100644 index 0000000000000..6bbb4eb81a709 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j616c.dts @@ -0,0 +1,895 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +// Copyright The Asahi Linux Contributors + +/dts-v1/; + +#include "t6041.dtsi" +#include +#include + +/ { + compatible = "apple,j616c", "apple,t6041", "apple,arm-platform"; + model = "Apple MacBook Pro (16-inch, M4 Max)"; + chassis-type = "laptop"; + + aliases { + serial0 = &serial0; + keyboard = &keyboard; + wifi0 = "/pcie@1cb0000000/pci@0,0/wifi@0,0"; + bluetooth0 = "/pcie@1cb0000000/pci@0,0/bluetooth@0,1"; + mtp = &mtp; + dcp = &dcp; + disp0 = &display; + disp0-piodma = &disp0_piodma; + gpu = &gpu; + }; + + chosen { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + stdout-path = "serial0:115200n8"; + + framebuffer0: framebuffer@0 { + compatible = "apple,simple-framebuffer", "simple-framebuffer"; + reg = <0 0 0 0>; + status = "disabled"; + }; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + }; + + memory@0 { + device_type = "memory"; + reg = <0 0 0 0>; + }; + + serial0: serial@429200000 { + compatible = "apple,s5l-uart"; + reg = <0x4 0x29200000 0x0 0x1000>; + reg-io-width = <4>; + interrupt-parent = <&aic>; + interrupts = ; + clocks = <&clkref>, <&clkref>; + clock-names = "uart", "clk_uart_baud0"; + }; + + clk_disp0: clock-disp0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <712000000>; + clock-output-names = "disp0"; + }; + + thermal-zones { + cpu-die-thermal { + polling-delay-passive = <1000>; + polling-delay = <1000>; + thermal-sensors = <&smc_hwmon 0>; + + trips { + cpu_die_passive: cpu-die-passive { + temperature = <113000>; + hysteresis = <5000>; + type = "passive"; + }; + + cpu-die-critical { + temperature = <118000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map-e { + trip = <&cpu_die_passive>; + cooling-device = + <&cpu_e0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_e1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_e2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_e3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map-p0 { + trip = <&cpu_die_passive>; + cooling-device = + <&cpu_p00 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p01 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p02 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p03 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p04 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p05 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map-p1 { + trip = <&cpu_die_passive>; + cooling-device = + <&cpu_p10 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p11 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p12 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p13 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p14 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_p15 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; +}; + +&cpufreq_e { + /delete-property/ apple,fast-die-effort; +}; + +&cpufreq_p0 { + /delete-property/ apple,fast-die-effort; +}; + +&cpufreq_p1 { + /delete-property/ apple,fast-die-effort; +}; + +&wdt { + timeout-sec = <140>; +}; + +&smc { + status = "okay"; + + smc_gpio_low: gpio-low { + compatible = "apple,smc-low-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&smc_mbox { + status = "okay"; +}; + +&nub_spmi0 { + status = "okay"; +}; + +&smc_hwmon { + temperature-TCMz { + apple,key-id = "TCMz"; + label = "CPU Die Max"; + }; + temperature-TCMb { apple,key-id = "TCMb"; label = "CPU TCMb"; }; + temperature-Tpx0 { apple,key-id = "Tpx0"; label = "CPU Tpx0"; }; + temperature-Tpx1 { apple,key-id = "Tpx1"; label = "CPU Tpx1"; }; + temperature-Tpx2 { apple,key-id = "Tpx2"; label = "CPU Tpx2"; }; + temperature-Tpx3 { apple,key-id = "Tpx3"; label = "CPU Tpx3"; }; + temperature-Tpx4 { apple,key-id = "Tpx4"; label = "CPU Tpx4"; }; + temperature-Tpx5 { apple,key-id = "Tpx5"; label = "CPU Tpx5"; }; + temperature-Tpx8 { apple,key-id = "Tpx8"; label = "CPU Tpx8"; }; + temperature-Tpx9 { apple,key-id = "Tpx9"; label = "CPU Tpx9"; }; + temperature-TpxA { apple,key-id = "TpxA"; label = "CPU TpxA"; }; + temperature-TpxB { apple,key-id = "TpxB"; label = "CPU TpxB"; }; + temperature-TpxC { apple,key-id = "TpxC"; label = "CPU TpxC"; }; + temperature-TpxD { apple,key-id = "TpxD"; label = "CPU TpxD"; }; + temperature-Tex0 { apple,key-id = "Tex0"; label = "CPU Tex0"; }; + temperature-Tex1 { apple,key-id = "Tex1"; label = "CPU Tex1"; }; + temperature-Tex2 { apple,key-id = "Tex2"; label = "CPU Tex2"; }; + temperature-Tex3 { apple,key-id = "Tex3"; label = "CPU Tex3"; }; + temperature-TH0x { apple,key-id = "TH0x"; label = "NAND Flash Temperature"; }; + temperature-TB0T { apple,key-id = "TB0T"; label = "Battery Hotspot"; }; + temperature-TCHP { apple,key-id = "TCHP"; label = "Charge Regulator Temp"; }; + temperature-TW0P { apple,key-id = "TW0P"; label = "WiFi/BT Module Temp"; }; + power-PSTR { apple,key-id = "PSTR"; label = "Total System Power"; }; + power-PHPC { apple,key-id = "PHPC"; label = "Heatpipe Power"; }; + power-PDTR { apple,key-id = "PDTR"; label = "AC Input Power"; }; + voltage-VD0R { apple,key-id = "VD0R"; label = "AC Input Voltage"; }; + voltage-SBAV { apple,key-id = "SBAV"; label = "Battery Voltage"; }; + current-ID0R { apple,key-id = "ID0R"; label = "AC Input Current"; }; +}; + +&pinctrl { + status = "okay"; + + wifi_clkreq_pins: wifi-clkreq-pins { + pinmux = ; + }; +}; + +&pinctrl_nub { + status = "okay"; + /delete-property/ interrupt-controller; + /delete-property/ #interrupt-cells; + /delete-property/ interrupts; +}; + +&mtp { + status = "okay"; +}; + +&mtp_mbox { + status = "okay"; +}; + +&mtp_dart { + status = "okay"; +}; + +&mtp_dockchannel { + status = "okay"; +}; + +&mtp_hid { + compatible = "apple,dockchannel-hid"; + apple,afe-reset-gpios = <&smc_gpio_low 25 GPIO_ACTIVE_LOW>; + apple,stm-reset-gpios = <&smc_gpio_low 26 GPIO_ACTIVE_LOW>; + + multi-touch { + firmware-name = "apple/tpmtfw-j616c.bin"; + apple,power-method = <2>; + }; + + keyboard: keyboard { + hid-country-code = <0>; + apple,keyboard-layout-id = <0>; + }; + + stm { + }; + + actuator { + }; + + tp-accel { + }; + + mtp { + }; +}; + +&pcie_dart { + status = "okay"; +}; + +/ { + pcie0: pcie@1cb0000000 { + compatible = "apple,t6041-pcie", "apple,t6020-pcie"; + reg = <0x1c 0xb0000000 0x0 0x1000000>, + <0x4 0x14000000 0x0 0x4000>, + <0x4 0x10028000 0x0 0x4000>, + <0x4 0x11028000 0x0 0x4000>, + <0x4 0x12028000 0x0 0x4000>, + <0x4 0x13028000 0x0 0x4000>, + <0x4 0x17020000 0x0 0x4000>, + <0x4 0x17024000 0x0 0x4000>, + <0x4 0x17028000 0x0 0x4000>, + <0x4 0x1702c000 0x0 0x4000>; + reg-names = "config", "rc", + "port0", "port1", "port2", "port3", + "phy0", "phy1", "phy2", "phy3"; + ranges = <0x43000000 0xb 0xc0000000 0xb 0xc0000000 0 0x20000000 0x2000000 0 0x80000000 0xb 0x80000000 0 0x40000000>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_clkreq_pins>; + #size-cells = <2>; + #address-cells = <3>; + bus-range = <0 1>; + iommu-map-mask = <0xffff>; + iommu-map = <0x100 &pcie_dart 1 2>; + msi-ranges = <&aic AIC_IRQ 2071 IRQ_TYPE_EDGE_RISING 32>; + msi-parent = <&pcie0>; + msi-controller; + interrupts = <0 0x6bb 4>; + interrupt-parent = <&aic>; + device_type = "pci"; + + port00: pci@0,0 { + reg = <0 0 0 0 0>; + ranges; + 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>; + interrupt-map-mask = <0 0 0 7>; + #interrupt-cells = <1>; + interrupt-controller; + #size-cells = <2>; + #address-cells = <3>; + pwren-gpios = <&smc_gpio 0x13 0>; + reset-gpios = <&pinctrl 4 1>; + device_type = "pci"; + + bluetooth@0,1 { + compatible = "pci14e4,5f72"; + reg = <0x100 0 0 0 0>; + local-bd-address = [00 00 00 00 00 00]; + brcm,board-type = "apple,hostomel"; + status = "okay"; + }; + + wifi@0,0 { + compatible = "pci14e4,4434", "brcm,bcm4329-fmac"; + reg = <0 0 0 0 0>; + brcm,ccode-map-trivial; + brcm,board-type = "apple,hostomel"; + }; + }; + }; +}; + +&ans_mbox { + status = "okay"; +}; + +&ans_sart { + status = "okay"; +}; + +&nvme { + status = "okay"; +}; + +&display { + phandle = <&display>; + status = "okay"; +}; + +&dcp { + clocks = <&clk_disp0>; + phandle = <&dcp>; + + panel { + compatible = "apple,panel-j616", "apple,panel-mini-led", "apple,panel"; + width-mm = <346>; + height-mm = <223>; + adj-height-mm = <216>; + apple,max-brightness = <500>; + }; +}; + +&disp0_piodma { + phandle = <&disp0_piodma>; +}; + +&nub_spmi_a0 { + status = "okay"; + + hpm1: usb-pd@a { + compatible = "apple,sn201202x"; + reg = <0xa SPMI_USID>; + interrupts = <37 IRQ_TYPE_EDGE_RISING>, + <39 IRQ_TYPE_EDGE_RISING>, + <43 IRQ_TYPE_EDGE_RISING>, + <45 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "irq", "select", "sleep", "wake"; + + 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_con_hs: endpoint { + remote-endpoint = <&usb_drd1_hs>; + }; + }; + }; + }; + }; +}; + +&nub_spmi_a1 { + status = "okay"; + + hpm2: usb-pd@c { + compatible = "apple,sn201202x"; + reg = <0xc SPMI_USID>; + interrupts = <11 IRQ_TYPE_EDGE_RISING>, + <13 IRQ_TYPE_EDGE_RISING>, + <17 IRQ_TYPE_EDGE_RISING>, + <19 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "irq", "select", "sleep", "wake"; + + 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_con_hs: endpoint { + remote-endpoint = <&usb_drd2_hs>; + }; + }; + }; + }; + }; +}; + +&atcphy1 { + apple,tunable-usb2-host = <0x8 0x7003 0x3>; + status = "okay"; +}; + +&usb_drd1_dart_0 { + status = "okay"; +}; + +&usb_drd1_dart_1 { + status = "okay"; +}; + +&usb_drd1 { + maximum-speed = "high-speed"; + phys = <&atcphy1 PHY_TYPE_USB2>; + phy-names = "usb2-phy"; + apple,tunable-gbl-host = <0x4 0x0001ef00 0x00002f00>, <0x1c 0x00000100 0x0>, + <0x2c 0x000a07ff 0x000800c8>, <0x100 0x02000100 0x02000100>, + <0x504 0x00001000 0x0>, <0x528 0xff0000ff 0x06000006>, + <0x52c 0xff0000ff 0x08000008>, <0x538 0x00000800 0x00000800>, + <0x580 0xffffffff 0x6f000006>; + apple,tunable-cfg-host = <0x20 0xff 0x1b>; + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_drd1_hs: endpoint { + remote-endpoint = <&typec1_con_hs>; + }; + }; + }; +}; + +&atcphy2 { + apple,tunable-usb2-host = <0x8 0x7003 0x3>; + status = "okay"; +}; + +&usb_drd2_dart_0 { + status = "okay"; +}; + +&usb_drd2_dart_1 { + status = "okay"; +}; + +&usb_drd2 { + maximum-speed = "high-speed"; + phys = <&atcphy2 PHY_TYPE_USB2>; + phy-names = "usb2-phy"; + apple,tunable-gbl-host = <0x4 0x0001ef00 0x00002f00>, <0x1c 0x00000100 0x0>, + <0x2c 0x000a07ff 0x000800c8>, <0x100 0x02000100 0x02000100>, + <0x504 0x00001000 0x0>, <0x528 0xff0000ff 0x06000006>, + <0x52c 0xff0000ff 0x08000008>, <0x538 0x00000800 0x00000800>, + <0x580 0xffffffff 0x6f000006>; + apple,tunable-cfg-host = <0x20 0xff 0x1b>; + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_drd2_hs: endpoint { + remote-endpoint = <&typec2_con_hs>; + }; + }; + }; +}; + +/ { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + gpu_uat_ttbs: uat-ttbs { + no-map; + status = "disabled"; + }; + + gpu_uat_pagetables: uat-pagetables { + no-map; + status = "disabled"; + }; + + gpu_uat_l2_pagetables: uat-l2-pagetables { + no-map; + status = "disabled"; + }; + + gpu_uat_handoff: uat-handoff { + no-map; + status = "disabled"; + }; + + gpu_fw_text: gpu-fw-text { + no-map; + status = "disabled"; + }; + + gpu_fw_data: gpu-fw-data { + no-map; + status = "disabled"; + }; + }; + + gpu_opp: opp-table-gpu { + compatible = "operating-points-v2"; + + opp00 { + opp-hz = /bits/ 64 <0>; + opp-microvolt = <125000 125000 125000 125000>; + }; + opp01 { + opp-hz = /bits/ 64 <338000000>; + opp-microvolt = <600000 600000 600000 600000>; + }; + opp02 { + opp-hz = /bits/ 64 <618000000>; + opp-microvolt = <665000 665000 660000 660000>; + }; + opp03 { + opp-hz = /bits/ 64 <796000000>; + opp-microvolt = <705000 705000 700000 705000>; + }; + opp04 { + opp-hz = /bits/ 64 <924000000>; + opp-microvolt = <725000 725000 715000 730000>; + }; + opp05 { + opp-hz = /bits/ 64 <952000000>; + opp-microvolt = <770000 770000 770000 780000>; + }; + opp06 { + opp-hz = /bits/ 64 <1056000000>; + opp-microvolt = <770000 770000 770000 780000>; + }; + opp07 { + opp-hz = /bits/ 64 <1062000000>; + opp-microvolt = <810000 810000 805000 810000>; + }; + opp08 { + opp-hz = /bits/ 64 <1182000000>; + opp-microvolt = <810000 810000 805000 810000>; + }; + opp09 { + opp-hz = /bits/ 64 <1182000000>; + opp-microvolt = <860000 860000 860000 860000>; + }; + opp10 { + opp-hz = /bits/ 64 <1312000000>; + opp-microvolt = <860000 860000 860000 860000>; + }; + opp11 { + opp-hz = /bits/ 64 <1242000000>; + opp-microvolt = <900000 895000 900000 900000>; + }; + opp12 { + opp-hz = /bits/ 64 <1380000000>; + opp-microvolt = <900000 895000 900000 900000>; + }; + opp13 { + opp-hz = /bits/ 64 <1326000000>; + opp-microvolt = <940000 925000 940000 940000>; + }; + opp14 { + opp-hz = /bits/ 64 <1470000000>; + opp-microvolt = <940000 925000 940000 940000>; + }; + opp15 { + opp-hz = /bits/ 64 <1578000000>; + opp-microvolt = <1020000 1020000 1020000 1020000>; + }; + }; + + gpu_cs_opp: opp-table-gpucs { + compatible = "operating-points-v2"; + + opp00 { + opp-hz = /bits/ 64 <24000000>; + opp-microvolt = <585000>; + }; + opp01 { + opp-hz = /bits/ 64 <338000000>; + opp-microvolt = <585000>; + }; + opp02 { + opp-hz = /bits/ 64 <618000000>; + opp-microvolt = <635000>; + }; + opp03 { + opp-hz = /bits/ 64 <796000000>; + opp-microvolt = <685000>; + }; + opp04 { + opp-hz = /bits/ 64 <992000000>; + opp-microvolt = <720000>; + }; + opp05 { + opp-hz = /bits/ 64 <1188000000>; + opp-microvolt = <770000>; + }; + opp06 { + opp-hz = /bits/ 64 <1380000000>; + opp-microvolt = <855000>; + }; + opp07 { + opp-hz = /bits/ 64 <1470000000>; + opp-microvolt = <885000>; + }; + }; + + gpu_afr_opp: opp-table-gpuafr { + compatible = "operating-points-v2"; + + opp00 { + opp-hz = /bits/ 64 <24000000>; + opp-microvolt = <585000>; + }; + opp01 { + opp-hz = /bits/ 64 <338000000>; + opp-microvolt = <585000>; + }; + opp02 { + opp-hz = /bits/ 64 <618000000>; + opp-microvolt = <635000>; + }; + opp03 { + opp-hz = /bits/ 64 <796000000>; + opp-microvolt = <685000>; + }; + opp04 { + opp-hz = /bits/ 64 <992000000>; + opp-microvolt = <720000>; + }; + opp05 { + opp-hz = /bits/ 64 <1188000000>; + opp-microvolt = <770000>; + }; + opp06 { + opp-hz = /bits/ 64 <1380000000>; + opp-microvolt = <855000>; + }; + opp07 { + opp-hz = /bits/ 64 <1470000000>; + opp-microvolt = <885000>; + }; + }; +}; + +&gpu { + memory-region = <&gpu_uat_ttbs>, <&gpu_uat_pagetables>, + <&gpu_uat_handoff>, <&gpu_fw_data>, + <&gpu_uat_l2_pagetables>, <&gpu_fw_text>; + memory-region-names = "ttbs", "pagetables", "handoff", "fw-data", + "l2-pagetables", "fw-text"; + operating-points-v2 = <&gpu_opp>; + apple,cs-opp = <&gpu_cs_opp>; + apple,afr-opp = <&gpu_afr_opp>; + apple,firmware-version = <26 5 2>; +}; + +/ { + aliases { + aop = &aop; + }; + speaker_sdz: regulator-sn012776-sdz { + compatible = "regulator-fixed"; + regulator-name = "sn012776-sdz"; + gpios = <&pinctrl 54 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + sound: sound { + compatible = "apple,j616-macaudio", "apple,macaudio"; + model = "MacBook Pro J616"; + #address-cells = <1>; + #size-cells = <0>; + + dai-link@0 { + reg = <0>; + link-name = "Speakers"; + dai-tdm-idle-mode-0 = "zero"; + dai-tdm-idle-mode-1 = "zero"; + dai-tdm-slot-tx-idle-mask-0 = <0xf0f0f0>; + dai-tdm-slot-tx-idle-mask-1 = <0x0f0f0f>; + + 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>; + }; + }; + }; + + sound_jack: sound-jack { + compatible = "apple,j616-macaudio-jack", "apple,macaudio"; + model = "MacBook Pro J616 Jack"; + #address-cells = <1>; + #size-cells = <0>; + + dai-link@0 { + reg = <0>; + link-name = "Headphone Jack"; + + cpu { + sound-dai = <&aop_audio 4>; + }; + + codec { + sound-dai = <&jack_codec>; + }; + }; + }; +}; + +&aop { + status = "okay"; +}; + +&aop_mbox { + status = "okay"; +}; + +&aop_dart { + status = "okay"; +}; + +&admac0 { + status = "okay"; +}; + +&admac1 { + status = "okay"; +}; + +&aop_audio { + apple,chassis-name = "J616"; + apple,machine-kind = "MacBook Pro"; +}; + +&i2c1 { + status = "okay"; + + speaker_left_woof1: codec@38 { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x38>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Left Woofer 1"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <0>; + ti,vmon-slot-no = <2>; + }; + + speaker_left_woof2: codec@39 { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x39>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Left Woofer 2"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <8>; + ti,vmon-slot-no = <10>; + }; + + speaker_left_tweet: codec@3a { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x3a>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Left Tweeter"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <16>; + ti,vmon-slot-no = <18>; + }; +}; + +&i2c3 { + status = "okay"; + + speaker_right_woof1: codec@3b { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x3b>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Right Woofer 1"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <4>; + ti,vmon-slot-no = <6>; + }; + + speaker_right_woof2: codec@3c { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x3c>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Right Woofer 2"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <12>; + ti,vmon-slot-no = <14>; + }; + + speaker_right_tweet: codec@3d { + compatible = "ti,sn012776", "ti,tas2764"; + reg = <0x3d>; + SDZ-supply = <&speaker_sdz>; + apple,sdz-group-fail-closed; + #sound-dai-cells = <0>; + sound-name-prefix = "Right Tweeter"; + interrupts-extended = <&pinctrl 55 IRQ_TYPE_LEVEL_LOW>; + ti,imon-slot-no = <20>; + ti,vmon-slot-no = <22>; + }; +}; + +&i2c2 { + status = "okay"; + + jack_codec: codec@4b { + compatible = "cirrus,cs42l84"; + reg = <0x4b>; + reset-gpios = <&pinctrl_nub 58 GPIO_ACTIVE_HIGH>; + #sound-dai-cells = <0>; + interrupts-extended = <&pinctrl 106 IRQ_TYPE_LEVEL_LOW>; + sound-name-prefix = "Jack"; + }; +}; + +&aop { nonposted-mmio; }; + +&aop_als { status = "disabled"; }; +&aop_las { status = "disabled"; }; + +&admac1 { dma-channels = <26>; nonposted-mmio; }; +&admac0 { nonposted-mmio; }; +&aop_dart { nonposted-mmio; }; +&i2c1 { nonposted-mmio; }; +&i2c2 { nonposted-mmio; }; +&i2c3 { nonposted-mmio; }; + +/ { + reserved-memory { + aop_mmio_pmgr: aop-mmio-pmgr@508304000 { + reg = <0x5 0x08304000 0x0 0x4000>; + iommu-addresses = <&aop 0x5 0x08304000 0x0 0x4000>; + no-map; + }; + }; +}; + +&aop { + memory-region = <&aop_mmio_pmgr>; +}; + +#include "t604x-extdisp.dtsi" + +/delete-node/ &atcphy0_xbar; +/delete-node/ &atcphy2_xbar; + +#include "t6041-j616c-hdmi.dtsi" +#include "t6041-j616c-usbc.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6041.dtsi b/arch/arm64/boot/dts/apple/t6041.dtsi new file mode 100644 index 0000000000000..62c2f817f3096 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041.dtsi @@ -0,0 +1,590 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +// Copyright The Asahi Linux Contributors + +#include "t604x.dtsi" + + +/* Keep the validated T6041 topology independent of unqualified T6040 blocks. */ +/delete-node/ &clk_200m; +/delete-node/ &sio; +/delete-node/ &ave0_dart1; +/delete-node/ &ave0_dart0; +/delete-node/ &apr0_dart; +/delete-node/ &usb4_0_dart; +/delete-node/ &apciec0_dart; +/delete-node/ &usb4_1_dart; +/delete-node/ &apciec1_dart; +/delete-node/ &usb4_2_dart; +/delete-node/ &apciec2_dart; +/delete-node/ &apcie1_dart; +/delete-node/ &sio_dart; +/delete-node/ &jpeg0; +/delete-node/ &jpeg1; +/delete-node/ &jpeg0_dart; +/delete-node/ &jpeg1_dart; +/delete-node/ &scaler0_dart; +/delete-node/ &usb4_0_mbox; +/delete-node/ &usb4_1_mbox; +/delete-node/ &usb4_2_mbox; +/delete-node/ &sio_mbox; +/delete-node/ &pinctrl_smc; +/delete-node/ &ps_gpx; +/delete-node/ &ps_apcie_gp; +/delete-node/ &ps_fab4_soc; +/delete-node/ &ps_sio_cpu; +/delete-node/ &ps_fpwm1; +/delete-node/ &ps_fpwm2; +/delete-node/ &ps_i2c0; +/delete-node/ &ps_i2c5; +/delete-node/ &ps_i2c7; +/delete-node/ &ps_uart_p; +/delete-node/ &ps_dpa_p; +/delete-node/ &ps_aes; +/delete-node/ &ps_spi0; +/delete-node/ &ps_spi1; +/delete-node/ &ps_spi3; +/delete-node/ &ps_spi4; +/delete-node/ &ps_spi5; +/delete-node/ &ps_qspi; +/delete-node/ &ps_uart_n; +/delete-node/ &ps_uart0; +/delete-node/ &ps_uart1; +/delete-node/ &ps_uart2; +/delete-node/ &ps_uart3; +/delete-node/ &ps_uart4; +/delete-node/ &ps_uart5; +/delete-node/ &ps_uart6; +/delete-node/ &ps_dpa0; +/delete-node/ &ps_dpa1; +/delete-node/ &ps_dpa2; +/delete-node/ &ps_dpa3; +/delete-node/ &ps_dpa4; +/delete-node/ &ps_disp_sys; +/delete-node/ &ps_amcc4; +/delete-node/ &ps_amcc5; +/delete-node/ &ps_amcc6; +/delete-node/ &ps_amcc7; +/delete-node/ &ps_amcc12; +/delete-node/ &ps_amcc13; +/delete-node/ &ps_amcc14; +/delete-node/ &ps_amcc15; +/delete-node/ &ps_dcs_04; +/delete-node/ &ps_dcs_05; +/delete-node/ &ps_dcs_06; +/delete-node/ &ps_dcs_07; +/delete-node/ &ps_dcs_12; +/delete-node/ &ps_dcs_13; +/delete-node/ &ps_dcs_14; +/delete-node/ &ps_dcs_15; +/delete-node/ &ps_disp_fe; +/delete-node/ &ps_apcie_sys_gp; +/delete-node/ &ps_apcie_phy_sw; +/delete-node/ &ps_jpg; +/delete-node/ &pmgr_disp; +/delete-node/ &ps_ecpu_0; +/delete-node/ &ps_ecpu_2; +/delete-node/ &ps_dwi; +/delete-node/ &ps_aic; +/delete-node/ &ps_pmc; +/delete-node/ &ps_pms_c1ppt; +/delete-node/ &ps_soc_dpe; +/delete-node/ &ps_pmgr_soc_ocla; +/delete-node/ &ps_pms_fpwm0; +/delete-node/ &ps_pms_fpwm1; +/delete-node/ &ps_pms_fpwm2; +/delete-node/ &ps_pms_fpwm3; +/delete-node/ &ps_pms_fpwm4; +/delete-node/ &ps_fab0_soc; +/delete-node/ &ps_ecpu_3; +/delete-node/ &ps_amcc0; +/delete-node/ &ps_dcs_00; +/delete-node/ &ps_rom; +/delete-node/ &ps_amcc1; +/delete-node/ &ps_dcs_01; +/delete-node/ &ps_amcc2; +/delete-node/ &ps_dcs_02; +/delete-node/ &ps_amcc3; +/delete-node/ &ps_dcs_03; +/delete-node/ &ps_amcc8; +/delete-node/ &ps_dcs_08; +/delete-node/ &ps_amcc9; +/delete-node/ &ps_dcs_09; +/delete-node/ &ps_amcc10; +/delete-node/ &ps_dcs_10; +/delete-node/ &ps_amcc11; +/delete-node/ &ps_pcpu0_0; +/delete-node/ &ps_dcs_11; +/delete-node/ &ps_venc0_sys; +/delete-node/ &ps_pcpu0_1; +/delete-node/ &ps_fab_gw_0; +/delete-node/ &ps_fab_gw_1; +/delete-node/ &ps_fab_afr; +/delete-node/ &ps_fab1_soc; +/delete-node/ &ps_pcpu0_2; +/delete-node/ &ps_scodec; +/delete-node/ &ps_scodec_streaming; +/delete-node/ &ps_fab2_soc; +/delete-node/ &ps_dispext0_sys; +/delete-node/ &ps_dispext0_fe; +/delete-node/ &ps_dispext0_cpu; +/delete-node/ &ps_pcpu0_3; +/delete-node/ &ps_atc0_cio; +/delete-node/ &ps_atc0_pcie; +/delete-node/ &ps_atc0_cio_pcie; +/delete-node/ &ps_atc0_cio_usb; +/delete-node/ &ps_atc1_cio; +/delete-node/ &ps_atc1_pcie; +/delete-node/ &ps_atc1_cio_pcie; +/delete-node/ &ps_atc1_cio_usb; +/delete-node/ &ps_atc2_cio; +/delete-node/ &ps_atc2_pcie; +/delete-node/ &ps_atc2_cio_pcie; +/delete-node/ &ps_pcpu0_4; +/delete-node/ &ps_atc2_cio_usb; +/delete-node/ &ps_atc3_cio; +/delete-node/ &ps_atc3_pcie; +/delete-node/ &ps_atc3_cio_pcie; +/delete-node/ &ps_atc3_cio_usb; +/delete-node/ &ps_fab5_soc; +/delete-node/ &ps_sbr; +/delete-node/ &ps_gpio; +/delete-node/ &ps_msg; +/delete-node/ &ps_ap_tmm; +/delete-node/ &ps_msr0; +/delete-node/ &ps_msr0_ase_core; +/delete-node/ &ps_pcpu0_5; +/delete-node/ &ps_fab7_soc; +/delete-node/ &ps_dispext1_sys; +/delete-node/ &ps_dispext1_fe; +/delete-node/ &ps_dispext1_cpu; +/delete-node/ &ps_pcpu1_0; +/delete-node/ &ps_pcpu1_1; +/delete-node/ &ps_pcpu1_2; +/delete-node/ &ps_pcpu1_3; +/delete-node/ &ps_pcpu1_4; +/delete-node/ &ps_pcpu1_5; +/delete-node/ &ps_ecpu_1; +/delete-node/ &ps_ecpm; +/delete-node/ &ps_pcpm0; +/delete-node/ &ps_pcpm1; +/delete-node/ &pmgr_venc; +/delete-node/ &ps_debug_gated; +/delete-node/ &ps_nub_fabric; +/delete-node/ &ps_nub_sram; +/delete-node/ &ps_debug_switch; +/delete-node/ &ps_nub_spmi_ahb; +/delete-node/ &ps_nub_spmi0; +/delete-node/ &ps_nub_spmi_a2; +/delete-node/ &ps_nub_spi0; +/delete-node/ &ps_nub_aon; +/delete-node/ &ps_nub_ocla; +/delete-node/ &ps_nub_spmi1; +/delete-node/ &ps_nub_spmi2; +/delete-node/ &ps_nub_spmi3; +/delete-node/ &ps_nub_spmi4; +/delete-node/ &dcuart; +/delete-node/ &spi4; +/delete-node/ &qspi; +/delete-node/ &nub_spmi1; +/delete-node/ &nub_spmi2; +/delete-node/ &nub_spmi3; +/delete-node/ &nub_spmi4; +/delete-node/ &aop_spmi0; +/delete-node/ &ave; + +/delete-node/ &aop_accel; +/delete-node/ &aop_gyro; +/delete-node/ &pmc_soc_max; +/delete-node/ &pmu_rtc; + +/ { + /delete-node/ pmu; +}; + +&avd { + compatible = "apple,t6041-max-avd", "apple,t6041-avd", "apple,t8132-avd"; + power-domains = <&ps_avd_sys>; + /delete-property/ power-domain-names; +}; + +&nub_spmi0 { + /delete-property/ interrupt-controller; + /delete-property/ #interrupt-cells; + /delete-property/ interrupt-parent; + /delete-property/ interrupts; +}; + +&usb_drd0_dart_0 { + /delete-property/ apple,dma-range; +}; + +&usb_drd0_dart_1 { + /delete-property/ apple,dma-range; +}; + +&usb_drd1_dart_0 { + /delete-property/ apple,dma-range; +}; + +&usb_drd1_dart_1 { + /delete-property/ apple,dma-range; +}; + +&usb_drd2_dart_0 { + /delete-property/ apple,dma-range; +}; + +&usb_drd2_dart_1 { + /delete-property/ apple,dma-range; +}; + +&mtp_dart { + /delete-property/ apple,dma-range; +}; + +&{/opp-table-e/opp01} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp02} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp03} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp04} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp05} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp06} { + /delete-property/ opp-microwatt; +}; + +&{/opp-table-e/opp07} { + /delete-property/ opp-microwatt; +}; + +&ps_avd_sys { + /delete-property/ power-domains; +}; + +&ps_atc0_common { + /delete-property/ power-domains; +}; + +&ps_atc1_common { + /delete-property/ power-domains; +}; + +&ps_atc2_common { + /delete-property/ power-domains; +}; + +&ps_atc3_common { + /delete-property/ power-domains; +}; + +/* FAB4_SOC and FAB5_SOC are critical, on from iBoot and not described here. */ +&ps_ane_sys { + /delete-property/ power-domains; +}; + +&ps_pmp { + /delete-property/ power-domains; +}; + +&ps_pms_sram { + /delete-property/ power-domains; +}; + +&serial0 { + /delete-property/ power-domains; + /delete-property/ status; +}; + +/delete-node/ &gpu; +/delete-node/ &gfx_mbox; +/delete-node/ &opp_p0; +/delete-node/ &opp_p1; + +/ { + opp_p0: opp-table-p0 { + compatible = "operating-points-v2"; + opp-shared; + + opp01 { + opp-hz = /bits/ 64 <1260000000>; + opp-level = <1>; + clock-latency-ns = <7200>; + }; + opp02 { + opp-hz = /bits/ 64 <1512000000>; + opp-level = <2>; + clock-latency-ns = <19000>; + }; + opp03 { + opp-hz = /bits/ 64 <1800000000>; + opp-level = <3>; + clock-latency-ns = <20000>; + }; + opp04 { + opp-hz = /bits/ 64 <2088000000>; + opp-level = <4>; + clock-latency-ns = <22000>; + }; + opp05 { + opp-hz = /bits/ 64 <2352000000>; + opp-level = <5>; + clock-latency-ns = <30000>; + }; + opp06 { + opp-hz = /bits/ 64 <2616000000>; + opp-level = <6>; + clock-latency-ns = <34000>; + }; + opp07 { + opp-hz = /bits/ 64 <2868000000>; + opp-level = <7>; + clock-latency-ns = <37000>; + }; + opp08 { + opp-hz = /bits/ 64 <3096000000>; + opp-level = <8>; + clock-latency-ns = <38000>; + }; + opp09 { + opp-hz = /bits/ 64 <3300000000>; + opp-level = <9>; + clock-latency-ns = <40000>; + }; + opp10 { + opp-hz = /bits/ 64 <3468000000>; + opp-level = <10>; + clock-latency-ns = <41000>; + }; + opp11 { + opp-hz = /bits/ 64 <3624000000>; + opp-level = <11>; + clock-latency-ns = <43000>; + }; + opp12 { + opp-hz = /bits/ 64 <3756000000>; + opp-level = <12>; + clock-latency-ns = <44000>; + }; + opp13 { + opp-hz = /bits/ 64 <3828000000>; + opp-level = <13>; + clock-latency-ns = <45000>; + }; + opp14 { + opp-hz = /bits/ 64 <3888000000>; + opp-level = <14>; + clock-latency-ns = <46000>; + }; + opp15 { + opp-hz = /bits/ 64 <3948000000>; + opp-level = <15>; + clock-latency-ns = <47000>; + }; + opp16 { + opp-hz = /bits/ 64 <3996000000>; + opp-level = <16>; + clock-latency-ns = <48000>; + }; + opp17 { + opp-hz = /bits/ 64 <4044000000>; + opp-level = <17>; + clock-latency-ns = <49000>; + }; + opp18 { + opp-hz = /bits/ 64 <4104000000>; + opp-level = <18>; + clock-latency-ns = <50000>; + }; + opp19 { + opp-hz = /bits/ 64 <4416000000>; + opp-level = <19>; + clock-latency-ns = <55000>; + turbo-mode; + }; + opp20 { + opp-hz = /bits/ 64 <4512000000>; + opp-level = <20>; + clock-latency-ns = <56000>; + turbo-mode; + }; + }; + + opp_p1: opp-table-p1 { + compatible = "operating-points-v2"; + opp-shared; + + opp01 { + opp-hz = /bits/ 64 <1260000000>; + opp-level = <1>; + clock-latency-ns = <7200>; + }; + opp02 { + opp-hz = /bits/ 64 <1512000000>; + opp-level = <2>; + clock-latency-ns = <19000>; + }; + opp03 { + opp-hz = /bits/ 64 <1800000000>; + opp-level = <3>; + clock-latency-ns = <20000>; + }; + opp04 { + opp-hz = /bits/ 64 <2088000000>; + opp-level = <4>; + clock-latency-ns = <22000>; + }; + opp05 { + opp-hz = /bits/ 64 <2352000000>; + opp-level = <5>; + clock-latency-ns = <30000>; + }; + opp06 { + opp-hz = /bits/ 64 <2616000000>; + opp-level = <6>; + clock-latency-ns = <34000>; + }; + opp07 { + opp-hz = /bits/ 64 <2868000000>; + opp-level = <7>; + clock-latency-ns = <37000>; + }; + opp08 { + opp-hz = /bits/ 64 <3096000000>; + opp-level = <8>; + clock-latency-ns = <38000>; + }; + opp09 { + opp-hz = /bits/ 64 <3300000000>; + opp-level = <9>; + clock-latency-ns = <40000>; + }; + opp10 { + opp-hz = /bits/ 64 <3468000000>; + opp-level = <10>; + clock-latency-ns = <41000>; + }; + opp11 { + opp-hz = /bits/ 64 <3624000000>; + opp-level = <11>; + clock-latency-ns = <43000>; + }; + opp12 { + opp-hz = /bits/ 64 <3756000000>; + opp-level = <12>; + clock-latency-ns = <44000>; + }; + opp13 { + opp-hz = /bits/ 64 <3828000000>; + opp-level = <13>; + clock-latency-ns = <45000>; + }; + opp14 { + opp-hz = /bits/ 64 <3888000000>; + opp-level = <14>; + clock-latency-ns = <46000>; + }; + opp15 { + opp-hz = /bits/ 64 <3948000000>; + opp-level = <15>; + clock-latency-ns = <47000>; + }; + opp16 { + opp-hz = /bits/ 64 <3996000000>; + opp-level = <16>; + clock-latency-ns = <48000>; + }; + opp17 { + opp-hz = /bits/ 64 <4044000000>; + opp-level = <17>; + clock-latency-ns = <49000>; + }; + opp18 { + opp-hz = /bits/ 64 <4104000000>; + opp-level = <18>; + clock-latency-ns = <50000>; + }; + opp19 { + opp-hz = /bits/ 64 <4416000000>; + opp-level = <19>; + clock-latency-ns = <55000>; + turbo-mode; + }; + opp20 { + opp-hz = /bits/ 64 <4512000000>; + opp-level = <20>; + clock-latency-ns = <56000>; + turbo-mode; + }; + }; + +}; + +&cpu_p00 { + enable-method = "spin-table"; + cpu-release-addr = <0 0>; +}; + +&aic { + reg = <0x5 0x02400000 0x0 0x1cc000>, + <0x5 0x02440000 0x0 0x4>; +}; + +&smc { + reg = <0x5 0x0c600000 0x0 0x4000>, + <0x5 0x0de00000 0x0 0x170000>; +}; + +&pmc { + /delete-property/ apple,pmp; + apple,static-voters = <1 3>; +}; + +/ { + gpu: gpu@288000000 { + compatible = "apple,agx-t6041"; + reg = <0x2 0x8a600000 0x0 0x88000>, + <0x2 0x88000000 0x0 0x3758000>; + reg-names = "asc", "sgx"; + mboxes = <&gfx_mbox>; + power-domains = <&ps_gfx>; + status = "disabled"; + }; + + gfx_mbox: mailbox@28a600000 { + compatible = "apple,t6040-ascwrap-v6"; + reg = <0x2 0x8a600000 0x0 0x88000>, + <0x2 0x8a050000 0x0 0x8>; + reg-names = "wrapper", "iop-vbar"; + interrupt-parent = <&aic>; + interrupts = , + ; + interrupt-names = "send-empty", "recv-not-empty"; + apple,firmware-role = "GFX"; + power-domains = <&ps_gfx>; + #mbox-cells = <0>; + status = "disabled"; + }; +}; + +&ps_afr { + apple,always-on; + apple,no-auto-pm; +}; + +&ps_gfx { + apple,always-on; + apple,no-auto-pm; +}; diff --git a/arch/arm64/boot/dts/apple/t604x-extdisp.dtsi b/arch/arm64/boot/dts/apple/t604x-extdisp.dtsi new file mode 100644 index 0000000000000..dcbce6e842cd9 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t604x-extdisp.dtsi @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * External display blocks of the T604x: the external display processors and + * their mailboxes, the fixed DP PHY of ATC3 and the ATC display crossbars. + * Every node is disabled. The board adds the wiring, the power it runs on and + * the ATC3 tables that differ between boards. + */ + +/ { + dcpext0: dcp@3a2e00000 { + compatible = "apple,t6041-dcpext", "apple,dcpext"; + reg = <0x3 0xa2e00000 0x0 0x4000>, + <0x3 0xa0000000 0x0 0x4000000>, + <0x3 0xa2240000 0x0 0x10000>, + <0x3 0xa23a8000 0x0 0x4000>, + <0x3 0xa2800000 0x0 0x800000>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + mboxes = <&dcpext0_mbox>; + mbox-names = "mbox"; + iommus = <&dcpext0_dart 23>; + /* guessed: the internal DCP uses 0x20000, J700 DISPEXT0 is +0x8000 */ + apple,bw-scratch = <&pmgr_dcp 0 4 0x28000>; + /* firmware Disp_Index, the dual-pipe endpoint ID */ + apple,dcp-endpoint = <1>; + /* the only pipe that can be the primary of a two-pipe display */ + apple,typec-hybrid-first; + status = "disabled"; + + dispext0_piodma: piodma { + iommus = <&dispext0_dart 16>; + }; + }; + + dcpext0_mbox: mailbox@3a2e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0xa2e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + dcpext1: dcp@602e00000 { + compatible = "apple,t6041-dcpext", "apple,dcpext"; + reg = <0x6 0x02e00000 0x0 0x4000>, + <0x6 0x00000000 0x0 0x4000000>, + <0x6 0x02240000 0x0 0x10000>, + <0x6 0x023a8000 0x0 0x4000>, + <0x6 0x02800000 0x0 0x800000>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + mboxes = <&dcpext1_mbox>; + mbox-names = "mbox"; + iommus = <&dcpext1_dart 23>; + /* guessed, as dcpext0 */ + apple,bw-scratch = <&pmgr_dcp 0 4 0x30000>; + apple,dcp-endpoint = <2>; + status = "disabled"; + + dispext1_piodma: piodma { + iommus = <&dispext1_dart 16>; + }; + }; + + dcpext1_mbox: mailbox@602e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x6 0x02e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + /* ATC3: the HDMI converter's fixed DP PHY; no USB controller, no pipehandler. */ + atcphy3: phy@39aa90000 { + compatible = "apple,t6040-atcphy"; + reg = <0x3 0x9aa90000 0x0 0x4000>, + <0x3 0x9a800000 0x0 0x4000>, + <0x3 0x9b000000 0x0 0x30000>, + <0x3 0x9b200000 0x0 0x4000>, + <0x3 0x9b140000 0x0 0x4000>, + <0x3 0x9b0c0000 0x0 0x10000>, + <0x3 0x98000000 0x0 0x8000>, + <0x3 0x98020000 0x0 0x4000>, + <0x3 0x9b244000 0x0 0x4000>, + <0x3 0x9b250000 0x0 0x4000>; + reg-names = "bank0", "bank1", "core", "cfg", "cpu", "cpu-data", + "axi2af", "axi2af-lioa", "fabric", "common-cfg"; + #phy-cells = <1>; + power-domains = <&ps_atc3_common_dp>; + mboxes = <&atcphy3_mbox>; + mbox-names = "phy-cpu"; + nonposted-mmio; + status = "disabled"; + apple,tunable-axi2af = + <0x0 0x800000ff 0x80000025>, + <0x4 0x80ff00ff 0x80250003>, + <0x8 0x80ff00ff 0x80250003>, + <0xc 0x80ff00ff 0x80250005>, + <0x10 0x80ff00ff 0x80250003>, + <0x14 0x80ff00ff 0x80250003>, + <0x18 0x80ff00ff 0x80250003>, + <0x1c 0x80ff00ff 0x80250003>, + <0x20 0x800000ff 0x8000001e>, + <0x24 0x800000ff 0x8000004a>, + <0x28 0x80ff00ff 0x804a0006>, + <0x2c 0x80ff00ff 0x804a0006>, + <0x30 0x80ff00ff 0x804a0006>, + <0x34 0x80ff00ff 0x804a0006>, + <0x38 0x80ff00ff 0x804a0006>, + <0x3c 0x80ff00ff 0x804a0006>, + <0x40 0x800000ff 0x8000001e>, + <0x44 0x800000ff 0x8000001e>, + <0x48 0x800000ff 0x8000001e>, + <0x100 0x000000ff 0x000000ff>, + <0x108 0xffff0006 0x00100000>, + <0x304 0x3f3f0000 0x04040000>, + <0x308 0x000fffff 0x00001681>, + <0x30c 0x000fffff 0x00001680>, + <0x310 0x70000fff 0x000001e0>, + <0x314 0xf0000fff 0x800001e0>, + <0x318 0x70000fff 0x000001e0>, + <0x31c 0xf0000fff 0x800001e0>, + <0x320 0x70000fff 0x000005a0>, + <0x324 0xf0000fff 0x800005a0>, + <0x328 0x70000fff 0x000005a0>, + <0x32c 0xf0000fff 0x800005a0>, + <0x330 0x70000fff 0x000005a0>, + <0x334 0xf0000fff 0x800005a0>, + <0x338 0x70000fff 0x000005a0>, + <0x33c 0x70000fff 0x000005a0>, + <0x340 0x70000fff 0x000005a0>, + <0x344 0x70000fff 0x000005a0>, + <0x348 0x70000fff 0x000005a0>, + <0x34c 0x70000fff 0x000005a0>, + <0x350 0x70000fff 0x000005a0>, + <0x358 0xffffffff 0x0000ffff>, + <0x35c 0xffffffff 0x0000ffff>, + <0x408 0xffff0020 0x00210020>, + <0x40c 0x000fffff 0x00001681>, + <0x410 0x000fffff 0x00001680>, + <0x414 0x70000fff 0x000001e0>, + <0x418 0x70000fff 0x000001e0>, + <0x41c 0x70000fff 0x000001e0>, + <0x420 0x70000fff 0x000001e0>, + <0x424 0x70000fff 0x000005a0>, + <0x428 0x70000fff 0x000005a0>, + <0x42c 0x70000fff 0x000005a0>, + <0x430 0x70000fff 0x000005a0>, + <0x434 0x70000fff 0x000005a0>, + <0x438 0x70000fff 0x000005a0>, + <0x43c 0x70000fff 0x000005a0>, + <0x440 0x70000fff 0x000005a0>, + <0x444 0x70000fff 0x000005a0>, + <0x448 0x70000fff 0x000005a0>, + <0x44c 0x70000fff 0x000005a0>, + <0x450 0x70000fff 0x000005a0>, + <0x454 0x70000fff 0x000005a0>, + <0x948 0x07ff07ff 0x00280000>, + <0xa48 0x07ff07ff 0x00400040>, + <0xb48 0x07ff07ff 0x00b8010e>, + <0xc48 0x07ff07ff 0x00400020>, + <0xd48 0x07ff07ff 0x008a008a>, + <0x1000 0xffffffff 0x7fffffff>, + <0x4008 0x00000001 0x00000001>, + <0x400c 0x00000001 0x00000001>, + <0x4014 0x00000001 0x00000001>, + <0x4018 0x00000001 0x00000000>, + <0x401c 0x00000001 0x00000001>; + apple,tunable-fabric = + <0x4 0x003f003f 0x00200020>, + <0xc 0x000000f1 0x000000a1>, + <0x10 0x0000801f 0x00000004>, + <0x18 0x003f003f 0x00200020>, + <0x20 0x000000f1 0x000000a1>, + <0x24 0x0000801f 0x00000004>, + <0x2c 0x00ff00ff 0x00960096>, + <0x34 0x000000f1 0x00000071>, + <0x38 0x0000801f 0x00000004>, + <0x40 0x0000003f 0x00000020>, + <0x48 0x0000801f 0x00000004>, + <0x50 0x007f007f 0x00450045>, + <0x58 0x0000801f 0x00000004>, + <0x60 0x0000003f 0x00000020>, + <0x68 0x0000801f 0x00000004>, + <0x70 0x00000001 0x00000001>, + <0x74 0x0000801f 0x00000004>, + <0x7c 0x007f007f 0x00400040>, + <0x80 0x000000f1 0x00000011>, + <0x84 0x00000001 0x00000001>, + <0x88 0x00000001 0x00000001>, + <0x8c 0x0000801f 0x00000004>, + <0x94 0x001f001f 0x00100010>, + <0x98 0x000000f1 0x00000011>, + <0x9c 0x0000801f 0x00000004>, + <0xa4 0x000000ff 0x000000e0>, + <0xa8 0x0000801f 0x00000004>, + <0xb0 0x0000003f 0x00000020>, + <0xb8 0x0000801f 0x00000004>, + <0xc0 0x0000003f 0x00000020>, + <0xc8 0x0000801f 0x00000004>, + <0xd0 0x001f001f 0x00100010>, + <0xd8 0x00000001 0x00000001>, + <0xdc 0x00000001 0x00000001>, + <0xe0 0x0000801f 0x00000004>, + <0xe8 0x0000000f 0x00000008>, + <0xec 0x0000801f 0x00000004>, + <0xf4 0xffffffff 0x01010101>, + <0xf8 0x0000801f 0x00000004>, + <0x100 0x00000001 0x00000001>, + <0x104 0x00000001 0x00000001>, + <0x108 0x0000801f 0x00000004>, + <0x110 0x0000801f 0x00000004>, + <0x118 0x0000801f 0x00000004>, + <0x120 0x00000001 0x00000001>, + <0x124 0x00000001 0x00000001>, + <0x128 0x0000801f 0x00000004>, + <0x130 0xffffffff 0x01010101>, + <0x134 0x0000801f 0x00000004>, + <0x13c 0x00000001 0x00000001>, + <0x140 0x00000001 0x00000001>, + <0x144 0x0000801f 0x00000004>, + <0x14c 0x00000001 0x00000001>, + <0x150 0x00000001 0x00000001>, + <0x154 0x0000801f 0x00000004>, + <0x15c 0x0000801f 0x00000004>, + <0x164 0xffffffff 0x01010101>, + <0x168 0x0000ffff 0x00000101>, + <0x16c 0x0000801f 0x00000004>, + <0x174 0x00000001 0x00000001>, + <0x178 0x00000001 0x00000001>, + <0x17c 0x0000801f 0x00000004>, + <0x184 0x00000001 0x00000001>, + <0x188 0x00000001 0x00000001>, + <0x18c 0x0000801f 0x00000004>; + apple,tunable-common-cfg = + <0x8 0x00000001 0x00000001>; + apple,tunable-axi2af-lioa = + <0x28 0x0000fe2f 0x00000000>, + <0x2c 0x00000007 0x00000000>, + <0x30 0x0000007f 0x00000000>, + <0x34 0x000000ff 0x00000000>, + <0x58 0x0000010b 0x00000000>; + apple,tunable-lane0 = + <0xd094 0x00080000 0x00080000>, + <0xd098 0x00080000 0x00080000>, + <0xd0a4 0x00800000 0x00800000>, + <0xd0a8 0x00200000 0x00200000>; + apple,tunable-lane1 = + <0x1d094 0x00080000 0x00080000>, + <0x1d098 0x00080000 0x00080000>, + <0x1d0a4 0x00800000 0x00800000>, + <0x1d0a8 0x00200000 0x00200000>; + }; + + atcphy3_mbox: mailbox@39b148000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x9b148000 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_phymxwrap>; + status = "disabled"; + }; + + /* Display crossbars (ADT atcN-dpxbar, atc-dpxbar,t604x). */ + atcphy0_xbar: mux@38324c000 { + compatible = "apple,t6041-display-crossbar"; + reg = <0x3 0x8324c000 0x0 0x4000>; + #mux-control-cells = <1>; + status = "disabled"; + power-domains = <&ps_atc0_usb>; + }; + + atcphy1_xbar: mux@38b24c000 { + compatible = "apple,t6041-display-crossbar"; + reg = <0x3 0x8b24c000 0x0 0x4000>; + #mux-control-cells = <1>; + status = "disabled"; + power-domains = <&ps_atc1_usb>; + }; + + atcphy2_xbar: mux@39324c000 { + compatible = "apple,t6041-display-crossbar"; + reg = <0x3 0x9324c000 0x0 0x4000>; + #mux-control-cells = <1>; + status = "disabled"; + power-domains = <&ps_atc2_usb>; + }; + + atcphy3_xbar: mux@39b24c000 { + compatible = "apple,t6041-display-crossbar"; + reg = <0x3 0x9b24c000 0x0 0x4000>; + #mux-control-cells = <1>; + status = "disabled"; + power-domains = <&ps_atc3_usb>; + }; +}; + +&ps_atc3_common { + apple,always-on; +}; + +&ps_atc3_usb_aon { + apple,always-on; +}; + +&ps_atc3_common_dp { + power-domains = <&ps_atc3_phymxwrap>; +}; diff --git a/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi b/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi index 27593217fd195..ba1f428b4ee04 100644 --- a/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi +++ b/arch/arm64/boot/dts/apple/t604x-j614-j616.dtsi @@ -4822,6 +4822,7 @@ #include "t6040-j616s-usb3.dtsi" /* External display chain, all disabled: the gate in drivers/soc/apple/display-gate.c enables it. */ +#include "t604x-extdisp.dtsi" #include "t6040-j616s-extdisp.dtsi" #include "t6040-j616s-extdisp-mem-loader.dtsi" #include "t6040-j616s-extdisp-hdmi.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6040-pmgr.dtsi b/arch/arm64/boot/dts/apple/t604x-pmgr.dtsi similarity index 100% rename from arch/arm64/boot/dts/apple/t6040-pmgr.dtsi rename to arch/arm64/boot/dts/apple/t604x-pmgr.dtsi diff --git a/arch/arm64/boot/dts/apple/t604x.dtsi b/arch/arm64/boot/dts/apple/t604x.dtsi new file mode 100644 index 0000000000000..178f1b061283e --- /dev/null +++ b/arch/arm64/boot/dts/apple/t604x.dtsi @@ -0,0 +1,2471 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Apple T604x SoC base + * + * Unit addresses are the Apple Device Tree's /arm-io addresses plus the + * 0x2_00000000 arm-io base. The nodes sit at the root, not under a + * simple-bus: the boot loader edits several of them by path. The blocks + * known to need non-posted writes carry nonposted-mmio themselves. + * + * Copyright The Asahi Linux Contributors + */ + +#include +#include +#include +#include +#include +#include + +/ { + #address-cells = <2>; + #size-cells = <2>; + + cpuidle: cpuidle { + compatible = "apple,t6041-cpuidle"; + status = "disabled"; + }; + + cpus { + #address-cells = <2>; + #size-cells = <0>; + + /* + * The clusters are MPIDR Aff1, which are also the L2 groups. + * capacity-dmips-mhz comes from pinned single-core throughput + * at the lowest p-state (E 1018 MHz, P 1257 MHz): E/P is 0.652 + * per MHz, so E 668 and P 1024. + */ + cpu-map { + cluster0 { + core0 { + cpu = <&cpu_e0>; + }; + core1 { + cpu = <&cpu_e1>; + }; + core2 { + cpu = <&cpu_e2>; + }; + core3 { + cpu = <&cpu_e3>; + }; + }; + + cluster1 { + core0 { + cpu = <&cpu_p00>; + }; + core1 { + cpu = <&cpu_p01>; + }; + core2 { + cpu = <&cpu_p02>; + }; + core3 { + cpu = <&cpu_p03>; + }; + core4 { + cpu = <&cpu_p04>; + }; + core5 { + cpu = <&cpu_p05>; + }; + }; + + cluster2 { + core0 { + cpu = <&cpu_p10>; + }; + core1 { + cpu = <&cpu_p11>; + }; + core2 { + cpu = <&cpu_p12>; + }; + core3 { + cpu = <&cpu_p13>; + }; + core4 { + cpu = <&cpu_p14>; + }; + core5 { + cpu = <&cpu_p15>; + }; + }; + }; + + /* m1n1 requires CPU nodes in MPIDR order. */ + cpu_e0: cpu@0 { + compatible = "apple,brava-e"; + device_type = "cpu"; + reg = <0x0 0x0>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_e>; + operating-points-v2 = <&opp_e>; + capacity-dmips-mhz = <668>; + performance-domains = <&cpufreq_e>; + #cooling-cells = <2>; + }; + + cpu_e1: cpu@1 { + compatible = "apple,brava-e"; + device_type = "cpu"; + reg = <0x0 0x1>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_e>; + operating-points-v2 = <&opp_e>; + capacity-dmips-mhz = <668>; + performance-domains = <&cpufreq_e>; + #cooling-cells = <2>; + }; + + cpu_e2: cpu@2 { + compatible = "apple,brava-e"; + device_type = "cpu"; + reg = <0x0 0x2>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_e>; + operating-points-v2 = <&opp_e>; + capacity-dmips-mhz = <668>; + performance-domains = <&cpufreq_e>; + #cooling-cells = <2>; + }; + + cpu_e3: cpu@3 { + compatible = "apple,brava-e"; + device_type = "cpu"; + reg = <0x0 0x3>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_e>; + operating-points-v2 = <&opp_e>; + capacity-dmips-mhz = <668>; + performance-domains = <&cpufreq_e>; + #cooling-cells = <2>; + }; + + /* The boot CPU: the boot loader enters the kernel on it. */ + cpu_p00: cpu@10100 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10100>; + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p01: cpu@10101 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10101>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p02: cpu@10102 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10102>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p03: cpu@10103 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10103>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p04: cpu@10104 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10104>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p05: cpu@10105 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10105>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; + next-level-cache = <&l2_cache_p0>; + operating-points-v2 = <&opp_p0>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p0>; + #cooling-cells = <2>; + }; + + cpu_p10: cpu@10200 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10200>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + + cpu_p11: cpu@10201 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10201>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + + cpu_p12: cpu@10202 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10202>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + + cpu_p13: cpu@10203 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10203>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + + cpu_p14: cpu@10204 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10204>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; /* To be filled by loader */ + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + + cpu_p15: cpu@10205 { + compatible = "apple,brava-p"; + device_type = "cpu"; + reg = <0x0 0x10205>; + enable-method = "spin-table"; + cpu-release-addr = <0 0>; + next-level-cache = <&l2_cache_p1>; + operating-points-v2 = <&opp_p1>; + capacity-dmips-mhz = <1024>; + performance-domains = <&cpufreq_p1>; + #cooling-cells = <2>; + }; + }; + + l2_cache_e: l2-cache-cluster0 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x400000>; + }; + + l2_cache_p0: l2-cache-cluster1 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x1000000>; + }; + + l2_cache_p1: l2-cache-cluster2 { + compatible = "cache"; + cache-level = <2>; + cache-unified; + cache-size = <0x1000000>; + }; + + /* + * DVFS states from the ADT: /arm-io/pmgr voltage-states1-sram (E), + * voltage-states5-sram (P0) and voltage-states13-sram (P1), word 0 + * in kHz. opp-level is the hardware p-state. Each P cluster has its + * own table even though the frequencies are the same: opp-shared + * means one clock domain per table. + * + * opp-microwatt is the power of one busy core, measured on a J616s + * from the SMC core-rail meters (P0 PR0b, P1 PP0b, E PP2b) with the + * cluster pinned at each state. The P values follow a k * V^2 * f + c + * fit to the sweep, because the PMP's die-temperature limit clips the + * two top states within seconds. One busy E core does not register on + * its meter below 2352 MHz, so the E values are the idle cluster plus + * a quarter of the four-core increase. + */ + opp_e: opp-table-e { + compatible = "operating-points-v2"; + opp-shared; + + opp01 { + opp-hz = /bits/ 64 <1020000000>; + opp-level = <1>; + opp-microwatt = <81900>; + }; + opp02 { + opp-hz = /bits/ 64 <1404000000>; + opp-level = <2>; + opp-microwatt = <133100>; + }; + opp03 { + opp-hz = /bits/ 64 <1788000000>; + opp-level = <3>; + opp-microwatt = <209400>; + }; + opp04 { + opp-hz = /bits/ 64 <2112000000>; + opp-level = <4>; + opp-microwatt = <301400>; + }; + opp05 { + opp-hz = /bits/ 64 <2352000000>; + opp-level = <5>; + opp-microwatt = <383900>; + }; + opp06 { + opp-hz = /bits/ 64 <2532000000>; + opp-level = <6>; + opp-microwatt = <478500>; + }; + opp07 { + opp-hz = /bits/ 64 <2592000000>; + opp-level = <7>; + opp-microwatt = <531000>; + }; + }; + + opp_p0: opp-table-p0 { + compatible = "operating-points-v2"; + opp-shared; + + opp01 { + opp-hz = /bits/ 64 <1260000000>; + opp-level = <1>; + opp-microwatt = <513000>; + }; + opp02 { + opp-hz = /bits/ 64 <1512000000>; + opp-level = <2>; + opp-microwatt = <715000>; + }; + opp03 { + opp-hz = /bits/ 64 <1800000000>; + opp-level = <3>; + opp-microwatt = <907500>; + }; + opp04 { + opp-hz = /bits/ 64 <2088000000>; + opp-level = <4>; + opp-microwatt = <1158200>; + }; + opp05 { + opp-hz = /bits/ 64 <2352000000>; + opp-level = <5>; + opp-microwatt = <1494500>; + }; + opp06 { + opp-hz = /bits/ 64 <2616000000>; + opp-level = <6>; + opp-microwatt = <1782600>; + }; + opp07 { + opp-hz = /bits/ 64 <2868000000>; + opp-level = <7>; + opp-microwatt = <2209600>; + }; + opp08 { + opp-hz = /bits/ 64 <3096000000>; + opp-level = <8>; + opp-microwatt = <2636700>; + }; + opp09 { + opp-hz = /bits/ 64 <3300000000>; + opp-level = <9>; + opp-microwatt = <3247200>; + }; + opp10 { + opp-hz = /bits/ 64 <3468000000>; + opp-level = <10>; + opp-microwatt = <3668700>; + }; + opp11 { + opp-hz = /bits/ 64 <3624000000>; + opp-level = <11>; + opp-microwatt = <4128200>; + }; + opp12 { + opp-hz = /bits/ 64 <3756000000>; + opp-level = <12>; + opp-microwatt = <4819300>; + }; + opp13 { + opp-hz = /bits/ 64 <3852000000>; + opp-level = <13>; + opp-microwatt = <4977700>; + }; + opp14 { + opp-hz = /bits/ 64 <3924000000>; + opp-level = <14>; + opp-microwatt = <5315900>; + }; + opp15 { + opp-hz = /bits/ 64 <3996000000>; + opp-level = <15>; + opp-microwatt = <5575900>; + }; + opp16 { + opp-hz = /bits/ 64 <4044000000>; + opp-level = <16>; + opp-microwatt = <5773400>; + }; + opp17 { + opp-hz = /bits/ 64 <4104000000>; + opp-level = <17>; + opp-microwatt = <5969200>; + }; + opp18 { + opp-hz = /bits/ 64 <4416000000>; + opp-level = <18>; + opp-microwatt = <8274900>; + }; + opp19 { + opp-hz = /bits/ 64 <4512000000>; + opp-level = <19>; + opp-microwatt = <9256900>; + }; + }; + + opp_p1: opp-table-p1 { + compatible = "operating-points-v2"; + opp-shared; + + opp01 { + opp-hz = /bits/ 64 <1260000000>; + opp-level = <1>; + opp-microwatt = <561800>; + }; + opp02 { + opp-hz = /bits/ 64 <1512000000>; + opp-level = <2>; + opp-microwatt = <772500>; + }; + opp03 { + opp-hz = /bits/ 64 <1800000000>; + opp-level = <3>; + opp-microwatt = <988900>; + }; + opp04 { + opp-hz = /bits/ 64 <2088000000>; + opp-level = <4>; + opp-microwatt = <1302300>; + }; + opp05 { + opp-hz = /bits/ 64 <2352000000>; + opp-level = <5>; + opp-microwatt = <1644100>; + }; + opp06 { + opp-hz = /bits/ 64 <2616000000>; + opp-level = <6>; + opp-microwatt = <2003700>; + }; + opp07 { + opp-hz = /bits/ 64 <2868000000>; + opp-level = <7>; + opp-microwatt = <2349000>; + }; + opp08 { + opp-hz = /bits/ 64 <3096000000>; + opp-level = <8>; + opp-microwatt = <2723000>; + }; + opp09 { + opp-hz = /bits/ 64 <3300000000>; + opp-level = <9>; + opp-microwatt = <3333200>; + }; + opp10 { + opp-hz = /bits/ 64 <3468000000>; + opp-level = <10>; + opp-microwatt = <3711900>; + }; + opp11 { + opp-hz = /bits/ 64 <3624000000>; + opp-level = <11>; + opp-microwatt = <4129900>; + }; + opp12 { + opp-hz = /bits/ 64 <3756000000>; + opp-level = <12>; + opp-microwatt = <4666300>; + }; + opp13 { + opp-hz = /bits/ 64 <3852000000>; + opp-level = <13>; + opp-microwatt = <4881000>; + }; + opp14 { + opp-hz = /bits/ 64 <3924000000>; + opp-level = <14>; + opp-microwatt = <5176700>; + }; + opp15 { + opp-hz = /bits/ 64 <3996000000>; + opp-level = <15>; + opp-microwatt = <5306500>; + }; + opp16 { + opp-hz = /bits/ 64 <4044000000>; + opp-level = <16>; + opp-microwatt = <5618900>; + }; + opp17 { + opp-hz = /bits/ 64 <4104000000>; + opp-level = <17>; + opp-microwatt = <5843100>; + }; + opp18 { + opp-hz = /bits/ 64 <4416000000>; + opp-level = <18>; + opp-microwatt = <8075300>; + }; + opp19 { + opp-hz = /bits/ 64 <4512000000>; + opp-level = <19>; + opp-microwatt = <8949200>; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupt-parent = <&aic>; + interrupt-names = "phys", "virt", "hyp-phys", "hyp-virt"; + interrupts = , + , + , + ; + }; + + pmu { + compatible = "apple,t6040-pmu"; + interrupt-parent = <&aic>; + /* The AIC raises both clusters' PMU FIQs as this one. */ + interrupts = ; + }; + + /* The 24 MHz reference clock (ADT clock-ids 4) of the I2C, PWM and watchdog blocks */ + clkref: clock-ref { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "clkref"; + }; + + /* + * Display component master. It has no registers; the boot loader + * enables it with the DCP when it hands the display over. + */ + display: display-subsystem { + compatible = "apple,display-subsystem"; + iommus = <&disp0_dart 0>; + status = "disabled"; + }; + + cpufreq_e: cpufreq@210e20000 { + compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; + reg = <0x2 0x10e20000 0x0 0x1000>; + nonposted-mmio; + #performance-domain-cells = <0>; + /* PMP fast die-temperature effort, byte 0 of FAST-DIE-CE */ + apple,fast-die-effort = <&pmp_report 0>; + }; + + cpufreq_p0: cpufreq@211e20000 { + compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; + reg = <0x2 0x11e20000 0x0 0x1000>; + nonposted-mmio; + #performance-domain-cells = <0>; + apple,fast-die-effort = <&pmp_report 1>; + }; + + cpufreq_p1: cpufreq@212e20000 { + compatible = "apple,t6041-cluster-cpufreq", "apple,t8112-cluster-cpufreq"; + reg = <0x2 0x12e20000 0x0 0x1000>; + nonposted-mmio; + #performance-domain-cells = <0>; + apple,fast-die-effort = <&pmp_report 2>; + }; + + /* + * System level cache planes: four AMCCs with four planes each. + * Allocation waits for the display, which takes over the scan-out DMA + * the boot loader left running. + */ + mcc: memory-controller@220000000 { + compatible = "apple,t6041-mcc", "apple,t8140-mcc"; + reg = <0x2 0x20000000 0x0 0x4000>, + <0x2 0x20040000 0x0 0x4000>, + <0x2 0x20080000 0x0 0x4000>, + <0x2 0x200c0000 0x0 0x4000>, + <0x2 0x22000000 0x0 0x4000>, + <0x2 0x22040000 0x0 0x4000>, + <0x2 0x22080000 0x0 0x4000>, + <0x2 0x220c0000 0x0 0x4000>, + <0x2 0x24000000 0x0 0x4000>, + <0x2 0x24040000 0x0 0x4000>, + <0x2 0x24080000 0x0 0x4000>, + <0x2 0x240c0000 0x0 0x4000>, + <0x2 0x26000000 0x0 0x4000>, + <0x2 0x26040000 0x0 0x4000>, + <0x2 0x26080000 0x0 0x4000>, + <0x2 0x260c0000 0x0 0x4000>; + nonposted-mmio; + apple,boot-dma-devices = <&display>; + status = "disabled"; + }; + + /* + * The decoder firmware programs the T8122/T8132 register family, so + * the driver binds through its T8132 entry. The ADT gives the whole + * block (0x2_80000000, 0x1404000); the windows follow the T6030/T8140 + * layout, with the CM3 SRAM between its code and the mailbox. + */ + avd: avd@280000000 { + compatible = "apple,t6041-avd", "apple,t8132-avd"; + reg = <0x2 0x81080000 0x0 0x14000>, + <0x2 0x81094000 0x0 0x14000>, + <0x2 0x810a8000 0x0 0x4000>, + <0x2 0x81100000 0x0 0x10000>; + reg-names = "code", "sram", "mbox", "ctrl"; + interrupt-parent = <&aic>; + interrupts = , + ; + power-domains = <&ps_avd_sys>, <&pmc_soc_max>; + power-domain-names = "core", "perf"; + resets = <&ps_avd_sys>; + iommus = <&avd_dart 0>; + }; + + avd_dart: iommu@281020000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x2 0x81020000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_avd_sys>; + }; + + /* Named after its sgx range: the coprocessor range is the mailbox node's too. */ + gpu: gpu@288000000 { + compatible = "apple,agx-t6040"; + reg = <0x2 0x8a600000 0x0 0x88000>, + <0x2 0x88000000 0x0 0x3758000>; + reg-names = "asc", "sgx"; + mboxes = <&gfx_mbox>; + power-domains = <&pmp_gfx>; + apple,clpc = <&clpc>; + status = "disabled"; + }; + + pmgr_gfx: power-management@288e80000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x2 0x88e80000 0x0 0x4000>; + /* child nodes are added in t604x-pmgr.dtsi */ + }; + + gfx_mbox: mailbox@28a600000 { + compatible = "apple,t6040-ascwrap-v6"; + reg = <0x2 0x8a600000 0x0 0x88000>, + <0x2 0x8a050000 0x0 0x8>; + reg-names = "wrapper", "iop-vbar"; + interrupt-parent = <&aic>; + interrupts = , + ; + interrupt-names = "send-empty", "recv-not-empty"; + apple,firmware-role = "GFX"; + power-domains = <&ps_gfx>; + #mbox-cells = <0>; + status = "disabled"; + }; + + disp0_dart: iommu@402300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x02300000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcp_dart: iommu@402340000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x02340000 0x0 0x20000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcp: dcp@402e00000 { + compatible = "apple,t6041-dcp", "apple,dcp"; + reg = <0x4 0x02e00000 0x0 0x4000>, + <0x4 0x00000000 0x0 0x4000000>, + <0x4 0x02240000 0x0 0x10000>, + <0x4 0x023a8000 0x0 0x4000>, + <0x4 0x02800000 0x0 0x800000>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + mboxes = <&dcp_mbox>; + mbox-names = "mbox"; + iommus = <&dcp_dart 23>; + apple,bw-scratch = <&pmgr_dcp 0 4 0x20000>; + apple,iomfb-surfaces = <1 1 0 0>; + /* the boot loader describes the piodma's regions with 2+2 cells */ + #address-cells = <2>; + #size-cells = <2>; + /* enabled once the boot loader has handed the display over */ + status = "disabled"; + + disp0_piodma: piodma { + iommus = <&disp0_dart 16>; + }; + }; + + dcp_mbox: mailbox@402e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x4 0x02e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + /* + * iBoot hands over a running SEP. Keep Linux off its DART at boot; + * apple_sep enables it when the driver binds. The SEP only accepts + * IOVAs in the window iBoot programmed (ADT vm-base 0x10000004000, + * vm-size 0x3ff00000), which carries the BIT(40) alias the DART + * translates. + */ + sep_dart: iommu@404c80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x04c80000 0x0 0x20000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + apple,dma-range = /bits/ 64 <0x10000004000 0x3ff00000>; + apple,dma-offset = /bits/ 64 <0x0>; + status = "disabled"; + }; + + sep: sep@406600000 { + compatible = "apple,sep"; + reg = <0x4 0x06600000 0x0 0x88000>; + mboxes = <&sep_mbox>; + mbox-names = "mbox"; + iommus = <&sep_dart 0>; + power-domains = <&ps_sep>; + status = "disabled"; + }; + + sep_mbox: mailbox@406608000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x4 0x06608000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + ans_mbox: mailbox@409608000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x4 0x09608000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + power-domains = <&ps_ans>; + #mbox-cells = <0>; + status = "disabled"; + }; + + ans_sart: sart@40dc50000 { + compatible = "apple,t6041-sart", "apple,t6000-sart"; + reg = <0x4 0x0dc50000 0x0 0xc000>; + power-domains = <&ps_ans>; + status = "disabled"; + }; + + pcie_dart: iommu@410000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x10000000 0x0 0x20000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + /* iBoot leaves the I2C gates on and the pins muxed to I2C. */ + i2c1: i2c@429014000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x29014000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c1_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c2: i2c@429018000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x29018000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c2_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c2>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c3: i2c@42901c000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x2901c000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c3_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c3>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c4: i2c@429020000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x29020000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c4_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c4>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c6: i2c@429028000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x29028000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c6_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c6>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c8: i2c@429030000 { + compatible = "apple,t6041-i2c", "apple,t8103-i2c"; + reg = <0x4 0x29030000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + pinctrl-0 = <&i2c8_pins>; + pinctrl-names = "default"; + power-domains = <&ps_i2c8>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + fpwm0: pwm@429040000 { + compatible = "apple,t6041-fpwm", "apple,s5l-fpwm"; + reg = <0x4 0x29040000 0x0 0x4000>; + clocks = <&clkref>; + power-domains = <&ps_fpwm0>; + #pwm-cells = <2>; + status = "disabled"; + }; + + /* + * Touch ID. iBoot leaves the pads muxed and the controller uses its + * native chip select, so there is no pinctrl here. + */ + spi2: spi@429108000 { + compatible = "apple,t6041-spi", "apple,t8103-spi"; + reg = <0x4 0x29108000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + clocks = <&clkref>; + power-domains = <&ps_spi2>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + mesa: fingerprint@0 { + compatible = "apple,mesa-fingerprint"; + reg = <0>; + spi-max-frequency = <8000000>; + spi-cpol; + status = "disabled"; + }; + }; + + nvme: nvme@44dcc0000 { + compatible = "apple,t6041-nvme-ans2"; + reg = <0x4 0x4dcc0000 0x0 0x10000>, + <0x4 0x09600000 0x0 0x4000>, + <0x4 0x0dcc0000 0x0 0x60000>; + reg-names = "nvme", "ans", "nvmmu"; + interrupt-parent = <&aic>; + interrupts = ; + mboxes = <&ans_mbox>; + apple,sart = <&ans_sart>; + power-domains = <&ps_ans>, <&ps_apcie_sys_st0>, + <&ps_apcie_sys_st1>; + power-domain-names = "ans", "apcie0", "apcie1"; + resets = <&ps_ans>; + status = "disabled"; + }; + + /* + * PMP (power management coprocessor). iBoot locks its DART (PROTECT + * 0x1e7, SIDs 0 and 1 translating): apple-dart adopts iBoot's SID 0 + * table and leaves SID 1 alone. apple,dma-range keeps Linux's IOVAs + * in the ADT window (vm-base 0x100_0000_0000, 64 GiB). The DART's + * second ADT range is the SoC's shared clock-protection block, not + * part of the DART. + */ + pmp_dart: iommu@500300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x00300000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + power-domains = <&ps_pmp>; + status = "disabled"; + }; + + /* + * Report (PTD) region: reads 16 bytes per entry at +0x0, writes 8 + * bytes per entry at +0x10000. Entries are PMP soc-devices; every + * entry reads 0 while the PMP is stopped. + */ + pmp_report: pmp-report@5003c0000 { + compatible = "apple,t6041-pmp-v2-report"; + reg = <0x5 0x003c0000 0x0 0x20000>; + nonposted-mmio; + power-domains = <&ps_pms_sram>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + /* The CPU clusters, for their fast die-temperature loops */ + report@a { + compatible = "apple,t6041-pmp-v2-report-entry", + "apple,t6000-pmp-v2-report-entry"; + reg = <0xa>; + label = "pmp-eacc0"; + #power-domain-cells = <0>; + apple,always-on; + }; + + report@b { + compatible = "apple,t6041-pmp-v2-report-entry", + "apple,t6000-pmp-v2-report-entry"; + reg = <0xb>; + label = "pmp-pacc0"; + #power-domain-cells = <0>; + apple,always-on; + }; + + report@c { + compatible = "apple,t6041-pmp-v2-report-entry", + "apple,t6000-pmp-v2-report-entry"; + reg = <0xc>; + label = "pmp-pacc1"; + #power-domain-cells = <0>; + apple,always-on; + }; + + /* + * The GPU (soc-device 13). Without it the running PMP treats + * the GPU as off and holds it at its lowest state, but claiming + * it while nothing powers the GPU crashes the PMP firmware + * (SError) right after it starts. It sits on the GPU's own + * power state. The GPU consumer takes this domain, so the request + * follows the GFX domain's power lifetime. + */ + pmp_gfx: report@d { + compatible = "apple,t6041-pmp-v2-report-entry", + "apple,t6000-pmp-v2-report-entry"; + reg = <0xd>; + label = "pmp-gfx"; + #power-domain-cells = <0>; + power-domains = <&ps_gfx>; + }; + }; + + /* + * The boot loader adds the per-unit properties (board, DRAM) and the + * firmware tunables the driver needs before it starts the PMP. + */ + pmp: pmp@500700000 { + compatible = "apple,t6041-pmp-v2", "apple,t6000-pmp-v2"; + reg = <0x5 0x00700000 0x0 0xe0000>, + <0x5 0x00e00000 0x0 0x4000>; + reg-names = "pmp", "asc"; + mboxes = <&pmp_mbox>; + mbox-names = "mbox"; + iommus = <&pmp_dart 0>; + power-domains = <&ps_pmp>; + apple,pmc = <1>; + apple,pmc-pmgr = <0x3f>; + status = "disabled"; + }; + + pmp_mbox: mailbox@500e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x5 0x00e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + power-domains = <&ps_pmp>, <&ps_pms_sram>; + #mbox-cells = <0>; + status = "disabled"; + }; + + pmgr: power-management@502280000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x5 0x02280000 0x0 0x4000>; + /* child nodes are added in t604x-pmgr.dtsi */ + }; + + pmgr_ane: power-management@50228c000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + reg = <0x5 0x0228c000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + }; + + pmgr_disp: power-management@502290000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + reg = <0x5 0x02290000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + }; + + pmgr_venc: power-management@502808000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + reg = <0x5 0x02808000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + }; + + pmgr_isp: power-management@502284000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x5 0x02284000 0x0 0x4000>; + /* child nodes are added in t604x-pmgr.dtsi */ + }; + + aic: interrupt-controller@502400000 { + compatible = "apple,t6041-aic3", "apple,t8122-aic3"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0x5 0x02400000 0x0 0x184000>, + <0x5 0x02440000 0x0 0x4>; + reg-names = "core", "event"; + }; + + pmgr_aux: power-management@502800000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x5 0x02800000 0x0 0x4000>; + /* child nodes are added in t604x-pmgr.dtsi */ + }; + + /* + * The PMGR range the DCP driver hands to its firmware; apple,bw-scratch + * points into it. + */ + pmgr_dcp: power-management@504800000 { + reg = <0x5 0x04800000 0x0 0xbc000>; + reg-names = "dcp-fw-pmgr"; + #apple,bw-scratch-cells = <3>; + }; + + /* + * PMC voter interface: the floor word of agent a at "voters" + + * 0x4000 * a, the floors the PMC honours and the rail enable words + * at "rails". Both lie inside pmgr_dcp's range, which the DCP driver + * only hands to its firmware, so the two do not conflict; "rails" + * comes first so that this node's unit address differs from + * pmgr_dcp's. + * Static voters are the PMP (0), CLPC (1) and AP (3). The PMP votes + * the DCS and fabric for memory clients other than the CPUs, the GPU + * among them; without its agent, GPU work runs at a low DCS + * state unless a CPU is busy. iBoot leaves the PMP's floor at the top + * DCS state, so its agent must stay off while the PMP does not run: + * apple,pmp holds off the PMC until the PMP driver has bound, and + * unbinds the PMC first. + */ + pmc: power-management@5048aa000 { + compatible = "apple,t6041-pmc"; + reg = <0x5 0x048aa000 0x0 0x3000>, + <0x5 0x04800000 0x0 0x10000>; + reg-names = "rails", "voters"; + nonposted-mmio; + #address-cells = <1>; + #size-cells = <0>; + apple,pmp = <&pmp>; + apple,static-voters = <0 1 3>; + status = "disabled"; + + clpc: performance-controller@1 { + compatible = "apple,t6041-clpc"; + reg = <1>; + + }; + + /* + * The SoC rail at its highest state. The video encoder runs on + * the fabric clock and encodes at less than half speed below it. + */ + pmc_soc_max: floor-soc-max { + label = "soc-max"; + #power-domain-cells = <0>; + apple,rail = <1>; + apple,level = <2>; + }; + }; + + /* + * The always-on GPIO bank (ADT /arm-io/nub-gpio0, 61 pins). Its power + * state is in the always-on PMGR. + */ + pinctrl_nub: pinctrl@5081e4000 { + compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; + reg = <0x5 0x081e4000 0x0 0x4000>; + power-domains = <&ps_nub_gpio>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl_nub 0 0 61>; + apple,npins = <61>; + + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + , + ; + status = "disabled"; + }; + + pmgr_mini: power-management@508300000 { + compatible = "apple,t6041-pmgr", "apple,t8103-pmgr", "syscon", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x5 0x08300000 0x0 0x4000>; + /* child nodes are added in t604x-pmgr.dtsi */ + }; + + /* + * The driver arms the reset only when userspace opens /dev/watchdog + * or the firmware left it running; it also provides restart. + */ + wdt: watchdog@50836c000 { + compatible = "apple,t6041-wdt", "apple,t8103-wdt"; + reg = <0x5 0x0836c000 0x0 0x4000>; + clocks = <&clkref>; + interrupt-parent = <&aic>; + interrupts = ; + }; + + nub_spmi0: spmi@509014000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09014000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + + pmic@e { + compatible = "apple,abbey-pmic", "apple,spmi-nvmem"; + reg = <0xe SPMI_USID>; + + pmu_rtc: rtc { + compatible = "apple,t6041-pmu-rtc"; + interrupt-parent = <&nub_spmi0>; + interrupts = <2 IRQ_TYPE_EDGE_RISING>; + nvmem-cells = <&rtc_offset>; + nvmem-cell-names = "rtc_offset"; + wakeup-source; + }; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + rtc_offset: rtc-offset@2100 { + reg = <0x2100 0x6>; + }; + + boot_stage: boot-stage@f801 { + reg = <0xf801 0x1>; + }; + + boot_error_count: boot-error-count@f802,0 { + reg = <0xf802 0x1>; + bits = <0 4>; + }; + + panic_count: panic-count@f802,4 { + reg = <0xf802 0x1>; + bits = <4 4>; + }; + + shutdown_flag: shutdown-flag@f80f,3 { + reg = <0xf80f 0x1>; + bits = <3 1>; + }; + }; + }; + }; + + smc: smc@50c600000 { + compatible = "apple,t6041-smc", "apple,t8103-smc"; + reg = <0x5 0x0c600000 0x0 0x4000>, + <0x5 0x0de70000 0x0 0x100000>; + reg-names = "smc", "sram"; + mboxes = <&smc_mbox>; + status = "disabled"; + + smc_gpio: gpio { + compatible = "apple,smc-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + + smc_hwmon: hwmon { + compatible = "apple,smc-hwmon"; + #thermal-sensor-cells = <1>; + }; + + smc_reboot: reboot { + compatible = "apple,smc-reboot"; + nvmem-cells = <&shutdown_flag>, <&boot_stage>, + <&boot_error_count>, <&panic_count>; + nvmem-cell-names = "shutdown_flag", "boot_stage", + "boot_error_count", "panic_count"; + }; + + smc_rtc: rtc { + compatible = "apple,smc-rtc"; + nvmem-cells = <&rtc_offset>; + nvmem-cell-names = "rtc_offset"; + }; + }; + + smc_mbox: mailbox@50c608000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x5 0x0c608000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + /* + * AOP (always-on processor). The boot loader loads its RTKit firmware + * and leaves it stopped; Linux starts it. + */ + aop: aop@510600000 { + compatible = "apple,t6041-aop"; + reg = <0x5 0x10c10000 0x0 0x2e0000>, + <0x5 0x10600000 0x0 0x88000>, + <0x5 0x10050000 0x0 0x4000>, + <0x5 0x08328000 0x0 0x24>; + reg-names = "firmware", "asc", "asc-aux", "config"; + mboxes = <&aop_mbox>; + mbox-names = "mbox"; + iommus = <&aop_dart 0>; + status = "disabled"; + + /* + * "dma" is the microphones' LEAP ADMAC channel; "spkr" and + * "sense" are the speaker stream's base-ns ADMAC channels 0 and + * 1 (ADT audio-speaker dma-channels), "cout" and "cin" the + * headphone jack's channels 4 and 5 (TX2 and RX2, ADT + * audio-codec-output and audio-codec-input). + */ + aop_audio: audio { + compatible = "apple,t6041-aop-audio", "apple,t6030-aop-audio"; + dmas = <&admac0 1>, <&admac1 0>, <&admac1 1>, <&admac1 4>, + <&admac1 5>; + dma-names = "dma", "spkr", "sense", "cout", "cin"; + #sound-dai-cells = <1>; + }; + + aop_als: als { + compatible = "apple,t6041-aop-als", "apple,aop-als"; + }; + + aop_las: las { + compatible = "apple,t6041-aop-las", "apple,aop-las"; + }; + + /* The calibration properties come from the bootloader. */ + aop_accel: accel { + compatible = "apple,t6041-aop-accel", "apple,aop-accel"; + }; + + aop_gyro: gyro { + compatible = "apple,t6041-aop-gyro", "apple,aop-gyro"; + }; + }; + + /* ADT lists the interrupts as 1, 0, 3, 2 of the block: send-empty is the lowest. */ + aop_mbox: mailbox@510608000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x5 0x10608000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + aop_dart: iommu@510f00000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x10f00000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + /* The audio fabric's ADMACs: admac-leap-ns (DART stream 10) and admac-base-ns (stream 8) */ + admac0: dma-controller@513300000 { + compatible = "apple,t6041-admac", "apple,t8132-admac"; + reg = <0x5 0x13300000 0x0 0x34000>; + #dma-cells = <1>; + dma-channels = <18>; + /* the ADT gives the first of the four outputs */ + interrupts-extended = <&aic AIC_IRQ 757 IRQ_TYPE_LEVEL_HIGH>, + <0>, <0>, <0>; + iommus = <&aop_dart 10>; + status = "disabled"; + }; + + admac1: dma-controller@513800000 { + compatible = "apple,t6041-admac", "apple,t8132-admac"; + reg = <0x5 0x13800000 0x0 0x34000>; + #dma-cells = <1>; + dma-channels = <13>; + /* the ADT gives the first of the four outputs */ + interrupts-extended = <&aic AIC_IRQ 754 IRQ_TYPE_LEVEL_HIGH>, + <0>, <0>, <0>; + iommus = <&aop_dart 8>; + status = "disabled"; + }; + + mtp: mtp@514600000 { + compatible = "apple,t6041-mtp", "apple,t6041-rtk-helper-asc4", + "apple,mtp", "apple,rtk-helper-asc4"; + reg = <0x5 0x14600000 0x0 0x4000>; + reg-names = "asc"; + mboxes = <&mtp_mbox>; + iommus = <&mtp_dart 0>; + #helper-cells = <0>; + status = "disabled"; + }; + + mtp_mbox: mailbox@514608000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x5 0x14608000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + mtp_dart: iommu@514800000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x14800000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + /* ADT "remap": streams 1 2 3 are stream 0 */ + apple,remap-streams = <1 0>, <2 0>, <3 0>; + status = "disabled"; + }; + + mtp_dockchannel: fifo@514b14000 { + compatible = "apple,t6041-dockchannel", "apple,dockchannel"; + reg = <0x5 0x14b14000 0x0 0x1000>; + reg-names = "irq"; + interrupt-parent = <&aic>; + interrupts = ; + + ranges = <0x0 0x5 0x14b28000 0x10000>; + nonposted-mmio; + #address-cells = <1>; + #size-cells = <1>; + + interrupt-controller; + #interrupt-cells = <2>; + status = "disabled"; + + mtp_hid: input@0 { + compatible = "apple,t6041-dockchannel-hid", "apple,dockchannel-hid"; + reg = <0x0000 0x1000>, + <0x4000 0x1000>, + <0x8000 0x1000>, + <0xc000 0x1000>; + reg-names = "rmt-config", "rmt-data", "config", "data"; + iommus = <&mtp_dart 0>; + interrupt-parent = <&mtp_dockchannel>; + interrupts = <2 IRQ_TYPE_LEVEL_HIGH>, + <3 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "tx", "rx"; + apple,fifo-size = <0x800>; + apple,helper-cpu = <&mtp>; + }; + }; + + pinctrl: pinctrl@51c000000 { + compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; + reg = <0x5 0x1c000000 0x0 0x4000>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl 0 0 200>; + apple,npins = <200>; + + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + , + ; + status = "disabled"; + + /* I2C is function 1 (ADT gpio-iic_scl/sda) */ + i2c1_pins: i2c1-pins { + pinmux = , + ; + }; + + i2c2_pins: i2c2-pins { + pinmux = , + ; + }; + + i2c3_pins: i2c3-pins { + pinmux = , + ; + }; + + i2c4_pins: i2c4-pins { + pinmux = , + ; + }; + + i2c6_pins: i2c6-pins { + pinmux = , + ; + }; + + i2c8_pins: i2c8-pins { + pinmux = , + ; + }; + }; + + /* + * ISP (ADT isp0, firmware loaded by iBoot). "coproc" is the + * coprocessor up to its control block; "mbox", "gpio" and "mbox2" are + * the interrupt words, the firmware handshake words and the doorbell + * of its mailbox at +0x2924000. The first of the ADT's four + * interrupts carries the mailbox. + */ + isp: isp@580000000 { + compatible = "apple,t6041-isp", "apple,isp"; + reg = <0x5 0x80000000 0x0 0x1604000>, + <0x5 0x82924000 0x0 0x40>, + <0x5 0x829241d0 0x0 0x20>, + <0x5 0x82924464 0x0 0x10>; + reg-names = "coproc", "mbox", "gpio", "mbox2"; + interrupt-parent = <&aic>; + interrupts = ; + iommus = <&isp_dart0 0>, <&isp_dart1 0>, <&isp_dart2 0>; + power-domains = <&ps_isp_sys>, <&ps_isp_cpu>, <&ps_isp_fe>, + <&ps_isp_dprx>, <&ps_isp_secure>, <&ps_isp_be>, + <&ps_isp_clr>, <&ps_ispsens0>; + /* the shared memory window above the firmware's 32 MiB */ + apple,dart-vm-size = /bits/ 64 <0xde600000>; + status = "disabled"; + }; + + /* + * ADT dart-isp0: three instances on one interrupt; ADT "remap": streams + * 1, 6, 7, 10 and 11 are stream 0. + */ + isp_dart0: iommu@5828c0000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x828c0000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_isp_sys>; + apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; + status = "disabled"; + }; + + isp_dart1: iommu@5828e0000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x828e0000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_isp_sys>; + apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; + status = "disabled"; + }; + + isp_dart2: iommu@582900000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x82900000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_isp_sys>; + apple,remap-streams = <1 0>, <6 0>, <7 0>, <10 0>, <11 0>; + status = "disabled"; + }; + + /* + * The three Type-C ports (ADT usb-drdN, atc-phyN, dart-usbN, + * acio-phy-cpuN) and the SPMI buses of their PD controllers. + */ + nub_spmi_a0: spmi@509188000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09188000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_nub_spmi_a0>; + status = "disabled"; + }; + + nub_spmi_a1: spmi@509198000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09198000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_nub_spmi_a1>; + status = "disabled"; + }; + + atcphy0: phy@382a90000 { + compatible = "apple,t6040-atcphy"; + reg = <0x3 0x82a90000 0x0 0x4000>, + <0x3 0x82800000 0x0 0x4000>, + <0x3 0x82a84000 0x0 0x4000>, + <0x3 0x83000000 0x0 0x30000>, + <0x3 0x83200000 0x0 0x4000>, + <0x3 0x83140000 0x0 0x4000>, + <0x3 0x830c0000 0x0 0x10000>, + <0x3 0x80000000 0x0 0x8000>, + <0x3 0x80020000 0x0 0x4000>, + <0x3 0x83244000 0x0 0x4000>, + <0x3 0x83250000 0x0 0x4000>; + reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", + "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; + #phy-cells = <1>; + #reset-cells = <0>; + power-domains = <&ps_atc0_common_dp>; + mboxes = <&atcphy0_mbox>; + mbox-names = "phy-cpu"; + nonposted-mmio; + orientation-switch; + status = "disabled"; + }; + + atcphy0_mbox: mailbox@383148000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x83148000 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_phymxwrap>; + status = "disabled"; + }; + + usb_drd0_dart_0: iommu@382f00000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x82f00000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc0_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd0_dart_1: iommu@382f80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x82f80000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc0_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd0: usb@382280000 { + compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; + reg = <0x3 0x82280000 0x0 0xcd00>, + <0x3 0x8228cd00 0x0 0x3200>, + <0x3 0x82200000 0x0 0x4000>; + reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; + interrupt-parent = <&aic>; + interrupts = ; + /* + * A role switch rather than a fixed host: the PD controller + * resets the eUSB2 repeater on every connect, so the PHY and + * the core start after the attach and stop on detach. + */ + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + iommus = <&usb_drd0_dart_0 0>, <&usb_drd0_dart_1 1>; + power-domains = <&ps_atc0_usb>; + resets = <&atcphy0>; + phys = <&atcphy0 PHY_TYPE_USB2>, <&atcphy0 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + + atcphy1: phy@38aa90000 { + compatible = "apple,t6040-atcphy"; + reg = <0x3 0x8aa90000 0x0 0x4000>, + <0x3 0x8a800000 0x0 0x4000>, + <0x3 0x8aa84000 0x0 0x4000>, + <0x3 0x8b000000 0x0 0x30000>, + <0x3 0x8b200000 0x0 0x4000>, + <0x3 0x8b140000 0x0 0x4000>, + <0x3 0x8b0c0000 0x0 0x10000>, + <0x3 0x88000000 0x0 0x8000>, + <0x3 0x88020000 0x0 0x4000>, + <0x3 0x8b244000 0x0 0x4000>, + <0x3 0x8b250000 0x0 0x4000>; + reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", + "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; + #phy-cells = <1>; + #reset-cells = <0>; + power-domains = <&ps_atc1_common_dp>; + mboxes = <&atcphy1_mbox>; + mbox-names = "phy-cpu"; + nonposted-mmio; + orientation-switch; + status = "disabled"; + }; + + atcphy1_mbox: mailbox@38b148000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x8b148000 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_phymxwrap>; + status = "disabled"; + }; + + usb_drd1_dart_0: iommu@38af00000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x8af00000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc1_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd1_dart_1: iommu@38af80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x8af80000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc1_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd1: usb@38a280000 { + compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; + reg = <0x3 0x8a280000 0x0 0xcd00>, + <0x3 0x8a28cd00 0x0 0x3200>, + <0x3 0x8a200000 0x0 0x4000>; + reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; + interrupt-parent = <&aic>; + interrupts = ; + /* + * A role switch rather than a fixed host: the PD controller + * resets the eUSB2 repeater on every connect, so the PHY and + * the core start after the attach and stop on detach. + */ + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + iommus = <&usb_drd1_dart_0 0>, <&usb_drd1_dart_1 1>; + power-domains = <&ps_atc1_usb>; + resets = <&atcphy1>; + phys = <&atcphy1 PHY_TYPE_USB2>, <&atcphy1 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + + atcphy2: phy@392a90000 { + compatible = "apple,t6040-atcphy"; + reg = <0x3 0x92a90000 0x0 0x4000>, + <0x3 0x92800000 0x0 0x4000>, + <0x3 0x92a84000 0x0 0x4000>, + <0x3 0x93000000 0x0 0x30000>, + <0x3 0x93200000 0x0 0x4000>, + <0x3 0x93140000 0x0 0x4000>, + <0x3 0x930c0000 0x0 0x10000>, + <0x3 0x90000000 0x0 0x8000>, + <0x3 0x90020000 0x0 0x4000>, + <0x3 0x93244000 0x0 0x4000>, + <0x3 0x93250000 0x0 0x4000>; + reg-names = "bank0", "bank1", "pipehandler", "core", "cfg", "cpu", + "cpu-data", "axi2af", "axi2af-lioa", "fabric", "common-cfg"; + #phy-cells = <1>; + #reset-cells = <0>; + power-domains = <&ps_atc2_common_dp>; + mboxes = <&atcphy2_mbox>; + mbox-names = "phy-cpu"; + nonposted-mmio; + orientation-switch; + status = "disabled"; + }; + + atcphy2_mbox: mailbox@393148000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x93148000 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_phymxwrap>; + status = "disabled"; + }; + + usb_drd2_dart_0: iommu@392f00000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x92f00000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc2_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd2_dart_1: iommu@392f80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x92f80000 0x0 0xc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc2_usb>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "disabled"; + }; + + usb_drd2: usb@392280000 { + compatible = "apple,t6040-dwc3", "apple,t8103-dwc3"; + reg = <0x3 0x92280000 0x0 0xcd00>, + <0x3 0x9228cd00 0x0 0x3200>, + <0x3 0x92200000 0x0 0x4000>; + reg-names = "dwc3-core", "dwc3-apple", "drd-cfg"; + interrupt-parent = <&aic>; + interrupts = ; + /* + * A role switch rather than a fixed host: the PD controller + * resets the eUSB2 repeater on every connect, so the PHY and + * the core start after the attach and stop on detach. + */ + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + iommus = <&usb_drd2_dart_0 0>, <&usb_drd2_dart_1 1>; + power-domains = <&ps_atc2_usb>; + resets = <&atcphy2>; + phys = <&atcphy2 PHY_TYPE_USB2>, <&atcphy2 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + status = "disabled"; + }; + /* Additional DARTs; enabled together with their DMA consumers. */ + ave0_dart1: iommu@283080000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x2 0x83080000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x00004000 0x0 0xffffc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_venc0_sys>; + status = "disabled"; + }; + + ave0_dart0: iommu@2830a0000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x2 0x830a0000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x00004000 0x0 0xffffc000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_venc0_sys>; + status = "disabled"; + }; + + apr0_dart: iommu@301020000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x01020000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_scodec>; + status = "disabled"; + }; + + apciec0_dart: iommu@384000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x84000000 0x0 0x20000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + apciec1_dart: iommu@38c000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x8c000000 0x0 0x20000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + apciec2_dart: iommu@394000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x94000000 0x0 0x20000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dispext0_dart: iommu@3a2300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0xa2300000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcpext0_dart: iommu@3a2340000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0xa2340000 0x0 0x20000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + apcie1_dart: iommu@411000000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x11000000 0x0 0x20000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + sio_dart: iommu@429060000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x29060000 0x0 0x20000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x1c000 0x2ff 0xfffe4000>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_sio>; + status = "disabled"; + }; + + ane0_dart0: iommu@485800000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x85800000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_ane_sys>; + /* Include firmware identity MMIO pages below the preload DVAs. */ + apple,dma-range = <0x0 0x0 0x400 0x0>; + status = "disabled"; + }; + + ane0_dart1: iommu@485820000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x85820000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_ane_sys>; + /* Include firmware identity MMIO pages below the preload DVAs. */ + apple,dma-range = <0x0 0x0 0x400 0x0>; + status = "disabled"; + }; + + ane0_dart2: iommu@485840000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x85840000 0x0 0xc000>; + #iommu-cells = <1>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_ane_sys>; + /* Include firmware identity MMIO pages below the preload DVAs. */ + apple,dma-range = <0x0 0x0 0x400 0x0>; + status = "disabled"; + }; + + jpeg0: jpeg@487000000 { + compatible = "apple,t6041-jpeg"; + reg = <0x4 0x87000000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + iommus = <&jpeg0_dart 0>; + power-domains = <&ps_jpg>; + apple,dma-range = /bits/ 64 <0x10000000000 0x100000000>; + status = "disabled"; + }; + + jpeg0_dart: iommu@487020000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x87020000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_jpg>; + status = "disabled"; + }; + + jpeg1: jpeg@487060000 { + compatible = "apple,t6041-jpeg"; + reg = <0x4 0x87060000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + iommus = <&jpeg1_dart 0>; + power-domains = <&ps_jpg>; + apple,dma-range = /bits/ 64 <0x10000000000 0x100000000>; + status = "disabled"; + }; + + jpeg1_dart: iommu@487080000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x4 0x87080000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_jpg>; + status = "disabled"; + }; + + scaler0_dart: iommu@521260000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x5 0x21260000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_msr0>; + status = "disabled"; + }; + + dispext1_dart: iommu@602300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x6 0x02300000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcpext1_dart: iommu@602340000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x6 0x02340000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + pinctrl_aop: pinctrl@510824000 { + compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; + reg = <0x5 0x10824000 0x0 0x4000>; + clocks = <&clkref>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl_aop 0 0 85>; + apple,npins = <85>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + , + ; + /* Coprocessor pins and interrupt groups need an ownership handoff. */ + status = "disabled"; + }; + + pinctrl_smc: pinctrl@50c824000 { + compatible = "apple,t6041-pinctrl", "apple,t8103-pinctrl"; + reg = <0x5 0x0c824000 0x0 0x4000>; + clocks = <&clkref>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl_smc 0 0 24>; + apple,npins = <24>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + , + , + ; + /* Coprocessor pins and interrupt groups need an ownership handoff. */ + status = "disabled"; + }; + + nub_spmi1: spmi@509054000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09054000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + power-domains = <&ps_nub_spmi1>; + status = "disabled"; + }; + + nub_spmi2: spmi@509094000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09094000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + power-domains = <&ps_nub_spmi2>; + status = "disabled"; + }; + + nub_spmi3: spmi@5090d4000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x090d4000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + power-domains = <&ps_nub_spmi3>; + status = "disabled"; + }; + + nub_spmi4: spmi@509114000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x09114000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + power-domains = <&ps_nub_spmi4>; + status = "disabled"; + }; + + aop_spmi0: spmi@510914000 { + compatible = "apple,t6041-spmi", "apple,t8103-spmi"; + reg = <0x5 0x10914000 0x0 0x100>; + #address-cells = <2>; + #size-cells = <0>; + /* Shared with AOP firmware; no AP bus ownership handoff yet. */ + status = "disabled"; + }; + + /* The QSPIMC input is ADT clock 434 (200 MHz). */ + clk_200m: clock-200m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <200000000>; + clock-output-names = "clk_200m"; + }; + + spi4: spi@429110000 { + compatible = "apple,t6041-spi", "apple,t8103-spi"; + reg = <0x4 0x29110000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + clocks = <&clkref>; + power-domains = <&ps_spi4>; + #address-cells = <1>; + #size-cells = <0>; + /* Panel/TCON control belongs to the display firmware. */ + status = "disabled"; + }; + + qspi: spi@429118000 { + compatible = "apple,t6041-qspi"; + reg = <0x4 0x29118000 0x0 0x4800>; + interrupt-parent = <&aic>; + interrupts = ; + clocks = <&clk_200m>; + power-domains = <&ps_qspi>; + #address-cells = <1>; + #size-cells = <0>; + /* Boards enable it with their flash and its nvram partition. */ + status = "disabled"; + }; + + /* The loader supplies the SIO firmware regions and protocol tables. */ + sio: dma-controller@429e00000 { + compatible = "apple,t6041-sio"; + reg = <0x4 0x29e00000 0x0 0x8000>; + dma-channels = <128>; + #dma-cells = <1>; + mboxes = <&sio_mbox>; + iommus = <&sio_dart 0>; + power-domains = <&ps_sio_cpu>; + status = "disabled"; + }; + + sio_mbox: mailbox@429e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x4 0x29e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + power-domains = <&ps_sio_cpu>; + status = "disabled"; + }; + + /* + * Disabled until the H16 firmware path is proven on hardware. The + * loader fills the preload reservations and the firmware IOVAs from + * the ADT, so enabling it then only takes status = "okay" here and on + * the three DARTs. + */ + ane: ane@484000000 { + compatible = "apple,t6041-ane"; + reg = <0x4 0x84000000 0x0 0x2000000>, + <0x5 0x02280000 0x0 0x18000>, + <0x5 0x022a0000 0x0 0x4000>, + <0x5 0x003c0000 0x0 0x30000>, + <0x2 0x12000000 0x0 0xff4000>, + <0x5 0x22000000 0x0 0x2000000>, + <0x5 0x08374000 0x0 0x4000>; + reg-names = "engine", "pmgr", "aux-0", "aux-1", "aux-2", + "aux-3", "aux-4"; + interrupt-parent = <&aic>; + interrupts = ; + /* Stream 0 only: the MPM stream 11 is not given to the host. */ + iommus = <&ane0_dart0 0>, <&ane0_dart1 0>, <&ane0_dart2 0>; + power-domains = <&ps_ane_sys>, <&ps_ane_cpu>, <&ps_ane_mpm>, + <&ps_ane_td>, <&ps_ane_base>; + apple,ane-type = <0x110>; + apple,firmware-preloaded; + /* Inclusive DAPF bounds, in hardware record order. */ + apple,dapf-ranges = /bits/ 64 <0x5022803c0 0x5022803c3>, + /bits/ 64 <0x50228c000 0x50228c01b>, + /bits/ 64 <0x581668000 0x581668003>, + /bits/ 64 <0x28a668000 0x28a668003>; + /* Default firmware layout; the loader rewrites it from the ADT. */ + apple,firmware-iovas = /bits/ 64 <0x10000000000 0x100000c0000>; + /* The bootloader supplies the physical TEXT/DATA reservations. */ + status = "disabled"; + }; + + /* The video encoder stays disabled until its firmware backend is available. */ + ave: video-codec@283100000 { + compatible = "apple,t6041-ave"; + reg = <0x2 0x83100000 0x0 0x45c000>, + <0x2 0x83050000 0x0 0x4000>, + <0x2 0x83800000 0x0 0x800000>; + reg-names = "codec", "mailbox", "coproc"; + interrupt-parent = <&aic>; + interrupts = , + , + , + , + ; + power-domains = <&ps_venc0_dma>, <&ps_venc0_pipe4>, + <&ps_venc0_pipe5>, <&ps_venc0_me0>, <&ps_venc0_me1>, + <&pmc_soc_max>; + power-domain-names = "dma", "pipe4", "pipe5", "me0", "me1", "perf"; + iommus = <&ave0_dart0 0>, <&ave0_dart1 0>; + status = "disabled"; + }; + + serial0: serial@429200000 { + compatible = "apple,s5l-uart"; + reg = <0x4 0x29200000 0x0 0x4000>; + reg-io-width = <4>; + interrupt-parent = <&aic>; + interrupts = ; + clocks = <&clkref>, <&clkref>; + clock-names = "uart", "clk_uart_baud0"; + power-domains = <&ps_uart0>; + status = "disabled"; + }; + + dcuart: serial@50883c000 { + compatible = "apple,dockchannel-uart"; + reg = <0x5 0x0883c000 0x0 0x4000>, + <0x5 0x08838000 0x0 0x4000>, + <0x5 0x0880c000 0x0 0x4000>; + reg-names = "data", "config", "irq"; + interrupt-parent = <&aic>; + interrupts = ; + apple,channel = <2>; + 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"; + }; + + usb4_0_dart: iommu@381a80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x81a80000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + 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"; + }; + + usb4_1_dart: iommu@389a80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x89a80000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + 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"; + }; + + usb4_2_dart: iommu@391a80000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x91a80000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x300 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + +}; + +#include "t604x-pmgr.dtsi" diff --git a/drivers/gpu/drm/apple/apple_drv.c b/drivers/gpu/drm/apple/apple_drv.c index a1680f12c2d2f..09894999f9b48 100644 --- a/drivers/gpu/drm/apple/apple_drv.c +++ b/drivers/gpu/drm/apple/apple_drv.c @@ -572,7 +572,14 @@ static void apple_atomic_commit_tail(struct drm_atomic_commit *state) dcp_retain_framebuffer(to_apple_crtc(old->crtc)->dcp, entry); } - drm_atomic_helper_commit_tail_rpm(state); + drm_atomic_helper_commit_modeset_disables(state->dev, state); + drm_atomic_helper_commit_modeset_enables(state->dev, state); + drm_atomic_helper_commit_planes(state->dev, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); + drm_atomic_helper_fake_vblank(state); + drm_atomic_helper_commit_hw_done(state); + drm_atomic_helper_wait_for_flip_done(state->dev, state); + drm_atomic_helper_cleanup_planes(state->dev, state); } static const struct drm_mode_config_helper_funcs apple_mode_config_helpers = { diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index be07aff95d776..7e4c120035623 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -4720,19 +4720,19 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev) ret = dcp_read_fw_version(dev, "apple,firmware-version", fw_str); /* - * T6041 (M4 Pro/Max) is driven only with the 26.6.2 firmware its - * desktop IOMFB instance was written for: both the boot firmware and - * its compatibility version must be exactly that release. + * T6041 (M4 Pro/Max) is driven only with the 26.5.2 and 26.6.2 firmware + * its desktop IOMFB instance was written for: the boot firmware and its + * compatibility version must both be exactly the same one of those. */ if (of_device_is_compatible(dev->of_node, "apple,t6041-dcp") || of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) { int compat_ret = dcp_read_fw_version(dev, "apple,firmware-compat", compat_str); - if (ret >= 0 && compat_ret >= 0 && !strcmp(fw_str, "26.6.2") && - !strcmp(compat_str, "26.6.2")) + if (ret >= 0 && compat_ret >= 0 && !strcmp(fw_str, compat_str) && + (!strcmp(fw_str, "26.5.2") || !strcmp(fw_str, "26.6.2"))) return DCP_FIRMWARE_V_26_6_DESKTOP; - dev_err(dev, "T6041 display not started: DCP firmware %s (compat %s) is not 26.6.2\n", + dev_err(dev, "T6041 display not started: DCP firmware %s (compat %s) is not 26.5.2 or 26.6.2\n", ret >= 0 ? fw_str : "missing", compat_ret >= 0 ? compat_str : "missing"); return DCP_FIRMWARE_UNKNOWN; diff --git a/drivers/gpu/drm/apple/parser.c b/drivers/gpu/drm/apple/parser.c index fff8b3465c60c..1c4bd3c4784b8 100644 --- a/drivers/gpu/drm/apple/parser.c +++ b/drivers/gpu/drm/apple/parser.c @@ -2380,3 +2380,39 @@ int parse_panel_edid_data(const void *blob, size_t len, const u8 **edid, size_t ret = parse(blob, len, &ctx); return ret ?: parse_panel_edid_value(&ctx, 0, &budget, true, edid, size); } +int parse_system_log_mnits_pairs(const void *blob, size_t size, + struct dcp_system_ev_mnits *entry) +{ + struct dcp_parse_ctx ctx = { .blob = blob, .len = size, .pos = 0 }; + s64 mnits = -1, idac = -1, timestamp = 0; + int ret = 0; + + if (size > U32_MAX) + return -EINVAL; + + while (round_up(ctx.pos, 4) + sizeof(u32) <= size) { + char *key = parse_string(&ctx); + + if (IS_ERR(key)) + break; + if (!strcmp(key, "mNits")) + ret = parse_int(&ctx, &mnits); + else if (!strcmp(key, "iDAC")) + ret = parse_int(&ctx, &idac); + else if (!strcmp(key, "timestamp")) + ret = parse_int(&ctx, ×tamp); + else + ret = skip(&ctx); + kfree(key); + if (ret) + break; + } + + if (mnits < 0 || mnits > U32_MAX) + return -EINVAL; + + entry->millinits = mnits; + entry->idac = idac < 0 ? 0 : idac; + entry->timestamp = timestamp; + return 0; +} diff --git a/drivers/gpu/drm/apple/parser.h b/drivers/gpu/drm/apple/parser.h index 81c75143c8f9d..4f7fcf721f5fc 100644 --- a/drivers/gpu/drm/apple/parser.h +++ b/drivers/gpu/drm/apple/parser.h @@ -265,5 +265,7 @@ struct dcp_system_ev_mnits { int parse_system_log_mnits(struct dcp_parse_ctx *handle, struct dcp_system_ev_mnits *entry); +int parse_system_log_mnits_pairs(const void *blob, size_t size, + struct dcp_system_ev_mnits *entry); #endif diff --git a/drivers/gpu/drm/apple/systemep.c b/drivers/gpu/drm/apple/systemep.c index 44e239c6016b0..392c2ca58f312 100644 --- a/drivers/gpu/drm/apple/systemep.c +++ b/drivers/gpu/drm/apple/systemep.c @@ -87,6 +87,13 @@ static int powerlog_report(struct apple_epic_service *service, enum epic_subtype ret = parse(data, data_size, &parse_ctx); if (ret) { + if (dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP && + !parse_system_log_mnits_pairs(data, data_size, &mnits)) { + dev_info(dcp->dev, "systemep: powerlog mNits %u.%03u iDAC %u\n", + mnits.millinits / 1000, mnits.millinits % 1000, + mnits.idac); + goto have_mnits; + } dev_warn(service->ep->dcp->dev, "systemep: failed to parse report: %d\n", ret); return ret; } @@ -100,6 +107,7 @@ static int powerlog_report(struct apple_epic_service *service, enum epic_subtype dev_dbg(dcp->dev, "systemep: mNits event: Nits: %u.%03u, iDAC: %u\n", mnits.millinits / 1000, mnits.millinits % 1000, mnits.idac); +have_mnits: if ((dcp->fw_compat == DCP_FIRMWARE_H17P && dcp->hw.iomfb_method_profile != DCP_IOMFB_METHODS_H17G) || dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP) { diff --git a/drivers/gpu/drm/asahi/driver.rs b/drivers/gpu/drm/asahi/driver.rs index d6e461a7c3210..ff82d8c118e85 100644 --- a/drivers/gpu/drm/asahi/driver.rs +++ b/drivers/gpu/drm/asahi/driver.rs @@ -161,6 +161,10 @@ macro_rules! asahi_of_device_table { of::DeviceId::new(c"apple,agx-t6040"), ProbeConfig::G17(&hw::t6040::CONFIG) ), + ( + of::DeviceId::new(c"apple,agx-t6041"), + ProbeConfig::G17(&hw::t6041::CONFIG) + ), ( of::DeviceId::new(c"apple,agx-t8103"), ProbeConfig::Legacy(&hw::t8103::HWCONFIG) diff --git a/drivers/gpu/drm/asahi/g17/fw/compute.rs b/drivers/gpu/drm/asahi/g17/fw/compute.rs index b1afdad816b6b..91b3a2f58334c 100644 --- a/drivers/gpu/drm/asahi/g17/fw/compute.rs +++ b/drivers/gpu/drm/asahi/g17/fw/compute.rs @@ -26,6 +26,16 @@ pub(crate) const COMPUTE_KICK_EVENT_MASK: [u64; 4] = [0, 0, 4, 0]; const COMPUTE_REGISTERS: usize = 41; const COMPUTE_REGISTERS_MAX: usize = COMPUTE_REGISTERS + 1; +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub(crate) enum ComputeProgram { + G17P, + V25F84, +} + +const V25F84_REGISTERS: usize = 36; +const V25F84_CHECKPOINTS: [u16; 4] = [34, 35, 35, V25F84_REGISTERS as u16]; +const V25F84_UNK_0A599_FIRST: u64 = 0x0000_0132_0040_0020; + /// Validated per-command shader-context scratch request. /// /// The layout word is Apple's packed SCS layout: depth (bits 0:15), levels @@ -133,8 +143,11 @@ impl ScratchRequest { self.tail } - fn checkpoints(self) -> [u16; 4] { - CHECKPOINTS.map(|count| count + u16::from(self.enabled())) + fn checkpoints(self, program: ComputeProgram) -> [u16; 4] { + match program { + ComputeProgram::G17P => CHECKPOINTS.map(|count| count + u16::from(self.enabled())), + ComputeProgram::V25F84 => V25F84_CHECKPOINTS, + } } } const ALT_REGISTERS: usize = 4; @@ -187,6 +200,15 @@ impl OperandState { r0a5c9: 0x1e000, size: 0x44000, }; + pub(crate) const FOUR_BY_TEN: OperandState = OperandState { + r10229: 0x78800, + r140a8: 0x7a800, + r10099: 0x3c405, + r10091: 0x78400, + r0a5c1: 0x0005, + r0a5c9: 0x3c000, + size: 0x80000, + }; } /// Checkpoints into the main register array, as entry counts: after the @@ -279,6 +301,7 @@ impl IntersectionTables { /// Inputs of one compute descriptor. pub(crate) struct ComputeArgs { + pub(crate) program: ComputeProgram, pub(crate) intersection: IntersectionTables, /// Scratch request validated with the userspace command. pub(crate) scratch: ScratchRequest, @@ -392,6 +415,61 @@ fn compute_registers(args: &ComputeArgs) -> Result<[RegisterWrite; COMPUTE_REGIS ]) } +fn compute_registers_25f84(args: &ComputeArgs) -> Result<[RegisterWrite; V25F84_REGISTERS]> { + let preempt = args.preempt_va; + let operand = args.operand_state_va; + let state = args.operand; + let key = work_key(args.context_id, args.work_state); + let ids = OBJECT_IDS.word(); + let intersection = args.intersection.words(); + + Ok([ + RegisterWrite::new(0x1a510, preempt), + RegisterWrite::new(0x1a420, args.cdm_va), + RegisterWrite::new(0x1a4d0, offset_va(preempt, PREEMPT_STATE[0])?), + RegisterWrite::new(0x1a4d8, offset_va(preempt, PREEMPT_STATE[1])?), + RegisterWrite::new(0x1a4e0, offset_va(preempt, PREEMPT_STATE[2])?), + RegisterWrite::new(0x1a4e8, offset_va(preempt, PREEMPT_STATE[3])?), + RegisterWrite::new(0x1a440, UNK_1A440), + RegisterWrite::new(0x1a458, UNK_1A458), + RegisterWrite::new(0x101d9, UNK_101D9), + RegisterWrite::new(0x1a089, intersection[0]), + RegisterWrite::new(0x1a091, intersection[1]), + RegisterWrite::new(0x1a059, intersection[2]), + RegisterWrite::new(0x1a061, intersection[3]), + RegisterWrite::new(0x1a0b9, intersection[4]), + RegisterWrite::new(0x1a0c1, intersection[5]), + RegisterWrite::new(0x101d1, args.scratch.size_word()), + RegisterWrite::new( + 0x0d479, + if args.intersection.auxiliary == 0 { + args.scratch.tail_word() + } else { + u64::from(args.intersection.auxiliary) + }, + ), + RegisterWrite::new(0x1a0e9, args.scratch.stack_word()), + RegisterWrite::new(0x107a1, args.scratch.window_word()), + RegisterWrite::new(0x0a599, V25F84_UNK_0A599_FIRST), + RegisterWrite::new(0x0d411, UNK_0D411), + RegisterWrite::new(0x1a540, ids), + RegisterWrite::new(0x014a9, ids), + RegisterWrite::new(0x0a351, ids), + RegisterWrite::new(0x10201, key), + RegisterWrite::new(0x10428, key), + RegisterWrite::new(0x14028, u64::from(args.free_list_slot)), + RegisterWrite::new(0x14070, args.usage_va | 1), + RegisterWrite::new(0x10229, offset_va(operand, state.r10229)?), + RegisterWrite::new(0x140a8, offset_va(operand, state.r140a8)?), + RegisterWrite::new(0x10099, offset_va(operand, state.r10099)?), + RegisterWrite::new(0x10091, offset_va(operand, state.r10091)?), + RegisterWrite::new(0x0a5c1, offset_va(operand, state.r0a5c1)?), + RegisterWrite::new(0x0a5c9, offset_va(operand, state.r0a5c9)?), + RegisterWrite::new(0x1a440, UNK_1A440_FINAL), + RegisterWrite::new(0x0a599, UNK_0A599), + ]) +} + /// The second array exchanges the operand-state regions of registers /// 0x10099/0x0a5c1 and 0x10091/0x0a5c9. fn alt_registers(args: &ComputeArgs) -> Result<[RegisterWrite; ALT_REGISTERS]> { @@ -506,6 +584,8 @@ impl ComputeDescriptor { const UNK_FB0: u16 = 0x1a; const UNK_FBA: u32 = 0xe0a0_0001; const UNK_FC5: u8 = 0x9f; + const UNK_FBA_25F84: u32 = 0x6c00_0001; + const UNK_FC5_25F84: u8 = 0x5f; /// Fills a descriptor cleared by `Object::initialize`. The unused firmware /// fields and padding retain that zero initialization. @@ -516,7 +596,6 @@ impl ComputeDescriptor { { return Err(EINVAL); } - let registers = compute_registers(args)?; let alt_registers = alt_registers(args)?; let registers_va = offset_va(args.descriptor_va, Self::REGISTERS_OFFSET)?; let alt_registers_va = offset_va(args.descriptor_va, Self::ALT_REGISTERS_OFFSET)?; @@ -526,11 +605,18 @@ impl ComputeDescriptor { self.tag = CommandTag::Compute as u32; self.context_id = args.context_id.into(); self.work_state_va = args.work_state_va; - self.checkpoints = args.scratch.checkpoints(); - // The enabled program prepends one register; disabled descriptors keep - // the same forty writes, trailer count and resume checkpoints. - let first = usize::from(!args.scratch.enabled()); - self.registers.set(registers_va, ®isters[first..])?; + self.checkpoints = args.scratch.checkpoints(args.program); + match args.program { + ComputeProgram::G17P => { + let registers = compute_registers(args)?; + let first = usize::from(!args.scratch.enabled()); + self.registers.set(registers_va, ®isters[first..])?; + } + ComputeProgram::V25F84 => { + self.registers + .set(registers_va, &compute_registers_25f84(args)?)?; + } + } self.alt_registers.set(alt_registers_va, &alt_registers)?; self.preempt_va = args.preempt_va; self.cdm_end_va = args.cdm_end_va; @@ -552,8 +638,18 @@ impl ComputeDescriptor { self.timestamp_end_va = timestamp_end_va; self.unk_fb0 = Self::UNK_FB0; self.free_list_control_va = args.free_list_control_va; - self.unk_fba = Self::UNK_FBA; - self.unk_fc5 = Self::UNK_FC5; + match args.program { + ComputeProgram::G17P => { + self.unk_fba = Self::UNK_FBA; + self.unk_fc5 = Self::UNK_FC5; + } + ComputeProgram::V25F84 => { + self.unk_fba = Self::UNK_FBA_25F84; + self.unk_fbe[0] = 0x06; + self.unk_fc5 = Self::UNK_FC5_25F84; + self.unk_fc6[0] = 0x04; + } + } self.usage_va = args.usage_fw_va; self.context_generation = args.context_generation; Ok(()) @@ -564,10 +660,11 @@ impl ComputeDescriptor { pub(crate) fn register_bindings( descriptor_va: u64, scratch: ScratchRequest, + program: ComputeProgram, ) -> Result<[Option; 4]> { let registers = RegisterArrayBinding::new( offset_va(descriptor_va, Self::REGISTERS_OFFSET)?, - scratch.checkpoints()[0] as u8, + scratch.checkpoints(program)[0] as u8, )?; let alt_registers = RegisterArrayBinding::new( offset_va(descriptor_va, Self::ALT_REGISTERS_OFFSET)?, diff --git a/drivers/gpu/drm/asahi/g17/fw/compute_pool.rs b/drivers/gpu/drm/asahi/g17/fw/compute_pool.rs index 0f0614f6155a1..b056fe5aff230 100644 --- a/drivers/gpu/drm/asahi/g17/fw/compute_pool.rs +++ b/drivers/gpu/drm/asahi/g17/fw/compute_pool.rs @@ -3,7 +3,7 @@ use kernel::prelude::*; use super::initdata::{FREE_LIST_BLOCK_PAGES, FREE_LIST_BLOCK_SIZE}; -use super::freelist::{COMPUTE_BLOCKS, PAGE_LIST_SIZE}; +use super::freelist::PAGE_LIST_SIZE; pub(crate) fn extra_bytes(active_cores: u32, scs_pages: u16) -> Result { if active_cores == 0 { return Err(EINVAL); } @@ -18,9 +18,10 @@ pub(crate) fn extra_bytes(active_cores: u32, scs_pages: u16) -> Result { Ok(extra) } -pub(crate) fn required_blocks(active_cores: u32, scs_pages: u16) -> Result { +pub(crate) fn required_blocks(base: usize, active_cores: u32, scs_pages: u16) -> Result { let extra = extra_bytes(active_cores, scs_pages)?; - let bytes = extra.checked_add((COMPUTE_BLOCKS * FREE_LIST_BLOCK_SIZE) as u64) + let bytes = extra + .checked_add((base * FREE_LIST_BLOCK_SIZE) as u64) .ok_or(EOVERFLOW)?; let blocks = usize::try_from(bytes.div_ceil(FREE_LIST_BLOCK_SIZE as u64)) .map_err(|_| EOVERFLOW)?; diff --git a/drivers/gpu/drm/asahi/g17/fw/initdata.rs b/drivers/gpu/drm/asahi/g17/fw/initdata.rs index 3092e599caa84..387cebb28a368 100644 --- a/drivers/gpu/drm/asahi/g17/fw/initdata.rs +++ b/drivers/gpu/drm/asahi/g17/fw/initdata.rs @@ -781,6 +781,15 @@ impl PerfGroup { } } } + + pub(crate) fn replicate_first_lane(&mut self, lanes: usize) { + for index in 0..PERF_STATES { + for lane in lanes.max(1)..PERF_LANES { + self.core_mv[index][lane] = self.core_mv[index][0]; + self.sram_mv[index][lane] = self.sram_mv[index][0]; + } + } + } } /// Returns the performance states selected by `map` from `opps`. diff --git a/drivers/gpu/drm/asahi/g17/fw/initdata/v25g83.rs b/drivers/gpu/drm/asahi/g17/fw/initdata/v25g83.rs index f4c3ee5db22e2..863a90fc52a34 100644 --- a/drivers/gpu/drm/asahi/g17/fw/initdata/v25g83.rs +++ b/drivers/gpu/drm/asahi/g17/fw/initdata/v25g83.rs @@ -107,6 +107,7 @@ pub(crate) struct HwDataArgs25G83<'a> { pub(crate) cs_opps: &'a [Opp], /// Operating points of the AFR clock domain. pub(crate) afr_opps: &'a [Opp], + pub(crate) chip: Option<&'a Chip>, } /// The hardware data of the 25G83 build, at the base of the bundle. @@ -300,8 +301,12 @@ impl HwData25G83 { } self.register_map[window.slot] = RegisterMapEntry::window(window); } - if !args.reserved_slots.is_empty() { - return Err(EINVAL); + for &slot in args.reserved_slots { + match used.get_mut(slot) { + Some(used) if !*used => *used = true, + _ => return Err(EINVAL), + } + self.register_map[slot] = RegisterMapEntry::reserved(); } self.chip_id = args.chip_id; @@ -336,6 +341,9 @@ impl HwData25G83 { } self.perf_a.fill(&states_a, 1); self.perf_b.fill(&states_b, 1); + if ext.chip.is_some_and(|chip| chip.perf_a_replicate_lanes) { + self.perf_a.replicate_first_lane(states_a[0].cells); + } for (index, state) in states_b.iter().enumerate() { self.perf_b_freq_mhz[index] = state.freq_mhz; self.perf_a_states[index] = perf.states_a[index].into(); @@ -344,7 +352,9 @@ impl HwData25G83 { self.perf_a_relative = perf.relative_a; self.perf_b_relative = perf.relative_b; self.unk_1848 = [0x3f82_8f5c; 11]; - self.cs_perf.fill(ext.cs_opps, perf.sram_min_mv)?; + if ext.chip.is_none_or(|chip| chip.cs_perf_table) { + self.cs_perf.fill(ext.cs_opps, perf.sram_min_mv)?; + } self.afr_perf.fill(ext.afr_opps, perf.sram_min_mv)?; self.unk_2544 = 5; @@ -375,15 +385,46 @@ impl HwData25G83 { self.unk_26c0 = 1; self.unk_26c4 = 1; self.unk_26f4 = 1; + // SAFETY: `HwData25G83` consists of integers only and has no padding, so any bytes are a + // valid value. + let bytes = unsafe { + core::slice::from_raw_parts_mut((self as *mut Self).cast::(), size_of::()) + }; + if let Some(chip) = ext.chip { + overlay_words(bytes, chip.hw_data_words)?; + } Ok(()) } } +fn overlay_words(bytes: &mut [u8], words: Words) -> Result { + for &(offset, value, repeat) in words { + for index in 0..repeat { + let at = offset + 4 * index; + bytes + .get_mut(at..at + 4) + .ok_or(EINVAL)? + .copy_from_slice(&value.to_le_bytes()); + } + } + Ok(()) +} + /// Power configuration control period, in 24 MHz clocks (8 ms). const PERIOD_CLOCKS: u32 = 200_000; /// Temperature sensors read by the die and MTR temperature limiters. const TEMP_SENSOR_MASK: u32 = 0x2a22_2aa2; +pub(crate) struct Chip { + pub(crate) max_power_mw: u32, + pub(crate) leakage: [u32; 56], + pub(crate) aon_table: &'static [u32], + pub(crate) hw_data_words: Words, + pub(crate) power_config_words: Words, + pub(crate) perf_a_replicate_lanes: bool, + pub(crate) cs_perf_table: bool, +} + /// Offset of the per-chip leakage coefficients in the power configuration. const LEAKAGE_OFFSET: usize = 0x642c; /// Offset in the power configuration of the GPU address of the configuration's status (the @@ -597,6 +638,10 @@ impl PowerConfig25G83 { self.0[AON_POINTER..AON_POINTER + 8].copy_from_slice(&aon_va.to_le_bytes()); self.0[ENTROPY..ENTROPY + 4].copy_from_slice(&entropy.to_le_bytes()); } + + pub(crate) fn apply_chip(&mut self, chip: &Chip) -> Result { + overlay_words(&mut self.0, chip.power_config_words) + } } /// The AON temperature-source rows the power configuration names: the GPU cluster 0, GPU diff --git a/drivers/gpu/drm/asahi/g17/fw/kick.rs b/drivers/gpu/drm/asahi/g17/fw/kick.rs index ca2b6604a302b..2a035524bdffb 100644 --- a/drivers/gpu/drm/asahi/g17/fw/kick.rs +++ b/drivers/gpu/drm/asahi/g17/fw/kick.rs @@ -507,10 +507,46 @@ impl KickEntry { } } +pub(crate) fn ksm_slot_descriptor( + ring_va: u64, + data_master: super::queue::DataMaster, + priority: u8, +) -> Result { + if ring_va & !RenderRegistration::ADDRESS_MASK != 0 || priority >= Policy::PRIORITIES { + return Err(EINVAL); + } + let term = (3 * (4 - u64::from(priority)) + 0x3fe).wrapping_shl(54); + Ok(((data_master as u64 + 1) << 60) | ring_va | term) +} + +#[derive(Copy, Clone, Debug)] +pub(crate) struct KsmQueue { + pub(crate) qid: u8, + pub(crate) descriptor: u64, +} + +impl KsmQueue { + pub(crate) fn new( + qid: u8, + ring_va: u64, + data_master: super::queue::DataMaster, + priority: u8, + ) -> Result { + if qid > QID_MAX { + return Err(EINVAL); + } + Ok(Self { + qid, + descriptor: ksm_slot_descriptor(ring_va, data_master, priority)?, + }) + } +} + /// The complete write-only installation of a fragment/tiling queue pair. /// Firmware must see both queues configured before either outer command. pub(crate) struct RenderRegistration { writes: [(usize, u64); 8], + queues: [KsmQueue; 2], } impl RenderRegistration { @@ -540,8 +576,7 @@ impl RenderRegistration { if qid > QID_MAX || va & !Self::ADDRESS_MASK != 0 { return Err(EINVAL); } - let completion = (3 * (4 - u64::from(priority)) + 0x3fe).wrapping_shl(54); - let payload = ((engine as u64 + 1) << 60) | va | completion; + let payload = ksm_slot_descriptor(va, engine, priority)?; let (low, high) = if qid < 64 { (1u64 << qid, 0) } else { @@ -554,10 +589,30 @@ impl RenderRegistration { (Self::VALID_LOW, low), ]); } - Ok(Self { writes }) + Ok(Self { + writes, + queues: [ + KsmQueue::new( + fragment.0, + fragment.1, + super::queue::DataMaster::Fragment, + priority, + )?, + KsmQueue::new( + tiling.0, + tiling.1, + super::queue::DataMaster::Tiling, + priority, + )?, + ], + }) } pub(crate) fn writes(&self) -> &[(usize, u64); 8] { &self.writes } + + pub(crate) fn queues(&self) -> &[KsmQueue; 2] { + &self.queues + } } diff --git a/drivers/gpu/drm/asahi/g17/fw/render.rs b/drivers/gpu/drm/asahi/g17/fw/render.rs index d0000282cef82..7933828961b78 100644 --- a/drivers/gpu/drm/asahi/g17/fw/render.rs +++ b/drivers/gpu/drm/asahi/g17/fw/render.rs @@ -70,6 +70,10 @@ impl Deflake { sub: [0xa0, 0x820], viewport: false, }; + pub(crate) const FOUR_CLUSTERS: Deflake = Deflake { + sub: [0x120, 0xda0], + viewport: false, + }; } /// The register programs of a firmware build's render descriptors. @@ -372,6 +376,8 @@ pub(crate) struct RenderArgs<'a> { pub(crate) fragment: RenderStage, /// Register programs of the firmware build. pub(crate) programs: RegisterPrograms, + /// Device/build policy for registers 0x1c890 and 0x1c918 in V25G83-format arrays. + pub(crate) ta_mode_1: bool, /// Deflake-buffer layout of the GPU. pub(crate) deflake: Deflake, } @@ -662,6 +668,8 @@ fn ta_registers( /// Tiler segment control of a two-cluster pass, what macOS writes. const VDM_SEGMENT_CONTROL: u64 = 0x20_0440; const VDM_SEGMENT_INDEX: u64 = 4; +/// Tiler segment control of T6041 on 25F84, what macOS writes, with 0x1c918 = 0. +const T6041_TA_MODE_1: u64 = 1; /// Pages the tiler keeps out of a partial render's segments: without them the pages a pass /// returns shrink to none and the tiler can't advance. Fifteen blocks, macOS's minimum heap. const MIN_FREE_TVB_PAGES: u64 = 0x3c; @@ -716,8 +724,13 @@ fn ta_registers_25g83( push(find(0x1c880, 0)?); push(RegisterWrite::new(0x1c948, gtp(4)?)); push(RegisterWrite::new(0x1c888, gtp(5)?)); - push(RegisterWrite::new(0x1c890, VDM_SEGMENT_CONTROL)); - push(RegisterWrite::new(0x1c918, VDM_SEGMENT_INDEX)); + let (segment_control, segment_index) = if args.ta_mode_1 { + (T6041_TA_MODE_1, 0) + } else { + (VDM_SEGMENT_CONTROL, VDM_SEGMENT_INDEX) + }; + push(RegisterWrite::new(0x1c890, segment_control)); + push(RegisterWrite::new(0x1c918, segment_index)); push(find(0x1c079, 0)?); push(find(0x1c9d8, 0)?); push(RegisterWrite::new(0x1c089, gtp2)); @@ -1596,3 +1609,152 @@ impl FragmentSlot { Ok(Some(table)) } } + +#[kunit_tests(asahi_g17_ta_mode)] +mod ta_mode_tests { + use super::*; + use crate::g17::fw::{ + compute::{IntersectionTables, ScratchRequest}, + render_rt::RayQueryStage, + variant::{Firmware, Variant, V25F84, V25G83, V26A428}, + }; + + fn selected(firmware: &Firmware) -> &'static Variant { + match firmware { + Firmware::Fixed(variant) => variant, + Firmware::Identified(builds) => { + assert_eq!(builds.len(), 1); + builds[0].variant + } + } + } + + #[test] + fn policy_is_local_to_the_admitted_t6041_build() { + let max = selected(&crate::hw::t6041::CONFIG.firmware); + let pro = selected(&crate::hw::t6040::CONFIG.firmware); + assert!(max.is_25f84()); + assert_eq!(max.programs, RegisterPrograms::V25G83); + assert!(max.ta_mode_1); + assert!(!pro.ta_mode_1); + assert!(!V25F84.ta_mode_1); + assert!(!V25G83.ta_mode_1); + assert!(!V26A428.ta_mode_1); + } + + fn fixture() -> (RenderPass, RenderResources) { + // SAFETY: These two types contain only integers, bools and structs of + // those types, for which all-zero bytes are valid. Required render + // dimensions and user-window addresses are filled below. + let mut pass: RenderPass = unsafe { core::mem::zeroed() }; + // SAFETY: RenderResources contains only integers and integer structs. + let mut resources: RenderResources = unsafe { core::mem::zeroed() }; + pass.width = 64; + pass.height = 64; + pass.layers = 1; + pass.utile_width = 32; + pass.utile_height = 32; + pass.sample_size = 4; + pass.vdm_va = USER_BASE + 0x10000; + resources.tilemap_va = USER_BASE + 0x20000; + resources.layermeta_va = USER_BASE + 0x30000; + resources.heapmeta_va = USER_BASE + 0x40000; + resources.tpc_va = USER_BASE + 0x50000; + resources.deflake_va = USER_BASE + 0x60000; + resources.gtp_va = core::array::from_fn(|i| USER_BASE + 0x70000 + i as u64 * 0x1000); + (pass, resources) + } + + fn args<'a>(pass: &'a RenderPass, resources: &'a RenderResources, scs: bool) -> RenderArgs<'a> { + let stage = RenderStage { + qid: 1, + descriptor_va: USER_BASE + 0x80000, + state_word: 1, + stamp_va: USER_BASE + 0x90000, + aux_stamp_va: USER_BASE + 0x90008, + }; + // Exercise the array with and without its optional SCS entry. + let ray = RayQueryStage { + intersection: IntersectionTables::NONE, + scratch: ScratchRequest::new(if scs { (1 << 32) | (1 << 24) | 8 } else { 0 }).unwrap(), + }; + RenderArgs { + pass, + resources, + ray_query: [ray; 2], + ordinal: 0, + ta: stage, + fragment: stage, + programs: RegisterPrograms::V25G83, + ta_mode_1: false, + deflake: Deflake::FOUR_CLUSTERS, + } + } + + #[test] + fn ta_mode_changes_only_the_segment_writes_with_or_without_scs() { + let (mut pass, resources) = fixture(); + for (width, height, layers) in [(64, 64, 1), (3456, 2234, 2)] { + pass.width = width; + pass.height = height; + pass.layers = layers; + let geometry = Geometry::new(&pass).unwrap(); + let words = PassWords::new(&pass).unwrap(); + for scs in [false, true] { + let mut args = args(&pass, &resources, scs); + let (before, count) = ta_registers_25g83(&args, &geometry, &words).unwrap(); + args.ta_mode_1 = selected(&crate::hw::t6041::CONFIG.firmware).ta_mode_1; + let (after, new_count) = ta_registers_25g83(&args, &geometry, &words).unwrap(); + assert_eq!(count, 83 + usize::from(scs)); + assert_eq!(new_count, count); + let slot = after[79 + usize::from(scs)].reg; + assert_eq!(slot, 0x14308); + let mut changed = 0; + for (old, new) in before.iter().zip(&after).take(count) { + let old = (old.reg, old.value); + let new = (new.reg, new.value); + if old.0 == 0x1c890 { + assert_eq!(old.1, VDM_SEGMENT_CONTROL); + assert_eq!(new, (0x1c890, T6041_TA_MODE_1)); + changed += 1; + } else if old.0 == 0x1c918 { + assert_eq!(old.1, VDM_SEGMENT_INDEX); + assert_eq!(new, (0x1c918, 0)); + changed += 1; + } else { + // Includes every merge-buffer write and 0x1c9a8. + assert_eq!(old, new); + } + } + assert_eq!(changed, 2); + } + } + } + + #[test] + fn mode_does_not_change_fragment_or_g17p_arrays() { + let (pass, resources) = fixture(); + let geometry = Geometry::new(&pass).unwrap(); + let words = PassWords::new(&pass).unwrap(); + for scs in [false, true] { + let mut args = args(&pass, &resources, scs); + let (before, count) = fragment_registers_25g83(&args, &geometry, &words).unwrap(); + args.ta_mode_1 = true; + let (after, new_count) = fragment_registers_25g83(&args, &geometry, &words).unwrap(); + assert_eq!(count, 91 + usize::from(scs)); + assert_eq!(new_count, count); + for (old, new) in before.iter().zip(&after).take(count) { + assert_eq!((old.reg, old.value), (new.reg, new.value)); + } + args.programs = RegisterPrograms::G17P; + args.ta_mode_1 = false; + let before = ta_registers(&args, &geometry, &words).unwrap(); + args.ta_mode_1 = true; + let after = ta_registers(&args, &geometry, &words).unwrap(); + for (old, new) in before.iter().zip(&after) { + assert_eq!((old.reg, old.value), (new.reg, new.value)); + assert_ne!({ new.reg }, 0x1c890); + } + } + } +} diff --git a/drivers/gpu/drm/asahi/g17/fw/variant.rs b/drivers/gpu/drm/asahi/g17/fw/variant.rs index 03d5bfccafeca..4a32d585d4190 100644 --- a/drivers/gpu/drm/asahi/g17/fw/variant.rs +++ b/drivers/gpu/drm/asahi/g17/fw/variant.rs @@ -36,7 +36,22 @@ pub(crate) enum InitGraph { V25G83, } +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub(crate) enum QueueRegistration { + Firmware, + PoweredRenderPairs, + Mailbox, +} + +#[derive(Copy, Clone, PartialEq, Eq)] +pub(crate) enum FirmwareVersion { + V26A428, + V25G83, + V25F84, +} + /// The layouts and rules of one G17 firmware build. +#[derive(Copy, Clone)] pub(crate) struct Variant { /// The initialization graph. pub(crate) graph: InitGraph, @@ -49,8 +64,7 @@ pub(crate) struct Variant { pub(crate) qid_floor: usize, /// Host words of a queue's pointer block. pub(crate) pointers: PointerLayout, - /// The host registers each render pair through the GPU's MMIO queue ports. - pub(crate) mmio_pair_registration: bool, + pub(crate) registration: QueueRegistration, /// Render kick entries may name an MCache table. pub(crate) mcache: bool, /// Renders may set the few-primitives auxiliary framebuffer flag. @@ -65,6 +79,12 @@ pub(crate) struct Variant { pub(crate) lead_commands: bool, /// Register programs of the render descriptors. pub(crate) programs: super::render::RegisterPrograms, + /// Use 0x1c890 = 1, 0x1c918 = 0 in V25G83-format tiling arrays (device/build policy). + pub(crate) ta_mode_1: bool, + pub(crate) compute: super::compute::ComputeProgram, + pub(crate) opening_record: bool, + pub(crate) split_firmware_area: bool, + pub(crate) version: FirmwareVersion, } /// A firmware build a SoC supports, identified by its loaded TEXT. @@ -98,13 +118,18 @@ pub(crate) const V26A428: Variant = Variant { producer: 0x40, recovery_target: Some(0x50), }, - mmio_pair_registration: true, + registration: QueueRegistration::PoweredRenderPairs, mcache: true, few_primitives: true, ray_traversal: true, fragment_busy: true, lead_commands: false, programs: super::render::RegisterPrograms::G17P, + ta_mode_1: false, + compute: super::compute::ComputeProgram::G17P, + opening_record: true, + split_firmware_area: false, + version: FirmwareVersion::V26A428, }; /// The M4 Pro firmware (25G83, `mBoot-18000.161.10`). @@ -122,7 +147,7 @@ pub(crate) const V25G83: Variant = Variant { }, // Whether this build tolerates the MMIO registration is unknown; the M4 Pro has only run // without it. - mmio_pair_registration: false, + registration: QueueRegistration::Firmware, mcache: false, // A fragment stage with the few-primitives flag hangs. few_primitives: false, @@ -132,9 +157,31 @@ pub(crate) const V25G83: Variant = Variant { fragment_busy: false, lead_commands: true, programs: super::render::RegisterPrograms::V25G83, + ta_mode_1: false, + compute: super::compute::ComputeProgram::G17P, + opening_record: true, + split_firmware_area: false, + version: FirmwareVersion::V25G83, }; +pub(crate) const V25F84: Variant = Variant { + version: FirmwareVersion::V25F84, + qid_floor: 0, + registration: QueueRegistration::Mailbox, + compute: super::compute::ComputeProgram::V25F84, + opening_record: false, + split_firmware_area: true, + ..V25G83 +}; + +impl Variant { + pub(crate) const fn is_25f84(&self) -> bool { + matches!(self.version, FirmwareVersion::V25F84) + } +} + const _: () = { assert!(super::queue::PointerBlock::valid_layout(&V26A428.pointers)); assert!(super::queue::PointerBlock::valid_layout(&V25G83.pointers)); + assert!(super::queue::PointerBlock::valid_layout(&V25F84.pointers)); }; diff --git a/drivers/gpu/drm/asahi/g17/initdata.rs b/drivers/gpu/drm/asahi/g17/initdata.rs index 578bb7533f3c9..56e7335a23bd2 100644 --- a/drivers/gpu/drm/asahi/g17/initdata.rs +++ b/drivers/gpu/drm/asahi/g17/initdata.rs @@ -862,7 +862,7 @@ impl InitData { clusters, }; if variant.graph == super::fw::variant::InitGraph::V25G83 { - return self.build_25g83(&env, cfg, metrics, active_cores); + return self.build_25g83(&env, cfg, metrics, active_cores, variant); } self.map_register_windows(&env, cfg.windows)?; let tables = self.build_descriptor_tables(&env, abi::private::SIZE)?; diff --git a/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs b/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs index 670f4b96dcb76..f7b1952685761 100644 --- a/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs +++ b/drivers/gpu/drm/asahi/g17/initdata/v25g83.rs @@ -18,6 +18,7 @@ use kernel::{c_str, prelude::*}; struct Objects { views: [usize; 5], firmware_area: usize, + firmware_area_2: Option, power_state: usize, aon: usize, } @@ -30,6 +31,7 @@ impl InitData { cfg: &Config, metrics: &KernelObject, active_cores: u32, + variant: &crate::g17::fw::Variant, ) -> Result { self.status_a = v::private::STATUS_A; self.status_b = v::private::STATUS_B; @@ -39,9 +41,9 @@ impl InitData { let first_block = self.build_render_pool(env)?; self.build_compute_pools(env, first_block)?; let bundle = self.build_bundle(env, cfg, metrics)?; - let objects = self.build_25g83_objects(env)?; + let objects = self.build_25g83_objects(env, variant.split_firmware_area)?; self.views = Some(objects.views); - self.initialize_25g83(env, cfg, active_cores, &tables, &bundle, &objects)?; + self.initialize_25g83(env, cfg, active_cores, &tables, &bundle, &objects, variant)?; if cfg.uat_quirks.clean_tables { // Write back every host-built byte before the firmware may read it. for object in self.objects.iter_mut() { @@ -53,8 +55,7 @@ impl InitData { Ok(()) } - /// The views, the firmware area, the power-state object and the AON table. - fn build_25g83_objects(&mut self, env: &BuildEnv<'_>) -> Result { + fn build_25g83_objects(&mut self, env: &BuildEnv<'_>, split: bool) -> Result { use mmu::{PROT_FW_PRIV_RW as FP, PROT_FW_SHARED_RW as FS}; use CpuMap::WriteCombined as WC; let mut views = [0; 5]; @@ -63,12 +64,17 @@ impl InitData { } let firmware_area = self.add(env.fixed(v::kernel_window::FIRMWARE_AREA, mmu::UAT_PGSZ, FP, WC)?)?; + let firmware_area_2 = match split { + true => Some(self.add(env.dynamic(mmu::UAT_PGSZ, mmu::UAT_PGSZ as u64, FP, WC)?)?), + false => None, + }; let power_state = self.add(env.fixed(v::kernel_window::POWER_STATE, mmu::UAT_PGSZ, FS, WC)?)?; let aon = self.add(env.fixed(v::kernel_window::AON_TABLE, mmu::UAT_PGSZ, FP, WC)?)?; Ok(Objects { views, firmware_area, + firmware_area_2, power_state, aon, }) @@ -84,15 +90,25 @@ impl InitData { tables: &DescriptorTables, bundle: &BundleObjects, objects: &Objects, + variant: &crate::g17::fw::Variant, ) -> Result { let bundle_va = self.object(self.bundle)?.gpu_va(); let cluster_va = self.object(self.cluster)?.gpu_va(); let config_va = cluster_va + v::private::CONFIG as u64; let status_a_va = cluster_va + v::private::STATUS_A as u64; let status_b_va = cluster_va + v::private::STATUS_B as u64; - let aon_va = self.object(objects.aon)?.gpu_va(); + let chip = cfg.chip; + let aon_table = chip.map_or(v::AON_TABLE.as_slice(), |chip| chip.aon_table); + let aon_va = match aon_table.is_empty() { + true => 0, + false => self.object(objects.aon)?.gpu_va(), + }; let power_state_va = self.object(objects.power_state)?.gpu_va(); let firmware_area_va = self.object(objects.firmware_area)?.gpu_va(); + let firmware_area_2_va = match objects.firmware_area_2 { + Some(index) => self.object(index)?.gpu_va(), + None => firmware_area_va, + }; let mut view_va = [0; 5]; for (va, index) in view_va.iter_mut().zip(objects.views) { *va = self.object(index)?.gpu_va(); @@ -101,14 +117,28 @@ impl InitData { let opps = Self::opps(env.dev, cfg.opps, env.clusters)?; let cs_opps = Self::opp_table(env.dev, c_str!("apple,cs-opp"))?; let afr_opps = Self::opp_table(env.dev, c_str!("apple,afr-opp"))?; - let calibration = Calibration::read(env.dev)?; - calibration.check_opps(&opps)?; + let calibration = if chip.is_none() { + let calibration = Calibration::read(env.dev)?; + calibration.check_opps(&opps)?; + Some(calibration) + } else { + None + }; + let (perf, max_power_mw, leakage) = match (calibration.as_ref(), chip) { + (Some(calibration), None) => ( + &calibration.perf, + calibration.max_power_mw, + &calibration.leakage, + ), + (None, Some(chip)) => (cfg.perf, chip.max_power_mw, &chip.leakage), + _ => return Err(EINVAL), + }; let hw_args = abi::HwDataArgs { chip_id: cfg.chip_id, windows: cfg.windows, reserved_slots: cfg.reserved_slots, opps: &opps, - perf: &calibration.perf, + perf, completion_rings: bundle.completion_rings, qos_va: self.object(bundle.qos)?.gpu_va(), }; @@ -116,6 +146,7 @@ impl InitData { active_cores, cs_opps: &cs_opps, afr_opps: &afr_opps, + chip, }; // SAFETY: Plain C entropy source. let entropy = unsafe { kernel::bindings::get_random_u32() }; @@ -126,22 +157,19 @@ impl InitData { })?; self.object_mut(self.bundle)? .initialize::(v::POWER_CONFIG, |power| { - power.init( - config_va, - aon_va, - entropy, - calibration.max_power_mw, - &calibration.leakage, - ); + power.init(config_va, aon_va, entropy, max_power_mw, leakage); + if let Some(chip) = chip { + power.apply_chip(chip)?; + } Ok(()) })?; self.object_mut(self.region_c)? .initialize::(0, |region| { region.init(cfg.region_c); - region.max_power_mw = calibration.max_power_mw; + region.max_power_mw = max_power_mw; Ok(()) })?; - for (index, word) in v::AON_TABLE.iter().enumerate() { + for (index, word) in aon_table.iter().enumerate() { self.object_mut(objects.aon)?.write(index * 4, *word)?; } @@ -180,7 +208,7 @@ impl InitData { .initialize::(main_offset, |main| { main.init_primary(&args, &views); main.view_va = view_va; - main.firmware_area_va = [firmware_area_va; 2]; + main.firmware_area_va = [firmware_area_va, firmware_area_2_va]; main.unk_18 = (cluster_va + v::private::MAIN_HEADER as u64).to_le_bytes(); // The secondary role's words, on the single instance. main.unk_300 = 4; @@ -189,10 +217,12 @@ impl InitData { main.unk_344 = 0; Ok(()) })?; - self.object_mut(self.bundle)?.write( - main_offset + abi::MainConfig::CONTROL_RING, - abi::OpeningRecord::new(abi::Role::Primary), - )?; + if variant.opening_record { + self.object_mut(self.bundle)?.write( + main_offset + abi::MainConfig::CONTROL_RING, + abi::OpeningRecord::new(abi::Role::Primary), + )?; + } // The merged root. let root = abi::RootArgs { @@ -214,12 +244,11 @@ impl InitData { } } - // The opening control record is staged in slot 0. - for (offset, value) in [ - (0, 0), - (0x10, 0), - (abi::ChannelState::PRODUCER, abi::OPENING_PRODUCER), - ] { + let producer = match variant.opening_record { + true => abi::OPENING_PRODUCER, + false => 0, + }; + for (offset, value) in [(0, 0), (0x10, 0), (abi::ChannelState::PRODUCER, producer)] { self.object(self.cluster)? .word(self.state_offset(Role::Primary) + abi::CONTROL_STATE_OFFSET + offset)? .store(value, Ordering::Relaxed); diff --git a/drivers/gpu/drm/asahi/g17/mod.rs b/drivers/gpu/drm/asahi/g17/mod.rs index 1dbfcc8fd3ce5..0d14122d86f20 100644 --- a/drivers/gpu/drm/asahi/g17/mod.rs +++ b/drivers/gpu/drm/asahi/g17/mod.rs @@ -193,6 +193,7 @@ pub(crate) struct Config { pub(crate) fabric_bridge: bool, /// The SoC's values of region C. pub(crate) region_c: &'static fw::initdata::RegionCConfig, + pub(crate) chip: Option<&'static fw::initdata::v25g83::Chip>, /// Physical address of the firmware's per-slot recovery keys, read while the firmware is /// halted to attribute a fault; `None` where it is unknown (recovery then relies on the /// firmware's own blame). @@ -215,6 +216,7 @@ pub(crate) struct CoreLayout { pub(crate) operand_state: fw::compute::OperandState, /// A render's deflake buffer. pub(crate) deflake: fw::render::Deflake, + pub(crate) compute_blocks: usize, } /// Where a G17 target's crash log buffers live. @@ -867,6 +869,7 @@ struct Shared { operand_state: &'static fw::compute::OperandState, /// Layout of renders' deflake buffers for this GPU's cores. deflake: fw::render::Deflake, + compute_blocks: usize, descriptor_flags: [u32; 2], crashed: AtomicBool, feed: Arc, @@ -1125,8 +1128,9 @@ impl Shared { self.crashed.store(true, Ordering::Release); dev_err!( self.dev.as_ref(), - "GPU firmware ({:?}) crashed, device lost\n", - role + "GPU firmware ({:?}) crashed, device lost (crash log {} bytes)\n", + role, + crashlog.map_or(0, |log| log.len()) ); // The GPU dev coredump support this used is gone; the crash log is not published. @@ -1247,6 +1251,7 @@ impl Gpu { variant, operand_state: &cfg.core_layout.operand_state, deflake: cfg.core_layout.deflake, + compute_blocks: cfg.core_layout.compute_blocks, descriptor_flags: [id.perf_control, id.perf_map[0]], crashed: AtomicBool::new(false), feed, @@ -1510,18 +1515,24 @@ impl Gpu { session.port.attach( session.init.port_views(mailbox)?, session.bridge.regs.clone(), + shared.variant.registration, )?; session.uat.mirror_secondary_root()?; if cfg.fabric_bridge { session.bridge.regs.enable_g17_gating()?; } let ack = shared.variant.init_ack; - session - .primary - .init(session.init.root_va(Role::Primary)?, ack)?; + let root_va = session.init.root_va(Role::Primary)?; + dev_dbg!( + dev.as_ref(), + "bring-up: initialization data built, publishing root {:#x}\n", + root_va + ); + session.primary.init(root_va, ack)?; if ack == fw::variant::InitAck::Status { Self::wait_for_init_accepted(dev, &session.init, &session.primary)?; } + dev_dbg!(dev.as_ref(), "bring-up: initialization data accepted\n"); if let Some(secondary) = session.secondary.as_mut() { secondary.init(session.init.root_va(Role::Secondary)?, ack)?; } @@ -1531,15 +1542,25 @@ impl Gpu { secondary.notify(MSG_POWER_ON_DONE)?; } } - Self::wait_for_opening( - dev, - &session.init, - &session.primary, - session.secondary.as_ref(), - )?; + if shared.variant.opening_record { + Self::wait_for_opening( + dev, + &session.init, + &session.primary, + session.secondary.as_ref(), + )?; + dev_dbg!(dev.as_ref(), "bring-up: opening record retired\n"); + } else { + dev_dbg!( + dev.as_ref(), + "bring-up: no opening record staged; device-control counters {:?}\n", + session.init.control_counters()? + ); + } session .uat .activate_render_context(&session._render_global)?; + dev_dbg!(dev.as_ref(), "bring-up: firmware running\n"); Ok(firmware) } diff --git a/drivers/gpu/drm/asahi/g17/port.rs b/drivers/gpu/drm/asahi/g17/port.rs index 6f9d1c7d956c0..5e759bb2b7d18 100644 --- a/drivers/gpu/drm/asahi/g17/port.rs +++ b/drivers/gpu/drm/asahi/g17/port.rs @@ -91,8 +91,8 @@ unsafe impl Sync for Views {} #[pin_data] pub(super) struct Port { views: SetOnce, - /// Register access for tracing the core power state at the doorbell. regs: SetOnce, + registration: SetOnce, /// Compute work-ring slots reserved by publishers that have not exposed them yet. #[pin] rings: SpinLock<[u32; PRIORITIES]>, @@ -163,6 +163,7 @@ impl Port { pin_init!(Self { views: SetOnce::new(), regs: SetOnce::new(), + registration: SetOnce::new(), rings <- new_spinlock!([0; PRIORITIES], "g17::Port::rings"), qos <- new_spinlock!(qos::Accounting::new(), "g17::Port::qos"), rx: SetOnce::new(), @@ -182,17 +183,37 @@ impl Port { } /// Called once while the session is built, before any publisher can see the port. - pub(super) fn attach(&self, views: Views, regs: crate::regs::G17Resources) -> Result { - // SAFETY: The session's primary coprocessor owns the mailbox and outlives the port, and - // with it every use of the handle. + pub(super) fn attach( + &self, + views: Views, + regs: crate::regs::G17Resources, + registration: super::fw::variant::QueueRegistration, + ) -> Result { + // SAFETY: The session owns the mailbox and outlives every port user. let rx = unsafe { (*views.mailbox).rx_util_min_handle() }; - if self.views.populate(views) && self.regs.populate(regs) && self.rx.populate(rx) { + if self.views.populate(views) + && self.regs.populate(regs) + && self.registration.populate(registration) + && self.rx.populate(rx) + { Ok(()) } else { Err(EBUSY) } } + pub(super) fn register_queues(&self, queues: &[super::fw::kick::KsmQueue]) -> Result { + use super::fw::variant::QueueRegistration; + if self.registration.as_ref() != Some(&QueueRegistration::Mailbox) { + return Ok(()); + } + let regs = self.regs.as_ref().ok_or(ENODEV)?; + for queue in queues { + regs.register_ksm_queue(queue.qid, queue.descriptor)?; + } + Ok(()) + } + fn views(&self) -> Result<&Views> { self.views.as_ref().ok_or(ENODEV) } diff --git a/drivers/gpu/drm/asahi/g17/queue/compute.rs b/drivers/gpu/drm/asahi/g17/queue/compute.rs index 55994066825f8..9501ec86785d2 100644 --- a/drivers/gpu/drm/asahi/g17/queue/compute.rs +++ b/drivers/gpu/drm/asahi/g17/queue/compute.rs @@ -11,7 +11,7 @@ use crate::g17::{ context::Context, fw::{ channels::ControlRecord, - compute::{OperandState, COMPUTE_DESCRIPTOR_SIZE}, + compute::{ComputeProgram, OperandState, COMPUTE_DESCRIPTOR_SIZE}, queue::*, variant::PointerLayout, }, @@ -145,6 +145,7 @@ struct Graph { pointers: PointerLayout, /// Layout of the operand-state buffer for the GPU's cores. operand_state: &'static OperandState, + program: ComputeProgram, } impl Graph { @@ -154,6 +155,7 @@ impl Graph { context: &Context, pointers: PointerLayout, operand_state: &'static OperandState, + program: ComputeProgram, ) -> Result { let page = mmu::UAT_PGSZ as u64; let prot = mmu::PROT_GPU_FW_SHARED_RW; @@ -220,6 +222,7 @@ impl Graph { reclaimed: 0, pointers, operand_state, + program, }) } @@ -614,9 +617,10 @@ impl Queue { context: Arc, pointers: PointerLayout, operand_state: &'static OperandState, + program: ComputeProgram, ) -> Result { let Backing { mut pool, mut kick } = backing; - let mut graph = Graph::new(alloc, objects, &context, pointers, operand_state)?; + let mut graph = Graph::new(alloc, objects, &context, pointers, operand_state, program)?; let kick_alias = kick.map_client(context.vm())?; let pool_alias = pool.map_client(context.vm())?; let binding = graph.bind(context.clone(), kick_alias, pool_alias)?; @@ -2149,6 +2153,7 @@ pub(crate) trait Host { ) -> Result; fn qos_cancel(&mut self, publication: qos::Publication) -> Result; fn publish_qid(&mut self, id: kick::Id) -> Result; + fn register_queue(&mut self, queue: &crate::g17::fw::kick::KsmQueue) -> Result; fn publish_outer(&mut self, priority: u8, slot: &crate::g17::fw::channels::WorkSlot) -> Result; fn notify(&mut self, message: u64) -> Result; fn note_submission(&mut self) -> Result; @@ -2237,6 +2242,7 @@ impl Queue { self.graph.ensure_record_slot(slot)?; } let args = ComputeArgs { + program: self.graph.program, intersection: *intersection, scratch: *scratch, usc_base: *usc_base, @@ -2296,7 +2302,7 @@ impl Queue { }, mcache: None, event_mask: COMPUTE_KICK_EVENT_MASK, - register_arrays: ComputeDescriptor::register_bindings(descriptor_low, *scratch)?, + register_arrays: ComputeDescriptor::register_bindings(descriptor_low, *scratch, self.graph.program)?, scs_enabled: scratch.enabled(), priority: policy.priority(), }; @@ -2364,9 +2370,16 @@ impl Queue { )?; wait_vas.push(address, GFP_KERNEL)?; } + let kick_ring_va = self.kick.low_va(); let prepared_kick = self.kick.prepare_entry(&kick_args)?; let mut producer; if first { + host.register_queue(&crate::g17::fw::kick::KsmQueue::new( + qid, + kick_ring_va, + DataMaster::Compute, + policy.priority(), + )?)?; producer = self.graph.first_descriptor(descriptor_high)?; host.prepare_compute_shared()?; packet.mark_published(); diff --git a/drivers/gpu/drm/asahi/g17/queue/render.rs b/drivers/gpu/drm/asahi/g17/queue/render.rs index 2436cfd33ed35..9019271b239d0 100644 --- a/drivers/gpu/drm/asahi/g17/queue/render.rs +++ b/drivers/gpu/drm/asahi/g17/queue/render.rs @@ -466,6 +466,7 @@ impl Pair { aux_stamp_va: addresses.stamps[1][1], }, programs: self.variant.programs, + ta_mode_1: self.variant.ta_mode_1, deflake: deflake_layout, }; self.memory.graph.claim(ordinal)?; diff --git a/drivers/gpu/drm/asahi/g17/runtime.rs b/drivers/gpu/drm/asahi/g17/runtime.rs index d391fbb3001bb..af76e8b62f040 100644 --- a/drivers/gpu/drm/asahi/g17/runtime.rs +++ b/drivers/gpu/drm/asahi/g17/runtime.rs @@ -1160,6 +1160,7 @@ impl Backend { self.context.clone(), self.shared.variant.pointers, self.shared.operand_state, + self.shared.variant.compute, )?; Ok(KBox::new(queue, GFP_KERNEL)?) })(); @@ -1399,6 +1400,9 @@ impl compute::Host for ComputeHost<'_> { fn publish_qid(&mut self, id: kick::Id) -> Result { self.qids.publish(id) } + fn register_queue(&mut self, queue: &super::fw::kick::KsmQueue) -> Result { + self.port.register_queues(core::slice::from_ref(queue)) + } fn publish_outer(&mut self, _priority: u8, slot: &super::fw::channels::WorkSlot) -> Result { self.port.publish_compute(self.outer.take().ok_or(EIO)?, slot).map(|_| ()) } @@ -1443,6 +1447,9 @@ impl compute::Host for DirectHost<'_> { // An installed queue published its identity with its first command. Ok(()) } + fn register_queue(&mut self, _queue: &super::fw::kick::KsmQueue) -> Result { + Err(EAGAIN) + } fn publish_outer(&mut self, _priority: u8, slot: &super::fw::channels::WorkSlot) -> Result { self.port.publish_compute(self.outer.take().ok_or(EIO)?, slot).map(|_| ()) } @@ -1734,7 +1741,7 @@ impl super::Firmware { impl Backend { fn ensure_compute(&self, scs_pages: u16, admission: &Admission<'_>) -> Result { admission.check()?; - let required = super::fw::compute_pool::required_blocks(self.shared.active_cores, scs_pages)?; + let required = super::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scs_pages)?; let mut deferred = DeferredBatch::publication()?; loop { admission.check()?; @@ -1833,7 +1840,7 @@ impl Backend { return None; } let super::command::Validated::Compute { scratch, .. } = &packet.command else { return None; }; - let required = super::fw::compute_pool::required_blocks(self.shared.active_cores, scratch.pages()).ok()?; + let required = super::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scratch.pages()).ok()?; loop { let channels = self.shared.channels.observe(); let progress = self.shared.progress.observe(); @@ -1976,7 +1983,7 @@ impl Backend { let super::command::Validated::Compute { scratch, .. } = &packet.command else { return Some(Err(EINVAL)); }; - let required = match super::fw::compute_pool::required_blocks(self.shared.active_cores, scratch.pages()) { + let required = match super::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scratch.pages()) { Ok(required) => required, Err(error) => return Some(Err(error)), }; @@ -1991,7 +1998,7 @@ impl Backend { deferred: &mut DeferredBatch, ) -> Result { let super::command::Validated::Compute { scratch, .. } = &packet.command else { return Err(EINVAL); }; - let required = super::fw::compute_pool::required_blocks(self.shared.active_cores, scratch.pages())?; + let required = super::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scratch.pages())?; if packet.cancel_requested() || self.admission_open().is_err() || packet.completion.status().get() != 0 { return Err(render::FALLBACK); } @@ -2068,7 +2075,7 @@ impl Backend { ) -> Result { packet.check_dependencies()?; let super::command::Validated::Compute { scratch, .. } = &packet.command else { return Err(EINVAL); }; - let required = super::fw::compute_pool::required_blocks(self.shared.active_cores, scratch.pages())?; + let required = super::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scratch.pages())?; if let Some(result) = self.compute_direct(packet, required, deferred) { return result; } diff --git a/drivers/gpu/drm/asahi/g17/runtime/backend.rs b/drivers/gpu/drm/asahi/g17/runtime/backend.rs index bf0f989f042a5..10085c3fcb922 100644 --- a/drivers/gpu/drm/asahi/g17/runtime/backend.rs +++ b/drivers/gpu/drm/asahi/g17/runtime/backend.rs @@ -177,7 +177,7 @@ impl job::Backend for Backend { // A reverse timeline chain must be submitted before the host signal. // Validate here, but do not consume physical capacity behind unsignalled // DRM dependencies. compute_packet admits it when the job can run. - crate::g17::fw::compute_pool::required_blocks(self.shared.active_cores, scs_pages) + crate::g17::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scs_pages) .map(|_| ()) } diff --git a/drivers/gpu/drm/asahi/g17/runtime/render.rs b/drivers/gpu/drm/asahi/g17/runtime/render.rs index 6657f83e9e738..fc2e01be761ae 100644 --- a/drivers/gpu/drm/asahi/g17/runtime/render.rs +++ b/drivers/gpu/drm/asahi/g17/runtime/render.rs @@ -572,10 +572,14 @@ impl crate::g17::queue::render::Host for Host<'_> { /// check let the firmware gate the cores between the host's configuration /// writes while several clients installed their first pairs at once. fn install_pair(&mut self, registration: &crate::g17::fw::kick::RenderRegistration) -> Result { - // Firmware builds without MMIO registration install the pair from its queue - // configuration alone. - if !self.firmware.variant.mmio_pair_registration { - return Ok(()); + use crate::g17::fw::variant::QueueRegistration; + match self.firmware.variant.registration { + QueueRegistration::Firmware => return Ok(()), + QueueRegistration::Mailbox => { + self.firmware.port.register_queues(registration.queues())?; + return Ok(()); + } + QueueRegistration::PoweredRenderPairs => {} } if !self.registration_powered { self.firmware.acquire_registration_power()?; diff --git a/drivers/gpu/drm/asahi/hw/mod.rs b/drivers/gpu/drm/asahi/hw/mod.rs index 2650131a4a293..c54ffb5c208fe 100644 --- a/drivers/gpu/drm/asahi/hw/mod.rs +++ b/drivers/gpu/drm/asahi/hw/mod.rs @@ -14,6 +14,8 @@ const MAX_POWERZONES: usize = 5; pub(crate) mod t600x; pub(crate) mod t602x; pub(crate) mod t6040; +pub(crate) mod t6041; +mod t604x; pub(crate) mod t8103; pub(crate) mod t8112; pub(crate) mod t8140; diff --git a/drivers/gpu/drm/asahi/hw/t6040.rs b/drivers/gpu/drm/asahi/hw/t6040.rs index c2e7c06f67b7f..d531e20c7e9f9 100644 --- a/drivers/gpu/drm/asahi/hw/t6040.rs +++ b/drivers/gpu/drm/asahi/hw/t6040.rs @@ -11,6 +11,7 @@ use crate::g17::fw::{ }; use crate::g17::{Config, CoreLayout, CrashBuffers, FixedBuffer, Identity}; use crate::hw::{GpuGen, GpuVariant}; +use super::t604x::{instances, window}; use crate::mmu::UatQuirks; /// Static configuration of the T6040 GPU. @@ -51,6 +52,7 @@ pub(crate) const CONFIG: Config = Config { native_gpu_permissions: true, }, region_c: ®ION_C, + chip: None, adopt_root_entries: false, fabric_bridge: false, // The firmware's per-slot recovery keys are not known for this build; recovery relies on @@ -107,44 +109,13 @@ pub(crate) const CONFIG: Config = Config { alternate_core_masks: Some((10, 8)), operand_state: fw::compute::OperandState::TWO_BY_TEN, deflake: fw::render::Deflake::TWO_CLUSTERS, + compute_blocks: fw::freelist::COMPUTE_BLOCKS, }, }; /// Chip identifier written to the hardware data. pub(crate) const CHIP_ID: u32 = 0x6040; -/// Base of the firmware MMIO aperture in the kernel window. -const MMIO_APERTURE: u64 = 0xffff_fc21_8000_0000; - -const fn window( - slot: usize, - phys: u64, - offset: u64, - size: u32, - unk_18: u64, - unk_20: u32, -) -> RegisterWindow { - RegisterWindow { - slot, - phys, - va: MMIO_APERTURE + offset, - size, - unk_18, - unk_20, - instances: 1, - phys_stride: 0, - } -} - -/// `window` repeated `instances` times, `phys_stride` apart in physical memory. -const fn instances(window: RegisterWindow, instances: u32, phys_stride: u64) -> RegisterWindow { - RegisterWindow { - instances, - phys_stride, - ..window - } -} - /// Register windows the firmware maps, by register-map slot. Slot 3 holds the four memory /// controllers (ADT /arm-io/mcc), slot 20 the four AFR blocks. pub(crate) const REGISTER_WINDOWS: [RegisterWindow; 25] = [ diff --git a/drivers/gpu/drm/asahi/hw/t6041.rs b/drivers/gpu/drm/asahi/hw/t6041.rs new file mode 100644 index 0000000000000..8be466f7842ab --- /dev/null +++ b/drivers/gpu/drm/asahi/hw/t6041.rs @@ -0,0 +1,495 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +use crate::g17::fw::{ + self, + initdata::{v25g83, PerfConfig, RegionCConfig, RegisterWindow, PERF_STATES}, +}; +use crate::g17::{Config, CoreLayout, CrashBuffers, FixedBuffer, Identity}; +use crate::hw::{GpuGen, GpuVariant}; +use super::t604x::{instances, window}; +use crate::mmu::UatQuirks; + +pub(crate) const CONFIG: Config = Config { + chip_id: CHIP_ID, + identity: Identity { + family: 0xa, + variant: 4, + num_dies: 1, + gpu_variant: GpuVariant::C, + usc_generation: 3, + hal_generation: 200, + }, + uat_ias: 42, + uat_oas: 42, + secondary_root_offset: None, + crash_buffers: CrashBuffers::FirmwareData, + // Unverified placement; use the M4 Pro layout. + pm_metrics: FixedBuffer { + va: 0x10_0008_0000, + size: 0x8000, + }, + windows: ®ISTER_WINDOWS, + reserved_slots: &RESERVED_SLOTS, + perf: &PERF, + opps: OPPS, + uat_quirks: UatQuirks { + reserved_tables: true, + clean_tables: true, + page_tlbi: true, + handoff_lock: false, + handoff_slot: 0xffff_ffff, + native_gpu_permissions: true, + }, + region_c: ®ION_C, + chip: Some(&CHIP), + adopt_root_entries: false, + fabric_bridge: false, + recovery_slot_keys: None, + gpu_generation: GpuGen::G16, + firmware: fw::variant::Firmware::Identified(&[fw::variant::Build { + os_version: [26, 5, 2], + name: "macOS 26.5.2 (25F84, iBoot mBoot-18000.121.3)", + images: &[crate::fwid::FirmwareBuild { + name: "Apple GFX 25F84 for T6041 (normalized loaded image)", + text_size: 0x60000, + data_size: 0x138000, + entropy: [0x5983a, 0x5991d], + text_sha256: [ + 0x6d, 0xa4, 0xd4, 0x42, 0x35, 0x35, 0x14, 0x44, 0xf6, 0xec, 0x00, 0x33, 0xf1, 0x9c, + 0xbf, 0x98, 0xd3, 0x43, 0x91, 0x28, 0x83, 0xe4, 0xe2, 0x94, 0xc1, 0x8b, 0xb8, 0xb8, + 0xa3, 0xc1, 0x83, 0xe8, + ], + }], + // macOS writes these tiler segment values on this machine, not the two-cluster ones. + variant: &fw::variant::Variant { + ta_mode_1: true, + ..fw::variant::V25F84 + }, + }]), + core_layout: CoreLayout { + cores: Some((4, 40)), + alternate_core_masks: None, + operand_state: fw::compute::OperandState::FOUR_BY_TEN, + deflake: fw::render::Deflake::FOUR_CLUSTERS, + compute_blocks: 160, + }, +}; + +pub(crate) const CHIP_ID: u32 = 0x6041; + +pub(crate) const REGISTER_WINDOWS: [RegisterWindow; 25] = [ + window(0, 0x5_0241_4000, 0x0, 0x4000, 0, 2), + instances( + window(3, 0x2_201c_4000, 0x8000, 0x1_8000, 0, 2), + 8, + 0x200_0000, + ), + window(4, 0x5_0244_c000, 0xd_0000, 0x4000, 0, 0), + window(9, 0x5_003d_0000, 0xd_8000, 0x4000, 0, 2), + window(10, 0x5_003c_0000, 0xe_0000, 0x4000, 0, 0), + window(11, 0x5_003d_8000, 0xe_8000, 0x4000, 0, 2), + window(12, 0x4_8565_c000, 0xf_0000, 0x4000, 0, 2), + window(14, 0x5_0040_0000, 0xf_8000, 0x1_0000, 0, 0), + window(15, 0x5_0cdc_0000, 0x11_0000, 0x4000, 0, 0), + window(17, 0x2_8800_0000, 0x11_8000, 0x2_1400, 0, 2), + instances( + window(20, 0x2_8b00_0000, 0x14_0000, 0x4_0000, 0, 2), + 4, + 0x20_0000, + ), + window(22, 0x2_8900_0000, 0x24_8000, 0x8000, 0, 2), + window(26, 0x2_88d0_4000, 0x25_8000, 0x8000, 0xd0_4000, 2), + window(28, 0x2_88d5_8000, 0x26_8000, 0x8000, 0xd5_8000, 2), + window(29, 0x2_88d1_0000, 0x27_8000, 0x4000, 0xd1_0000, 2), + window(31, 0x2_88d4_0000, 0x28_0000, 0x4000, 0xd4_0000, 2), + window(32, 0x2_88d6_0000, 0x28_8000, 0x2_0000, 0xd6_0000, 2), + window(33, 0x2_88d4_4000, 0x2b_0000, 0x4000, 0xd4_4000, 2), + window(34, 0x2_88d4_c000, 0x2b_8000, 0x200, 0xd4_c000, 2), + window(35, 0x2_88e0_0000, 0x2c_0000, 0x4000, 0xe0_0000, 2), + window(37, 0x2_88e4_0000, 0x2c_8000, 0x4000, 0xe4_0000, 2), + window(39, 0x2_88e0_8000, 0x2d_0000, 0x8000, 0, 2), + window(40, 0x2_88e1_c000, 0x2e_0000, 0x4000, 0xe1_c000, 2), + window(41, 0x2_88e1_f800, 0x2e_b800, 0x4000, 0, 2), + window(43, 0x2_88e6_0000, 0x2f_8000, 0x58, 0xe6_0000, 2), +]; + +const RESERVED_SLOTS: [usize; 14] = [2, 5, 6, 7, 8, 27, 30, 38, 42, 46, 47, 48, 49, 52]; + +pub(crate) const PERF: PerfConfig = PerfConfig { + states_a: [0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 15], + states_b: [0, 1, 2, 3, 4, 6, 7, 9, 11, 13, 15], + relative_a: [0, 10, 18, 25, 31, 40, 50, 62, 70, 78, 100], + relative_b: [0, 0, 22, 36, 47, 57, 68, 78, 84, 91, 100], + sram_min_mv: 810, +}; + +pub(crate) const OPPS: usize = 16; + +const _: () = { + let mut index = 0; + while index < PERF_STATES { + assert!((PERF.states_a[index] as usize) < OPPS); + assert!((PERF.states_b[index] as usize) < OPPS); + index += 1; + } +}; + +const MAX_POWER_MW: u32 = 129_702; + +const REGION_C: RegionCConfig = RegionCConfig { + unk_54: 0x0fa0, + unk_78: [1, 0, 0], + max_power_mw: MAX_POWER_MW, + unk_9c: 0, + unk_a0: 0, + unk_7c4: 1500, + unk_9e0: [ + 1, + 0x0102_0200, + 0x010a_2801, + 0x2802_0101, + 0x0101_010a, + 0x010a_2802, + 0x2801_0101, + 0x0001_010a, + ], +}; + +const CHIP: v25g83::Chip = v25g83::Chip { + max_power_mw: MAX_POWER_MW, + leakage: { + let mut words = [0; 56]; + words[0] = 0x44f9_c000; + words[1] = 0x44f7_2000; + words[2] = 0x44f4_b000; + words[3] = 0x44f1_5000; + words[32] = 0x43e4_0000; + words[33] = 0x43e4_0000; + words[34] = 0x43e4_0000; + words[35] = 0x43e4_0000; + words[52] = 0x4404_0000; + words[54] = 0x43df_8000; + words + }, + aon_table: &[], + hw_data_words: HW_DATA_WORDS, + power_config_words: POWER_CONFIG_WORDS, + perf_a_replicate_lanes: true, + cs_perf_table: false, +}; + +const HW_DATA_WORDS: &[(usize, u32, usize)] = &[ + (0xe0, 0x2008, 1), + (0xe8, 0x20080000, 1), + (0xf4, 0x2008, 1), + (0xf8, 0x24cb, 1), + (0xfc, 0xc98a2cfa, 1), + (0x100, 0xf4f624cb, 1), + (0x104, 0x1877e917, 1), + (0x108, 0x38d924cb, 1), + (0x10c, 0xbdab0000, 1), + (0x2d8, 0xfff82000, 1), + (0x2dc, 0xd32d2cdb, 1), + (0x2e0, 0xf5002000, 1), + (0x2e4, 0x21dae926, 1), + (0x2e8, 0x38b62000, 1), + (0x2ec, 0xc7420008, 1), + (0x3e0, 0x7fe0, 1), + (0x3e8, 0x7fe00000, 1), + (0x3f4, 0x7fe0, 1), + (0x3f8, 0x8000, 1), + (0x400, 0x80000000, 1), + (0x40c, 0x8000, 1), + (0x5d8, 0x4b232645, 1), + (0x5dc, 0xe98, 1), + (0x5e0, 0xd5a2ea5f, 1), + (0x5e4, 0x40003fff, 1), + (0x5e8, 0xca5e4000, 1), + (0x5ec, 0x4000f5a2, 1), + (0xf6c, 0x1, 1), + (0xf8c, 0xff, 1), + (0xfac, 0x1, 1), + (0xfb8, 0x1d, 1), + (0x2594, 0x2e0000, 1), + (0x2610, 0x1, 1), +]; + +const POWER_CONFIG_WORDS: &[(usize, u32, usize)] = &[ + (0x0, 0x1, 1), + (0x44, 0xc, 1), + (0x9c, 0x43a90000, 1), + (0x200, 0x1, 1), + (0x208, 0x162, 1), + (0x210, 0xd89165f9, 1), + (0x218, 0x1254c, 1), + (0x698, 0xd8917807, 1), + (0x69c, 0x13, 1), + (0x6a8, 0x129a8, 1), + (0x728, 0x4a714, 1), + (0x7a8, 0x4a714, 1), + (0x920, 0x3dd00000, 1), + (0x9ec, 0xbbfca403, 1), + (0x9f0, 0x28, 1), + (0xa70, 0x4, 1), + (0xa7c, 0x0, 1), + (0xa84, 0x3f800000, 1), + (0xa8c, 0x3e0b4396, 1), + (0xa9c, 0x3e99999a, 1), + (0xaa8, 0x28, 1), + (0xab8, 0x43b10000, 1), + (0xac0, 0x162, 1), + (0xad0, 0x0, 1), + (0xae0, 0xc7fca200, 1), + (0xaf0, 0x3e8, 1), + (0xafc, 0x3f800000, 1), + (0xb00, 0x3e0b4396, 1), + (0xb04, 0x3e99999a, 1), + (0xb08, 0x162, 1), + (0xb2c, 0x2, 1), + (0xb88, 0x42a00000, 1), + (0xb90, 0x7, 1), + (0xbc8, 0x3f7eb852, 1), + (0xbcc, 0x3ba3d70a, 1), + (0xbd0, 0x3f64c986, 1), + (0xbd4, 0x403ea7f0, 1), + (0x21f4, 0x42200000, 1), + (0x2210, 0x28, 1), + (0x2264, 0x1020, 1), + (0x226c, 0x2a222aa2, 1), + (0x2294, 0x40baaaaa, 1), + (0x22a4, 0x42080000, 1), + (0x22b0, 0x28, 1), + (0x22c8, 0x1020, 1), + (0x2868, 0x389d8, 1), + (0x2874, 0x154, 1), + (0x28d8, 0x47fd5300, 1), + (0x29bc, 0x74, 1), + (0x29c8, 0x3f772c23, 1), + (0x29d0, 0x3d0d3dcb, 1), + (0x29d8, 0x3cf5c290, 1), + (0x29e8, 0x3f19999a, 1), + (0x2a04, 0x4304ad79, 1), + (0x2a0c, 0x162, 1), + (0x2a2c, 0xc7fd10a9, 1), + (0x2a44, 0x3f772c23, 1), + (0x2a48, 0x3d0d3dcb, 1), + (0x2a4c, 0x3cf5c290, 1), + (0x2a50, 0x3f19999a, 1), + (0x2a54, 0x162, 1), + (0x2b18, 0x2ef94, 2), + (0x2b20, 0x2e89, 1), + (0x2b24, 0xe36, 1), + (0x2b40, 0x1, 1), + (0x2b94, 0x46023400, 1), + (0x2b9c, 0x208d, 1), + (0x2bc4, 0x47800000, 1), + (0x2bcc, 0x3e8, 1), + (0x2be8, 0x208d, 1), + (0x2c40, 0x28, 1), + (0x2c88, 0x3e8, 1), + (0x2cec, 0x1, 1), + (0x2cf0, 0xf, 1), + (0x2cf4, 0x3, 1), + (0x2cfc, 0x6, 1), + (0x2f0c, 0x2a222aa2, 1), + (0x3140, 0x29, 1), + (0x3144, 0x24dd, 1), + (0x3148, 0x4, 1), + (0x314c, 0x20, 1), + (0x3150, 0x29, 1), + (0x3154, 0x10d2c39d, 1), + (0x315c, 0x1d441, 1), + (0x31e0, 0x29, 1), + (0x31e4, 0x24a0, 1), + (0x31e8, 0x4, 1), + (0x31ec, 0x20, 1), + (0x31f0, 0x29, 1), + (0x31f4, 0x10f5cfb4, 1), + (0x31fc, 0x1d4d8, 1), + (0x3230, 0x29, 1), + (0x3234, 0x24ba, 1), + (0x3238, 0x4, 1), + (0x323c, 0x20, 1), + (0x3240, 0x29, 1), + (0x3244, 0x10fe2d62, 1), + (0x324c, 0x1d554, 1), + (0x3280, 0x28, 1), + (0x3284, 0x245c, 1), + (0x3288, 0x4, 1), + (0x328c, 0x20, 1), + (0x3290, 0x28, 1), + (0x3294, 0x10ec3bb1, 1), + (0x329c, 0x1d5bc, 1), + (0x32d0, 0x28, 1), + (0x32d4, 0x246e, 1), + (0x32d8, 0x4, 1), + (0x32dc, 0x20, 1), + (0x32e0, 0x29, 1), + (0x32e4, 0x1101cc20, 1), + (0x32ec, 0x1d640, 1), + (0x3320, 0x28, 1), + (0x3324, 0x2439, 1), + (0x3328, 0x4, 1), + (0x332c, 0x20, 1), + (0x3330, 0x28, 1), + (0x3334, 0x10f01dbd, 1), + (0x333c, 0x1d6dd, 1), + (0x33c0, 0x29, 1), + (0x33c4, 0x2497, 1), + (0x33c8, 0x4, 1), + (0x33cc, 0x20, 1), + (0x33d0, 0x29, 1), + (0x33d4, 0x111077fe, 1), + (0x33dc, 0x1d847, 1), + (0x3460, 0x29, 1), + (0x3464, 0x2480, 1), + (0x3468, 0x4, 1), + (0x346c, 0x20, 1), + (0x3470, 0x29, 1), + (0x3474, 0x110f91ba, 1), + (0x347c, 0x1d8fa, 1), + (0x3500, 0x28, 1), + (0x3504, 0x243a, 1), + (0x3508, 0x4, 1), + (0x350c, 0x20, 1), + (0x3510, 0x28, 1), + (0x3514, 0x10f2bfe8, 1), + (0x351c, 0x1d9a7, 1), + (0x3550, 0x28, 1), + (0x3554, 0x246d, 1), + (0x3558, 0x4, 1), + (0x355c, 0x20, 1), + (0x3560, 0x28, 1), + (0x3564, 0x113b3172, 1), + (0x356c, 0x1da43, 1), + (0x35a0, 0x28, 1), + (0x35a4, 0x2483, 1), + (0x35a8, 0x4, 1), + (0x35ac, 0x20, 1), + (0x35b0, 0x29, 1), + (0x35b4, 0x114027af, 1), + (0x35bc, 0x1dace, 1), + (0x3640, 0x28, 1), + (0x3644, 0x2486, 1), + (0x3648, 0x4, 1), + (0x364c, 0x20, 1), + (0x3650, 0x29, 1), + (0x3654, 0x112421ab, 1), + (0x365c, 0x1db07, 1), + (0x36e0, 0x29, 1), + (0x36e4, 0x24ce, 1), + (0x36e8, 0x4, 1), + (0x36ec, 0x20, 1), + (0x36f0, 0x29, 1), + (0x36f4, 0x114de7b5, 1), + (0x36fc, 0x1dbaa, 1), + (0x3730, 0x29, 1), + (0x3734, 0x24a1, 1), + (0x3738, 0x4, 1), + (0x373c, 0x20, 1), + (0x3740, 0x29, 1), + (0x3744, 0x11342213, 1), + (0x374c, 0x1dc2e, 1), + (0x3780, 0x28, 1), + (0x3784, 0x2446, 1), + (0x3788, 0x4, 1), + (0x378c, 0x20, 1), + (0x3790, 0x28, 1), + (0x3794, 0x111ec867, 1), + (0x379c, 0x1dcb7, 1), + (0x37d0, 0x28, 1), + (0x37d4, 0x2453, 1), + (0x37d8, 0x4, 1), + (0x37dc, 0x20, 1), + (0x37e0, 0x29, 1), + (0x37e4, 0x11273f2d, 1), + (0x37ec, 0x1dd49, 1), + (0x3820, 0x28, 1), + (0x3824, 0x2470, 1), + (0x3828, 0x4, 1), + (0x382c, 0x20, 1), + (0x3830, 0x28, 1), + (0x3834, 0x1131becf, 1), + (0x383c, 0x1ddc8, 1), + (0x38c0, 0x29, 1), + (0x38c4, 0x249c, 1), + (0x38c8, 0x4, 1), + (0x38cc, 0x20, 1), + (0x38d0, 0x29, 1), + (0x38d4, 0x1153d78e, 1), + (0x38dc, 0x1df60, 1), + (0x3960, 0x29, 1), + (0x3964, 0x2484, 1), + (0x3968, 0x4, 1), + (0x396c, 0x20, 1), + (0x3970, 0x29, 1), + (0x3974, 0x114b8bd5, 1), + (0x397c, 0x1dfe3, 1), + (0x3a00, 0x29, 1), + (0x3a04, 0x2522, 1), + (0x3a08, 0x4, 1), + (0x3a0c, 0x20, 1), + (0x3a10, 0x29, 1), + (0x3a14, 0x116ebefa, 1), + (0x3a1c, 0x1e077, 1), + (0x3a50, 0x29, 1), + (0x3a54, 0x2494, 1), + (0x3a58, 0x4, 1), + (0x3a5c, 0x20, 1), + (0x3a60, 0x29, 1), + (0x3a64, 0x11455238, 1), + (0x3a6c, 0x1e0d8, 1), + (0x3aa0, 0x29, 1), + (0x3aa4, 0x24a1, 1), + (0x3aa8, 0x4, 1), + (0x3aac, 0x20, 1), + (0x3ab0, 0x29, 1), + (0x3ab4, 0x1157064b, 1), + (0x3abc, 0x1e165, 1), + (0x3b1c, 0x2522, 1), + (0x3b20, 0x4, 1), + (0x3b24, 0x20, 1), + (0x3b28, 0x29, 1), + (0x3b2c, 0x116cd390, 1), + (0x3b34, 0x1dbf1, 1), + (0x3b40, 0x29, 1), + (0x3b44, 0x34, 1), + (0x3b5c, 0x2a222aa2, 1), + (0x62c4, 0x1000000, 1), + (0x62cc, 0x1010202, 1), + (0x62d0, 0x1010a28, 1), + (0x62d4, 0xa280201, 1), + (0x62d8, 0x2010101, 1), + (0x62dc, 0x1010a28, 1), + (0x62e0, 0xa280101, 1), + (0x62e4, 0x45000101, 1), + (0x62e8, 0x4000200, 1), + (0x62f4, 0x4a000000, 1), + (0x62f8, 0x100, 1), + (0x6304, 0xd7000000, 1), + (0x6308, 0x29, 1), + (0x6328, 0x67325452, 1), + (0x632c, 0x67335452, 1), + (0x6360, 0xf, 1), + (0x63c8, 0x1, 1), + (0x63cc, 0xd88be35c, 1), + (0x63d0, 0x13, 1), + (0x63d8, 0x13, 1), + (0x63dc, 0xd891fc7b, 1), + (0x63e0, 0x13, 1), + (0x63e4, 0xd8633257, 1), + (0x63e8, 0x13, 1), + (0x63ec, 0xd863f8ef, 1), + (0x63f0, 0x13, 1), + (0x63f4, 0xd8903ed2, 1), + (0x63f8, 0x13, 1), + (0x63fc, 0xd89165f9, 1), + (0x6400, 0x13, 1), + (0x6404, 0xd891fc7b, 1), + (0x6408, 0x13, 1), + (0x6414, 0xab2ab62, 1), + (0x6418, 0x7, 1), + (0x641c, 0x30d40, 1), + (0x6428, 0x1, 1), + (0x650c, 0x89778246, 1), +]; diff --git a/drivers/gpu/drm/asahi/hw/t604x.rs b/drivers/gpu/drm/asahi/hw/t604x.rs new file mode 100644 index 0000000000000..961cef76cf4aa --- /dev/null +++ b/drivers/gpu/drm/asahi/hw/t604x.rs @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +use crate::g17::fw::initdata::RegisterWindow; + +const MMIO_APERTURE: u64 = 0xffff_fc21_8000_0000; + +pub(super) const fn window( + slot: usize, + phys: u64, + offset: u64, + size: u32, + unk_18: u64, + unk_20: u32, +) -> RegisterWindow { + RegisterWindow { + slot, + phys, + va: MMIO_APERTURE + offset, + size, + unk_18, + unk_20, + instances: 1, + phys_stride: 0, + } +} + +pub(super) const fn instances(window: RegisterWindow, instances: u32, phys_stride: u64) -> RegisterWindow { + RegisterWindow { + instances, + phys_stride, + ..window + } +} diff --git a/drivers/gpu/drm/asahi/hw/t8140.rs b/drivers/gpu/drm/asahi/hw/t8140.rs index ea0f9cd782e81..93d1c86e3425d 100644 --- a/drivers/gpu/drm/asahi/hw/t8140.rs +++ b/drivers/gpu/drm/asahi/hw/t8140.rs @@ -51,6 +51,7 @@ pub(crate) const CONFIG: Config = Config { opps: OPPS, uat_quirks: crate::mmu::UatQuirks::DEFAULT, region_c: &crate::g17::fw::initdata::REGION_C_26A428, + chip: None, adopt_root_entries: true, fabric_bridge: true, firmware: crate::g17::fw::variant::Firmware::Fixed(&crate::g17::fw::variant::V26A428), @@ -60,6 +61,7 @@ pub(crate) const CONFIG: Config = Config { alternate_core_masks: None, operand_state: crate::g17::fw::compute::OperandState::ONE_BY_SIX, deflake: crate::g17::fw::render::Deflake::ONE_CLUSTER, + compute_blocks: crate::g17::fw::freelist::COMPUTE_BLOCKS, }, }; diff --git a/drivers/gpu/drm/asahi/regs.rs b/drivers/gpu/drm/asahi/regs.rs index e8b845cba989f..2b04726e43878 100644 --- a/drivers/gpu/drm/asahi/regs.rs +++ b/drivers/gpu/drm/asahi/regs.rs @@ -46,6 +46,16 @@ const FAULT_INFO: usize = 0x17030; const G17_HOST_IRQ_SUMMARY: usize = 0xe01000; const G17_HOST_POWERED: u32 = 0xf; +const KSM_MAILBOX_TAG: usize = 0x4090; +const KSM_MAILBOX_DATA: usize = 0x4098; +const KSM_MAILBOX_FLAGS: u64 = (1 << 42) | (1 << 53); +const KSM_SLOT_DESCRIPTOR: u64 = 0x21008; +const KSM_SLOT_TIMESTAMP: u64 = 0x21020; +const KSM_SELECT: usize = 0x103a8; +const KSM_RUN_SET: usize = 0x21068; +const KSM_RUN_CLEAR: usize = 0x21078; +const KSM_RUNNING: [usize; 2] = [0x21038, 0x21040]; + const ID_VERSION: usize = 0xd04000; const ID_UNK08: usize = 0xd04008; const ID_COUNTS_1: usize = 0xd04010; @@ -602,6 +612,52 @@ impl G17Resources { Ok(true) } + /// Registers a queue KSM slot through the firmware mailbox. + pub(crate) fn register_ksm_queue(&self, qid: u8, descriptor: u64) -> Result { + if qid > 127 { + return Err(EINVAL); + } + let sgx = self.sgx.try_access().ok_or(ENODEV)?; + let sgx = (&*sgx).as_view(); + let tag = |reg: u64| reg | KSM_MAILBOX_FLAGS | (u64::from(qid) << 43); + let bit = 1u64 << (qid & 63); + let (low, high) = if qid < 64 { (bit, 0) } else { (0, bit) }; + let running = KSM_RUNNING[usize::from(qid >= 64)]; + if sgx.try_read64(running)? & bit != 0 { + sgx.try_write64(high, KSM_RUN_CLEAR + 8)?; + sgx.try_write64(low, KSM_RUN_CLEAR)?; + } + sgx.try_write64(tag(KSM_SLOT_DESCRIPTOR), KSM_MAILBOX_TAG)?; + sgx.try_write64(descriptor, KSM_MAILBOX_DATA)?; + sgx.try_write64(tag(KSM_SLOT_TIMESTAMP), KSM_MAILBOX_TAG)?; + sgx.try_read64(KSM_MAILBOX_DATA)?; + sgx.try_write64(tag(KSM_SLOT_DESCRIPTOR), KSM_MAILBOX_TAG)?; + let mut readback = sgx.try_read64(KSM_MAILBOX_DATA)?; + let direct = readback != descriptor; + if direct { + sgx.try_write64(u64::from(qid), KSM_SELECT)?; + sgx.try_write64(descriptor, KSM_SLOT_DESCRIPTOR as usize)?; + readback = sgx.try_read64(KSM_SLOT_DESCRIPTOR as usize)?; + } + if readback != descriptor { + dev_err!( + self.dev.as_ref(), + "KSM queue {} slot descriptor {:#x} did not take (reads {:#x})\n", + qid, + descriptor, + readback + ); + return Err(EIO); + } + if sgx.try_read64(running)? & bit == 0 { + sgx.try_write64(high, KSM_RUN_SET + 8)?; + sgx.try_write64(low, KSM_RUN_SET)?; + } + sgx.try_write64(tag(KSM_SLOT_TIMESTAMP), KSM_MAILBOX_TAG)?; + sgx.try_read64(KSM_MAILBOX_DATA)?; + Ok(()) + } + fn sgx_read32(&self) -> u32 { if let Some(sgx) = self.sgx.try_access() { (&*sgx).as_view().relaxed().read32(OFF) diff --git a/drivers/media/platform/apple/avd/avd-drv.c b/drivers/media/platform/apple/avd/avd-drv.c index 57021503e6e10..7d2e408e34486 100644 --- a/drivers/media/platform/apple/avd/avd-drv.c +++ b/drivers/media/platform/apple/avd/avd-drv.c @@ -526,6 +526,31 @@ static const struct avd_variant avd_t6040_variant = { .quirks = AVD_QUIRK_HEVC_V5_HEADER, }; +static const struct avd_variant avd_t6041_variant = { + .apple = &avd_borage_hw, + .fp_size = 0x1130d0, + .vp_slots = { + [AVD_CODEC_HEVC] = 4, + [AVD_CODEC_H264] = 4, + [AVD_CODEC_VP9] = 1, + [AVD_CODEC_AV1] = 3, + }, + .fifo_slots = 15, + .configure_stream = t8122_configure_stream, + .capabilities = AVD_CAPABILITY_HEVC | + AVD_CAPABILITY_H264 | + AVD_CAPABILITY_VP9 | + AVD_CAPABILITY_AV1, + .fw_name = "apple/avd-fw-v5-t2.bin", + .fw_name_fallback = "apple/avd-fw-v5-t1.bin", + .revision = 4, + .vp_slot_offset = 0xc, + .submit_offset = 0x40, + .submit_queue_max_offset = 0x44, + .submit_queue_status_offset = 0x7c, + .quirks = AVD_QUIRK_HEVC_V5_HEADER, +}; + /* can also be derived from a version register */ static const struct of_device_id avd_of_match[] = { { @@ -548,6 +573,10 @@ static const struct of_device_id avd_of_match[] = { .compatible = "apple,t8122-avd", .data = &avd_t8122_variant }, + { + .compatible = "apple,t6041-max-avd", + .data = &avd_t6041_variant + }, { .compatible = "apple,t6041-avd", .data = &avd_t6040_variant diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index 997a9d90b105a..4639f5b8ab9bf 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -321,7 +321,10 @@ config APPLE_DISPLAY_GATE_KUNIT_TEST before, whatever the T6031 option says. On T8122: on by default, and nothing changed when the handoff or the device tree's own PMP topology does not check out. On T6041: a power management processor - that binds late still powers the external displays up. + that binds late still powers the external displays up. On the + J616c: each external display chain is enabled without a PMP once + its processor has firmware memory, and the display subsystem's + status is never written. endmenu diff --git a/drivers/soc/apple/Makefile b/drivers/soc/apple/Makefile index f02b6b2c495f6..57d06930401c4 100644 --- a/drivers/soc/apple/Makefile +++ b/drivers/soc/apple/Makefile @@ -21,7 +21,8 @@ obj-$(CONFIG_APPLE_DISPLAY_GATE) += apple-display-gate.o apple-display-gate-y := display-gate.o t6030-pmp.dtbo.o t6030-j516s-pmp.dtbo.o apple-display-gate-$(CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST) += t6031-gate-test.dtbo.o \ t6030-gate-test.dtbo.o \ - t8122-gate-test.dtbo.o + t8122-gate-test.dtbo.o \ + t6041-gate-test.dtbo.o # The gate adds the interrupt parent from the base tree at boot. DTC_FLAGS_t6030-pmp := -Wno-interrupts_property DTC_FLAGS_t6030-j516s-pmp := -Wno-interrupts_property @@ -31,6 +32,7 @@ DTC_FLAGS_t6031-gate-test := -Wno-interrupts_property -Wno-chosen_node_is_root \ DTC_FLAGS_t6030-gate-test := -Wno-interrupts_property -Wno-chosen_node_is_root \ -Wno-avoid_unnecessary_addr_size DTC_FLAGS_t8122-gate-test := -Wno-interrupts_property -Wno-chosen_node_is_root +DTC_FLAGS_t6041-gate-test := -Wno-unit_address_vs_reg -Wno-avoid_unnecessary_addr_size obj-$(CONFIG_APPLE_TUNABLE) += apple-tunable.o apple-tunable-y = tunable.o diff --git a/drivers/soc/apple/aop.rs b/drivers/soc/apple/aop.rs index 0a63aeb752204..20e78e2b542cb 100644 --- a/drivers/soc/apple/aop.rs +++ b/drivers/soc/apple/aop.rs @@ -1594,16 +1594,34 @@ impl AopData { &self, aop_mmio: &Mmio<'_, Region>, patches: &[(u32, u64)], + word_access: bool, ) -> Result<()> { let offset = aop_mmio.read32(BOOTARGS_OFFSET) as usize; let size = aop_mmio.read32(BOOTARGS_SIZE) as usize; if offset > aop_mmio.size() || size > aop_mmio.size() - offset { return Err(EINVAL); } - let mut arg_bytes = KVec::::from_elem(0, size, GFP_KERNEL)?; + let start = if word_access { offset & !3 } else { offset }; + let end = if word_access { + (offset + size).checked_add(3).ok_or(EINVAL)? & !3 + } else { + offset + size + }; + if end > aop_mmio.size() || (word_access && size == 0) { + return Err(EINVAL); + } + let mut bytes = KVec::::from_elem(0, end - start, GFP_KERNEL)?; let aop_io_array: Mmio<'_, [u8; AOP_MMIO_SIZE]> = aop_mmio.try_cast()?; let bootargs = io_project!(aop_io_array, [try: offset .. offset+size]); - bootargs.copy_to_slice(&mut arg_bytes); + if word_access { + for (i, chunk) in bytes.chunks_exact_mut(4).enumerate() { + chunk.copy_from_slice(&aop_mmio.try_read32(start + i * 4)?.to_le_bytes()); + } + } else { + bootargs.copy_to_slice(&mut bytes); + } + let first = offset - start; + let arg_bytes = &mut bytes[first..first + size]; let mut idx = 0; while idx < size { if size - idx < 8 { @@ -1627,7 +1645,21 @@ impl AopData { } idx += len; } - bootargs.copy_from_slice(&arg_bytes); + if word_access { + for (i, chunk) in bytes.chunks_exact(4).enumerate() { + let address = start + i * 4; + let value = u32::from_le_bytes(chunk.try_into().unwrap()); + if aop_mmio.try_read32(address)? == value { + continue; + } + aop_mmio.try_write32(value, address)?; + if aop_mmio.try_read32(address)? != value { + return Err(EIO); + } + } + } else { + bootargs.copy_from_slice(arg_bytes); + } Ok(()) } @@ -2530,6 +2562,7 @@ struct AopHwConfig { /// and lists in `memory-region`; check their IOMMU mappings before /// starting it (T6040). fw_regions: bool, + bootargs_word_access: bool, /// Halt the co-processor again when its start fails (T6040). halt_on_failed_start: bool, } @@ -2545,6 +2578,7 @@ const HW_CFG_T8103: AopHwConfig = AopHwConfig { quiesce_on_unbind: false, required_endpoints: &[], fw_regions: false, + bootargs_word_access: false, halt_on_failed_start: false, }; const HW_CFG_T8112: AopHwConfig = AopHwConfig { @@ -2558,6 +2592,7 @@ const HW_CFG_T8112: AopHwConfig = AopHwConfig { quiesce_on_unbind: false, required_endpoints: &[], fw_regions: false, + bootargs_word_access: false, halt_on_failed_start: false, }; const HW_CFG_T6000: AopHwConfig = AopHwConfig { @@ -2571,6 +2606,7 @@ const HW_CFG_T6000: AopHwConfig = AopHwConfig { quiesce_on_unbind: false, required_endpoints: &[], fw_regions: false, + bootargs_word_access: false, halt_on_failed_start: false, }; const HW_CFG_T6020: AopHwConfig = AopHwConfig { @@ -2584,6 +2620,7 @@ const HW_CFG_T6020: AopHwConfig = AopHwConfig { quiesce_on_unbind: false, required_endpoints: &[], fw_regions: false, + bootargs_word_access: false, halt_on_failed_start: false, }; /// T6040 (J616s): the firmware's external code and log live in DRAM, mapped @@ -2602,6 +2639,7 @@ const HW_CFG_T6040: AopHwConfig = AopHwConfig { quiesce_on_unbind: true, required_endpoints: &[], fw_regions: true, + bootargs_word_access: true, halt_on_failed_start: true, }; /// T8132 (J713): as T6040. The bootloader hands the AOP over the same way, with @@ -2624,6 +2662,7 @@ const HW_CFG_T8140: AopHwConfig = AopHwConfig { quiesce_on_unbind: true, required_endpoints: &[0x20, 0x21, 0x22, 0x23, 0x2b], fw_regions: false, + bootargs_word_access: false, halt_on_failed_start: false, }; @@ -2684,6 +2723,7 @@ impl platform::Driver for AopDriver { (from_fourcc(b"alig"), cfg.alig), (from_fourcc(b"AOPt"), cfg.aopt), ], + cfg.bootargs_word_access, )?; } let rtkit = rtkit::RtKit::::new(pdev.as_ref(), None, 0, data.clone())?; diff --git a/drivers/soc/apple/display-gate-test.c b/drivers/soc/apple/display-gate-test.c index 4751b0804503e..c767a064e9280 100644 --- a/drivers/soc/apple/display-gate-test.c +++ b/drivers/soc/apple/display-gate-test.c @@ -18,6 +18,10 @@ * - T6041: no test tree; a PMP that binds after the deadline still * starts the external display power-up, and only a failed PMP or power-up * leaves the internal panel alone. + * - T6041 on the J616c (t6041-gate-test.dtso): no PMP; each external chain + * is enabled once its processor has firmware memory, one without it or + * already enabled stays as it is, and the display subsystem is never + * written. * Included at the end of display-gate.c. * * The test trees are applied once and stay: the gate gives some properties @@ -33,6 +37,8 @@ extern const u8 __dtbo_t6030_gate_test_begin[]; extern const u8 __dtbo_t6030_gate_test_end[]; extern const u8 __dtbo_t8122_gate_test_begin[]; extern const u8 __dtbo_t8122_gate_test_end[]; +extern const u8 __dtbo_t6041_gate_test_begin[]; +extern const u8 __dtbo_t6041_gate_test_end[]; /* One SoC's test tree and what the gate should make of it. */ struct gt_soc { @@ -136,6 +142,7 @@ static const struct gt_soc gt_t6030 __initconst = { static int gt_fixture_t6031 __initdata = -1; static int gt_fixture_t6030 __initdata = -1; static int gt_fixture_t8122 __initdata = -1; +static int gt_fixture_t6041 __initdata = -1; /* * Whether the booted tree has its own /soc, checked before the first fixture @@ -1016,6 +1023,220 @@ static struct kunit_suite gate_t6041_suite __refdata = { .test_cases = gate_t6041_cases, }; +/* + * T6041 on the J616c. Its test tree is at the root, so it is applied only + * where there is no display subsystem; the chains are reverted after each + * case, the tree stays. + */ +static const struct gt_soc gt_t6041_max __initconst = { + .soc = &gate_t6041_max, + .fixture = __dtbo_t6041_gate_test_begin, + .fixture_end = __dtbo_t6041_gate_test_end, +}; + +static bool gt_max_live __initdata; +static struct property *gt_max_display_status __initdata; + +static int __init gt_max_suite_init(struct kunit_suite *suite) +{ + struct device_node *np = of_find_node_by_path("/display-subsystem"); + + gt_max_live = !!np; + of_node_put(np); + if (gt_max_live) + return 0; + return of_overlay_fdt_apply(gt_t6041_max.fixture, + gt_t6041_max.fixture_end - gt_t6041_max.fixture, + >_fixture_t6041, NULL); +} + +static int __init gt_max_init(struct kunit *test) +{ + int ret = gt_init(test, >_t6041_max); + + if (!ret && gt_max_live) + kunit_skip(test, "the booted device tree has its own display subsystem"); + return ret; +} + +static void __init gt_max_exit(struct kunit *test) +{ + unsigned int i; + + /* The later chain's iommus edit builds on the earlier one's. */ + for (i = ARRAY_SIZE(t6041_max_cs); i--;) { + of_changeset_revert(&t6041_max_cs[i]); + of_changeset_destroy(&t6041_max_cs[i]); + } + gt_exit(test); +} + +/* The test's edits, then the gate; the display subsystem's status property is noted before. */ +static void __init gt_max_run(struct kunit *test) +{ + struct gate_test *t = test->priv; + unsigned int i; + + KUNIT_ASSERT_EQ(test, of_changeset_apply(&t->cs), 0); + for (i = 0; i < ARRAY_SIZE(t6041_max_cs); i++) + of_changeset_init(&t6041_max_cs[i]); + gt_max_display_status = of_find_property(gt_node(test, "/display-subsystem"), "status", + NULL); + gate_t6041_max_run(); +} + +/* The processor's data and heap regions, as the boot loader fills them. */ +static void __init gt_max_fill(struct kunit *test, unsigned int i) +{ + char path[48]; + + snprintf(path, sizeof(path), "/reserved-memory/dcpext%u-data", i); + gt_set_string(test, path, "status", "okay"); + snprintf(path, sizeof(path), "/reserved-memory/dcpext%u-heap", i); + gt_set_string(test, path, "status", "okay"); +} + +static void __init gt_max_expect_chain(struct kunit *test, unsigned int i, bool enabled) +{ + const struct gate_staged *st = &t6041_max_stages[i]; + unsigned int n; + + for (n = 0; n < st->nr; n++) + KUNIT_EXPECT_EQ_MSG(test, gt_okay(test, st->nodes[n]), enabled, "%s", st->nodes[n]); +} + +/* + * The display subsystem keeps its status property (the gate never wrote it) + * and has the internal DART's entry, then the display DARTs of the chains in + * @mask, in order. + */ +static void __init gt_max_expect_display(struct kunit *test, unsigned int mask) +{ + struct device_node *display = gt_node(test, "/display-subsystem"); + struct of_phandle_args args; + unsigned int i, entry = 1; + + KUNIT_EXPECT_PTR_EQ(test, of_find_property(display, "status", NULL), gt_max_display_status); + KUNIT_EXPECT_TRUE(test, of_device_is_available(display)); + KUNIT_EXPECT_EQ(test, of_count_phandle_with_args(display, "iommus", "#iommu-cells"), + 1 + hweight32(mask)); + for (i = 0; i < ARRAY_SIZE(t6041_max_stages); i++) { + if (!(mask & BIT(i))) + continue; + KUNIT_ASSERT_EQ(test, of_parse_phandle_with_args(display, "iommus", "#iommu-cells", + entry++, &args), 0); + KUNIT_EXPECT_PTR_EQ(test, args.np, gt_node(test, t6041_max_stages[i].dart)); + KUNIT_EXPECT_EQ(test, args.args[0], 0); + of_node_put(args.np); + } +} + +/* Without a PMP, both chains whose processors have memory are enabled. */ +static void __init gate_t6041_max_enabled(struct kunit *test) +{ + struct device_node *pmp = of_find_node_by_path("/pmp@500700000"); + + KUNIT_EXPECT_NULL(test, pmp); + of_node_put(pmp); + gt_max_fill(test, 0); + gt_max_fill(test, 1); + gt_max_run(test); + gt_max_expect_chain(test, 0, true); + gt_max_expect_chain(test, 1, true); + gt_max_expect_display(test, BIT(0) | BIT(1)); +} + +/* A boot loader that fills nothing leaves everything as it is. */ +static void __init gate_t6041_max_no_memory(struct kunit *test) +{ + gt_max_run(test); + gt_max_expect_chain(test, 0, false); + gt_max_expect_chain(test, 1, false); + gt_max_expect_display(test, 0); +} + +/* The other processor's chain does not wait for one that was refused. */ +static void __init gate_t6041_max_one_processor(struct kunit *test) +{ + gt_max_fill(test, 1); + gt_max_run(test); + gt_max_expect_chain(test, 0, false); + gt_max_expect_chain(test, 1, true); + gt_max_expect_display(test, BIT(1)); +} + +/* A region that is still a placeholder keeps the whole chain off. */ +static void __init gate_t6041_max_partial_memory(struct kunit *test) +{ + gt_max_fill(test, 1); + gt_set_string(test, "/reserved-memory/dcpext0-data", "status", "okay"); + gt_max_run(test); + gt_max_expect_chain(test, 0, false); + gt_max_expect_chain(test, 1, true); + gt_max_expect_display(test, BIT(1)); +} + +/* A boot loader that enabled a chain itself is not enabled again, nor its DART added twice. */ +static void __init gate_t6041_max_enabled_by_loader(struct kunit *test) +{ + gt_max_fill(test, 0); + gt_max_fill(test, 1); + gt_set_string(test, t6041_max_hdmi_nodes[0], "status", "okay"); + gt_set_string(test, t6041_max_usbc_nodes[0], "status", "okay"); + gt_max_run(test); + KUNIT_EXPECT_TRUE(test, gt_okay(test, t6041_max_hdmi_nodes[0])); + KUNIT_EXPECT_FALSE(test, gt_okay(test, t6041_max_hdmi_nodes[1])); + KUNIT_EXPECT_TRUE(test, gt_okay(test, t6041_max_usbc_nodes[0])); + KUNIT_EXPECT_FALSE(test, gt_okay(test, t6041_max_usbc_nodes[1])); + gt_max_expect_display(test, 0); +} + +/* A chain that is not all there is refused whole. */ +static void __init gate_t6041_max_missing_node(struct kunit *test) +{ + gt_max_fill(test, 0); + gt_max_fill(test, 1); + gt_detach(test, "/phy@39aa90000"); + gt_max_run(test); + gt_max_expect_chain(test, 1, true); + gt_max_expect_display(test, BIT(1)); + KUNIT_EXPECT_FALSE(test, gt_okay(test, t6041_max_hdmi_nodes[0])); +} + +/* Without an enabled display subsystem nothing is enabled, and it stays as it was. */ +static void __init gate_t6041_max_no_display(struct kunit *test) +{ + struct device_node *display = gt_node(test, "/display-subsystem"); + + gt_max_fill(test, 0); + gt_max_fill(test, 1); + gt_set_string(test, "/display-subsystem", "status", "disabled"); + gt_max_run(test); + gt_max_expect_chain(test, 0, false); + gt_max_expect_chain(test, 1, false); + KUNIT_EXPECT_FALSE(test, of_device_is_available(display)); + KUNIT_EXPECT_EQ(test, of_count_phandle_with_args(display, "iommus", "#iommu-cells"), 1); +} + +static struct kunit_case gate_t6041_max_cases[] __refdata = { + KUNIT_CASE(gate_t6041_max_enabled), + KUNIT_CASE(gate_t6041_max_no_memory), + KUNIT_CASE(gate_t6041_max_one_processor), + KUNIT_CASE(gate_t6041_max_partial_memory), + KUNIT_CASE(gate_t6041_max_enabled_by_loader), + KUNIT_CASE(gate_t6041_max_missing_node), + KUNIT_CASE(gate_t6041_max_no_display), + {} +}; + +static struct kunit_suite gate_t6041_max_suite __refdata = { + .name = "apple-display-gate-t6041-max", + .suite_init = gt_max_suite_init, + .init = gt_max_init, + .exit = gt_max_exit, + .test_cases = gate_t6041_max_cases, +}; + /* T6030 first: the T6031 and T8122 trees describe a PMP, which it refuses. */ kunit_test_init_section_suites(&gate_t6030_suite, &gate_t6031_suite, &gate_t8122_suite, - &gate_t6041_suite); + &gate_t6041_suite, &gate_t6041_max_suite); diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index 7178412579287..a34cbc9fee011 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -77,6 +77,12 @@ * bound, even long after the boot (see gate_t6041_run()). This part was a * driver of its own, t6041-display-gate.c, by Ryan Murray and František * Balázsy. + * + * On the M4 Max (J616c, apple,t6041) the PMP never runs: iBoot leaves the + * external chains powered and the boot loader fills each external display + * processor's firmware memory. The gate enables a chain once its processor has + * that memory, before any device exists (see gate_t6041_max_run()), and never + * touches the internal display. */ #define pr_fmt(fmt) fmt @@ -327,11 +333,22 @@ static const struct gate_soc gate_t6041 __initconst = { .run = gate_t6041_run, }; +static void __init gate_t6041_max_run(void); + +/* T6041 (M4 Max): no PMP; the external chains follow the boot loader's firmware memory. */ +static const struct gate_soc gate_t6041_max __initconst = { + .machine = "apple,t6041", + .prefix = "apple-t6041-display: ", + .name = "T6041", + .run = gate_t6041_max_run, +}; + static const struct gate_soc *const gate_socs[] __initconst = { &gate_t6030, &gate_t8122, &gate_t6031, &gate_t6041, + &gate_t6041_max, }; /* The SoC this boot runs on, if the gate serves it. */ @@ -2946,6 +2963,110 @@ static void __init gate_t6041_run(void) gate_t6041_staged(); } +/* + * J616c's external chains. No PMP, so no DISPEXT power domain is described and + * nothing is requested or waited for: the domains are on as iBoot left them. + */ +static const char *const t6041_max_hdmi_nodes[] = { + /* ATC3 power, AOP pins, PHY, crossbar, DARTs, mailbox, dcpext0 */ + "/power-management@502800000/power-controller@408", + "/power-management@508300000/power-controller@e0", + "/power-management@508300000/power-controller@168", + "/power-management@508300000/power-controller@b8", + "/power-management@508300000/power-controller@148", + "/pinctrl@510824000", + "/mailbox@39b148000", + "/phy@39aa90000", + "/mux@39b24c000", + "/iommu@3a2340000", + "/iommu@3a2300000", + "/mailbox@3a2e08000", + "/dcp@3a2e00000", +}; + +static const char *const t6041_max_usbc_nodes[] = { + /* ATC1 mailbox and crossbar, DARTs, mailbox, route, dcpext1 */ + "/mailbox@38b148000", + "/mux@38b24c000", + "/iommu@602340000", + "/iommu@602300000", + "/mailbox@602e08000", + "/dcp@602e00000/typec-routes/route@1", + "/dcp@602e00000", +}; + +static const struct gate_staged t6041_max_stages[] = { + { "/iommu@3a2300000", t6041_max_hdmi_nodes, ARRAY_SIZE(t6041_max_hdmi_nodes) }, + { "/iommu@602300000", t6041_max_usbc_nodes, ARRAY_SIZE(t6041_max_usbc_nodes) }, +}; + +/* Applied, they stay: the live tree refers to them. Only the KUnit test reverts them. */ +static struct of_changeset t6041_max_cs[ARRAY_SIZE(t6041_max_stages)]; + +/* Enable every node of stage @i and put its display DART into the display subsystem's iommus. */ +static int __init t6041_max_apply(unsigned int i, struct device_node *display) +{ + const struct gate_staged *st = &t6041_max_stages[i]; + struct of_changeset *cs = &t6041_max_cs[i]; + struct device_node *np; + unsigned int n; + int ret; + + of_changeset_init(cs); + np = of_find_node_by_path(st->dart); + ret = np ? gate_iommus_append(cs, display, np) : -ENODEV; + of_node_put(np); + for (n = 0; !ret && n < st->nr; n++) { + np = of_find_node_by_path(st->nodes[n]); + ret = np ? of_changeset_update_prop_string(cs, np, "status", "okay") : -ENODEV; + of_node_put(np); + } + if (!ret) + ret = of_changeset_apply(cs); + if (ret) + of_changeset_destroy(cs); + return ret; +} + +/* + * Each chain is enabled in one changeset, once its processor has firmware + * memory. A chain that has none, or is not all there and disabled (a boot + * loader that enabled it itself), stays as it is, and the other chain does not + * depend on it. The display subsystem only gains the DART of an enabled chain: + * its status is never written, so the internal display stays as the boot + * loader left it whatever happens here. + */ +static void __init gate_t6041_max_run(void) +{ + struct device_node *display; + unsigned int i; + int ret; + + if (IS_ENABLED(CONFIG_VIDEO) && video_firmware_drivers_only()) + return; + + staged_prefix = gate_soc->prefix; + display = of_find_node_by_path("/display-subsystem"); + if (!display || !of_device_is_available(display)) { + staged_err("no display subsystem, nothing enabled\n"); + of_node_put(display); + return; + } + for (i = 0; i < ARRAY_SIZE(t6041_max_stages); i++) { + const struct gate_staged *st = &t6041_max_stages[i]; + const char *dcp = st->nodes[st->nr - 1]; + + if (!staged_ready(st)) + continue; + ret = t6041_max_apply(i, display); + if (ret) + staged_err("%s: could not enable the chain: %d\n", dcp, ret); + else + staged_info("%s enabled\n", dcp); + } + of_node_put(display); +} + /* Runs before of_platform_default_populate_init() at arch_initcall_sync. */ static int __init apple_display_gate(void) { diff --git a/drivers/soc/apple/t6041-gate-test.dtso b/drivers/soc/apple/t6041-gate-test.dtso new file mode 100644 index 0000000000000..96c0eaa541ced --- /dev/null +++ b/drivers/soc/apple/t6041-gate-test.dtso @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Test device tree for the display gate KUnit test: the J616c's external + * display chains at their real paths (t604x-extdisp.dtsi, + * t6041-j616c-hdmi.dtsi, t6041-j616c-usbc.dtsi), disabled, and the display + * subsystem with the internal display's DART. There is no PMP. The data and + * heap regions of both processors are the boot loader's disabled + * placeholders, the text region the one it adds. + * + * The display subsystem is the only node that is enabled. It sits at the + * root, as on the J616c, so a tree that has one does not get this applied. + */ + +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target-path = "/"; + + __overlay__ { + reserved-memory { + dcpext0_text: dcpext0-text { + compatible = "apple,asc-mem"; + }; + + dcpext0_data: dcpext0-data { + compatible = "apple,asc-mem"; + status = "disabled"; + }; + + dcpext0_heap: dcpext0-heap { + compatible = "apple,asc-mem"; + status = "disabled"; + }; + + dcpext1_text: dcpext1-text { + compatible = "apple,asc-mem"; + }; + + dcpext1_data: dcpext1-data { + compatible = "apple,asc-mem"; + status = "disabled"; + }; + + dcpext1_heap: dcpext1-heap { + compatible = "apple,asc-mem"; + status = "disabled"; + }; + }; + + power-management@502800000 { + power-controller@408 { + status = "disabled"; + }; + }; + + power-management@508300000 { + power-controller@e0 { + status = "disabled"; + }; + + power-controller@168 { + status = "disabled"; + }; + + power-controller@b8 { + status = "disabled"; + }; + + power-controller@148 { + status = "disabled"; + }; + }; + + pinctrl@510824000 { + status = "disabled"; + }; + + mailbox@39b148000 { + status = "disabled"; + }; + + phy@39aa90000 { + status = "disabled"; + }; + + mux@39b24c000 { + status = "disabled"; + }; + + dcpext0_dart: iommu@3a2340000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + dispext0_dart: iommu@3a2300000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + mailbox@3a2e08000 { + status = "disabled"; + }; + + dcp@3a2e00000 { + compatible = "apple,t6041-dcpext"; + iommus = <&dcpext0_dart 23>; + memory-region = <&dcpext0_data>, <&dcpext0_heap>, <&dcpext0_text>; + status = "disabled"; + + piodma { + iommus = <&dispext0_dart 16>; + }; + }; + + mailbox@38b148000 { + status = "disabled"; + }; + + mux@38b24c000 { + status = "disabled"; + }; + + dcpext1_dart: iommu@602340000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + dispext1_dart: iommu@602300000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + mailbox@602e08000 { + status = "disabled"; + }; + + dcp@602e00000 { + compatible = "apple,t6041-dcpext"; + iommus = <&dcpext1_dart 23>; + memory-region = <&dcpext1_data>, <&dcpext1_heap>, <&dcpext1_text>; + status = "disabled"; + + typec-routes { + route@1 { + status = "disabled"; + }; + }; + + piodma { + iommus = <&dispext1_dart 16>; + }; + }; + + disp_dart: iommu@a00000000 { + #iommu-cells = <1>; + }; + + display-subsystem { + compatible = "apple,display-subsystem"; + iommus = <&disp_dart 0>; + status = "okay"; + }; + }; + }; +}; diff --git a/sound/soc/apple/macaudio.c b/sound/soc/apple/macaudio.c index 3e51478e8797e..e56d40783457e 100644 --- a/sound/soc/apple/macaudio.c +++ b/sound/soc/apple/macaudio.c @@ -651,6 +651,9 @@ static void macaudio_vlimit_update(struct macaudio_snd_data *ma) atomic_inc(&ma->sw_gain_lock_epoch); schedule_work(&ma->sw_gain_stop_work); } + if (!unlock && !ma->pm_quiesced && ma->cfg->fe_cpu_is_platform && + ma->cfg->amp == AMP_SN012776) + schedule_work(&ma->sw_gain_stop_work); ma->speaker_volume_unlocked = unlock; snd_ctl_notify(ma->card.snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &ma->speaker_lock_kctl->id); @@ -815,7 +818,7 @@ static void macaudio_sw_gain_stop_work(struct work_struct *work) struct macaudio_snd_data *ma = container_of(work, struct macaudio_snd_data, sw_gain_stop_work); - macaudio_stop_playback(ma, true); + macaudio_stop_playback(ma, ma->cfg->amp == AMP_MAX98360A); } static int macaudio_copy_link(struct device *dev, struct snd_soc_dai_link *target, diff --git a/tools/asahi/aop-bootargs-tests.py b/tools/asahi/aop-bootargs-tests.py new file mode 100644 index 0000000000000..aba3842077664 --- /dev/null +++ b/tools/asahi/aop-bootargs-tests.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT +"""Exercise production bootarg patching with synthetic MMIO.""" +import argparse +import os +from pathlib import Path +import subprocess +import tempfile + +HARNESS = r''' +#![allow(dead_code)] +use std::{cell::{Cell,RefCell},marker::PhantomData,mem,ops::{Deref,DerefMut}}; +type Result = std::result::Result; +const EINVAL:i32=-22; const EIO:i32=-5; const GFP_KERNEL:u32=0; +const AOP_MMIO_SIZE:usize=128; const BOOTARGS_OFFSET:usize=16; const BOOTARGS_SIZE:usize=20; +struct KVec(Vec); +impl KVec{fn from_elem(v:T,n:usize,_:u32)->Result{Ok(Self(vec![v;n]))}} +impl Deref for KVec{type Target=Vec;fn deref(&self)->&Vec{&self.0}} +impl DerefMut for KVec{fn deref_mut(&mut self)->&mut Vec{&mut self.0}} +struct Region; +struct Device{bytes:RefCell>,writes:RefCell>,fail:Cell} +struct Mmio<'a,T>{dev:&'a Device,_p:PhantomData} +impl<'a,T> Mmio<'a,T>{ + fn size(&self)->usize{self.dev.bytes.borrow().len()} + fn read32(&self,at:usize)->u32{self.try_read32(at).unwrap()} + fn try_read32(&self,at:usize)->Result{assert_eq!(at%4,0);Ok(u32::from_le_bytes(self.dev.bytes.borrow()[at..at+4].try_into().unwrap()))} + fn try_write32(&self,v:u32,at:usize)->Result{assert_eq!(at%4,0);self.dev.writes.borrow_mut().push(at);if !self.dev.fail.get(){self.dev.bytes.borrow_mut()[at..at+4].copy_from_slice(&v.to_le_bytes());}Ok(())} + fn try_cast(&self)->Result>{Ok(Mmio{dev:self.dev,_p:PhantomData})} +} +struct IoSlice<'a>{dev:&'a Device,start:usize,end:usize} +impl IoSlice<'_>{ + fn copy_to_slice(&self,v:&mut[u8]){v.copy_from_slice(&self.dev.bytes.borrow()[self.start..self.end]);} + fn copy_from_slice(&self,v:&[u8]){self.dev.bytes.borrow_mut()[self.start..self.end].copy_from_slice(v);} +} +macro_rules! io_project {($io:ident,[try: $start:ident .. $($end:tt)*])=>{IoSlice{dev:$io.dev,start:$start,end:$($end)*}};} +struct Aop; +impl Aop { METHOD } +fn fixture(offset:usize,table:&[u8])->Device{ + let mut bytes=vec![0xa5;AOP_MMIO_SIZE];bytes[16..20].copy_from_slice(&(offset as u32).to_le_bytes());bytes[20..24].copy_from_slice(&(table.len() as u32).to_le_bytes()); + if offset+table.len()<=bytes.len(){bytes[offset..offset+table.len()].copy_from_slice(table);} + Device{bytes:RefCell::new(bytes),writes:RefCell::new(Vec::new()),fail:Cell::new(false)} +} +fn patch(dev:&Device,word:bool)->Result{Aop.patch_bootargs(&Mmio{dev,_p:PhantomData::>},&[(1,0x12345678),(2,0x87654321)],word)} +fn main(){ + let table:[u8;24]=[1,0,0,0,4,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,0,0,0,0]; + for offset in 32..36 {for word in [false,true] { + let d=fixture(offset,&table);let mut expected=d.bytes.borrow().clone();expected[offset+8..offset+12].copy_from_slice(&0x12345678u32.to_le_bytes());expected[offset+20..offset+24].copy_from_slice(&0x87654321u32.to_le_bytes()); + assert_eq!(patch(&d,word),Ok(()));assert_eq!(*d.bytes.borrow(),expected,"adjacent bytes changed"); + assert!(d.writes.borrow().iter().all(|&x|x%4==0&&x>=offset&!3&&x+4<=(offset+table.len()+3)&!3)); + if word {assert!(!d.writes.borrow().is_empty());}else{assert!(d.writes.borrow().is_empty());} + let writes=d.writes.borrow().len();assert_eq!(patch(&d,word),Ok(()));assert_eq!(d.writes.borrow().len(),writes,"unchanged words rewritten"); + }} + let mut malformed=table;malformed[16..20].copy_from_slice(&9u32.to_le_bytes()); + for word in [false,true]{let d=fixture(35,&malformed);let before=d.bytes.borrow().clone();assert_eq!(patch(&d,word),Err(EINVAL));assert_eq!(*d.bytes.borrow(),before);assert!(d.writes.borrow().is_empty());} + for tail in 1..8 {let d=fixture(35,&table[..12+tail]);assert_eq!(patch(&d,true),Err(EINVAL));assert!(d.writes.borrow().is_empty());} + let d=fixture(35,&table);d.fail.set(true);assert_eq!(patch(&d,true),Err(EIO),"readback error ignored"); + assert_eq!(patch(&fixture(35,&[]),true),Err(EINVAL));assert_eq!(patch(&fixture(35,&[]),false),Ok(())); + assert_eq!(patch(&fixture(120,&table),true),Err(EINVAL)); + println!("PASS aligned/unaligned byte and word access, unchanged writes, malformed tables, bounds and failed readback"); +} +''' + + +def method(source): + start = source.index(' fn patch_bootargs(') + at = source.index('{', start) + depth = 1 + end = at + 1 + while depth: + depth += (source[end] == '{') - (source[end] == '}') + end += 1 + return source[start:end] + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--source', type=Path, default=Path(__file__).resolve().parents[2] / 'drivers/soc/apple/aop.rs') + args = parser.parse_args() + production = method(args.source.read_text()) + macros = ''.join('macro_rules! ' + name + ' {($($t:tt)*)=>{()};}\n' for name in ['dev_info', 'dev_err'] if name + '!' in production) + code = HARNESS.replace('METHOD', production).replace('struct Aop;', macros + 'struct Aop;') + with tempfile.TemporaryDirectory(prefix='aop-bootargs-') as tmp: + p = Path(tmp) / 'test.rs' + binary = p.with_suffix('') + p.write_text(code) + subprocess.run([os.environ.get('RUSTC', 'rustc'), '--edition=2021', str(p), '-o', str(binary)], check=True) + subprocess.run([str(binary)], check=True) + bad = code.replace('if aop_mmio.try_read32(address)? != value {', 'if false {') + assert bad != code + p.write_text(bad) + subprocess.run([os.environ.get('RUSTC', 'rustc'), '--edition=2021', str(p), '-o', str(binary)], check=True) + result = subprocess.run([str(binary)], capture_output=True, text=True) + assert result.returncode != 0 and 'readback error ignored' in result.stderr + print('PASS negative control: missing write verification') + + +if __name__ == '__main__': + main() diff --git a/tools/asahi/g17-admission-order-tests.py b/tools/asahi/g17-admission-order-tests.py index c9908aca591c6..e247afd638318 100644 --- a/tools/asahi/g17-admission-order-tests.py +++ b/tools/asahi/g17-admission-order-tests.py @@ -31,7 +31,7 @@ def main(): type Result = std::result::Result; const ECANCELED:i32=-125;const EIO:i32=-5;const EFAULT:i32=-14; mod g17 {pub mod fw {pub mod compute_pool { - pub fn required_blocks(cores:u32,pages:u16)->crate::Result { + pub fn required_blocks(_:usize,cores:u32,pages:u16)->crate::Result { if cores==0 {Err(-22)} else {Ok(21+usize::from(pages))} } }}} @@ -39,7 +39,7 @@ def main(): impl Status {fn get(&self)->i32{self.0}} struct Context {status:Status} impl Context {fn status(&self)->&Status{&self.status} fn is_current(&self)->bool{true}} -struct Shared {active_cores:u32,crashed:AtomicBool} +struct Shared {compute_blocks:usize,active_cores:u32,crashed:AtomicBool} struct Backend {shared:Shared,physical:AtomicUsize,closed:AtomicBool,context:Context} impl Backend { fn ensure_compute(&self,_:u16)->Result {self.physical.fetch_add(1,Ordering::SeqCst);Ok(())} @@ -50,14 +50,14 @@ def main(): ''' + method('runtime/backend.rs', 'fn ensure_compute(') + r''' } fn main(){ - let backend=Backend{shared:Shared{active_cores:10,crashed:AtomicBool::new(false)},physical:AtomicUsize::new(0),closed:AtomicBool::new(false),context:Context{status:Status(0)}}; + let backend=Backend{shared:Shared{compute_blocks:21,active_cores:10,crashed:AtomicBool::new(false)},physical:AtomicUsize::new(0),closed:AtomicBool::new(false),context:Context{status:Status(0)}}; // Four clients each enqueue nine queues in reverse dependency order. The // final host signal cannot be submitted if ioctl admission blocks on channels. for _client in 0..4 {for _queue in (0..9).rev() {::ensure_compute(&backend,0).unwrap();}} assert_eq!(backend.physical.load(Ordering::SeqCst),0,"unsignalled work must not pin physical capacity"); Backend::ensure_compute(&backend,0).unwrap(); assert_eq!(backend.physical.load(Ordering::SeqCst),1); - let invalid=Backend{shared:Shared{active_cores:0,crashed:AtomicBool::new(false)},physical:AtomicUsize::new(0),closed:AtomicBool::new(false),context:Context{status:Status(0)}}; + let invalid=Backend{shared:Shared{compute_blocks:21,active_cores:0,crashed:AtomicBool::new(false)},physical:AtomicUsize::new(0),closed:AtomicBool::new(false),context:Context{status:Status(0)}}; assert_eq!(::ensure_compute(&invalid,0),Err(-22)); assert_eq!(invalid.physical.load(Ordering::SeqCst),0); for _ in 0..512 { @@ -68,7 +68,7 @@ def main(): println!("PASS closed builders cannot install after logical close; production ioctl sizing validates 36 reverse-order submissions without physical admission; invalid sizing consumes no channel"); } ''' - fixed = 'crate::g17::fw::compute_pool::required_blocks(self.shared.active_cores, scs_pages)\n .map(|_| ())' + fixed = 'crate::g17::fw::compute_pool::required_blocks(self.shared.compute_blocks, self.shared.active_cores, scs_pages)\n .map(|_| ())' assert code.count(fixed) == 1 with tempfile.TemporaryDirectory(prefix='g17-admission-order-') as tmp: for name, source in [('fixed', code), ('eager-physical-admission', code.replace(fixed, 'Backend::ensure_compute(self, scs_pages)')), ('ignore-logical-close', code.replace('self.closed.load(Ordering::Acquire)', 'false'))]: diff --git a/tools/asahi/g17-compute-deadline-tests.py b/tools/asahi/g17-compute-deadline-tests.py index 0b021d1b8f810..e33f643fc61f0 100644 --- a/tools/asahi/g17-compute-deadline-tests.py +++ b/tools/asahi/g17-compute-deadline-tests.py @@ -94,10 +94,10 @@ def fixture(): impl Firmware{fn replay_compute(&mut self,_:&mut DeferredBatch)->Result{Ok(())}fn publish_compute(&mut self,_:u64,_:Arc,_:&[()],_:&mut DeferredBatch)->Result{Err(EAGAIN)}} struct State(Mutex>>);impl State{fn lock(&self)->MutexGuard<'_,Option>>{self.0.lock().unwrap()}} struct Available;impl Available{fn observe(&self)->u64{now_ns()}} -struct Shared{preparations:Arc,state:State,crashed:AtomicBool,active_cores:u32,progress:Available}impl Shared{fn queue_events(&self){}} +struct Shared{preparations:Arc,state:State,crashed:AtomicBool,compute_blocks:usize,active_cores:u32,progress:Available}impl Shared{fn queue_events(&self){}} struct ComputeDemand;impl ComputeDemand{fn new(_:&Shared)->Self{Self}} struct Backend{shared:Shared,owner:u64,context:Context} -fn required_blocks(_:u32,_:u16)->Result{Ok(1)} +fn required_blocks(_:usize,_:u32,_:u16)->Result{Ok(1)} impl Backend{ fn compute_direct(&self,_:&Arc,_:usize,_:&mut DeferredBatch)->Option{None} fn sources_published(&self,_:&Arc)->Result{Ok(true)} @@ -116,7 +116,7 @@ def fixture(): ''' + ensure + '\n' + packet + r''' } fn main(){ - let b=Backend{owner:1,context:Context,shared:Shared{active_cores:1,progress:Available,preparations:Arc::new(Gate{wait:Wait,changed:Changed}),state:State(Mutex::new(Some(Box::new(Firmware{recovery:Recovery,init:Init,queues:Queues,port:()})))),crashed:AtomicBool::new(false)}}; + let b=Backend{owner:1,context:Context,shared:Shared{compute_blocks:21,active_cores:1,progress:Available,preparations:Arc::new(Gate{wait:Wait,changed:Changed}),state:State(Mutex::new(Some(Box::new(Firmware{recovery:Recovery,init:Init,queues:Queues,port:()})))),crashed:AtomicBool::new(false)}}; let p=Arc::new(Packet{command:Validated::Compute{scratch:Scratch},completion:Completion}); for mode in 0..4 { MODE.store(mode,Ordering::SeqCst);NOW.store(0,Ordering::SeqCst);CALLS.store(0,Ordering::SeqCst); diff --git a/tools/asahi/g17-t6041-initdata-tests.py b/tools/asahi/g17-t6041-initdata-tests.py new file mode 100644 index 0000000000000..05ddc6b145d9d --- /dev/null +++ b/tools/asahi/g17-t6041-initdata-tests.py @@ -0,0 +1,327 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT +"""Build T6041 initialization data and compare it with captures when given.""" + +import argparse +import re +import struct +import subprocess +import sys +import tempfile +from pathlib import Path + +DRIVER = Path(__file__).resolve().parents[2] / "drivers/gpu/drm/asahi" + + +def item(source, start): + """Extract an item and its attributes.""" + at = source.index(start) + line = source.rfind("\n", 0, at) + 1 + while True: + previous = source.rfind("\n", 0, line - 1) + 1 + if line == 0 or not source[previous:line].lstrip().startswith("#["): + break + line = previous + depth = 0 + end = at + while True: + c = source[end] + if c in "([{": + depth += 1 + elif c in ")]}": + depth -= 1 + if depth == 0 and c == "}" and not re.match( + r"(pub\(crate\) )?(const|static) (?!fn )", source[at:] + ): + return source[line : end + 1] + elif c == ";" and depth == 0: + return source[line : end + 1] + end += 1 + + +HEADER = r""" +#![allow(dead_code, unused_imports, unused_variables, clippy::all)] +use core::mem::size_of; +#[derive(Debug)] +pub struct Error(i32); +pub const EINVAL: Error = Error(-22); +pub const EOVERFLOW: Error = Error(-75); +impl From for Error { + fn from(_: core::num::TryFromIntError) -> Self { EINVAL } +} +pub type Result = core::result::Result; +pub unsafe trait Zeroable {} +macro_rules! static_assert { ($e:expr $(,)?) => { const _: () = assert!($e); }; } +pub fn clear(object: &mut T) { + unsafe { core::ptr::write_bytes(object as *mut T, 0, 1) } +} +const PAGE_SIZE: usize = 0x4000; +""" + +INITDATA_ITEMS = [ + "pub(crate) const REGISTER_MAP_SLOTS", + "pub(crate) struct RegisterWindow", + "const RESERVED_SLOT_UNK_20", + "pub(crate) struct RegisterMapEntry", + "unsafe impl Zeroable for RegisterMapEntry", + "impl RegisterMapEntry", + "pub(crate) const PERF_STATES", + "const PERF_LANES", + "pub(crate) const OPP_CELLS", + "pub(crate) struct Opp ", + "pub(crate) struct PerfConfig", + "pub(crate) struct PerfGroup", + "unsafe impl Zeroable for PerfGroup", + "struct PerfState", + "impl PerfGroup", + "fn perf_states", + "pub(crate) struct CompletionRingDescriptor", + "unsafe impl Zeroable for CompletionRingDescriptor", + "const COMPLETION_RING_DESCRIPTORS", + "pub(crate) const COMPLETION_RING_INDEX", + "const COMPLETION_RING_ENTRIES", + "const COMPLETION_RING_ENTRY_SIZE", + "pub(crate) struct CompletionRing ", + "pub(crate) struct HwDataArgs", + "type Words", + "fn fill_words", + "pub(crate) const CONTEXT_SWITCH_TIMER_MASK", + "pub(crate) const CONTEXT_SWITCH_TIMER_MULTIPLIER", + "pub(crate) struct RegionCConfig", + "pub(crate) struct RegionC ", + "unsafe impl Zeroable for RegionC ", + "impl RegionC ", +] + +SOC_ITEMS = [ + "pub(crate) const CHIP_ID", + "pub(crate) const REGISTER_WINDOWS", + "pub(crate) const PERF", + "pub(crate) const OPPS", + "const REGION_C", +] + +T6041_ITEMS = SOC_ITEMS + [ + "const RESERVED_SLOTS", + "const MAX_POWER_MW", + "const CHIP: ", + "const HW_DATA_WORDS", + "const POWER_CONFIG_WORDS", +] + +T6041_OPP_HZ = [0, 338, 618, 796, 924, 952, 1056, 1062, 1182, 1182, 1312, 1242, 1380, 1326, + 1470, 1578] +T6041_OPP_MV = [ + [125, 600, 665, 705, 725, 770, 770, 810, 810, 860, 860, 900, 900, 940, 940, 1020], + [125, 600, 665, 705, 725, 770, 770, 810, 810, 860, 860, 895, 895, 925, 925, 1020], + [125, 600, 660, 700, 715, 770, 770, 805, 805, 860, 860, 900, 900, 940, 940, 1020], + [125, 600, 660, 705, 730, 780, 780, 810, 810, 860, 860, 900, 900, 940, 940, 1020], +] +T6041_AUX = [(24, 585000), (338, 585000), (618, 635000), (796, 685000), (992, 720000), + (1188, 770000), (1380, 855000), (1470, 885000)] + + +def opps(name, hz, mv): + rows = [] + for index, freq in enumerate(hz): + cells = [m[index] * 1000 for m in mv] + [0] * (16 - len(mv)) + rows.append( + "Opp { freq_hz: %d, volt_uv: [%s], cells: %d }" + % (freq * 1_000_000, ", ".join(map(str, cells)), len(mv)) + ) + return "const %s: [Opp; %d] = [%s];\n" % (name, len(rows), ",\n".join(rows)) + + +def aux(name, rows): + body = ",\n".join( + "Opp { freq_hz: %d, volt_uv: [%d, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], cells: 1 }" + % (mhz * 1_000_000, uv) + for mhz, uv in rows + ) + return "const %s: [Opp; %d] = [%s];\n" % (name, len(rows), body) + + +MAIN = r""" +fn build( + chip_id: u32, + windows: &[RegisterWindow], + reserved: &[usize], + perf: &PerfConfig, + opps: &[Opp], + aux: &[Opp], + chip: &v25g83::Chip, + region_c: &RegionCConfig, + cores: u32, +) -> (Vec, Vec, Vec) { + let args = HwDataArgs { + chip_id, + windows, + reserved_slots: reserved, + opps, + perf, + completion_rings: [ + CompletionRing { low_va: 0x70_03f0_0000, high_va: 0xffff_fc20_0000_0000 }, + CompletionRing { low_va: 0x70_03f2_8000, high_va: 0xffff_fc20_0002_8000 }, + ], + qos_va: 0xffff_fc20_0004_0000, + }; + let ext = v25g83::HwDataArgs25G83 { active_cores: cores, cs_opps: aux, afr_opps: aux, chip: Some(chip) }; + let mut hw: Box = unsafe { Box::new(core::mem::zeroed()) }; + hw.init(&args, &ext).unwrap(); + let mut power: Box = unsafe { Box::new(core::mem::zeroed()) }; + power.init(0xffff_fc20_000d_3440, 0, 0, chip.max_power_mw, &chip.leakage); + power.apply_chip(chip).unwrap(); + let mut region: Box = unsafe { Box::new(core::mem::zeroed()) }; + region.init(region_c); + region.max_power_mw = region_c.max_power_mw; + let hw_bytes = unsafe { + core::slice::from_raw_parts((&*hw as *const v25g83::HwData25G83).cast::(), + size_of::()) + }.to_vec(); + let region_bytes = unsafe { + core::slice::from_raw_parts((&*region as *const RegionC).cast::(), size_of::()) + }.to_vec(); + (hw_bytes, power.0.to_vec(), region_bytes) +} + +fn main() { + let out = std::env::args().nth(1).unwrap(); + let (hw, power, region) = build(t6041::CHIP_ID, &t6041::REGISTER_WINDOWS, + &t6041::RESERVED_SLOTS, &t6041::PERF, &T6041_OPPS, &T6041_AUX, &t6041::CHIP, + &t6041::REGION_C, 40); + println!("T6041 initialization objects built"); + std::fs::write(format!("{}/t6041-hwdata.bin", out), hw).unwrap(); + std::fs::write(format!("{}/t6041-power-config.bin", out), power).unwrap(); + std::fs::write(format!("{}/t6041-region-c.bin", out), region).unwrap(); +} +""" + + +def program(): + initdata = (DRIVER / "g17/fw/initdata.rs").read_text() + v25g83 = (DRIVER / "g17/fw/initdata/v25g83.rs").read_text() + t6041 = (DRIVER / "hw/t6041.rs").read_text() + v25g83 = re.sub(r"use super::\{[^}]*\};", "use super::*;", v25g83, count=1) + v25g83 = v25g83.replace("use kernel::prelude::*;", "") + float_source = (DRIVER / "float.rs").read_text().split("impl<'a> TryFrom [(arguments, expectation)]. '{out}' is a fresh directory. ASAHI_TESTS = { 'aop-als-channel-tests.py': [([], PASS)], + 'aop-bootargs-tests.py': [([], PASS)], 'mtp-pm-tests.py': [(out(), PASS), (out() + ['--old-transport', '4db3a5a22c43'], PASS)], 'ave-pm-tests.py': [(out(), PASS), @@ -124,6 +125,7 @@ def mutations(flag, names, base, expect=KILL): 'g17-pool-release-tests.py': [([], PASS)], 'g17-resource-tests.py': [([], PASS)], 'g17-shared-pool-tests.py': [([], PASS)], + 'g17-t6041-initdata-tests.py': [([], PASS)], 'g17-uninstalled-cleanup-tests.py': [([], PASS)], 'g17-unpublished-tests.py': [([], PASS)], 'mt7932-association-events-tests.py': [(out(), PASS)], @@ -156,6 +158,7 @@ def mutations(flag, names, base, expect=KILL): 't6030-wiring-tests.py': [(out(), PASS), (out() + ['--old-classifier', 'tb'], PASS), (out() + ['--old-classifier', 'dcp'], PASS)], 't6040-calibration-tests.py': [([], PASS)], + 't604x-cpu-order-tests.py': [(out('--output') + ['--dtc', '{dtc}'], PASS)], 'tb-dp-repair-tests.py': [(out('--output'), PASS), (out('--output') + ['--mutations'], PASS)], 'tbnet-refill-tests.py': [(out(), PASS)] + mutations('--mutant', ('refill-count', 'no-retry', 'no-cancel', 'worker-allocation'), out()), diff --git a/tools/asahi/t604x-cpu-order-tests.py b/tools/asahi/t604x-cpu-order-tests.py new file mode 100644 index 0000000000000..16b1078504da8 --- /dev/null +++ b/tools/asahi/t604x-cpu-order-tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT +"""Check the CPU order required by m1n1's sequential MPIDR validation.""" +import argparse +from pathlib import Path +import subprocess + +ROOT = Path(__file__).resolve().parents[2] +BOARDS = {'t6040-j614s': 5, 't6040-j616s': 5, 't6040-j616s-tether': 5, 't6041-j616c': 6} + + +def check(dtb, board, cores): + def get(*options): + return subprocess.check_output(['fdtget', *options, str(dtb), '/cpus'], text=True) + + actual = [] + for node in get('-l').split(): + if not node.startswith('cpu@'): + continue + cells = subprocess.check_output( + ['fdtget', '-t', 'x', str(dtb), '/cpus/' + node, 'reg'], text=True).split() + actual.append((int(cells[0], 16) << 32) | int(cells[1], 16)) + expected = list(range(4)) + [base + core for base in [0x10100, 0x10200] + for core in range(cores)] + assert actual == expected, f'{board} CPU MPIDR order: {actual!r}; expected {expected!r}' + print(f'PASS: {board} CPU order ({len(actual)} cores)') + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--dtc', required=True, help="this kernel's built scripts/dtc/dtc") + parser.add_argument('--output', type=Path, required=True) + args = parser.parse_args() + args.output.mkdir(parents=True, exist_ok=True) + for board, cores in BOARDS.items(): + source = subprocess.check_output([ + 'cpp', '-nostdinc', '-undef', '-D__DTS__', + '-I', str(ROOT / 'scripts/dtc/include-prefixes'), + '-x', 'assembler-with-cpp', str(ROOT / f'arch/arm64/boot/dts/apple/{board}.dts'), + ]) + dtb = args.output / f'{board}.dtb' + subprocess.run([args.dtc, '-q', '-I', 'dts', '-O', 'dtb', '-o', str(dtb)], + input=source, check=True) + check(dtb, board, cores) + + +if __name__ == '__main__': + main() diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py index 8a23ffbeb83ff..860578ee16f1a 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py @@ -582,6 +582,7 @@ def powerlog_framing(root): prefix += block(afkh, 'struct epic_compact_desc {') + ';\n' prefix += '#undef kfree\n#define kfree(p) free((void *)(p))\n#define pr_err(...) ((void)0)\n' prefix += block(parser, 'int parse_system_log_mnits(') + prefix += block(parser, 'int parse_system_log_mnits_pairs(') prefix += r''' #define DCP_FIRMWARE_H17P 1 #define DCP_FIRMWARE_V_26_6_DESKTOP 5 @@ -589,6 +590,7 @@ def powerlog_framing(root): #define READ_ONCE(x) (x) #define WRITE_ONCE(x,v) ((x)=(v)) #define dev_dbg(...) ((void)0) +#define dev_info(...) ((void)0) #define dev_warn(...) ((void)0) #define __le64 u64 #define EPIC_SUBTYPE_STD_SERVICE 0xc0 @@ -640,6 +642,20 @@ def powerlog_framing(root): memcpy(wire+16,report,8); afk_recv_compact_message(&ep,3,wire,23); assert(hints==2 && !service.users); + /* Headerless pairs, after the descriptor, on the desktop firmware only. */ + struct dcp_system_ev_mnits mnits; + assert(!parse_system_log_mnits_pairs(report+8,sizeof(report)-8,&mnits)); + assert(mnits.millinits==123000 && mnits.idac==42 && mnits.timestamp==1234); + hint=0;memset(wire+16,0,8);memcpy(wire+24,report+8,sizeof(report)-8); + afk_recv_compact_message(&ep,3,wire,sizeof(wire)-8); + assert(hints==3 && hint==123000 && !service.users); + d.fw_compat=DCP_FIRMWARE_H17P; + afk_recv_compact_message(&ep,3,wire,sizeof(wire)-8); + assert(hints==3 && !service.users); + d.fw_compat=DCP_FIRMWARE_V_26_6_DESKTOP; + /* The first key without its value gives no reading. */ + afk_recv_compact_message(&ep,3,wire,24+12); + assert(hints==3 && !service.users); return 0; } '''