]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm64: dts: amlogic: meson-gx: add the Mali-450 OPP table and use DVFS
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Sun, 19 Jul 2020 17:32:11 +0000 (19:32 +0200)
committerKevin Hilman <khilman@baylibre.com>
Tue, 21 Jul 2020 21:12:37 +0000 (14:12 -0700)
Add the OPP table for the Mali-450 GPU and drop the hardcoded initial
clock configuration. This enables GPU DVFS and thus saves power when the
GPU is not in use while still being able switch to a higher clock on
demand.

Set the GP0_PLL clock to 744MHz (which is the only frequency which
cannot be derived from the FCLK dividers) as the clock driver avoids
setting the parent clock rates so the MPLL clocks aren't changed (as
these are reserved for audio). The only exception to this is the GXL
S805X package because the 744MHz OPP isn't working correctly there.

While here, make most of meson-gxl-mali re-usable to reduce the amount
of duplicate code between GXBB and GXL. This is more important now as we
don't want to duplicate the GPU OPP table.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Link: https://lore.kernel.org/r/20200719173213.639540-2-martin.blumenstingl@googlemail.com
arch/arm64/boot/dts/amlogic/meson-gx-mali450.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-s805x.dtsi

diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-mali450.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-mali450.dtsi
new file mode 100644 (file)
index 0000000..f9771b5
--- /dev/null
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 BayLibre SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+/ {
+       gpu_opp_table: opp-table {
+               compatible = "operating-points-v2";
+
+               opp-125000000 {
+                       opp-hz = /bits/ 64 <125000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp-250000000 {
+                       opp-hz = /bits/ 64 <250000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp-285714285 {
+                       opp-hz = /bits/ 64 <285714285>;
+                       opp-microvolt = <950000>;
+               };
+               opp-400000000 {
+                       opp-hz = /bits/ 64 <400000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp-500000000 {
+                       opp-hz = /bits/ 64 <500000000>;
+                       opp-microvolt = <950000>;
+               };
+               opp-666666666 {
+                       opp-hz = /bits/ 64 <666666666>;
+                       opp-microvolt = <950000>;
+               };
+               opp-744000000 {
+                       opp-hz = /bits/ 64 <744000000>;
+                       opp-microvolt = <950000>;
+               };
+       };
+};
+
+&apb {
+       mali: gpu@c0000 {
+               compatible = "arm,mali-450";
+               reg = <0x0 0xc0000 0x0 0x40000>;
+               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "gp", "gpmmu", "pp", "pmu",
+                       "pp0", "ppmmu0", "pp1", "ppmmu1",
+                       "pp2", "ppmmu2";
+               operating-points-v2 = <&gpu_opp_table>;
+       };
+};
index ea50dd434887eddbc0aa015707d4e6f3517be7f9..7c029f552a23b3d5312c5c489425e6f848aa1b94 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include "meson-gx.dtsi"
+#include "meson-gx-mali450.dtsi"
 #include <dt-bindings/gpio/meson-gxbb-gpio.h>
 #include <dt-bindings/reset/amlogic,meson-gxbb-reset.h>
 #include <dt-bindings/clock/gxbb-clkc.h>
        };
 };
 
-&apb {
-       mali: gpu@c0000 {
-               compatible = "amlogic,meson-gxbb-mali", "arm,mali-450";
-               reg = <0x0 0xc0000 0x0 0x40000>;
-               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
-               interrupt-names = "gp", "gpmmu", "pp", "pmu",
-                       "pp0", "ppmmu0", "pp1", "ppmmu1",
-                       "pp2", "ppmmu2";
-               clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
-               clock-names = "bus", "core";
-
-               /*
-                * Mali clocking is provided by two identical clock paths
-                * MALI_0 and MALI_1 muxed to a single clock by a glitch
-                * free mux to safely change frequency while running.
-                */
-               assigned-clocks = <&clkc CLKID_GP0_PLL>,
-                                 <&clkc CLKID_MALI_0_SEL>,
-                                 <&clkc CLKID_MALI_0>,
-                                 <&clkc CLKID_MALI>; /* Glitch free mux */
-               assigned-clock-parents = <0>, /* Do Nothing */
-                                        <&clkc CLKID_GP0_PLL>,
-                                        <0>, /* Do Nothing */
-                                        <&clkc CLKID_MALI_0>;
-               assigned-clock-rates = <744000000>,
-                                      <0>, /* Do Nothing */
-                                      <744000000>,
-                                      <0>; /* Do Nothing */
-       };
-};
-
 &cbus {
        spifc: spi@8c80 {
                compatible = "amlogic,meson-gxbb-spifc";
        clocks = <&clkc CLKID_I2C>;
 };
 
+&mali {
+       compatible = "amlogic,meson-gxbb-mali", "arm,mali-450";
+
+       clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
+       clock-names = "bus", "core";
+
+       assigned-clocks = <&clkc CLKID_GP0_PLL>;
+       assigned-clock-rates = <744000000>;
+};
+
 &periphs {
        pinctrl_periphs: pinctrl@4b0 {
                compatible = "amlogic,meson-gxbb-periphs-pinctrl";
index 6aaafff674f97f56625c2da8ea6a5b7dd10eb2d8..478e755cc87c7d228052039ba8605e41ea3e144d 100644 (file)
@@ -4,42 +4,14 @@
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  */
 
-&apb {
-       mali: gpu@c0000 {
-               compatible = "amlogic,meson-gxl-mali", "arm,mali-450";
-               reg = <0x0 0xc0000 0x0 0x40000>;
-               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
-               interrupt-names = "gp", "gpmmu", "pp", "pmu",
-                       "pp0", "ppmmu0", "pp1", "ppmmu1",
-                       "pp2", "ppmmu2";
-               clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
-               clock-names = "bus", "core";
+#include "meson-gx-mali450.dtsi"
 
-               /*
-                * Mali clocking is provided by two identical clock paths
-                * MALI_0 and MALI_1 muxed to a single clock by a glitch
-                * free mux to safely change frequency while running.
-                */
-               assigned-clocks = <&clkc CLKID_GP0_PLL>,
-                                 <&clkc CLKID_MALI_0_SEL>,
-                                 <&clkc CLKID_MALI_0>,
-                                 <&clkc CLKID_MALI>; /* Glitch free mux */
-               assigned-clock-parents = <0>, /* Do Nothing */
-                                        <&clkc CLKID_GP0_PLL>,
-                                        <0>, /* Do Nothing */
-                                        <&clkc CLKID_MALI_0>;
-               assigned-clock-rates = <744000000>,
-                                      <0>, /* Do Nothing */
-                                      <744000000>,
-                                      <0>; /* Do Nothing */
-       };
+&mali {
+       compatible = "amlogic,meson-gxl-mali", "arm,mali-450";
+
+       clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
+       clock-names = "bus", "core";
+
+       assigned-clocks = <&clkc CLKID_GP0_PLL>;
+       assigned-clock-rates = <744000000>;
 };
index f9d705648426e78995525c579e18ff9cce3d3e78..29975849822c873c96ded497d2ba5bf9b230a307 100644 (file)
 };
 
 /* The S805X Package doesn't seem to handle the 744MHz OPP correctly */
+&gpu_opp_table {
+       opp-744000000 {
+               status = "disabled";
+       };
+};
+
 &mali {
-       assigned-clocks = <&clkc CLKID_MALI_0_SEL>,
-                         <&clkc CLKID_MALI_0>,
-                         <&clkc CLKID_MALI>; /* Glitch free mux */
-       assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
-                                <0>, /* Do Nothing */
-                                <&clkc CLKID_MALI_0>;
-       assigned-clock-rates = <0>, /* Do Nothing */
-                              <666666666>,
-                              <0>; /* Do Nothing */
+       /delete-property/ assigned-clocks;
+       /delete-property/ assigned-clock-rates;
 };