diff --git a/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml b/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml index b4f1245065..01127c9c34 100644 --- a/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml +++ b/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml @@ -10,13 +10,16 @@ maintainers: - Brett-Michael Green description: | - CMU_TOP supplies the HSI0 NoC and peripheral clocks to CMU_HSI0 from its - shared PLLs. CMU_HSI0 supplies USI2, the touchscreen's SPI, from the HSI0 - peripheral clock; its NoC path also takes the board-level HSI0 ALT clock. + CMU_TOP supplies the HSI0 NoC and peripheral clocks to CMU_HSI0, and the + G3D clocks to CMU_G3D, from its shared PLLs. CMU_HSI0 supplies USI2, the + touchscreen's SPI, from the HSI0 peripheral clock; its NoC path also takes + the board-level HSI0 ALT clock. CMU_TOP also supplies the PERIC1 NoC and USI input clocks to CMU_PERIC1, which supplies USI11, the I2C bus of the battery, charger and USB-C chips. CMU_APM supplies the APM mailbox, its internal memory and the always-on GPIO banks from the always-on ALV PLL and the oscillator. + CMU_G3D supplies the GPU from its own two PLLs and from the G3D GLB, NOCD + and SWITCH clocks of CMU_TOP. The external oscillator supplies the PLL reference and the oscillator mux paths. Clock identifiers are defined in dt-bindings/clock/google,zuma.h. @@ -26,6 +29,7 @@ properties: enum: - google,zuma-cmu-top - google,zuma-cmu-apm + - google,zuma-cmu-g3d - google,zuma-cmu-hsi0 - google,zuma-cmu-peric0 - google,zuma-cmu-peric1 @@ -84,6 +88,24 @@ allOf: - const: bus - const: peri - const: alt + - if: + properties: + compatible: + const: google,zuma-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: diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml index 154039cd40..f75969b1ca 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -78,7 +78,7 @@ properties: description: The SoC's thermal sensors, which the ACPM firmware reads on the kernel's behalf. Cells are the sensor index (0 big, 1 mid, 2 little - CPU cluster, 3 GPU, 4 ISP, 5 TPU, and on gs201 and zumapro 6 AUR). + CPU cluster, 3 GPU, 4 ISP, 5 TPU, and on gs201, zuma and zumapro 6 AUR). type: object $ref: /schemas/thermal/thermal-sensor.yaml# unevaluatedProperties: false @@ -88,6 +88,7 @@ properties: enum: - google,gs101-acpm-tmu - google,gs201-acpm-tmu + - google,zuma-acpm-tmu - google,zumapro-acpm-tmu "#thermal-sensor-cells": diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml index e1951820af..353235e894 100644 --- a/Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml +++ b/Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml @@ -19,6 +19,7 @@ properties: - items: - enum: - google,gs201-mali # G710 + - google,zuma-mali # G715 - google,zumapro-mali # G715 family - mediatek,mt8196-mali - nxp,imx95-mali # G310 diff --git a/MAINTAINERS b/MAINTAINERS index 2c4ec69a7a..a44d4a1fbe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11199,6 +11199,7 @@ F: drivers/thermal/samsung/gs101_acpm_tmu.c F: drivers/usb/dwc3/dwc3-google.c F: include/dt-bindings/clock/google,gs101* F: include/dt-bindings/clock/google,gs201* +F: include/dt-bindings/clock/google,zuma-acpm.h F: include/dt-bindings/clock/google,zuma.h F: include/dt-bindings/clock/google,zumapro* K: [gG]oogle.?[tT]ensor diff --git a/arch/arm64/boot/dts/exynos/google/zuma-husky.dts b/arch/arm64/boot/dts/exynos/google/zuma-husky.dts index 1cc3647435..6f1c0d8417 100644 --- a/arch/arm64/boot/dts/exynos/google/zuma-husky.dts +++ b/arch/arm64/boot/dts/exynos/google/zuma-husky.dts @@ -161,6 +161,67 @@ constant-charge-current-max-microamp = <1485000>; }; + /* + * The GPU's levels: the shader rates of the Pixel 8 Pro's GPU DVFS + * table, each with its paired L2 rate through the ACPM "gpu" clock, + * up to stock's 890 MHz. gpu-thermal throttles them. + */ + 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>; + }; + + 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>; + }; + }; + reserved-memory { #address-cells = <2>; #size-cells = <1>; @@ -259,6 +320,60 @@ }; }; +&cmu_g3d { + status = "okay"; +}; + +/* The CPU levels' turbo-mode marks are this phone's BCL caps (zuma.dtsi). */ +&cpu0 { + operating-points-v2 = <&cpucl0_opp>; +}; + +&cpu1 { + operating-points-v2 = <&cpucl0_opp>; +}; + +&cpu2 { + operating-points-v2 = <&cpucl0_opp>; +}; + +&cpu3 { + operating-points-v2 = <&cpucl0_opp>; +}; + +&cpu4 { + operating-points-v2 = <&cpucl1_opp>; +}; + +&cpu5 { + operating-points-v2 = <&cpucl1_opp>; +}; + +&cpu6 { + operating-points-v2 = <&cpucl1_opp>; +}; + +&cpu7 { + operating-points-v2 = <&cpucl1_opp>; +}; + +&cpu8 { + operating-points-v2 = <&cpucl2_opp>; +}; + +/* + * 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 ZUMA_CLK_ACPM_GPU>, + <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, + <&cmu_g3d CLK_GOUT_G3D_STACKS>; + operating-points-v2 = <&gpu_opp>; + status = "okay"; +}; + /* * DECON0 takes the display over from simple-framebuffer and flips DPP0 * between scanout buffers. It scans out to DSIM0, so gs-decon can switch diff --git a/arch/arm64/boot/dts/exynos/google/zuma.dtsi b/arch/arm64/boot/dts/exynos/google/zuma.dtsi index 93a9ce3685..610a8901c8 100644 --- a/arch/arm64/boot/dts/exynos/google/zuma.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zuma.dtsi @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -96,6 +97,8 @@ reg = <0x000>; enable-method = "psci"; capacity-dmips-mhz = <193>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL0>; }; cpu1: cpu@100 { device_type = "cpu"; @@ -103,6 +106,8 @@ reg = <0x100>; enable-method = "psci"; capacity-dmips-mhz = <193>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL0>; }; cpu2: cpu@200 { device_type = "cpu"; @@ -110,6 +115,8 @@ reg = <0x200>; enable-method = "psci"; capacity-dmips-mhz = <193>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL0>; }; cpu3: cpu@300 { device_type = "cpu"; @@ -117,6 +124,8 @@ reg = <0x300>; enable-method = "psci"; capacity-dmips-mhz = <193>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL0>; }; cpu4: cpu@400 { device_type = "cpu"; @@ -124,6 +133,8 @@ reg = <0x400>; enable-method = "psci"; capacity-dmips-mhz = <927>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL1>; }; cpu5: cpu@500 { device_type = "cpu"; @@ -131,6 +142,8 @@ reg = <0x500>; enable-method = "psci"; capacity-dmips-mhz = <927>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL1>; }; cpu6: cpu@600 { device_type = "cpu"; @@ -138,6 +151,8 @@ reg = <0x600>; enable-method = "psci"; capacity-dmips-mhz = <927>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL1>; }; cpu7: cpu@700 { device_type = "cpu"; @@ -145,6 +160,8 @@ reg = <0x700>; enable-method = "psci"; capacity-dmips-mhz = <927>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL1>; }; cpu8: cpu@800 { device_type = "cpu"; @@ -152,15 +169,274 @@ reg = <0x800>; enable-method = "psci"; capacity-dmips-mhz = <1024>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMA_CLK_ACPM_DVFS_CPUCL2>; }; }; + /* + * CPU levels: the ACPM firmware's own DVFS levels, from the ECT that the + * bootloader leaves at 0x90000000, up to each cluster's max-freq in + * stock's exynos-acme domains (Google's zuma-cpu.dtsi). The levels + * above, listed in each table, are left out as stock leaves them. + * + * The firmware sets the rail voltages from its fused ASV tables, so + * there is no opp-microvolt, and the energy model can't be computed + * from a power coefficient. opp-microwatt is each level's power in + * stock's default energy model (the pixel-em profile in Google's + * zuma-b0-ipop.dts, the same in the Pixel 8 Pro's own device tree). + * + * Stock caps the mid and big clusters at 1945 and 2294 MHz whenever + * its battery current limiter (BCL) sees the battery voltage droop + * (freq_qos vdroop1/vdroop2/smpl_warn in Google's + * zuma-shusky-bcl.dtsi). There is no BCL driver here, so the levels + * above those caps are turbo-mode: off until boost is enabled + * (/sys/devices/system/cpu/cpufreq/boost). + * + * Those turbo-mode marks are the Pixel 8 Pro's caps, so the CPUs get + * operating-points-v2 in the board file. A board whose BCL caps are + * lower needs tables of its own. + */ + cpucl0_opp: opp-table-cpucl0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-324000000 { + opp-hz = /bits/ 64 <324000000>; + opp-microwatt = <11000>; + }; + + opp-610000000 { + opp-hz = /bits/ 64 <610000000>; + opp-microwatt = <12000>; + }; + + opp-820000000 { + opp-hz = /bits/ 64 <820000000>; + opp-microwatt = <19000>; + }; + + opp-955000000 { + opp-hz = /bits/ 64 <955000000>; + opp-microwatt = <25000>; + }; + + opp-1098000000 { + opp-hz = /bits/ 64 <1098000000>; + opp-microwatt = <31000>; + }; + + opp-1197000000 { + opp-hz = /bits/ 64 <1197000000>; + opp-microwatt = <37000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + opp-microwatt = <45000>; + }; + + opp-1425000000 { + opp-hz = /bits/ 64 <1425000000>; + opp-microwatt = <57000>; + }; + + opp-1548000000 { + opp-hz = /bits/ 64 <1548000000>; + opp-microwatt = <155000>; + }; + + opp-1704000000 { + opp-hz = /bits/ 64 <1704000000>; + opp-microwatt = <195000>; + }; + + /* 1785, 1950, 2024, 2098, 2147 and 2253 MHz stay off, as on stock. */ + }; + + cpucl1_opp: opp-table-cpucl1 { + compatible = "operating-points-v2"; + opp-shared; + + opp-402000000 { + opp-hz = /bits/ 64 <402000000>; + opp-microwatt = <59000>; + }; + + opp-578000000 { + opp-hz = /bits/ 64 <578000000>; + opp-microwatt = <85000>; + }; + + opp-697000000 { + opp-hz = /bits/ 64 <697000000>; + opp-microwatt = <106000>; + }; + + opp-712000000 { + opp-hz = /bits/ 64 <712000000>; + opp-microwatt = <114000>; + }; + + opp-910000000 { + opp-hz = /bits/ 64 <910000000>; + opp-microwatt = <156000>; + }; + + opp-1065000000 { + opp-hz = /bits/ 64 <1065000000>; + opp-microwatt = <208000>; + }; + + opp-1221000000 { + opp-hz = /bits/ 64 <1221000000>; + opp-microwatt = <266000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + opp-microwatt = <320000>; + }; + + opp-1418000000 { + opp-hz = /bits/ 64 <1418000000>; + opp-microwatt = <368000>; + }; + + opp-1572000000 { + opp-hz = /bits/ 64 <1572000000>; + opp-microwatt = <449000>; + }; + + opp-1836000000 { + opp-hz = /bits/ 64 <1836000000>; + opp-microwatt = <638000>; + }; + + opp-1945000000 { + opp-hz = /bits/ 64 <1945000000>; + opp-microwatt = <804000>; + }; + + opp-2130000000 { + opp-hz = /bits/ 64 <2130000000>; + opp-microwatt = <1042000>; + turbo-mode; + }; + + opp-2245000000 { + opp-hz = /bits/ 64 <2245000000>; + opp-microwatt = <1272000>; + turbo-mode; + }; + + opp-2367000000 { + opp-hz = /bits/ 64 <2367000000>; + opp-microwatt = <1514000>; + turbo-mode; + }; + + /* 2450 and 2600 MHz stay off, as on stock. */ + }; + + cpucl2_opp: opp-table-cpucl2 { + compatible = "operating-points-v2"; + opp-shared; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microwatt = <116000>; + }; + + opp-880000000 { + opp-hz = /bits/ 64 <880000000>; + opp-microwatt = <213000>; + }; + + opp-1164000000 { + opp-hz = /bits/ 64 <1164000000>; + opp-microwatt = <321000>; + }; + + opp-1298000000 { + opp-hz = /bits/ 64 <1298000000>; + opp-microwatt = <391000>; + }; + + opp-1557000000 { + opp-hz = /bits/ 64 <1557000000>; + opp-microwatt = <535000>; + }; + + opp-1745000000 { + opp-hz = /bits/ 64 <1745000000>; + opp-microwatt = <675000>; + }; + + opp-1885000000 { + opp-hz = /bits/ 64 <1885000000>; + opp-microwatt = <784000>; + }; + + opp-2049000000 { + opp-hz = /bits/ 64 <2049000000>; + opp-microwatt = <1034000>; + }; + + opp-2147000000 { + opp-hz = /bits/ 64 <2147000000>; + opp-microwatt = <1145000>; + }; + + opp-2294000000 { + opp-hz = /bits/ 64 <2294000000>; + opp-microwatt = <1363000>; + }; + + opp-2363000000 { + opp-hz = /bits/ 64 <2363000000>; + opp-microwatt = <1533000>; + turbo-mode; + }; + + opp-2556000000 { + opp-hz = /bits/ 64 <2556000000>; + opp-microwatt = <1911000>; + turbo-mode; + }; + + opp-2687000000 { + opp-hz = /bits/ 64 <2687000000>; + opp-microwatt = <2415000>; + turbo-mode; + }; + + opp-2850000000 { + opp-hz = /bits/ 64 <2850000000>; + opp-microwatt = <3175000>; + turbo-mode; + }; + + opp-2914000000 { + opp-hz = /bits/ 64 <2914000000>; + opp-microwatt = <3714000>; + turbo-mode; + }; + + /* 2943, 2970 and 3015 MHz stay off, as on stock. */ + }; + firmware { acpm_ipc: power-management { compatible = "google,zuma-acpm-ipc"; #clock-cells = <1>; mboxes = <&ap2apm_mailbox>; shmem = <&apm_sram>; + + acpm_tmu: thermal-sensor { + compatible = "google,zuma-acpm-tmu"; + #thermal-sensor-cells = <1>; + }; }; }; @@ -169,6 +445,158 @@ method = "smc"; }; + thermal-zones { + /* + * The CPU zones throttle their cluster from 80 C and force its + * lowest level from 95 C. + */ + 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 = <&cpu8 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&big_hot>; + cooling-device = <&cpu8 14 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 9 0xffffffff>; + }; + }; + }; + + /* + * Below stock's own GPU trips (passive from 100 C, hot at + * 115 C). + */ + 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>; + }; + }; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = , @@ -909,6 +1337,33 @@ status = "disabled"; }; + /* The bootloader leaves G3D powered; there's no power domain yet. */ + cmu_g3d: clock-controller@1ee00000 { + compatible = "google,zuma-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"; + status = "disabled"; + }; + + gpu: gpu@1f000000 { + compatible = "google,zuma-mali", "arm,mali-valhall-csf"; + reg = <0x1f000000 0x480000>; + interrupts = , + , + ; + interrupt-names = "job", "mmu", "gpu"; + clocks = <&cmu_g3d CLK_GOUT_G3D_CORE>, + <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, + <&cmu_g3d CLK_GOUT_G3D_STACKS>; + clock-names = "core", "coregroup", "stacks"; + #cooling-cells = <2>; + status = "disabled"; + }; + cmu_top: clock-controller@26040000 { compatible = "google,zuma-cmu-top"; reg = <0x26040000 0x8000>; diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c index 93f4b89b64..14ec89df2d 100644 --- a/drivers/clk/samsung/clk-acpm.c +++ b/drivers/clk/samsung/clk-acpm.c @@ -240,6 +240,7 @@ static const struct acpm_clk_pair zumapro_gpu_pairs[] = { { 807000, 900000 }, { 850000, 900000 }, { 890000, 900000 }, + /* zuma's table stops above 890 MHz: keep this level last. */ { 940000, 950000 }, }; @@ -270,6 +271,39 @@ static const struct acpm_clk_driver_data acpm_clk_zumapro = { .mbox_chan_id = 0, }; +/* + * Tensor G3 (zuma): the same 17 DVFS domains as zumapro (Google's + * enum acpm_dvfs_id is zuma's), and the Pixel 8 Pro's GPU DVFS table (its + * stock gpu_dvfs_table_v2) is the 9a's, pair for pair. Stock stops at + * 890 MHz (gpu_dvfs_max_freq in Google's zuma-gpu.dtsi), so the 940 MHz + * level is left out. + */ +static unsigned int zuma_gpu_max_khz; +module_param(zuma_gpu_max_khz, uint, 0644); +MODULE_PARM_DESC(zuma_gpu_max_khz, + "zuma: highest GPU shader rate in kHz, 0 = read-only (default)"); + +static const struct acpm_clk_paired zuma_acpm_paired[] = { + { + .name = "gpu", + .id = 7, /* G3D: shader cores */ + .id2 = 8, /* G3DL2: top level and L2 */ + .pairs = zumapro_gpu_pairs, + .nr_pairs = ARRAY_SIZE(zumapro_gpu_pairs) - 1, /* not 940 MHz */ + .max_khz = &zuma_gpu_max_khz, + }, +}; + +static const struct acpm_clk_driver_data acpm_clk_zuma = { + .clks = zumapro_acpm_clks, + .nr_clks = ARRAY_SIZE(zumapro_acpm_clks), + .paired = zuma_acpm_paired, + .nr_paired = ARRAY_SIZE(zuma_acpm_paired), + /* Show the firmware's rate, not the last one asked for. */ + .flags = CLK_GET_RATE_NOCACHE, + .mbox_chan_id = 0, +}; + static unsigned long acpm_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -509,6 +543,9 @@ static const struct platform_device_id acpm_clk_id[] = { }, { .name = "gs201-acpm-clk", .driver_data = (kernel_ulong_t)&acpm_clk_gs201, + }, { + .name = "zuma-acpm-clk", + .driver_data = (kernel_ulong_t)&acpm_clk_zuma, }, { .name = "zumapro-acpm-clk", .driver_data = (kernel_ulong_t)&acpm_clk_zumapro, diff --git a/drivers/clk/samsung/clk-zuma.c b/drivers/clk/samsung/clk-zuma.c index 03648acdb1..a0b45be30c 100644 --- a/drivers/clk/samsung/clk-zuma.c +++ b/drivers/clk/samsung/clk-zuma.c @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Google Tensor G3 (zuma) clocks for the touchscreen, its PMIC and the - * battery bus. + * Google Tensor G3 (zuma) clocks for the touchscreen, its PMIC, the battery + * bus and the GPU. * * Register layout and parents derived from Google's GPL CMUCAL tables in * cal-if/zuma/cmucal-{sfr,node}.c, Copyright 2022 Samsung Electronics Co., Ltd. - * Only the path from CMU_TOP to HSI0's USI2 is described, with CMU_APM's - * clocks for the APM mailbox, its SRAM and the always-on GPIO banks, and - * the path from CMU_TOP to PERIC1's USI11 (the battery, charger and USB-C - * I2C bus). PLLs, - * muxes and dividers keep their firmware settings, except USI2's own - * divider, which sets the SPI rate. No PLL rate table is supplied. + * Only the paths from CMU_TOP to HSI0's USI2 and to CMU_G3D are described, + * with CMU_APM's clocks for the APM mailbox, its SRAM and the always-on GPIO + * banks, and the path from CMU_TOP to PERIC1's USI11 (the battery, charger + * and USB-C I2C bus). PLLs, muxes and dividers keep their firmware settings, + * except USI2's own divider, which sets the SPI rate. No PLL rate table is + * supplied. */ #include @@ -44,6 +44,10 @@ static const struct samsung_fixed_factor_clock top_factors[] __initconst = { FFACTOR(CLK_SHARED1_D4, "zuma_shared1_d4", "zuma_shared1", 1, 4, 0), FFACTOR(CLK_SHARED2_D2, "zuma_shared2_d2", "zuma_shared2", 1, 2, 0), FFACTOR(CLK_SHARED3_D2, "zuma_shared3_d2", "zuma_shared3", 1, 2, 0), + FFACTOR(CLK_SHARED0_D2, "zuma_shared0_d2", "zuma_shared0", 1, 2, 0), + FFACTOR(CLK_SHARED0_D3, "zuma_shared0_d3", "zuma_shared0", 1, 3, 0), + FFACTOR(CLK_SHARED1_D2, "zuma_shared1_d2", "zuma_shared1", 1, 2, 0), + FFACTOR(CLK_SHARED1_D3, "zuma_shared1_d3", "zuma_shared1", 1, 3, 0), }; PNAME(mout_peric1_parents) = { @@ -58,6 +62,17 @@ PNAME(mout_hsi0_peri_parents) = { "zuma_shared0_d4", "zuma_shared2_d2", "zuma_shared3_d2", "zuma_spare", }; +/* NOCD takes the same sources as GLB. */ +PNAME(mout_g3d_glb_parents) = { + "zuma_shared0_d2", "zuma_shared1_d2", "zuma_shared2", "zuma_shared3", + "zuma_shared0_d3", "zuma_shared1_d3", "zuma_shared0_d4", "zuma_spare", +}; + +PNAME(mout_g3d_switch_parents) = { + "zuma_shared2", "zuma_shared0_d3", "zuma_shared3", "zuma_shared1_d3", + "zuma_shared0_d4", "zuma_shared1_d4", "zuma_spare", "zuma_spare", +}; + static const struct samsung_mux_clock top_muxes[] __initconst = { MUX_F(CLK_MOUT_HSI0_NOC, "zuma_mout_hsi0_noc", mout_hsi0_noc_parents, 0x1094, 0, 3, 0, CLK_MUX_READ_ONLY), @@ -71,9 +86,18 @@ static const struct samsung_mux_clock top_muxes[] __initconst = { 0x10f0, 0, 2, 0, CLK_MUX_READ_ONLY), MUX_F(CLK_MOUT_PERIC0_IP, "zuma_mout_peric0_ip", mout_peric1_parents, 0x10ec, 0, 2, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_GLB, "zuma_mout_g3d_glb", mout_g3d_glb_parents, + 0x106c, 0, 3, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_NOCD, "zuma_mout_g3d_nocd", mout_g3d_glb_parents, + 0x1070, 0, 3, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_SWITCH, "zuma_mout_g3d_switch", + mout_g3d_switch_parents, 0x1074, 0, 3, 0, CLK_MUX_READ_ONLY), }; -/* The hardware order is mux -> gate -> divider. HSI0 and PERIC1 are firmware-owned. */ +/* + * The hardware order is mux -> gate -> divider. The HSI0, PERIC0, PERIC1 and + * G3D paths are firmware-owned. + */ static const struct samsung_gate_clock top_ro_gates[] __initconst = { GATE(CLK_GOUT_HSI0_NOC, "zuma_gout_hsi0_noc", "zuma_mout_hsi0_noc", 0x20bc, 21, CLK_IGNORE_UNUSED, 0), @@ -87,6 +111,12 @@ static const struct samsung_gate_clock top_ro_gates[] __initconst = { 0x2114, 21, CLK_IGNORE_UNUSED, 0), GATE(CLK_GOUT_PERIC0_IP, "zuma_gout_peric0_ip", "zuma_mout_peric0_ip", 0x2110, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_GLB, "zuma_gout_g3d_glb", "zuma_mout_g3d_glb", + 0x2094, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_NOCD, "zuma_gout_g3d_nocd", "zuma_mout_g3d_nocd", + 0x2098, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_SWITCH, "zuma_gout_g3d_switch", "zuma_mout_g3d_switch", + 0x209c, 21, CLK_IGNORE_UNUSED, 0), }; static const struct samsung_div_clock top_dividers[] __initconst = { @@ -102,6 +132,12 @@ static const struct samsung_div_clock top_dividers[] __initconst = { 0x18e8, 0, 4, 0, CLK_DIVIDER_READ_ONLY), DIV_F(CLK_DOUT_PERIC0_IP, "zuma_dout_peric0_ip", "zuma_gout_peric0_ip", 0x18e4, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_GLB, "zuma_dout_g3d_glb", "zuma_gout_g3d_glb", + 0x1864, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_NOCD, "zuma_dout_g3d_nocd", "zuma_gout_g3d_nocd", + 0x1868, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_SWITCH, "zuma_dout_g3d_switch", "zuma_gout_g3d_switch", + 0x186c, 0, 3, 0, CLK_DIVIDER_READ_ONLY), }; static const struct samsung_cmu_info top_cmu __initconst = { @@ -115,7 +151,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_DOUT_PERIC0_IP + 1, + .nr_clk_ids = CLK_DOUT_G3D_SWITCH + 1, }; static void __init zuma_top_init(struct device_node *np) @@ -402,6 +438,107 @@ static const struct samsung_cmu_info peric0_cmu __initconst = { .clk_name = "bus", }; +/* + * CMU_G3D, 0x1ee00000. 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(mout_g3d_switch_user_parents) = { "oscclk", "zuma_dout_g3d_switch" }; + +PNAME(mout_g3d_glb_user_parents) = { "oscclk", "zuma_dout_g3d_glb" }; + +PNAME(mout_g3d_nocd_user_parents) = { "oscclk", "zuma_dout_g3d_nocd" }; + +PNAME(mout_g3d_l2_glb_parents) = { + "zuma_fout_g3d_l2", "zuma_mout_g3d_glb_user", +}; + +PNAME(mout_g3d_stacks_parents) = { + "zuma_fout_g3d", "zuma_mout_g3d_switch_user", +}; + +PNAME(mout_g3d_top_parents) = { + "zuma_mout_g3d_stacks", "zuma_mout_g3d_nocd_user", + "zuma_mout_g3d_l2_glb", "oscclk", +}; + +PNAME(mout_g3d_coregroup_user_parents) = { "oscclk", "zuma_dout_g3d_l2_glb" }; + +PNAME(mout_g3d_stacks_user_parents) = { "oscclk", "zuma_dout_g3d_stacks" }; + +PNAME(mout_g3d_top_user_parents) = { "oscclk", "zuma_dout_g3d_top" }; + +static const struct samsung_pll_clock g3d_plls[] __initconst = { + PLL(pll_0822x, CLK_FOUT_G3D, "zuma_fout_g3d", "oscclk", + 0x000, 0x10c, NULL), + PLL(pll_0822x, CLK_FOUT_G3D_L2, "zuma_fout_g3d_l2", "oscclk", + 0x008, 0x18c, NULL), +}; + +static const struct samsung_mux_clock g3d_muxes[] __initconst = { + MUX_F(CLK_MOUT_G3D_SWITCH_USER, "zuma_mout_g3d_switch_user", + mout_g3d_switch_user_parents, 0x620, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_GLB_USER, "zuma_mout_g3d_glb_user", + mout_g3d_glb_user_parents, 0x600, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_NOCD_USER, "zuma_mout_g3d_nocd_user", + mout_g3d_nocd_user_parents, 0x610, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_L2_GLB, "zuma_mout_g3d_l2_glb", + mout_g3d_l2_glb_parents, 0x1000, 0, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_STACKS, "zuma_mout_g3d_stacks", + mout_g3d_stacks_parents, 0x1004, 0, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_TOP, "zuma_mout_g3d_top", mout_g3d_top_parents, + 0x1008, 0, 2, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_COREGROUP_USER, "zuma_mout_g3d_coregroup_user", + mout_g3d_coregroup_user_parents, 0x630, 4, 1, 0, + CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_STACKS_USER, "zuma_mout_g3d_stacks_user", + mout_g3d_stacks_user_parents, 0x640, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_G3D_TOP_USER, "zuma_mout_g3d_top_user", + mout_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, "zuma_dout_g3d_l2_glb", + "zuma_mout_g3d_l2_glb", 1, 1, 0), + FFACTOR(CLK_DOUT_G3D_STACKS, "zuma_dout_g3d_stacks", + "zuma_mout_g3d_stacks", 1, 1, 0), +}; + +static const struct samsung_div_clock g3d_dividers[] __initconst = { + DIV_F(CLK_DOUT_G3D_TOP, "zuma_dout_g3d_top", "zuma_mout_g3d_top", + 0x1814, 0, 3, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_G3D_NOCP, "zuma_dout_g3d_nocp", "zuma_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, "zuma_gout_g3d_cmu", "zuma_dout_g3d_nocp", + 0x2018, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_CORE, "zuma_gout_g3d_core", "zuma_mout_g3d_top_user", + 0x201c, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_COREGROUP, "zuma_gout_g3d_coregroup", + "zuma_mout_g3d_coregroup_user", 0x2020, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_G3D_STACKS, "zuma_gout_g3d_stacks", + "zuma_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", +}; + static int __init zuma_cmu_probe(struct platform_device *pdev) { const struct samsung_cmu_info *cmu = device_get_match_data(&pdev->dev); @@ -412,6 +549,7 @@ static int __init zuma_cmu_probe(struct platform_device *pdev) static const struct of_device_id zuma_cmu_match[] = { { .compatible = "google,zuma-cmu-apm", .data = &apm_cmu }, + { .compatible = "google,zuma-cmu-g3d", .data = &g3d_cmu }, { .compatible = "google,zuma-cmu-hsi0", .data = &hsi0_cmu }, { .compatible = "google,zuma-cmu-peric0", .data = &peric0_cmu }, { .compatible = "google,zuma-cmu-peric1", .data = &peric1_cmu }, diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c index 7641dd0069..09676fa7cf 100644 --- a/drivers/gpu/drm/panthor/panthor_drv.c +++ b/drivers/gpu/drm/panthor/panthor_drv.c @@ -1887,6 +1887,11 @@ static const struct panthor_soc_data soc_data_mediatek_mt8196 = { }; static const struct of_device_id dt_match[] = { + { + /* zuma's l2-hash-values are zumapro's. */ + .compatible = "google,zuma-mali", + .data = &soc_data_google_zumapro, + }, { .compatible = "google,zumapro-mali", .data = &soc_data_google_zumapro, diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 74fd917870..e58d851051 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -12,7 +12,7 @@ config EXYNOS_THERMAL data from the supported SoCs. config GS101_ACPM_THERMAL - tristate "Google gs101, Tensor G2 and Tensor G4 thermal sensors through ACPM" + tristate "Google gs101, Tensor G2, G3 and G4 thermal sensors through ACPM" depends on THERMAL_OF depends on EXYNOS_ACPM_PROTOCOL help diff --git a/drivers/thermal/samsung/gs101_acpm_tmu.c b/drivers/thermal/samsung/gs101_acpm_tmu.c index 7950e9b582..3a6a538990 100644 --- a/drivers/thermal/samsung/gs101_acpm_tmu.c +++ b/drivers/thermal/samsung/gs101_acpm_tmu.c @@ -17,8 +17,8 @@ #include /* - * The sensors: BIG, MID, LITTLE, G3D, ISP, TPU, and on gs201 and zumapro - * also AUR, in the firmware's order. + * The sensors: BIG, MID, LITTLE, G3D, ISP, TPU, and on gs201, zuma and + * zumapro also AUR, in the firmware's order. */ #define GS101_ACPM_TMU_MAX_SENSORS 7 @@ -115,6 +115,7 @@ static const struct gs101_tmu_data gs201_tmu_data = { .nr_sensors = 7, }; +/* zuma's TMU service is zumapro's: channel 9, the same seven sensors. */ static const struct gs101_tmu_data zumapro_tmu_data = { .acpm_chan = 9, .nr_sensors = 7, @@ -123,6 +124,7 @@ static const struct gs101_tmu_data zumapro_tmu_data = { static const struct of_device_id gs101_tmu_of_match[] = { { .compatible = "google,gs101-acpm-tmu", .data = &gs101_tmu_data }, { .compatible = "google,gs201-acpm-tmu", .data = &gs201_tmu_data }, + { .compatible = "google,zuma-acpm-tmu", .data = &zumapro_tmu_data }, { .compatible = "google,zumapro-acpm-tmu", .data = &zumapro_tmu_data }, { } }; diff --git a/include/dt-bindings/clock/google,zuma-acpm.h b/include/dt-bindings/clock/google,zuma-acpm.h new file mode 100644 index 0000000000..d4dfb8af8f --- /dev/null +++ b/include/dt-bindings/clock/google,zuma-acpm.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Device Tree binding constants for the clocks of the Google Tensor G3 + * (zuma) ACPM firmware. + */ + +#ifndef _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_ACPM_H +#define _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_ACPM_H + +/* DVFS domains, numbered as in the firmware messages (enum acpm_dvfs_id). */ +#define ZUMA_CLK_ACPM_DVFS_MIF 0 +#define ZUMA_CLK_ACPM_DVFS_INT 1 +#define ZUMA_CLK_ACPM_DVFS_CPUCL0 2 +#define ZUMA_CLK_ACPM_DVFS_CPUCL1 3 +#define ZUMA_CLK_ACPM_DVFS_CPUCL2 4 +#define ZUMA_CLK_ACPM_DVFS_DSU 5 +#define ZUMA_CLK_ACPM_DVFS_BCI 6 +#define ZUMA_CLK_ACPM_DVFS_G3D 7 +#define ZUMA_CLK_ACPM_DVFS_G3DL2 8 +#define ZUMA_CLK_ACPM_DVFS_TPU 9 +#define ZUMA_CLK_ACPM_DVFS_INTCAM 10 +#define ZUMA_CLK_ACPM_DVFS_TNR 11 +#define ZUMA_CLK_ACPM_DVFS_CAM 12 +#define ZUMA_CLK_ACPM_DVFS_MFC 13 +#define ZUMA_CLK_ACPM_DVFS_DISP 14 +#define ZUMA_CLK_ACPM_DVFS_AOC 15 +#define ZUMA_CLK_ACPM_DVFS_BW 16 + +/* + * The GPU as one clock: its rate is the shader (G3D) rate, and setting it + * also moves the top/L2 domain (G3DL2) to the level paired with it. + */ +#define ZUMA_CLK_ACPM_GPU 17 + +#endif /* _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_ACPM_H */ diff --git a/include/dt-bindings/clock/google,zuma.h b/include/dt-bindings/clock/google,zuma.h index 05db2859f4..a0f2e2f8a9 100644 --- a/include/dt-bindings/clock/google,zuma.h +++ b/include/dt-bindings/clock/google,zuma.h @@ -33,6 +33,21 @@ #define CLK_DOUT_PERIC0_NOC 26 #define CLK_DOUT_PERIC0_IP 27 +/* CMU_TOP: the G3D paths, and the shared PLL dividers they take. */ +#define CLK_SHARED0_D2 28 +#define CLK_SHARED0_D3 29 +#define CLK_SHARED1_D2 30 +#define CLK_SHARED1_D3 31 +#define CLK_MOUT_G3D_GLB 32 +#define CLK_MOUT_G3D_NOCD 33 +#define CLK_MOUT_G3D_SWITCH 34 +#define CLK_GOUT_G3D_GLB 35 +#define CLK_GOUT_G3D_NOCD 36 +#define CLK_GOUT_G3D_SWITCH 37 +#define CLK_DOUT_G3D_GLB 38 +#define CLK_DOUT_G3D_NOCD 39 +#define CLK_DOUT_G3D_SWITCH 40 + /* CMU_HSI0: USI2, the touchscreen's SPI, and USI3, the GNSS receiver's SPI. */ #define CLK_GOUT_HSI0_ALT 1 #define CLK_MOUT_HSI0_NOC_USER 2 @@ -104,4 +119,25 @@ #define CLK_GOUT_PERIC0_USI14_PCLK 7 #define CLK_GOUT_PERIC0_USI14_RSTNSYNC 8 +/* CMU_G3D: the GPU. */ +#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 + #endif /* _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_H */