Skip to content

clk: samsung: zumapro: Add CMU_G3D (the GPU's clocks) - #73

Closed
W4HO-ham wants to merge 2 commits into
derekross:omamobilefrom
W4HO-ham:tegu-g3d-clocks
Closed

W4HO-ham wants to merge 2 commits into
derekross:omamobilefrom
W4HO-ham:tegu-g3d-clocks

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto omamobile now that #40 is merged, so only this PR's two commits remain: dt-bindings: clock: google,zumapro: Add CMU_G3D and clk: samsung: zumapro: Add CMU_G3D.

CMU_G3D clocks the Mali GPU. It's built the same way as #40's HSI0:

  • Common path: it uses exynos_arm64_register_cmu() with the bus input.
  • Read-only state: firmware sets it up and keeps the domain on, so the two PLLs (PLL0822x, no rate table), the muxes and the dividers are read-only. The GPU's core, coregroup and stacks gates and the CMU's own gate are read-only gates.
  • CMU_TOP's three G3D branches: GLB, NOCD and SWITCH each get a mux, a read-only gate and a divider, in top_ro_gates like MISC's and HSI0's. Their ids are 31-39, appended to the TOP block.
  • Two 1:1 paths: the CAL gives the STACKS and L2_GLB dividers only busy and auto-gating bits and no ratio field, so they're fixed 1:1 factors.
  • Binding: google,zumapro-cmu-g3d with four inputs (oscclk, bus, glb, switch), its 19 ids in a new block, and a node in the example. No power-domains.
  • DVFS: the GPU's rate changes go through ACPM, not this CMU.

I checked every offset, field width and parent list against zuma's cmucal-sfr.c and cmucal-node.c, the same commit as #40. That covers the three TOP mux selects (3 bits each) and parent orders, the TOP divider widths (GLB 4, NOCD 4, SWITCH 3), the PLL CON3 M/P/S fields, the three internal muxes' parents and widths, and the TOP and NOCP dividers (3 bits each).

The palmtop runs these tables today, in the integration kernel named in the commit with its clk-zumapro.c blob. All 30 G3D clocks register, and Panthor runs the desktop on the core, coregroup and stacks gates. The tegu cmu_g3d node comes with the board PR, as for #40.

checkpatch --strict is clean on both new commits, clk-zumapro.o builds with W=1, and dt_binding_check passes for the binding.

@derekross

Copy link
Copy Markdown
Owner

Thanks for this one. I checked every entry of the G3D tables against Google's cmucal-sfr.c and cmucal-node.c at the commit you cite: the three CMU_TOP mux selects, gates and dividers, both PLLs' lock and CON3 offsets and their M/P/S layout, the six user muxes, the three local muxes, the two dividers, the two 1:1 paths (the CAL really has no ratio field for DIV_CLK_G3D_STACKS and _L2_GLB), and the four gates with their parents. All of it matches, the read-only treatment is the right one for a block the firmware owns, and the release string and blob id in the message are what I wanted.

One thing has to change before it merges. g3d_glb_parents and g3d_switch_parents name zumapro_shared0_d2, zumapro_shared1_d2, zumapro_shared0_d3 and zumapro_shared1_d3, in the CAL's order, but nothing in clk-zumapro.c registers those four clocks: top_factors has only shared0_d4, shared1_d4, shared2_d2 and shared3_d2. A mux whose selected parent has no registered clock stays an orphan and reports 0 Hz (clk_core_get_rate_nolock() in drivers/clk/clk.c), so if the bootloader left MUX_CLKCMU_G3D_NOCD on SHARED0_D3, say, zumapro_dout_g3d_nocd, the CMU_G3D bus input and the NOCD branch of mout_g3d_top all read 0. The GPU rates in your report come from the PLLs and the local dividers, so the boot wouldn't have shown it. The CAL gives the four as fixed rates (FIXEDRATE(PLL_SHARED0_D2, 1067000000), _D3 711000000, PLL_SHARED1_D2 933000000, _D3 622000000): four FFACTORs in top_factors (1/2, 1/2, 1/3, 1/3 of zumapro_shared0/zumapro_shared1) and four ids in the TOP block of the bindings commit. Take 40-43 and shift the later PRs' TOP ids by four, or append them at the end of the stack's numbering; either is fine for a block no device tree uses yet. The camera PR (#78) uses the same two _d3 names in cis_clk_parents and ispfe_noc_parents, so this fixes that one too.

When you re-push, could you add the boot's clk_summary lines for mout/gout/dout_g3d_glb, _nocd and _switch, so we know which parent the bootloader picked?

The gate and CI pass on today's base, and I built clk-zumapro.o at each of the fourteen commits of the stack with W=1: all clean. Since the seven PRs are one chain, I'll merge once the stack is re-pushed and green, most likely #79 as a whole with the others closed as landed through it, unless you'd rather I take them one by one.

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>
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>
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks, you were right, and it does bite on the 9a. The bootloader leaves MUX_CLKCMU_G3D_GLB on SHARED0_D2, so without the factors dout_g3d_glb would read 0 Hz. The whole stack is re-pushed on today's base (29a8d41):

clk-zumapro.o builds with W=1 at each of the fourteen commits, checkpatch --strict is clean on all of them, and dt_binding_check passes. Merging #79 as a whole and closing the rest works for me.

One heads-up: my DT PRs (#80, #81, #85, #87) sit on top of this stack. I'm rebasing them onto it now. They name clocks rather than numbers, so nothing in them changes.

@derekross

Copy link
Copy Markdown
Owner

Thanks for the quick turnaround, and for checking it on the phone: good to know GLB really sits on SHARED0_D2, so the fix matters on the 9a and isn't just tidiness.

I went through the re-pushed stack against the old one, commit by commit. The only changes are the ones we talked about:

The gate passes on today's base, CI is green on all seven, and clk-zumapro.o builds cleanly with W=1 at each of the fourteen commits.

One small thing came with the re-push, on #77 (details there): the Link: in its bindings commit is no longer a trailer. If you can amend that one message, I'll merge #79 right after, landing the whole stack, and close #73-#78 as landed through it. If you're busy, I'll merge it as it is.

Thanks also for rebasing #80, #81, #85 and #87 onto the stack. Once #79 is merged, its commits get new ids on omamobile, so those four will need one more rebase onto the branch before they can merge.

@derekross

Copy link
Copy Markdown
Owner

Landed through #79, which carried this commit with the rest of the stack. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants