From dbeae8e3f908e2435dd6cdd123273ca6ebbdc48d Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:37:17 -0647 Subject: [PATCH 01/16] arm64: dts: exynos: google: zumapro-tegu: Enable the GPU Turn on CMU_G3D and the Mali-G715 for the Pixel 9a, with its core clock on ACPM's paired "gpu" clock (index 17), which sets the shader (G3D) and L2 (G3DL2) domains together, and coregroup and stacks on CMU_G3D's gates. The operating points are the shader rates of the 9a's GPU DVFS table up to 649 MHz. The levels above it, to 940 MHz, wait for a GPU thermal zone, since nothing throttles the GPU yet. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index c8e150e529..95dfe0fbda 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -8,6 +8,7 @@ /dts-v1/; +#include #include #include #include "../exynos-pinctrl.h" @@ -73,6 +74,51 @@ }; }; + /* + * The GPU's levels: the shader rates of the Pixel 9a's GPU DVFS table + * up to 649 MHz, each with its paired L2 rate through the ACPM "gpu" + * clock. The levels above, to 940 MHz, wait for a GPU thermal zone. + */ + gpu_opp: opp-table-gpu { + compatible = "operating-points-v2"; + + opp-150000000 { + opp-hz = /bits/ 64 <150000000>; + }; + + opp-302000000 { + opp-hz = /bits/ 64 <302000000>; + }; + + opp-337000000 { + opp-hz = /bits/ 64 <337000000>; + }; + + opp-376000000 { + opp-hz = /bits/ 64 <376000000>; + }; + + opp-419000000 { + opp-hz = /bits/ 64 <419000000>; + }; + + opp-467000000 { + opp-hz = /bits/ 64 <467000000>; + }; + + opp-521000000 { + opp-hz = /bits/ 64 <521000000>; + }; + + opp-580000000 { + opp-hz = /bits/ 64 <580000000>; + }; + + opp-649000000 { + opp-hz = /bits/ 64 <649000000>; + }; + }; + /* UFS VCC, switched by gpp0-1 as on stock. */ ufs_vcc: regulator-ufs-vcc { compatible = "regulator-fixed"; @@ -135,6 +181,10 @@ status = "okay"; }; +&cmu_g3d { + status = "okay"; +}; + &cmu_hsi0 { status = "okay"; }; @@ -188,6 +238,19 @@ interrupts = ; }; +/* + * The GPU's core clock is ACPM's paired "gpu" clock, which sets the shader + * (G3D) and L2 (G3DL2) domains together; coregroup and stacks stay on + * CMU_G3D's gates. + */ +&gpu { + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_GPU>, + <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, + <&cmu_g3d CLK_GOUT_G3D_STACKS>; + operating-points-v2 = <&gpu_opp>; + status = "okay"; +}; + &pinctrl_alive { status = "okay"; }; From babf9742a49efc5883f635e76405f48edc423ac7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:51:28 -0647 Subject: [PATCH 02/16] arm64: dts: exynos: google: zumapro: Add CPU DVFS and thermal zones Give the three CPU clusters their ACPM DVFS clocks (cpucl0-2, by the zumapro ACPM clock ids) and operating points for cpufreq-dt, with capacities and power coefficients for the energy model from Google's zumapro-cpu.dtsi, and add the ACPM TMU sensor and the big, mid, little and GPU thermal zones. The CPU levels are the APM firmware's own (its DVFS table, read on the Pixel 9a), up to the 9a's thermal headroom: 1950 MHz little (Google's max-freq for that cluster), 2367 MHz mid and 2687 MHz big. The little cluster's 324 and 610 MHz lie below stock's 820 MHz floor. Each CPU zone throttles its cluster from 80 C, forces the cluster's lowest levels from 95 C and shuts down at 105 C, all below stock's 112 C (CPU) and 115 C (GPU) hot trips. gpu-thermal throttles panthor's devfreq from 85 C. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../arm64/boot/dts/exynos/google/zumapro.dtsi | 378 ++++++++++++++++++ 1 file changed, 378 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index 10b018b180..2a8017bea1 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -104,6 +105,11 @@ compatible = "arm,cortex-a520"; reg = <0x000>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu1: cpu@100 { @@ -111,6 +117,11 @@ compatible = "arm,cortex-a520"; reg = <0x100>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu2: cpu@200 { @@ -118,6 +129,11 @@ compatible = "arm,cortex-a520"; reg = <0x200>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu3: cpu@300 { @@ -125,6 +141,11 @@ compatible = "arm,cortex-a520"; reg = <0x300>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu4: cpu@400 { @@ -132,6 +153,11 @@ compatible = "arm,cortex-a720"; reg = <0x400>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu5: cpu@500 { @@ -139,6 +165,11 @@ compatible = "arm,cortex-a720"; reg = <0x500>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu6: cpu@600 { @@ -146,6 +177,11 @@ compatible = "arm,cortex-a720"; reg = <0x600>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu7: cpu@700 { @@ -153,6 +189,11 @@ compatible = "arm,cortex-x4"; reg = <0x700>; enable-method = "psci"; + capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <757>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL2>; + operating-points-v2 = <&cpucl2_opp>; }; }; @@ -214,6 +255,342 @@ mboxes = <&ap2apm_mailbox>; shmem = <&apm_sram>; status = "disabled"; + + acpm_tmu: thermal-sensor { + compatible = "google,zumapro-acpm-tmu"; + #thermal-sensor-cells = <1>; + }; + }; + }; + + /* + * CPU levels: the APM firmware's own DVFS levels, read on the Pixel 9a + * (the little cluster's 324 and 610 MHz are below stock's 820 MHz + * floor), up to the 9a's thermal headroom: the levels above each table's + * top, listed in it, are left out for that board. A board with more + * headroom can add them. The little cluster stops at 1950 MHz, Google's + * max-freq for it. + */ + cpucl0_opp: opp-table-cpucl0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-324000000 { + opp-hz = /bits/ 64 <324000000>; + }; + + opp-610000000 { + opp-hz = /bits/ 64 <610000000>; + }; + + opp-820000000 { + opp-hz = /bits/ 64 <820000000>; + }; + + opp-955000000 { + opp-hz = /bits/ 64 <955000000>; + }; + + opp-1098000000 { + opp-hz = /bits/ 64 <1098000000>; + }; + + opp-1197000000 { + opp-hz = /bits/ 64 <1197000000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + }; + + opp-1425000000 { + opp-hz = /bits/ 64 <1425000000>; + }; + + opp-1548000000 { + opp-hz = /bits/ 64 <1548000000>; + }; + + opp-1696000000 { + opp-hz = /bits/ 64 <1696000000>; + }; + + opp-1849000000 { + opp-hz = /bits/ 64 <1849000000>; + }; + + opp-1950000000 { + opp-hz = /bits/ 64 <1950000000>; + }; + + }; + + cpucl1_opp: opp-table-cpucl1 { + compatible = "operating-points-v2"; + opp-shared; + + opp-357000000 { + opp-hz = /bits/ 64 <357000000>; + }; + + opp-578000000 { + opp-hz = /bits/ 64 <578000000>; + }; + + opp-648000000 { + opp-hz = /bits/ 64 <648000000>; + }; + + opp-787000000 { + opp-hz = /bits/ 64 <787000000>; + }; + + opp-910000000 { + opp-hz = /bits/ 64 <910000000>; + }; + + opp-1065000000 { + opp-hz = /bits/ 64 <1065000000>; + }; + + opp-1221000000 { + opp-hz = /bits/ 64 <1221000000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + }; + + opp-1418000000 { + opp-hz = /bits/ 64 <1418000000>; + }; + + opp-1549000000 { + opp-hz = /bits/ 64 <1549000000>; + }; + + opp-1795000000 { + opp-hz = /bits/ 64 <1795000000>; + }; + + opp-1945000000 { + opp-hz = /bits/ 64 <1945000000>; + }; + + opp-2130000000 { + opp-hz = /bits/ 64 <2130000000>; + }; + + opp-2245000000 { + opp-hz = /bits/ 64 <2245000000>; + }; + + opp-2367000000 { + opp-hz = /bits/ 64 <2367000000>; + }; + + /* 2450 and 2600 MHz stay off: above the cluster's thermal headroom. */ + }; + + cpucl2_opp: opp-table-cpucl2 { + compatible = "operating-points-v2"; + opp-shared; + + opp-700000000 { + opp-hz = /bits/ 64 <700000000>; + }; + + opp-1164000000 { + opp-hz = /bits/ 64 <1164000000>; + }; + + opp-1396000000 { + opp-hz = /bits/ 64 <1396000000>; + }; + + opp-1557000000 { + opp-hz = /bits/ 64 <1557000000>; + }; + + opp-1745000000 { + opp-hz = /bits/ 64 <1745000000>; + }; + + opp-1885000000 { + opp-hz = /bits/ 64 <1885000000>; + }; + + opp-1999000000 { + opp-hz = /bits/ 64 <1999000000>; + }; + + opp-2147000000 { + opp-hz = /bits/ 64 <2147000000>; + }; + + opp-2294000000 { + opp-hz = /bits/ 64 <2294000000>; + }; + + opp-2363000000 { + opp-hz = /bits/ 64 <2363000000>; + }; + + opp-2499000000 { + opp-hz = /bits/ 64 <2499000000>; + }; + + opp-2687000000 { + opp-hz = /bits/ 64 <2687000000>; + }; + + /* + * 2802, 2914, 2943, 2970, 3015 and 3105 MHz stay off: above the + * cluster's thermal headroom. + */ + }; + + thermal-zones { + big-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 0>; + + trips { + big_alert: big-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + big_hot: big-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + big_crit: big-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&big_alert>; + cooling-device = <&cpu7 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&big_hot>; + cooling-device = <&cpu7 11 0xffffffff>; + }; + }; + }; + + mid-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 1>; + + trips { + mid_alert: mid-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + mid_hot: mid-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + mid_crit: mid-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&mid_alert>; + cooling-device = <&cpu4 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&mid_hot>; + cooling-device = <&cpu4 14 0xffffffff>; + }; + }; + }; + + little-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 2>; + + trips { + little_alert: little-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + little_hot: little-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + little_crit: little-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&little_alert>; + cooling-device = <&cpu0 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&little_hot>; + cooling-device = <&cpu0 11 0xffffffff>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <1000>; + polling-delay = <2000>; + thermal-sensors = <&acpm_tmu 3>; + + trips { + gpu_alert: gpu-alert { + temperature = <85000>; + hysteresis = <5000>; + type = "passive"; + }; + + gpu_crit: gpu-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + /* panthor's devfreq cooling: step_wise walks the GPU down its OPPs. */ + cooling-maps { + map0 { + trip = <&gpu_alert>; + cooling-device = <&gpu 0xffffffff 0xffffffff>; + }; + }; }; }; @@ -1115,6 +1492,7 @@ <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, <&cmu_g3d CLK_GOUT_G3D_STACKS>; clock-names = "core", "coregroup", "stacks"; + #cooling-cells = <2>; status = "disabled"; }; From 94f81703f0205e2741f76cf03f735fe9e06402fe Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:51:28 -0647 Subject: [PATCH 03/16] arm64: dts: exynos: google: zumapro-tegu: Add the GPU's levels to 890 MHz With gpu-thermal throttling the GPU, add the 9a's GPU levels above 649 MHz: 723, 807, 850 and 890 MHz. The table's top, 940 MHz, stays out until it has run on the 9a. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 95dfe0fbda..d68fd18f82 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -76,8 +76,9 @@ /* * The GPU's levels: the shader rates of the Pixel 9a's GPU DVFS table - * up to 649 MHz, each with its paired L2 rate through the ACPM "gpu" - * clock. The levels above, to 940 MHz, wait for a GPU thermal zone. + * up to 890 MHz, each with its paired L2 rate through the ACPM "gpu" + * clock; gpu-thermal throttles them from 85 C. 940 MHz, the table's + * top, is left out until it has run on the 9a. */ gpu_opp: opp-table-gpu { compatible = "operating-points-v2"; @@ -117,6 +118,22 @@ opp-649000000 { opp-hz = /bits/ 64 <649000000>; }; + + opp-723000000 { + opp-hz = /bits/ 64 <723000000>; + }; + + opp-807000000 { + opp-hz = /bits/ 64 <807000000>; + }; + + opp-850000000 { + opp-hz = /bits/ 64 <850000000>; + }; + + opp-890000000 { + opp-hz = /bits/ 64 <890000000>; + }; }; /* UFS VCC, switched by gpp0-1 as on stock. */ From 4a1fd4a360ad32f0a2c5a5a091b009d4e34dec6c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:30 -0647 Subject: [PATCH 04/16] dt-bindings: display: samsung: google,gs201-dsim: Add Tensor G4 The Tensor G4 (zumapro) display pipeline has the gs201 DSIM, at the same register layout and with the same three register windows. Add google,zumapro-dsim with google,gs201-dsim as its fallback. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../bindings/display/samsung/google,gs201-dsim.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml b/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml index 663c43b67f..e70bda177c 100644 --- a/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml +++ b/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml @@ -14,14 +14,19 @@ description: pipeline. It takes pixel data from a DECON and drives up to four data lanes through a combined D-PHY/C-PHY, in video or command mode, with DSC slice packing and TE-based command scheduling. Panels are described - as child nodes. + as child nodes. The Tensor G4 (zumapro) has the same DSIM, at the same + register layout. allOf: - $ref: /schemas/display/dsi-controller.yaml# properties: compatible: - const: google,gs201-dsim + oneOf: + - const: google,gs201-dsim + - items: + - const: google,zumapro-dsim + - const: google,gs201-dsim reg: minItems: 1 From 52136cdd274ef513db67958b2b4871e50b385d82 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:31 -0647 Subject: [PATCH 05/16] arm64: dts: exynos: google: zumapro: Add DSIM0 Add DSIM0, the DSI master between DECON0 and the panel: its link and D-PHY register windows and its interrupt (GIC SPI 252), as in Google's GPL zumapro device tree, disabled until a board names its panel. Link: https://android.googlesource.com/kernel/devices/google/zumapro/+/8831630eee2ad095b85ed452944e6353940966a5/dts/zumapro.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- arch/arm64/boot/dts/exynos/google/zumapro.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index 2a8017bea1..cb99ace061 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -1457,6 +1457,18 @@ }; }; + dsi0: dsi@19440000 { + compatible = "google,zumapro-dsim", "google,gs201-dsim"; + reg = <0x0 0x19440000 0x300>, + <0x0 0x19460100 0x700>, + <0x0 0x19460000 0x100>; + reg-names = "dsi", "dphy", "dphy-extra"; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + /* Scans out what the bootloader set up; no panel or clock control. */ decon0: display-controller@19470000 { compatible = "google,zumapro-decon"; From 6c3e80e983247439a7e79f62ab7ea7198dcde2c6 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:31 -0647 Subject: [PATCH 06/16] arm64: dts: exynos: google: zumapro-tegu: Enable the display Turn on the Pixel 9a's display pipeline: DECON0 with a 64 MiB reusable scanout pool below 4 GiB and the bootloader's splash as its boot framebuffer, scanning out to DSIM0, and the TG4C panel on DSIM0's virtual channel 0. With DECON's output on DSIM0, gs-decon switches the link and the panel between 60 and 120 Hz. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index d68fd18f82..5f2a479c35 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -158,6 +158,15 @@ reg = <0x0 0xfac00000 0x009fc900>; no-map; }; + + /* DECON's scanout buffers, below 4 GiB for its 32-bit DMA. */ + display_pool: display-pool { + compatible = "shared-dma-pool"; + reusable; + size = <0x04000000>; + alignment = <0x0 0x00200000>; + alloc-ranges = <0x0 0x98000000 0x06000000>; + }; }; &acpm_ipc { @@ -230,6 +239,37 @@ status = "okay"; }; +/* + * DECON0 scans out to DSIM0, so gs-decon can switch the link and the + * panel between 60 and 120 Hz. + */ +&decon0 { + memory-region = <&display_pool>, <&cont_splash_mem>; + memory-region-names = "pool", "boot-framebuffer"; + status = "okay"; + + port { + decon0_out: endpoint { + remote-endpoint = <&dsi0_in>; + }; + }; +}; + +&dsi0 { + status = "okay"; + + panel@0 { + compatible = "google,tg4c"; + reg = <0>; + }; + + port { + dsi0_in: endpoint { + remote-endpoint = <&decon0_out>; + }; + }; +}; + /* The keys' banks and the touchscreen's raise their own interrupts. */ &gpa4 { interrupt-controller; From 5628f188890408080c51f1a876a3d3a86817e96d Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:37:19 -0647 Subject: [PATCH 07/16] arm64: dts: exynos: google: zumapro-tegu: Add the haptics and the torch Add the Pixel 9a's haptics, a Cirrus Logic CS40L26 on USI9's I2C bus (0x43, interrupt on gpa6-3, reset on gph2-3), with Google's limits for its LRA (2.5 A boost peak, 10 V boost, 162 Hz, ReDC 14.1 ohm) and VP brownout prevention at 3.008 V, and its torch, a TI LM3644 on USI4's I2C bus (0x63, enable on gpp24-1) driving one white LED from both outputs, limited to 75 mA. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 5f2a479c35..20e72a61a4 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -11,6 +11,7 @@ #include #include #include +#include #include "../exynos-pinctrl.h" #include "zumapro.dtsi" #include "zumapro-reserved-memory.dtsi" @@ -308,6 +309,53 @@ status = "okay"; }; +/* The torch: a TI LM3644 flash driver, both LED outputs on one white LED. */ +&hsi2c4 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c4_bus>; + status = "okay"; + + led-controller@63 { + compatible = "ti,lm3644"; + reg = <0x63>; + enable-gpios = <&gpp24 1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&torch_enable>; + + led { + function = LED_FUNCTION_TORCH; + color = ; + led-sources = <1 2>; + /* A dim flashlight, far below the part's and the LED's limits. */ + led-max-microamp = <75000>; + }; + }; +}; + +/* The haptics: a CS40L26 on the 9a's LRA, with Google's limits for it. */ +&hsi2c9 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c9_bus>; + status = "okay"; + + haptic-driver@43 { + compatible = "cirrus,cs40l26a"; + reg = <0x43>; + interrupt-parent = <&gpa6>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&gph2 3 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&haptic_reset>; + cirrus,boost-peak-microamp = <2500000>; + cirrus,boost-ctl-microvolt = <10000000>; + cirrus,lra-f0-hz = <162>; + cirrus,lra-redc-micro-ohms = <14100007>; + cirrus,vpbr-threshold-microvolt = <3008000>; + }; +}; + &pinctrl_alive { status = "okay"; }; @@ -322,6 +370,13 @@ &pinctrl_hsi1 { status = "okay"; + + haptic_reset: haptic-reset-pins { + samsung,pins = "gph2-3"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pinctrl_hsi2 { @@ -335,6 +390,13 @@ &pinctrl_peric0 { status = "okay"; + hsi2c4_bus: hsi2c4-bus-pins { + samsung,pins = "gpp8-0", "gpp8-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + touch_reset_held: touch-reset-held-pins { samsung,pins = "gpp1-1"; samsung,pin-function = ; @@ -344,6 +406,20 @@ &pinctrl_peric1 { status = "okay"; + + hsi2c9_bus: hsi2c9-bus-pins { + samsung,pins = "gpp19-4", "gpp19-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + + torch_enable: torch-enable-pins { + samsung,pins = "gpp24-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pmu_system_controller { @@ -441,6 +517,14 @@ status = "okay"; }; +&usi4 { + status = "okay"; +}; + +&usi9 { + status = "okay"; +}; + &watchdog_cl0 { status = "okay"; }; From 6bbb335874c5d4b82fc466faed3ebb5665f336e7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 05:11:57 -0647 Subject: [PATCH 08/16] arm64: dts: exynos: google: zumapro-tegu: Add the fuel gauge and USB-C port controller The Pixel 9a's MAX77779 sits on hsi2c6 (USI6, pins gpp12-0/1, 950 kHz as stock): its fuel gauge at 0x36 with the board's 2 mOhm shunt, and its USB-C port controller at 0x25, interrupting on gpa8-3 (active low, as stock's max77759tcpc@25). The port is described as a sink with a dual data role and is not linked to the USB controller's role switch yet: the USB controller stays a peripheral, as today. gpa8 becomes an interrupt controller with its four EINT SPIs (44-47). Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 20e72a61a4..848dd690c5 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -12,6 +12,7 @@ #include #include #include +#include #include "../exynos-pinctrl.h" #include "zumapro.dtsi" #include "zumapro-reserved-memory.dtsi" @@ -290,6 +291,16 @@ ; }; +/* The USB-C port controller's interrupt (gpa8-3). */ +&gpa8 { + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , + , + , + ; +}; + &gpn0 { interrupt-controller; #interrupt-cells = <2>; @@ -333,6 +344,42 @@ }; }; +/* + * The MAX77779's bus: its fuel gauge and its USB-C port controller, a sink + * with no link to the USB controller's role yet. + */ +&hsi2c6 { + clock-frequency = <950000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c6_bus>; + status = "okay"; + + usb_tcpc: tcpc@25 { + compatible = "maxim,max77779-tcpc"; + reg = <0x25>; + interrupt-parent = <&gpa8>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usb_pd_irq>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "sink"; + self-powered; + op-sink-microwatt = <2600000>; + sink-pdos = ; + }; + }; + + fuel_gauge: fuel-gauge@36 { + compatible = "maxim,max77779-fg"; + reg = <0x36>; + shunt-resistor-micro-ohms = <2000>; + }; +}; + /* The haptics: a CS40L26 on the 9a's LRA, with Google's limits for it. */ &hsi2c9 { clock-frequency = <100000>; @@ -358,6 +405,13 @@ &pinctrl_alive { status = "okay"; + + usb_pd_irq: usb-pd-irq-pins { + samsung,pins = "gpa8-3"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pinctrl_custom_alive { @@ -397,6 +451,13 @@ samsung,pin-drv = <0>; }; + hsi2c6_bus: hsi2c6-bus-pins { + samsung,pins = "gpp12-0", "gpp12-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + touch_reset_held: touch-reset-held-pins { samsung,pins = "gpp1-1"; samsung,pin-function = ; @@ -521,6 +582,10 @@ status = "okay"; }; +&usi6 { + status = "okay"; +}; + &usi9 { status = "okay"; }; From 7dbac6f4e65cc4ff04ec955ea54ae373dd85e3e1 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:02:24 -0643 Subject: [PATCH 09/16] arm64: dts: exynos: google: zumapro-tegu: Add the MAX77779 charger The MAX77779's charger answers at 0x69 on the same bus as its fuel gauge and USB-C port controller. Describe it, and name it as the fuel gauge's power supply, so the max77779-charger driver binds from the device tree and the battery reports charging through it. The binding (maxim,max77779-charger) takes no interrupt or supplies; the chip charges on its own and the driver reports its state and offers charge inhibit. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 848dd690c5..e373d05a70 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -345,8 +345,8 @@ }; /* - * The MAX77779's bus: its fuel gauge and its USB-C port controller, a sink - * with no link to the USB controller's role yet. + * The MAX77779's bus: its USB-C port controller, a sink with no link to the + * USB controller's role yet, its fuel gauge and its charger. */ &hsi2c6 { clock-frequency = <950000>; @@ -377,6 +377,12 @@ compatible = "maxim,max77779-fg"; reg = <0x36>; shunt-resistor-micro-ohms = <2000>; + power-supplies = <&charger>; + }; + + charger: charger@69 { + compatible = "maxim,max77779-charger"; + reg = <0x69>; }; }; From ca9d9c8ae327af0ca6a0c22cd9ff244c2ef2c775 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:30:43 -0647 Subject: [PATCH 10/16] soc: samsung: exynos-pmu: zuma: allow the PCIe channel 1 PHY control The PHY of zumapro's PCIe channel 1 (the Pixel 9a's Wi-Fi link) is isolated by PMU 0x3ec8 until its controller driver sets bit 0, and the controller driver sets bit 10 once the PHY is configured, as Google's root-complex driver does through its private PMU write. zuma's regmap refuses every offset outside its access table, so add the register. Tested on the Pixel 9a with a bring-up module doing the same two updates through the PMU regmap: the link trained to L0 and the BCM4383 behind it enumerated. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/soc/samsung/gs101-pmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/samsung/gs101-pmu.c b/drivers/soc/samsung/gs101-pmu.c index e357744d4a..a1fbaa2ecd 100644 --- a/drivers/soc/samsung/gs101-pmu.c +++ b/drivers/soc/samsung/gs101-pmu.c @@ -343,6 +343,7 @@ const struct exynos_pmu_data gs101_pmu_data = { #define ZUMA_CLUSTER1_NONCPU_INT_EN 0x1544 #define ZUMA_HSI0_STATUS 0x2a84 #define ZUMA_PHY_CTRL_UFS 0x3ec0 +#define ZUMA_PHY_CTRL_PCIE1 0x3ec8 static const struct regmap_range zuma_pmu_registers[] = { /* reboot mode */ @@ -358,6 +359,7 @@ static const struct regmap_range zuma_pmu_registers[] = { /* PHY isolation */ regmap_reg_range(GS101_PHY_CTRL_USB20, GS101_PHY_CTRL_USB20), regmap_reg_range(ZUMA_PHY_CTRL_UFS, ZUMA_PHY_CTRL_UFS), + regmap_reg_range(ZUMA_PHY_CTRL_PCIE1, ZUMA_PHY_CTRL_PCIE1), /* a hint TF-A reads, not a status register: see zuma_pmu_regmap_init() */ regmap_reg_range(ZUMA_PMU_INFORM0, ZUMA_PMU_INFORM0), }; From c9c2b2df03dc20c1ea325570460559cd5ee9a1c9 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:31:57 -0647 Subject: [PATCH 11/16] dt-bindings: PCI: Add the Google zumapro PCIe controller Channel 1 of zumapro's PCIe (Tensor G4, the Pixel 9a's Wi-Fi link) is a DesignWare core in a Samsung wrapper. Besides the DBI and configuration space the wrapper has its ELBI, a sub-system control block, the PHY's UDBG, PMA and PCS blocks and an I/A sequencer, eight register regions in all, and fourteen gate clocks in CMU_HSI2. That is more than snps,dw-pcie-common.yaml allows, so the binding builds on pci-host-bridge.yaml alone. The PHY sits behind an isolation switch in the PMU, given by samsung,pmu-syscon as in other Exynos PHY bindings. MSIs reach the DesignWare core's MSI controller and are signalled on msi0 to msi4. The endpoint's power enable belongs to the root port, as a vpcie3v3 supply. Register regions, interrupts and clocks follow stock's pcie@13120000 and Google's GPL zumapro clock driver. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../bindings/pci/google,zumapro-pcie.yaml | 200 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 201 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/google,zumapro-pcie.yaml diff --git a/Documentation/devicetree/bindings/pci/google,zumapro-pcie.yaml b/Documentation/devicetree/bindings/pci/google,zumapro-pcie.yaml new file mode 100644 index 0000000000..d4767d8249 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/google,zumapro-pcie.yaml @@ -0,0 +1,200 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/google,zumapro-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google zumapro (Tensor G4) PCIe host controller + +maintainers: + - W4HO <87742609+W4HO-ham@users.noreply.github.com> + +description: + The second PCIe channel (channel 1) of the Google zumapro (Tensor G4) SoC, + one lane in the HSI2 block, is a Synopsys DesignWare core in a Samsung + wrapper. The wrapper adds an external local bus interface (ELBI) with link + training control and status, a sub-system control block, the PHY's debug + (UDBG), PMA and PCS register blocks, and an I/A sequencer. The PHY sits + behind an isolation switch in the PMU, which has to be opened before any + of these registers is accessed. MSIs are received by the + DesignWare core's own MSI controller and signalled on five interrupt + lines, one per group of 32 vectors. + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + +properties: + compatible: + const: google,zumapro-pcie + + reg: + items: + - description: External local bus interface (ELBI) registers + - description: Sub-system control registers + - description: PHY debug (UDBG) registers + - description: PHY PMA registers + - description: PHY PCS registers + - description: I/A sequencer registers + - description: Data Bus Interface (DBI) registers, with the unrolled + iATU at offset 0x300000 + - description: PCIe configuration space region + + reg-names: + items: + - const: elbi + - const: soc + - const: udbg + - const: phy + - const: pcs + - const: ia + - const: dbi + - const: config + + interrupts: + items: + - description: Controller interrupt + - description: MSI vectors 0 to 31 + - description: MSI vectors 32 to 63 + - description: MSI vectors 64 to 95 + - description: MSI vectors 96 to 127 + - description: MSI vectors 128 to 159 + + interrupt-names: + items: + - const: ctrl + - const: msi0 + - const: msi1 + - const: msi2 + - const: msi3 + - const: msi4 + + clocks: + items: + - description: Controller APB clock + - description: DBI AXI clock + - description: AXI slave clock + - description: AXI master clock + - description: PHY UDBG APB clock + - description: PHY PAL APB clock + - description: PHY reference clock + - description: PHY bridge APB clock + - description: PHY test APB clock + - description: I/A sequencer clock + - description: I/A SSMT AXI clock + - description: I/A SSMT APB clock + - description: System MMU clock + - description: PMMU clock + + clock-names: + items: + - const: ctl-apb + - const: dbi-aclk + - const: slv-aclk + - const: mstr-aclk + - const: phy-udbg-apb + - const: phy-pal-apb + - const: phy-ref + - const: phy-bridge-apb + - const: phy-test-apb + - const: ia-clk + - const: ssmt-ia-aclk + - const: ssmt-ia-pclk + - const: sysmmu-clk + - const: pmmu-clk + + reset-gpios: + description: PERST# of the endpoint. + maxItems: 1 + + samsung,pmu-syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle of the PMU system controller + - description: offset of the PCIe PHY control register + description: + The PMU register that isolates the PCIe PHY. Bit 0 opens the isolation, + bit 10 is set once the PHY is configured. + + num-lanes: + const: 1 + +required: + - compatible + - reg + - reg-names + - interrupts + - interrupt-names + - clocks + - clock-names + - reset-gpios + - samsung,pmu-syscon + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + soc { + #address-cells = <2>; + #size-cells = <1>; + + pcie@13120000 { + compatible = "google,zumapro-pcie"; + reg = <0x0 0x13120000 0x2000>, <0x0 0x13130000 0x5000>, + <0x0 0x13150000 0xd000>, <0x0 0x13160000 0x3000>, + <0x0 0x13140000 0x5000>, <0x0 0x13100000 0x1000>, + <0x0 0x13400000 0x381000>, <0x0 0x60ffe000 0x2000>; + reg-names = "elbi", "soc", "udbg", "phy", "pcs", "ia", "dbi", + "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges = <0x82000000 0x0 0x60000000 0x0 0x60000000 0x0 0xff0000>; + bus-range = <0x00 0xff>; + interrupts = , + , + , + , + , + ; + interrupt-names = "ctrl", "msi0", "msi1", "msi2", "msi3", "msi4"; + clocks = <&cmu_hsi2 CLK_GOUT_PCIE1_CTL_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_DBI_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SLV_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_MSTR_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_UDBG_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_PAL_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_REF>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_BRIDGE_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_TEST_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_IA_CLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SSMT_IA_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SSMT_IA_PCLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SYSMMU_CLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PMMU_CLK>; + clock-names = "ctl-apb", "dbi-aclk", "slv-aclk", "mstr-aclk", + "phy-udbg-apb", "phy-pal-apb", "phy-ref", + "phy-bridge-apb", "phy-test-apb", "ia-clk", + "ssmt-ia-aclk", "ssmt-ia-pclk", "sysmmu-clk", + "pmmu-clk"; + reset-gpios = <&gph3 0 GPIO_ACTIVE_LOW>; + samsung,pmu-syscon = <&pmu_system_controller 0x3ec8>; + num-lanes = <1>; + max-link-speed = <2>; + + pcie@0,0 { + compatible = "pciclass,0604"; + reg = <0x0 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x01 0xff>; + ranges; + vpcie3v3-supply = <&wlan_reg_on>; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 4841af951f..bcb7fbc716 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11167,6 +11167,7 @@ C: irc://irc.oftc.net/pixel6-kernel-dev F: Documentation/devicetree/bindings/clock/google,gs101-clock.yaml F: Documentation/devicetree/bindings/clock/google,gs201-clock.yaml F: Documentation/devicetree/bindings/clock/google,zumapro* +F: Documentation/devicetree/bindings/pci/google,zumapro-pcie.yaml F: Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml F: Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml F: Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml From c45d9501149ff9c69bd143630f1d74194cda533a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:36:09 -0647 Subject: [PATCH 12/16] PCI: dwc: Add a driver for the Google zumapro PCIe controller PCIe channel 1 of zumapro (Tensor G4) carries the Pixel 9a's Wi-Fi chip. It is a DesignWare core in a Samsung wrapper, with its PHY behind an isolation switch in the PMU. Add a host driver for it. The sequence follows Google's GPL root-complex driver for zumapro (pcie-exynos-rc.c and the zuma CAL, version 0.2) for channel 1 with a Broadcom Wi-Fi endpoint, minus what the DesignWare core does itself: open the PHY isolation, enable the fourteen CMU_HSI2 gates, power the endpoint through pwrctrl, run the CAL's power-down-clear and PHY configuration tables, mark the PHY configured in the PMU, turn Gen3 equalisation off, release PERST#, and set the wrapper's L1 exit, Q-channel and pending-transfer controls. After training, the wrapper's interrupt status is acknowledged and XFER_PENDING dropped: left raised, configuration accesses work but every memory read of the endpoint returns all ones. Power-down follows Google's exynos_pcie_rc_poweroff(): PERST#, the link clock back to the oscillator, LTSSM off, a soft power reset, the CAL's power-down table, the clocks, the endpoint's power, and the PHY isolation last. The PHY isolation is opened before any wrapper, PHY or DBI access and closed only after the last one, on every error path and on removal: an access with the PHY isolated hangs the SoC. A PHY lock that does not come within 10 ms fails the probe and powers everything down again. The link counts as up from Recovery.RcvrLock to L1.Idle, as in Google's driver. An endpoint in D3hot parks the link in L1, and an L0-only check made the DesignWare core refuse the configuration write that brings it back to D0. ASPM L1 exit needs the I/A sequencer, which is not programmed yet, so ASPM is cleared from the root port's link capabilities: with ASPM on, the link entered L1 and configuration reads returned all ones. L1 substates, INTx and suspend with the link down are left for later. Tested on the Pixel 9a with an out-of-tree module running the same power-up sequence on 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty: in 33 of 33 bring-ups the PHY locked and the link came up at Gen2 x1, and brcmfmac then brought up the BCM4383, which associated and stayed up across s2idle. That module raised the endpoint's power enable from a GPIO of its own and kept ASPM off with pcie_aspm.policy=performance; this driver uses pwrctrl and the link capabilities instead. Its power-down path never ran on the phone. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/ Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- MAINTAINERS | 1 + drivers/pci/controller/dwc/Kconfig | 15 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-zumapro.c | 612 ++++++++++++++++++++++ 4 files changed, 629 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-zumapro.c diff --git a/MAINTAINERS b/MAINTAINERS index bcb7fbc716..35f8c8a312 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11177,6 +11177,7 @@ F: arch/arm64/boot/dts/exynos/google/ F: drivers/clk/samsung/clk-gs101.c F: drivers/clk/samsung/clk-gs201.c F: drivers/clk/samsung/clk-zumapro.c +F: drivers/pci/controller/dwc/pcie-zumapro.c F: drivers/phy/phy-google-usb.c F: drivers/soc/samsung/gs101-pmu.c F: drivers/phy/samsung/phy-gs101-ufs.c diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig index dcfbe7e229..0b6303acb8 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -577,4 +577,19 @@ config PCIE_ULTRARISC By default, this symbol is enabled when ARCH_ULTRARISC is active, requiring no further configuration on that platform. +config PCIE_ZUMAPRO + tristate "Google zumapro PCIe controller (host mode)" + depends on OF && (ARCH_EXYNOS || COMPILE_TEST) + depends on PCI_MSI + select PCIE_DW_HOST + select PCI_PWRCTRL_GENERIC + help + Say Y here to enable support for PCIe channel 1 of the Google + zumapro (Tensor G4) SoC in host mode. The Pixel 9a connects its + Wi-Fi chip to it. The controller is a DesignWare core in a Samsung + wrapper, with its PHY programmed by this driver. + + To compile this driver as a module, choose M here: the module + will be called pcie-zumapro. + endmenu diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile index d4f88cfc62..736fbf5cb2 100644 --- a/drivers/pci/controller/dwc/Makefile +++ b/drivers/pci/controller/dwc/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_PCIE_SPACEMIT_K1) += pcie-spacemit-k1.o obj-$(CONFIG_PCIE_STM32_HOST) += pcie-stm32.o obj-$(CONFIG_PCIE_STM32_EP) += pcie-stm32-ep.o obj-$(CONFIG_PCIE_ULTRARISC) += pcie-ultrarisc.o +obj-$(CONFIG_PCIE_ZUMAPRO) += pcie-zumapro.o # The following drivers are for devices that use the generic ACPI # pci_root.c driver but don't support standard ECAM config access. diff --git a/drivers/pci/controller/dwc/pcie-zumapro.c b/drivers/pci/controller/dwc/pcie-zumapro.c new file mode 100644 index 0000000000..3f7b299643 --- /dev/null +++ b/drivers/pci/controller/dwc/pcie-zumapro.c @@ -0,0 +1,612 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * PCIe host controller driver for channel 1 of the Google zumapro (Tensor G4) + * + * Channel 1 is a one-lane Synopsys DesignWare core in a Samsung wrapper, with + * its PHY behind an isolation switch in the PMU. On the Pixel 9a it carries + * the Wi-Fi chip. The sequence follows the root-complex driver Google builds + * for zumapro, google-modules/soc/gs drivers/pci/controller/dwc/ + * pcie-exynos-rc.c and pcie-exynos-zuma-rc-cal.c ("PCIe CAL ver 0.2"), for + * channel 1 with a Broadcom Wi-Fi endpoint, reduced to what the DesignWare + * core does not do itself. + * + * Nothing in the wrapper, the PHY or the DBI may be accessed while the PHY is + * isolated, so every register access happens between opening the isolation + * in host_init and closing it again on the way down. + * + * Not handled yet: L1 substates and ASPM L1 exit (the I/A sequencer is not + * programmed, so ASPM is kept off by clearing it from the root port's link + * capabilities), INTx, the System MMU, and system suspend with the link + * powered down. + * + * Copyright (C) 2020 Samsung Electronics Co., Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcie-designware.h" + +/* ELBI (sub-control) registers */ +#define ZUMAPRO_ELBI_IRQ0 0x000 +#define ZUMAPRO_ELBI_IRQ1 0x004 +#define ZUMAPRO_ELBI_IRQ2 0x008 +#define ZUMAPRO_ELBI_LTSSM_EN 0x054 +#define ZUMAPRO_ELBI_XFER_PENDING 0x074 +#define ZUMAPRO_ELBI_LTSSM_STATE 0x2c8 +#define ZUMAPRO_ELBI_LTSSM_STATE_MASK GENMASK(5, 0) +#define ZUMAPRO_ELBI_LINKDOWN_RST_SEL 0x3a0 +#define ZUMAPRO_ELBI_LINKDOWN_RST_MANUAL BIT(1) +#define ZUMAPRO_ELBI_SOFT_RESET 0x3a4 +#define ZUMAPRO_ELBI_SOFT_PWR_RESET BIT(1) +#define ZUMAPRO_ELBI_QCH_SEL 0x3a8 +#define ZUMAPRO_ELBI_QCH_GATING_MASK GENMASK(11, 0) +#define ZUMAPRO_ELBI_REQ_EXIT_L1_MODE 0x3bc +#define ZUMAPRO_ELBI_APP_REQ_EXIT_L1_MODE BIT(0) +#define ZUMAPRO_ELBI_L1_REQ_NAK_MASTER BIT(4) +#define ZUMAPRO_ELBI_MSTR_PEND_SEL_NAK 0x474 +#define ZUMAPRO_ELBI_DBI_L1_EXIT_DISABLE 0x1078 + +/* Sub-system control; clearing SEL switches to the OSC clock, in SW mode */ +#define ZUMAPRO_SOC_CLK_CTRL 0x4000 +#define ZUMAPRO_SOC_CLK_CTRL_ON 0x15 +#define ZUMAPRO_SOC_CLK_CTRL_SEL GENMASK(1, 0) + +/* Values Google's driver writes outside the CAL tables, for channel 1 */ +#define ZUMAPRO_UDBG_C800 0xc800 +#define ZUMAPRO_UDBG_C800_VAL 0x421 +#define ZUMAPRO_PHY_032C 0x032c + +/* DBI port logic */ +#define ZUMAPRO_DBI_AUX_CLK_FREQ 0xb40 +#define ZUMAPRO_DBI_AUX_CLK_26MHZ 0x1a + +/* PMU PHY control */ +#define ZUMAPRO_PMU_PHY_ISO_BYPASS BIT(0) +#define ZUMAPRO_PMU_PHY_CONFIGURED BIT(10) + +/* What Google's driver waits after PERST# goes high, before training */ +#define ZUMAPRO_PERST_DELAY_US 15000 +#define ZUMAPRO_L0_TIMEOUT_US 100000 +#define ZUMAPRO_PHY_POLL_TIMEOUT_US 10000 + +enum zumapro_pcie_blk { + ZUMAPRO_BLK_ELBI, + ZUMAPRO_BLK_SOC, + ZUMAPRO_BLK_UDBG, + ZUMAPRO_BLK_PHY, + ZUMAPRO_BLK_PCS, + ZUMAPRO_BLK_COUNT, +}; + +enum zumapro_pcie_opcode { + ZUMAPRO_OP_WRITE, + ZUMAPRO_OP_SET, + ZUMAPRO_OP_CLEAR, + ZUMAPRO_OP_DELAY_US, + ZUMAPRO_OP_POLL_BIT, +}; + +/* + * One step of a CAL table: write a value, set or clear bits, wait a number of + * microseconds, or wait for one bit to read 1. + */ +struct zumapro_pcie_op { + u8 op; + u8 blk; + u16 offset; + u32 value; +}; + +#define ZP_WR(b, o, v) { ZUMAPRO_OP_WRITE, ZUMAPRO_BLK_##b, o, v } +#define ZP_SET(b, o, v) { ZUMAPRO_OP_SET, ZUMAPRO_BLK_##b, o, v } +#define ZP_CLR(b, o, v) { ZUMAPRO_OP_CLEAR, ZUMAPRO_BLK_##b, o, v } +#define ZP_POLL(b, o, v) { ZUMAPRO_OP_POLL_BIT, ZUMAPRO_BLK_##b, o, v } +#define ZP_DELAY(us) { ZUMAPRO_OP_DELAY_US, 0, 0, us } + +/* exynos_pcie_rc_phy_all_pwrdn_clear() for channel 1 */ +static const struct zumapro_pcie_op zumapro_pcie_phy_pwrdn_clear[] = { + ZP_SET(UDBG, 0xc700, BIT(0)), + ZP_DELAY(100), + ZP_WR(PHY, 0x000c, 0x00), + ZP_WR(PHY, 0x0928, 0x55), + ZP_WR(PHY, 0x0580, 0x02), + ZP_WR(PHY, 0x0208, 0x00), + ZP_WR(PHY, 0x1044, 0x00), + ZP_WR(PHY, 0x1048, 0x00), + ZP_WR(PHY, 0x104c, 0x00), + ZP_WR(PHY, 0x1050, 0x00), + ZP_WR(PHY, 0x185c, 0x00), + ZP_DELAY(10), +}; + +/* exynos_pcie_rc_pcie_phy_config() for channel 1, Broadcom Wi-Fi endpoint */ +static const struct zumapro_pcie_op zumapro_pcie_phy_config[] = { + ZP_WR(PHY, 0x032c, 0x03), + ZP_SET(UDBG, 0xc700, BIT(0)), + ZP_CLR(UDBG, 0xc700, BIT(1)), + ZP_POLL(UDBG, 0xc734, 2), /* external PLL lock */ + ZP_CLR(SOC, 0x4004, BIT(2)), + ZP_SET(SOC, 0x4004, GENMASK(5, 4)), + ZP_WR(ELBI, 0x0080, 0x4), /* device type: root complex */ + ZP_WR(ELBI, 0x03a4, 0xf), + ZP_WR(ELBI, 0x03a4, 0xd), + ZP_DELAY(10), + ZP_WR(ELBI, 0x03a4, 0xf), + ZP_DELAY(10), + ZP_WR(ELBI, 0x1404, 0x1), + ZP_WR(ELBI, 0x1408, 0x1), + ZP_WR(ELBI, 0x1400, 0x1), + ZP_WR(ELBI, 0x1404, 0x0), + ZP_WR(ELBI, 0x1408, 0x0), + ZP_WR(ELBI, 0x1400, 0x0), + ZP_WR(ELBI, 0x03d8, 0x1), + ZP_WR(PHY, 0x0000, 0x88), + ZP_WR(PHY, 0x001c, 0x66), + ZP_WR(PHY, 0x01f4, 0x00), + ZP_WR(PHY, 0x0514, 0x59), + ZP_WR(PHY, 0x051c, 0x11), + ZP_WR(PHY, 0x062c, 0x0e), + ZP_WR(PHY, 0x0644, 0x22), + ZP_WR(PHY, 0x0688, 0x03), + ZP_WR(PHY, 0x06d4, 0x28), + ZP_WR(PHY, 0x0788, 0x64), + ZP_WR(PHY, 0x078c, 0x64), + ZP_WR(PHY, 0x0790, 0x50), + ZP_WR(PHY, 0x0794, 0x50), + ZP_WR(PHY, 0x0944, 0x05), + ZP_WR(PHY, 0x0948, 0x05), + ZP_WR(PHY, 0x094c, 0x05), + ZP_WR(PHY, 0x0950, 0x05), + ZP_WR(PHY, 0x0590, 0x02), + ZP_WR(PHY, 0x07f8, 0xb0), + ZP_WR(PHY, 0x0730, 0x08), + ZP_WR(PHY, 0x0344, 0xc0), + ZP_WR(PHY, 0x0040, 0x04), + ZP_WR(PHY, 0x0204, 0x03), + ZP_WR(PHY, 0x02d4, 0x1f), + ZP_WR(PHY, 0x0358, 0x10), + ZP_WR(PHY, 0x0018, 0x01), + ZP_WR(PHY, 0x0514, 0x5b), + ZP_WR(PHY, 0x0608, 0x0c), + ZP_WR(PHY, 0x060c, 0x0f), + ZP_WR(PHY, 0x0610, 0x0f), + ZP_WR(PHY, 0x0614, 0x0f), + ZP_WR(PHY, 0x0618, 0x0f), + ZP_WR(PHY, 0x0510, 0x80), + ZP_WR(PHY, 0x0688, 0x03), + ZP_WR(PHY, 0x0644, 0x23), + ZP_WR(PHY, 0x0624, 0x11), + ZP_WR(PHY, 0x0630, 0x0f), + ZP_WR(PHY, 0x06d0, 0x53), + ZP_WR(PHY, 0x1140, 0x04), + ZP_WR(PHY, 0x1144, 0x04), + ZP_WR(PHY, 0x1148, 0x04), + ZP_WR(PHY, 0x114c, 0x02), + ZP_WR(PHY, 0x1150, 0x00), + ZP_WR(PHY, 0x1154, 0x00), + ZP_WR(PHY, 0x1158, 0x00), + ZP_WR(PHY, 0x115c, 0x00), + ZP_WR(PHY, 0x12cc, 0x1c), + ZP_WR(PHY, 0x12dc, 0x6c), + ZP_WR(PHY, 0x130c, 0x29), + ZP_WR(PHY, 0x13b4, 0x2f), + ZP_WR(PHY, 0x1a64, 0x05), + ZP_WR(PHY, 0x1a68, 0x05), + ZP_WR(PHY, 0x1a84, 0x05), + ZP_WR(PHY, 0x1a88, 0x05), + ZP_WR(PHY, 0x1a98, 0x00), + ZP_WR(PHY, 0x1a9c, 0x00), + ZP_WR(PHY, 0x1aa8, 0x07), + ZP_WR(PHY, 0x1ab8, 0x00), + ZP_WR(PHY, 0x1abc, 0x00), + ZP_WR(PHY, 0x1af8, 0x90), + ZP_WR(PHY, 0x1b34, 0x03), + ZP_WR(PHY, 0x1bb0, 0x03), + ZP_WR(PHY, 0x1bb4, 0x03), + ZP_WR(PHY, 0x1bc0, 0x06), + ZP_WR(PHY, 0x1bc4, 0x06), + ZP_WR(PHY, 0x1be8, 0x01), + ZP_WR(PHY, 0x1bf8, 0x04), + ZP_WR(PHY, 0x1c98, 0x00), + ZP_WR(PHY, 0x1ca4, 0x81), + /* Broadcom Wi-Fi endpoint */ + ZP_WR(PHY, 0x1b20, 0x02), + ZP_WR(PHY, 0x1340, 0x23), + ZP_WR(PHY, 0x002c, 0x3c), + ZP_SET(PHY, 0x1350, BIT(0)), + ZP_WR(PCS, 0x0190, 0x100b0604), + ZP_WR(PCS, 0x0154, 0x000700d5), + ZP_WR(PCS, 0x0100, 0x16400000), + ZP_WR(PCS, 0x0104, 0x08600000), + ZP_WR(PCS, 0x0114, 0x18500000), + ZP_WR(PCS, 0x0124, 0x60700000), + ZP_WR(PCS, 0x0174, 0x00000007), + ZP_WR(PCS, 0x0178, 0x00000100), + ZP_WR(PCS, 0x017c, 0x00000700), /* Broadcom Wi-Fi endpoint */ + ZP_WR(PCS, 0x0110, 0x01600202), /* Broadcom Wi-Fi endpoint */ + ZP_WR(ELBI, 0x1404, 0x1), + ZP_DELAY(10), + ZP_WR(ELBI, 0x1408, 0x1), + ZP_WR(ELBI, 0x1400, 0x1), + ZP_POLL(PHY, 0x0a80, 0), /* PLL lock */ + ZP_POLL(PHY, 0x15c0, 4), /* CDR lock */ + ZP_POLL(PHY, 0x140c, 7), /* offset calibration done */ + ZP_WR(PHY, 0x032c, 0x00), + ZP_WR(ELBI, 0x1078, 0x1), +}; + +/* exynos_pcie_rc_phy_all_pwrdn() for channel 1 */ +static const struct zumapro_pcie_op zumapro_pcie_phy_pwrdn[] = { + ZP_CLR(PHY, 0x0204, GENMASK(3, 2)), + ZP_WR(PHY, 0x1044, 0x2a), + ZP_WR(PHY, 0x1048, 0xaa), + ZP_WR(PHY, 0x104c, 0xa8), + ZP_WR(PHY, 0x1050, 0x80), + ZP_WR(PHY, 0x185c, 0x0a), + ZP_DELAY(1), + ZP_WR(PHY, 0x0208, 0xff), + ZP_DELAY(1), + ZP_WR(PHY, 0x0580, 0x0a), + ZP_WR(PHY, 0x0928, 0xaa), + ZP_WR(PHY, 0x000c, 0x0a), + ZP_DELAY(50), + ZP_CLR(UDBG, 0xc700, BIT(0)), + ZP_DELAY(10), +}; + +static const char * const zumapro_pcie_blk_names[ZUMAPRO_BLK_COUNT] = { + [ZUMAPRO_BLK_ELBI] = "elbi", + [ZUMAPRO_BLK_SOC] = "soc", + [ZUMAPRO_BLK_UDBG] = "udbg", + [ZUMAPRO_BLK_PHY] = "phy", + [ZUMAPRO_BLK_PCS] = "pcs", +}; + +struct zumapro_pcie { + struct dw_pcie pci; + void __iomem *blk[ZUMAPRO_BLK_COUNT]; + struct clk_bulk_data *clks; + int num_clks; + struct regmap *pmu; + u32 pmu_offset; + struct gpio_desc *perst; +}; + +#define to_zumapro_pcie(x) container_of(x, struct zumapro_pcie, pci) + +static int zumapro_pcie_run(struct zumapro_pcie *zp, + const struct zumapro_pcie_op *ops, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + const struct zumapro_pcie_op *o = &ops[i]; + void __iomem *reg = zp->blk[o->blk] + o->offset; + u32 val; + int ret; + + switch (o->op) { + case ZUMAPRO_OP_WRITE: + writel(o->value, reg); + break; + case ZUMAPRO_OP_SET: + writel(readl(reg) | o->value, reg); + break; + case ZUMAPRO_OP_CLEAR: + writel(readl(reg) & ~o->value, reg); + break; + case ZUMAPRO_OP_DELAY_US: + udelay(o->value); + break; + case ZUMAPRO_OP_POLL_BIT: + ret = readl_poll_timeout(reg, val, val & BIT(o->value), + 10, ZUMAPRO_PHY_POLL_TIMEOUT_US); + if (ret) { + dev_err(zp->pci.dev, + "%s+%#x bit %u did not set (%#010x)\n", + zumapro_pcie_blk_names[o->blk], + o->offset, o->value, val); + return ret; + } + break; + } + } + + return 0; +} + +static u32 zumapro_pcie_ltssm(struct zumapro_pcie *zp) +{ + return readl(zp->pci.elbi_base + ZUMAPRO_ELBI_LTSSM_STATE) & + ZUMAPRO_ELBI_LTSSM_STATE_MASK; +} + +static enum dw_pcie_ltssm zumapro_pcie_get_ltssm(struct dw_pcie *pci) +{ + return zumapro_pcie_ltssm(to_zumapro_pcie(pci)); +} + +/* + * As Google's driver: recovery, L0, L0s and L1 all count as up. An endpoint + * in D3hot parks the link in L1, and with an L0-only check the DesignWare + * core would refuse the configuration write that brings it back to D0. + */ +static bool zumapro_pcie_link_up(struct dw_pcie *pci) +{ + u32 ltssm = zumapro_pcie_ltssm(to_zumapro_pcie(pci)); + + return ltssm >= DW_PCIE_LTSSM_RCVRY_LOCK && ltssm <= DW_PCIE_LTSSM_L1_IDLE; +} + +static int zumapro_pcie_start_link(struct dw_pcie *pci) +{ + struct zumapro_pcie *zp = to_zumapro_pcie(pci); + void __iomem *elbi = pci->elbi_base; + u32 ltssm; + int ret; + + writel(1, elbi + ZUMAPRO_ELBI_LTSSM_EN); + + /* + * Google's driver waits for L0, acknowledges the ELBI interrupt status + * and only then drops XFER_PENDING, which host_init raised before + * training. With it left raised, configuration works but every memory + * read of the endpoint returns all ones. + */ + ret = readl_poll_timeout(elbi + ZUMAPRO_ELBI_LTSSM_STATE, ltssm, + (ltssm & ZUMAPRO_ELBI_LTSSM_STATE_MASK) == + DW_PCIE_LTSSM_L0, 10, ZUMAPRO_L0_TIMEOUT_US); + if (ret) + dev_dbg(pci->dev, "LTSSM %#x, not L0 yet\n", + zumapro_pcie_ltssm(zp)); + + writel(readl(elbi + ZUMAPRO_ELBI_IRQ0), elbi + ZUMAPRO_ELBI_IRQ0); + writel(readl(elbi + ZUMAPRO_ELBI_IRQ1), elbi + ZUMAPRO_ELBI_IRQ1); + writel(readl(elbi + ZUMAPRO_ELBI_IRQ2), elbi + ZUMAPRO_ELBI_IRQ2); + writel(0, elbi + ZUMAPRO_ELBI_XFER_PENDING); + + return 0; +} + +static void zumapro_pcie_stop_link(struct dw_pcie *pci) +{ + writel(0, pci->elbi_base + ZUMAPRO_ELBI_LTSSM_EN); +} + +/* ASPM L1 exit needs the I/A sequencer, which is not programmed */ +static void zumapro_pcie_disable_aspm(struct dw_pcie *pci) +{ + u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 val; + + dw_pcie_dbi_ro_wr_en(pci); + val = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP); + val &= ~PCI_EXP_LNKCAP_ASPMS; + dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, val); + dw_pcie_dbi_ro_wr_dis(pci); +} + +/* + * Undo host_init in the order of Google's exynos_pcie_rc_poweroff(), the PHY + * isolation last: nothing here may be touched once it is closed. + */ +static void zumapro_pcie_power_off(struct zumapro_pcie *zp) +{ + struct dw_pcie *pci = &zp->pci; + void __iomem *elbi = pci->elbi_base; + void __iomem *soc = zp->blk[ZUMAPRO_BLK_SOC]; + u32 val; + + gpiod_set_value_cansleep(zp->perst, 1); + writel(readl(soc + ZUMAPRO_SOC_CLK_CTRL) & ~ZUMAPRO_SOC_CLK_CTRL_SEL, + soc + ZUMAPRO_SOC_CLK_CTRL); + writel(0, elbi + ZUMAPRO_ELBI_LTSSM_EN); + + val = readl(elbi + ZUMAPRO_ELBI_SOFT_RESET); + writel(val & ~ZUMAPRO_ELBI_SOFT_PWR_RESET, elbi + ZUMAPRO_ELBI_SOFT_RESET); + usleep_range(20, 40); + writel(val | ZUMAPRO_ELBI_SOFT_PWR_RESET, elbi + ZUMAPRO_ELBI_SOFT_RESET); + + zumapro_pcie_run(zp, zumapro_pcie_phy_pwrdn, + ARRAY_SIZE(zumapro_pcie_phy_pwrdn)); + clk_bulk_disable_unprepare(zp->num_clks, zp->clks); + pci_pwrctrl_power_off_devices(pci->dev); + regmap_update_bits(zp->pmu, zp->pmu_offset, ZUMAPRO_PMU_PHY_ISO_BYPASS, 0); +} + +static int zumapro_pcie_host_init(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct zumapro_pcie *zp = to_zumapro_pcie(pci); + struct device *dev = pci->dev; + void __iomem *elbi = pci->elbi_base; + u32 val; + int ret; + + ret = regmap_update_bits(zp->pmu, zp->pmu_offset, + ZUMAPRO_PMU_PHY_ISO_BYPASS, + ZUMAPRO_PMU_PHY_ISO_BYPASS); + if (ret) + return dev_err_probe(dev, ret, "failed to open the PHY isolation\n"); + + ret = clk_bulk_prepare_enable(zp->num_clks, zp->clks); + if (ret) { + dev_err(dev, "failed to enable the clocks: %d\n", ret); + goto err_isolate; + } + + /* The endpoint's power enable, held until PERST# is released below */ + ret = pci_pwrctrl_power_on_devices(dev); + if (ret) { + dev_err_probe(dev, ret, "failed to power the endpoint on\n"); + goto err_clocks; + } + + writel(ZUMAPRO_SOC_CLK_CTRL_ON, zp->blk[ZUMAPRO_BLK_SOC] + ZUMAPRO_SOC_CLK_CTRL); + zumapro_pcie_run(zp, zumapro_pcie_phy_pwrdn_clear, + ARRAY_SIZE(zumapro_pcie_phy_pwrdn_clear)); + ret = zumapro_pcie_run(zp, zumapro_pcie_phy_config, + ARRAY_SIZE(zumapro_pcie_phy_config)); + if (ret) + goto err_power_off; + + ret = regmap_update_bits(zp->pmu, zp->pmu_offset, + ZUMAPRO_PMU_PHY_CONFIGURED, + ZUMAPRO_PMU_PHY_CONFIGURED); + if (ret) { + dev_err(dev, "failed to mark the PHY configured: %d\n", ret); + goto err_power_off; + } + writel(ZUMAPRO_UDBG_C800_VAL, zp->blk[ZUMAPRO_BLK_UDBG] + ZUMAPRO_UDBG_C800); + writel(0, zp->blk[ZUMAPRO_BLK_PHY] + ZUMAPRO_PHY_032C); + dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, + GEN3_RELATED_OFF_GEN3_EQ_DISABLE | + GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS); + + gpiod_set_value_cansleep(zp->perst, 0); + usleep_range(ZUMAPRO_PERST_DELAY_US, ZUMAPRO_PERST_DELAY_US + 2000); + + val = readl(elbi + ZUMAPRO_ELBI_REQ_EXIT_L1_MODE); + val |= ZUMAPRO_ELBI_APP_REQ_EXIT_L1_MODE | ZUMAPRO_ELBI_L1_REQ_NAK_MASTER; + writel(val, elbi + ZUMAPRO_ELBI_REQ_EXIT_L1_MODE); + writel(ZUMAPRO_ELBI_LINKDOWN_RST_MANUAL, elbi + ZUMAPRO_ELBI_LINKDOWN_RST_SEL); + writel(1, elbi + ZUMAPRO_ELBI_XFER_PENDING); + val = readl(elbi + ZUMAPRO_ELBI_QCH_SEL) & ~ZUMAPRO_ELBI_QCH_GATING_MASK; + writel(val, elbi + ZUMAPRO_ELBI_QCH_SEL); + writel(1, elbi + ZUMAPRO_ELBI_MSTR_PEND_SEL_NAK); + writel(1, elbi + ZUMAPRO_ELBI_DBI_L1_EXIT_DISABLE); + + dw_pcie_writel_dbi(pci, ZUMAPRO_DBI_AUX_CLK_FREQ, ZUMAPRO_DBI_AUX_CLK_26MHZ); + zumapro_pcie_disable_aspm(pci); + + return 0; + +err_power_off: + zumapro_pcie_power_off(zp); + return ret; + +err_clocks: + clk_bulk_disable_unprepare(zp->num_clks, zp->clks); +err_isolate: + regmap_update_bits(zp->pmu, zp->pmu_offset, ZUMAPRO_PMU_PHY_ISO_BYPASS, 0); + return ret; +} + +static void zumapro_pcie_host_deinit(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + + zumapro_pcie_power_off(to_zumapro_pcie(pci)); +} + +static const struct dw_pcie_host_ops zumapro_pcie_host_ops = { + .init = zumapro_pcie_host_init, + .deinit = zumapro_pcie_host_deinit, +}; + +static const struct dw_pcie_ops zumapro_pcie_dw_ops = { + .link_up = zumapro_pcie_link_up, + .get_ltssm = zumapro_pcie_get_ltssm, + .start_link = zumapro_pcie_start_link, + .stop_link = zumapro_pcie_stop_link, +}; + +static int zumapro_pcie_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct of_phandle_args args; + struct zumapro_pcie *zp; + int i, ret; + + zp = devm_kzalloc(dev, sizeof(*zp), GFP_KERNEL); + if (!zp) + return -ENOMEM; + + zp->pci.dev = dev; + zp->pci.ops = &zumapro_pcie_dw_ops; + zp->pci.pp.ops = &zumapro_pcie_host_ops; + platform_set_drvdata(pdev, zp); + + /* Mapped here rather than by the DesignWare core, which would too */ + for (i = 0; i < ZUMAPRO_BLK_COUNT; i++) { + const char *name = zumapro_pcie_blk_names[i]; + + zp->blk[i] = devm_platform_ioremap_resource_byname(pdev, name); + if (IS_ERR(zp->blk[i])) + return PTR_ERR(zp->blk[i]); + } + zp->pci.elbi_base = zp->blk[ZUMAPRO_BLK_ELBI]; + + zp->num_clks = devm_clk_bulk_get_all(dev, &zp->clks); + if (zp->num_clks < 0) + return dev_err_probe(dev, zp->num_clks, "failed to get the clocks\n"); + + ret = of_parse_phandle_with_fixed_args(dev->of_node, "samsung,pmu-syscon", + 1, 0, &args); + if (ret) + return dev_err_probe(dev, ret, "no samsung,pmu-syscon\n"); + zp->pmu_offset = args.args[0]; + of_node_put(args.np); + + zp->pmu = exynos_get_pmu_regmap_by_phandle(dev->of_node, "samsung,pmu-syscon"); + if (IS_ERR(zp->pmu)) + return dev_err_probe(dev, PTR_ERR(zp->pmu), "failed to get the PMU\n"); + + /* PERST# asserted until the PHY is configured */ + zp->perst = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(zp->perst)) + return dev_err_probe(dev, PTR_ERR(zp->perst), "failed to get PERST#\n"); + + ret = pci_pwrctrl_create_devices(dev); + if (ret) + return dev_err_probe(dev, ret, "failed to create pwrctrl devices\n"); + + ret = dw_pcie_host_init(&zp->pci.pp); + if (ret) { + pci_pwrctrl_destroy_devices(dev); + return dev_err_probe(dev, ret, "failed to initialize the host\n"); + } + + return 0; +} + +static void zumapro_pcie_remove(struct platform_device *pdev) +{ + struct zumapro_pcie *zp = platform_get_drvdata(pdev); + + dw_pcie_host_deinit(&zp->pci.pp); + pci_pwrctrl_destroy_devices(&pdev->dev); +} + +static const struct of_device_id zumapro_pcie_of_match[] = { + { .compatible = "google,zumapro-pcie" }, + { } +}; +MODULE_DEVICE_TABLE(of, zumapro_pcie_of_match); + +static struct platform_driver zumapro_pcie_driver = { + .driver = { + .name = "zumapro-pcie", + .of_match_table = zumapro_pcie_of_match, + .suppress_bind_attrs = true, + }, + .probe = zumapro_pcie_probe, + .remove = zumapro_pcie_remove, +}; +module_platform_driver(zumapro_pcie_driver); + +MODULE_DESCRIPTION("Google zumapro PCIe host controller driver"); +MODULE_LICENSE("GPL"); From 2ca3846dd78d5b405af90ea505e7b1070271242b Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:36:23 -0647 Subject: [PATCH 13/16] arm64: dts: exynos: google: zumapro: Add PCIe channel 1 Describe zumapro's PCIe channel 1 and its root port, disabled: the registers and interrupts of stock's pcie@13120000, the fourteen CMU_HSI2 gates and the PMU's PHY control at 0x3ec8. The link is one lane at Gen2, as stock and Google's CAL run it. Boards add PERST# and the endpoint, with its power under the root port. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../arm64/boot/dts/exynos/google/zumapro.dtsi | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index cb99ace061..6316ca1cc8 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -1185,6 +1185,62 @@ }; }; + pcie_1: pcie@13120000 { + compatible = "google,zumapro-pcie"; + reg = <0x0 0x13120000 0x2000>, <0x0 0x13130000 0x5000>, + <0x0 0x13150000 0xd000>, <0x0 0x13160000 0x3000>, + <0x0 0x13140000 0x5000>, <0x0 0x13100000 0x1000>, + <0x0 0x13400000 0x381000>, <0x0 0x60ffe000 0x2000>; + reg-names = "elbi", "soc", "udbg", "phy", "pcs", "ia", "dbi", + "config"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges = <0x82000000 0x0 0x60000000 0x0 0x60000000 0x0 0xff0000>; + bus-range = <0x00 0xff>; + interrupts = , + , + , + , + , + ; + interrupt-names = "ctrl", "msi0", "msi1", "msi2", "msi3", + "msi4"; + clocks = <&cmu_hsi2 CLK_GOUT_PCIE1_CTL_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_DBI_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SLV_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_MSTR_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_UDBG_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_PAL_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_REF>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_BRIDGE_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PHY_TEST_APB>, + <&cmu_hsi2 CLK_GOUT_PCIE1_IA_CLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SSMT_IA_ACLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SSMT_IA_PCLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_SYSMMU_CLK>, + <&cmu_hsi2 CLK_GOUT_PCIE1_PMMU_CLK>; + clock-names = "ctl-apb", "dbi-aclk", "slv-aclk", "mstr-aclk", + "phy-udbg-apb", "phy-pal-apb", "phy-ref", + "phy-bridge-apb", "phy-test-apb", "ia-clk", + "ssmt-ia-aclk", "ssmt-ia-pclk", "sysmmu-clk", + "pmmu-clk"; + samsung,pmu-syscon = <&pmu_system_controller 0x3ec8>; + num-lanes = <1>; + max-link-speed = <2>; + status = "disabled"; + + pcie_1_rp: pcie@0,0 { + compatible = "pciclass,0604"; + reg = <0x0 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0x01 0xff>; + ranges; + }; + }; + ufs: ufs@13200000 { compatible = "google,zumapro-ufs"; reg = <0x0 0x13200000 0x200>, From 7736f59527e22aa6404d8605be2a82d7db2e17f6 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:37:56 -0647 Subject: [PATCH 14/16] dt-bindings: net: wireless: brcm,bcm4329-fmac: add BCM4383 PCI ID Add the PCI ID of the BCM4383, the Wi-Fi chip of Google's Pixel 9a. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml index 38e9a0444f..42e4c9d1c0 100644 --- a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml +++ b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml @@ -56,6 +56,7 @@ properties: - pci14e4,4433 # BCM4387 - pci14e4,4434 # BCM4388 - pci14e4,4441 # BCM4389 + - pci14e4,4449 # BCM4383 - pci14e4,449d # BCM43752 reg: From 10d32e841f084c9fd1a74655754f0fd8fa2f501b Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:53:24 -0647 Subject: [PATCH 15/16] dt-bindings: net: wireless: brcm,bcm4329-fmac: allow a restricted DMA pool On the Pixel 7 Pro and the Pixel 9a no IOMMU can confine the Wi-Fi chip's PCIe DMA: the HSI2 System MMU and S2MPU see PCIe and UFS on one VID. Their device trees give the chip a restricted-dma-pool through memory-region instead, which of_dma_configure() picks up for the PCI device, so every DMA buffer bounces through that region. Document the property. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml index 42e4c9d1c0..be1765aa4d 100644 --- a/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml +++ b/Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml @@ -126,6 +126,11 @@ properties: NVRAM. This would normally be filled in by the bootloader from platform configuration data. + memory-region: + maxItems: 1 + description: A restricted-dma-pool region that all DMA of a PCIe device + bounces through, for platforms that limit the device's DMA to it. + clocks: items: - description: External Low Power Clock input (32.768KHz) From 294bcb2c6d52c68a4085f344df244567661c5741 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:37:56 -0647 Subject: [PATCH 16/16] arm64: dts: exynos: google: zumapro-tegu: Add Wi-Fi The Pixel 9a's BCM4383 sits behind PCIe channel 1. Enable the channel with PERST# on gph3-0, give the root port WL_REG_ON (gph3-4) as a fixed regulator with the 150 ms the bring-up waited before configuring the PHY, and describe the chip with its board type, so brcmfmac picks the board's firmware files. All of the chip's DMA goes through a 16 MiB restricted DMA pool below 4 GiB, as on the Pixel 7 Pro: the HSI2 System MMU and S2MPU see PCIe and UFS on the same VID, so they cannot confine the chip, and the pool at least keeps driver bugs away from the rest of RAM. Tested on the Pixel 9a with the same description applied as a runtime overlay to 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty (there WL_REG_ON was a GPIO of the controller node): the link came up at Gen2 x1, brcmfmac assigned the pool to the chip and brought up wlan0. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index e373d05a70..d5c0d94a49 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -147,6 +147,18 @@ regulator-boot-on; regulator-always-on; }; + + /* + * WL_REG_ON (gph3-4), the Wi-Fi chip's power enable (stock's + * pcie,wlan-gpio), raised 150 ms before the PCIe PHY is configured. + */ + wlan_reg_on: regulator-wlan-reg-on { + compatible = "regulator-fixed"; + regulator-name = "wlan-reg-on"; + gpio = <&gph3 4 GPIO_ACTIVE_HIGH>; + enable-active-high; + startup-delay-us = <150000>; + }; }; &{/reserved-memory} { @@ -169,6 +181,19 @@ alignment = <0x0 0x00200000>; alloc-ranges = <0x0 0x98000000 0x06000000>; }; + + /* + * All of the Wi-Fi chip's DMA buffers come from this pool. It keeps + * driver bugs away from the rest of RAM; it does not confine the + * chip's own firmware, as the HSI2 System MMU and S2MPU see PCIe and + * UFS on the same VID and cannot enforce on it. + */ + wifi_dma_pool: wifi-dma-pool { + compatible = "restricted-dma-pool"; + size = <0x01000000>; + alignment = <0x0 0x00200000>; + alloc-ranges = <0x0 0x80000000 0x80000000>; + }; }; &acpm_ipc { @@ -409,6 +434,22 @@ }; }; +&pcie_1 { + reset-gpios = <&gph3 0 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + +&pcie_1_rp { + vpcie3v3-supply = <&wlan_reg_on>; + + wifi@0,0 { + compatible = "pci14e4,4449"; + reg = <0x10000 0x0 0x0 0x0 0x0>; + brcm,board-type = "google,zumapro-tegu"; + memory-region = <&wifi_dma_pool>; + }; +}; + &pinctrl_alive { status = "okay";