Add Mali GPU support for Mediatek MT8370 SoC
Subsystems (5)
v4 cover Add Mali GPU support for Mediatek MT8370 SoC
This patchset adds the support of the ARM Mali G57 MC2 GPU (Valhall-JM, dual core), integrated in the Mediatek MT8370 SoC, to the panfrost driver and to the mt8370.dtsi include file.
I've tested this patchset on a Mediatek Genio 510 EVK board, with a kernel based on linux-next (tag: next-20250207) plus [1] patch (not needed for building, only for testing to avoid boot issues on this board).
The panfrost driver probed with the following messages:
``` panfrost 13000000.gpu: clock rate = 390000000 panfrost 13000000.gpu: mali-g57 id 0x9093 major 0x0 minor 0x0 status 0x0 panfrost 13000000.gpu: features: 00000000,000019f7, issues: 00000003, 80000400 panfrost 13000000.gpu: Features: L2:0x08130206 Shader:0x00000000 Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xff JS:0x7 panfrost 13000000.gpu: shader_present=0x5 l2_present=0x1 [drm] Initialized panfrost 1.3.0 for 13000000.gpu on minor 0 ```
[1] https://lore.kernel.org/all/[email protected]/
---
Changes in v4:
- Add warning comment in mt8370.dtsi about GPU node override
- Reword "dt-bindings: gpu: mali-bifrost: Add compatible for MT8370
SoC" commit message
- Add code-review trailers
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Rebased on linux-next (tag: next-20250207)
- Remove prerequisite change/patch ids
- Reword commit messages to better explicit compatible needs
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Rework "drm/panfrost: Add support for Mali on the MT8370 SoC" to avoid
data structure duplication, as requested by Krzysztof Kozlowski
- Reword commit messages to use imperative mood and make new compatible
need more explicit
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Louis-Alexis Eyraud (3):
dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC drm/panfrost: Add support for Mali on the MT8370 SoC
arm64: dts: mediatek: mt8370: Enable gpu support
.../devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++- arch/arm64/boot/dts/mediatek/mt8370.dtsi | 16 ++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + 3 files changed, 21 insertions(+), 1 deletion(-)
---
base-commit: ed58d103e6da15a442ff87567898768dc3a66987
change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d
Best regards,
Signature · 1 line
Louis-Alexis Eyraud <[email protected]>
PATCH v4 1/3 dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core). None of the already existing SoC specific compatibles is usable as fallback, as those either do not match the number of cores (and number of power domains), or are for a different GPU architecture.
--- Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +4 -1
@@ -37,6 +37,7 @@ properties: - enum: - mediatek,mt8188-mali - mediatek,mt8192-mali + - mediatek,mt8370-mali - const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable reg:
@@ -217,7 +218,9 @@ allOf: properties: compatible: contains: - const: mediatek,mt8186-mali + enum: + - mediatek,mt8186-mali + - mediatek,mt8370-mali then: properties: power-domains:
Signature · 1 line
2.48.1
Re: [PATCH v4 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
Quoted 8 lines · Louis-Alexis Eyraud
Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core). None of the already existing SoC specific compatibles is usable as fallback, as those either do not match the number of cores (and number of power domains), or are for a different GPU architecture.
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Louis-Alexis Eyraud <[email protected]>
PATCH v4 2/3 drm/panfrost: Add support for Mali on the MT8370 SoC
In reply to Louis-Alexis EyraudAdd a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core), with the same platform data as MT8186 (one regulator, two power domains).
Despite their different GPU architecture (making them not being compatible), the MT8186 platform data can still be used for MT8370 because it only describes supplies, pm_domains and enablement of power management features in the panfrost driver.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +1 -0
@@ -859,6 +859,7 @@ static const struct of_device_id dt_match[] = { { .compatible = "mediatek,mt8186-mali", .data = &mediatek_mt8186_data }, { .compatible = "mediatek,mt8188-mali", .data = &mediatek_mt8188_data }, { .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data }, + { .compatible = "mediatek,mt8370-mali", .data = &mediatek_mt8186_data }, {} };MODULE_DEVICE_TABLE (of, dt_match);
Signature · 1 line
2.48.1
PATCH v4 3/3 arm64: dts: mediatek: mt8370: Enable gpu support
In reply to Louis-Alexis EyraudAdd a new gpu node in mt8370.dtsi to enable support for the ARM Mali G57 MC2 GPU (Valhall-JM) found on the MT8370 SoC, using the Panfrost driver.
On a Mediatek Genio 510 EVK board, the panfrost driver probed with the following message:
``` panfrost 13000000.gpu: clock rate = 390000000 panfrost 13000000.gpu: mali-g57 id 0x9093 major 0x0 minor 0x0 status 0x0 panfrost 13000000.gpu: features: 00000000,000019f7, issues: 00000003, 80000400 panfrost 13000000.gpu: Features: L2:0x08130206 Shader:0x00000000 Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xff JS:0x7 panfrost 13000000.gpu: shader_present=0x5 l2_present=0x1 [drm] Initialized panfrost 1.3.0 for 13000000.gpu on minor 0 ```
--- arch/arm64/boot/dts/mediatek/mt8370.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/mediatek/mt8370.dtsi +16 -0
@@ -59,6 +59,22 @@ &cpu_little3_cooling_map0 { <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; +/* + * Please note that overriding compatibles is a discouraged practice and is a + * clear indication of nodes not being, well, compatible! + * + * This is a special case, where the GPU is the same as MT8188, but with one + * of the cores fused out in this lower-binned SoC. + */ +&gpu { + compatible = "mediatek,mt8370-mali", "arm,mali-valhall-jm"; + + power-domains = <&spm MT8188_POWER_DOMAIN_MFG2>, + <&spm MT8188_POWER_DOMAIN_MFG3>; + + power-domain-names = "core0", "core1"; +}; + &ppi_cluster0 { affinity = <&cpu0 &cpu1 &cpu2 &cpu3>; };
Signature · 1 line
2.48.1