From f9e16a05469dae43d89ec0dfe1be9d9c67da839e Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 08:21:27 -0647 Subject: [PATCH 1/2] dt-bindings: clock: google,zumapro: Add CMU_G3D CMU_G3D clocks the Tensor G4's Mali GPU: two PLLs (the stacks' and the L2's), user muxes for CMU_TOP's G3D NoC, global and switch clocks, and the GPU's core, coregroup and stacks clocks. Describe it in the common Tensor G4 clock binding with its four inputs, and add CMU_TOP's three G3D branches (mux, gate and divider each) and the SHARED0 and SHARED1 halves and thirds those branches select at the end of the TOP block and the 19 CMU_G3D identifiers in a new block, leaving the existing ones unchanged. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/soc/google/cal-if/zuma/cmucal-node.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../bindings/clock/google,zumapro-clock.yaml | 31 ++++++++++++++++- include/dt-bindings/clock/google,zumapro.h | 34 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/google,zumapro-clock.yaml b/Documentation/devicetree/bindings/clock/google,zumapro-clock.yaml index 88938509f8..3c2ff4cb78 100644 --- a/Documentation/devicetree/bindings/clock/google,zumapro-clock.yaml +++ b/Documentation/devicetree/bindings/clock/google,zumapro-clock.yaml @@ -15,6 +15,8 @@ description: | CMU_MISC supplies the firmware-owned watchdog bus clock paths. CMU_HSI0 supplies the USB, eUSB2 PHY and touchscreen USI2 clocks; its ALT and TCXO inputs are board-level fixed clocks. + CMU_G3D supplies the GPU's core, coregroup and stacks clocks from its two + PLLs and CMU_TOP's G3D NoC, global and switch clocks. The external oscillator supplies the PLL reference and oscillator mux paths. Clock identifiers are defined in dt-bindings/clock/google,zumapro.h. @@ -23,6 +25,7 @@ properties: compatible: enum: - google,zumapro-cmu-top + - google,zumapro-cmu-g3d - google,zumapro-cmu-hsi0 - google,zumapro-cmu-hsi2 - google,zumapro-cmu-peric0 @@ -88,6 +91,24 @@ allOf: else: properties: power-domains: false + - if: + properties: + compatible: + const: google,zumapro-cmu-g3d + then: + properties: + clocks: + items: + - description: External oscillator reference clock + - description: G3D NoC clock from CMU_TOP + - description: G3D global clock from CMU_TOP + - description: G3D switch clock from CMU_TOP + clock-names: + items: + - const: oscclk + - const: bus + - const: glb + - const: switch - if: properties: compatible: @@ -171,5 +192,13 @@ examples: clocks = <&oscclk>, <&cmu_top CLK_DOUT_PERIC0_NOC>; clock-names = "oscclk", "bus"; }; -... + clock-controller@1ee00000 { + compatible = "google,zumapro-cmu-g3d"; + reg = <0x1ee00000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>, <&cmu_top CLK_DOUT_G3D_NOCD>, + <&cmu_top CLK_DOUT_G3D_GLB>, <&cmu_top CLK_DOUT_G3D_SWITCH>; + clock-names = "oscclk", "bus", "glb", "switch"; + }; +... diff --git a/include/dt-bindings/clock/google,zumapro.h b/include/dt-bindings/clock/google,zumapro.h index 875b3ed744..e80a48eae2 100644 --- a/include/dt-bindings/clock/google,zumapro.h +++ b/include/dt-bindings/clock/google,zumapro.h @@ -34,6 +34,19 @@ #define CLK_DOUT_MISC_NOC 28 #define CLK_GOUT_HSI0_NOC 29 #define CLK_GOUT_HSI0_PERI 30 +#define CLK_MOUT_G3D_GLB 31 +#define CLK_MOUT_G3D_NOCD 32 +#define CLK_MOUT_G3D_SWITCH 33 +#define CLK_GOUT_G3D_GLB 34 +#define CLK_GOUT_G3D_NOCD 35 +#define CLK_GOUT_G3D_SWITCH 36 +#define CLK_DOUT_G3D_GLB 37 +#define CLK_DOUT_G3D_NOCD 38 +#define CLK_DOUT_G3D_SWITCH 39 +#define CLK_SHARED0_D2 40 +#define CLK_SHARED0_D3 41 +#define CLK_SHARED1_D2 42 +#define CLK_SHARED1_D3 43 /* CMU_HSI0. */ #define CLK_FOUT_HSI0_USB 1 @@ -59,6 +72,27 @@ #define CLK_GOUT_HSI0_USB_LINK 21 #define CLK_GOUT_HSI0_USB_SUSPEND 22 +/* CMU_G3D. */ +#define CLK_FOUT_G3D 1 +#define CLK_FOUT_G3D_L2 2 +#define CLK_MOUT_G3D_SWITCH_USER 3 +#define CLK_MOUT_G3D_GLB_USER 4 +#define CLK_MOUT_G3D_NOCD_USER 5 +#define CLK_MOUT_G3D_L2_GLB 6 +#define CLK_MOUT_G3D_STACKS 7 +#define CLK_MOUT_G3D_TOP 8 +#define CLK_DOUT_G3D_L2_GLB 9 +#define CLK_DOUT_G3D_STACKS 10 +#define CLK_DOUT_G3D_TOP 11 +#define CLK_MOUT_G3D_COREGROUP_USER 12 +#define CLK_MOUT_G3D_STACKS_USER 13 +#define CLK_MOUT_G3D_TOP_USER 14 +#define CLK_DOUT_G3D_NOCP 15 +#define CLK_GOUT_G3D_CMU 16 +#define CLK_GOUT_G3D_CORE 17 +#define CLK_GOUT_G3D_COREGROUP 18 +#define CLK_GOUT_G3D_STACKS 19 + /* CMU_HSI2. */ #define CLK_MOUT_HSI2_NOC_USER 1 #define CLK_MOUT_HSI2_UFS_USER 2 From 6b6818c827b428758eca558b4362ee03b6d419dc Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 08:23:02 -0647 Subject: [PATCH 2/2] clk: samsung: zumapro: Add CMU_G3D Register CMU_G3D, the Mali GPU's clock unit, on the common exynos_arm64_register_cmu() path with its bus input, and CMU_TOP's three G3D branches it takes its inputs from. Firmware sets G3D up and keeps its domain on: the two PLLs (PLL0822x, no rate table), the muxes and the dividers are read-only, and the GPU's core, coregroup and stacks gates and the CMU's own gate are read-only gates, as are CMU_TOP's three G3D gates. The STACKS and L2_GLB dividers have no ratio field in the CAL (only busy and auto-gating bits), so they are 1:1 factors. The GPU's rate changes go through the ACPM firmware, not this CMU. Every offset, width and parent list was checked against zuma's cmucal- sfr.c and cmucal-node.c. On the Pixel 9a the integration kernel 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, whose clk- zumapro.c (blob ae4948e0dd60) has these G3D and CMU_TOP G3D tables, registers the 30 G3D clocks and runs Panthor on the core, coregroup and stacks gates (fout_g3d at 149.9 MHz, gout_g3d_core at 159.7 MHz). CMU_TOP's G3D GLB and SWITCH muxes also select SHARED0 and SHARED1 divided by 2 and 3, which the driver didn't register, so a mux left on one of them would be an orphan reading 0 Hz. Add the four fixed factors (the CAL's PLL_SHARED0_D2 and _D3, PLL_SHARED1_D2 and _D3). On the Pixel 9a the bootloader leaves the GLB mux on SHARED0_D2: mout/gout_g3d_glb read 1065.984 MHz and dout_g3d_glb 532.992 MHz; NOCD and SWITCH are on SHARED2 (798.72 MHz), dout_g3d_nocd 133.12 and dout_g3d_switch 266.24 MHz. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/soc/google/cal-if/zuma/cmucal-sfr.c Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/soc/google/cal-if/zuma/cmucal-node.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/clk/samsung/clk-zumapro.c | 126 +++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk-zumapro.c b/drivers/clk/samsung/clk-zumapro.c index 4a78ccb97e..c5b89f7ac5 100644 --- a/drivers/clk/samsung/clk-zumapro.c +++ b/drivers/clk/samsung/clk-zumapro.c @@ -37,6 +37,10 @@ static const struct samsung_pll_clock top_plls[] __initconst = { }; static const struct samsung_fixed_factor_clock top_factors[] __initconst = { + FFACTOR(CLK_SHARED0_D2, "zumapro_shared0_d2", "zumapro_shared0", 1, 2, 0), + FFACTOR(CLK_SHARED0_D3, "zumapro_shared0_d3", "zumapro_shared0", 1, 3, 0), + FFACTOR(CLK_SHARED1_D2, "zumapro_shared1_d2", "zumapro_shared1", 1, 2, 0), + FFACTOR(CLK_SHARED1_D3, "zumapro_shared1_d3", "zumapro_shared1", 1, 3, 0), FFACTOR(CLK_SHARED0_D4, "zumapro_shared0_d4", "zumapro_shared0", 1, 4, 0), FFACTOR(CLK_SHARED1_D4, "zumapro_shared1_d4", "zumapro_shared1", 1, 4, 0), FFACTOR(CLK_SHARED2_D2, "zumapro_shared2_d2", "zumapro_shared2", 1, 2, 0), @@ -60,6 +64,18 @@ PNAME(peric0_noc_parents) = { "zumapro_spare", }; +PNAME(g3d_glb_parents) = { + "zumapro_shared0_d2", "zumapro_shared1_d2", "zumapro_shared2", + "zumapro_shared3", "zumapro_shared0_d3", "zumapro_shared1_d3", + "zumapro_shared0_d4", "zumapro_spare", +}; + +PNAME(g3d_switch_parents) = { + "zumapro_shared2", "zumapro_shared0_d3", "zumapro_shared3", + "zumapro_shared1_d3", "zumapro_shared0_d4", "zumapro_shared1_d4", + "zumapro_spare", "zumapro_spare", +}; + static const struct samsung_mux_clock top_muxes[] __initconst = { MUX_F(CLK_MOUT_HSI2_NOC, "zumapro_mout_hsi2_noc", hsi2_noc_parents, 0x10b0, 0, 3, 0, CLK_MUX_READ_ONLY), @@ -75,6 +91,12 @@ static const struct samsung_mux_clock top_muxes[] __initconst = { 0x10b4, 0, 1, 0, CLK_MUX_READ_ONLY), MUX_F(CLK_MOUT_MISC_NOC, "zumapro_mout_misc_noc", peric0_noc_parents, 0x10d0, 0, 2, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_GLB, "zumapro_mout_g3d_glb", g3d_glb_parents, + 0x106c, 0, 3, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_NOCD, "zumapro_mout_g3d_nocd", g3d_glb_parents, + 0x1070, 0, 3, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_SWITCH, "zumapro_mout_g3d_switch", g3d_switch_parents, + 0x1074, 0, 3, 0, CLK_MUX_READ_ONLY), }; /* The hardware order is mux -> gate -> divider. */ @@ -97,6 +119,12 @@ static const struct samsung_gate_clock top_ro_gates[] __initconst = { 0x20bc, 21, CLK_IGNORE_UNUSED, 0), GATE(CLK_GOUT_HSI0_PERI, "zumapro_gout_hsi0_peri", "zumapro_mout_hsi0_peri", 0x20c0, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_GLB, "zumapro_gout_g3d_glb", "zumapro_mout_g3d_glb", + 0x2094, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_NOCD, "zumapro_gout_g3d_nocd", "zumapro_mout_g3d_nocd", + 0x2098, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_SWITCH, "zumapro_gout_g3d_switch", + "zumapro_mout_g3d_switch", 0x209c, 21, CLK_IGNORE_UNUSED, 0), }; static const struct samsung_div_clock top_dividers[] __initconst = { @@ -114,6 +142,12 @@ static const struct samsung_div_clock top_dividers[] __initconst = { 0x18ac, 0, 3, 0, CLK_DIVIDER_READ_ONLY), DIV_F(CLK_DOUT_MISC_NOC, "zumapro_dout_misc_noc", "zumapro_gout_misc_noc", 0x18c4, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_GLB, "zumapro_dout_g3d_glb", "zumapro_gout_g3d_glb", + 0x1864, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_NOCD, "zumapro_dout_g3d_nocd", "zumapro_gout_g3d_nocd", + 0x1868, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_SWITCH, "zumapro_dout_g3d_switch", + "zumapro_gout_g3d_switch", 0x186c, 0, 3, 0, CLK_DIVIDER_READ_ONLY), }; /* Only these branch gates are put under manual CCF control. */ @@ -134,7 +168,7 @@ static const struct samsung_cmu_info top_cmu __initconst = { .nr_ro_gate_clks = ARRAY_SIZE(top_ro_gates), .div_clks = top_dividers, .nr_div_clks = ARRAY_SIZE(top_dividers), - .nr_clk_ids = CLK_GOUT_HSI0_PERI + 1, + .nr_clk_ids = CLK_SHARED1_D3 + 1, .clk_regs = top_regs, .nr_clk_regs = ARRAY_SIZE(top_regs), }; @@ -231,6 +265,95 @@ static const struct samsung_cmu_info hsi2_cmu __initconst = { .clk_name = "bus", }; +/* + * CMU_G3D. Firmware sets it up and keeps its domain on: the PLLs, muxes and + * dividers are read-only (the PLLs use the PLL0822x M/P/S layout, with no + * rate table), and the GPU's gates are read-only gates. The GPU's own rate + * changes go through the ACPM firmware, not this CMU. + */ +PNAME(g3d_switch_user_parents) = { "oscclk", "zumapro_dout_g3d_switch" }; +PNAME(g3d_glb_user_parents) = { "oscclk", "zumapro_dout_g3d_glb" }; +PNAME(g3d_nocd_user_parents) = { "oscclk", "zumapro_dout_g3d_nocd" }; +PNAME(g3d_l2_glb_parents) = { "zumapro_fout_g3d_l2", "zumapro_mout_g3d_glb_user" }; +PNAME(g3d_stacks_parents) = { "zumapro_fout_g3d", "zumapro_mout_g3d_switch_user" }; +PNAME(g3d_top_parents) = { + "zumapro_mout_g3d_stacks", "zumapro_mout_g3d_nocd_user", + "zumapro_mout_g3d_l2_glb", "oscclk", +}; + +PNAME(g3d_coregroup_user_parents) = { "oscclk", "zumapro_dout_g3d_l2_glb" }; +PNAME(g3d_stacks_user_parents) = { "oscclk", "zumapro_dout_g3d_stacks" }; +PNAME(g3d_top_user_parents) = { "oscclk", "zumapro_dout_g3d_top" }; + +static const struct samsung_pll_clock g3d_plls[] __initconst = { + PLL(pll_0822x, CLK_FOUT_G3D, "zumapro_fout_g3d", "oscclk", + 0x000, 0x10c, NULL), + PLL(pll_0822x, CLK_FOUT_G3D_L2, "zumapro_fout_g3d_l2", "oscclk", + 0x008, 0x18c, NULL), +}; + +static const struct samsung_mux_clock g3d_muxes[] __initconst = { + MUX_F(CLK_MOUT_G3D_SWITCH_USER, "zumapro_mout_g3d_switch_user", + g3d_switch_user_parents, 0x620, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_GLB_USER, "zumapro_mout_g3d_glb_user", + g3d_glb_user_parents, 0x600, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_NOCD_USER, "zumapro_mout_g3d_nocd_user", + g3d_nocd_user_parents, 0x610, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_L2_GLB, "zumapro_mout_g3d_l2_glb", + g3d_l2_glb_parents, 0x1000, 0, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_STACKS, "zumapro_mout_g3d_stacks", + g3d_stacks_parents, 0x1004, 0, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_TOP, "zumapro_mout_g3d_top", + g3d_top_parents, 0x1008, 0, 2, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_COREGROUP_USER, "zumapro_mout_g3d_coregroup_user", + g3d_coregroup_user_parents, 0x630, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_STACKS_USER, "zumapro_mout_g3d_stacks_user", + g3d_stacks_user_parents, 0x640, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_TOP_USER, "zumapro_mout_g3d_top_user", + g3d_top_user_parents, 0x650, 4, 1, 0, CLK_MUX_READ_ONLY), +}; + +/* CAL exposes no ratio field for these two paths: they are pass-through. */ +static const struct samsung_fixed_factor_clock g3d_factors[] __initconst = { + FFACTOR(CLK_DOUT_G3D_L2_GLB, "zumapro_dout_g3d_l2_glb", + "zumapro_mout_g3d_l2_glb", 1, 1, 0), + FFACTOR(CLK_DOUT_G3D_STACKS, "zumapro_dout_g3d_stacks", + "zumapro_mout_g3d_stacks", 1, 1, 0), +}; + +static const struct samsung_div_clock g3d_dividers[] __initconst = { + DIV_F(CLK_DOUT_G3D_TOP, "zumapro_dout_g3d_top", "zumapro_mout_g3d_top", + 0x1814, 0, 3, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_NOCP, "zumapro_dout_g3d_nocp", "zumapro_dout_g3d_l2_glb", + 0x1808, 0, 3, 0, CLK_DIVIDER_READ_ONLY), +}; + +static const struct samsung_gate_clock g3d_ro_gates[] __initconst = { + GATE(CLK_GOUT_G3D_CMU, "zumapro_gout_g3d_cmu", "zumapro_dout_g3d_nocp", + 0x2018, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_CORE, "zumapro_gout_g3d_core", "zumapro_mout_g3d_top_user", + 0x201c, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_COREGROUP, "zumapro_gout_g3d_coregroup", + "zumapro_mout_g3d_coregroup_user", 0x2020, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_STACKS, "zumapro_gout_g3d_stacks", + "zumapro_mout_g3d_stacks_user", 0x2024, 21, CLK_IGNORE_UNUSED, 0), +}; + +static const struct samsung_cmu_info g3d_cmu __initconst = { + .pll_clks = g3d_plls, + .nr_pll_clks = ARRAY_SIZE(g3d_plls), + .mux_clks = g3d_muxes, + .nr_mux_clks = ARRAY_SIZE(g3d_muxes), + .fixed_factor_clks = g3d_factors, + .nr_fixed_factor_clks = ARRAY_SIZE(g3d_factors), + .div_clks = g3d_dividers, + .nr_div_clks = ARRAY_SIZE(g3d_dividers), + .ro_gate_clks = g3d_ro_gates, + .nr_ro_gate_clks = ARRAY_SIZE(g3d_ro_gates), + .nr_clk_ids = CLK_GOUT_G3D_STACKS + 1, + .clk_name = "bus", +}; + /* CMU_HSI0. Firmware keeps the domain powered; there is no local PM. */ PNAME(mout_hsi0_tcxo_user_parents) = { "oscclk", "hsi0-tcxo" }; PNAME(mout_hsi0_usb20_ref_parents) = { "zumapro_dout_hsi0_usb", "zumapro_mout_hsi0_tcxo_user" }; @@ -393,6 +516,7 @@ static int __init zumapro_cmu_probe(struct platform_device *pdev) } static const struct of_device_id zumapro_cmu_match[] = { + { .compatible = "google,zumapro-cmu-g3d", .data = &g3d_cmu }, { .compatible = "google,zumapro-cmu-hsi0", .data = &hsi0_cmu }, { .compatible = "google,zumapro-cmu-hsi2", .data = &hsi2_cmu }, { .compatible = "google,zumapro-cmu-peric0", .data = &peric0_cmu },