Skip to contentSkip to conversation

Add Support for MediaTek MT8192 APU Power

PATCH Superseded Flora Fu 2 participants 18 messages Apr 7, 2021 – Apr 16, 2021

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Flora Fu

author
#0 lore raw

cover Add Support for MediaTek MT8192 APU Power

The MediaTek AI Processing Unit (APU) is a proprietary hardware in the SoC to support AI operations.
The series is to create apusys in the SoC folder for developing the related drivers. Add the apu clocks, basic apu nodes and the power domain to provide the power controller of APU subsystem.

This series is based on MT8192 clock[1] and PMIC[2] patches.
[1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=454523
[2] https://patchwork.kernel.org/project/linux-mediatek/list/?series=458733

Flora Fu (8):
dt-bindings: clock: Add MT8192 APU clock bindings
clk: mediatek: mt8192: Add APU clocks support
dt-bindings: apu: Add MT8192 APU power domain
dt-bindings: arm: mediatek: Add new document bindings for APU
dt-bindings: soc: mediatek: apusys: Add new document for APU power
domain
soc: mediatek: apu: Add apusys and add apu power domain driver
arm64: dts: mt8192: Add APU node
arm64: dts: mt8192: Add APU power domain node

 .../arm/mediatek/mediatek,apusys.yaml         |  56 ++
 .../soc/mediatek/mediatek,apu-pm.yaml         | 146 +++++
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts   |   7 +
 arch/arm64/boot/dts/mediatek/mt8192.dtsi      |  46 ++
 drivers/clk/mediatek/clk-mt8192.c             |  91 +++
 drivers/soc/mediatek/Kconfig                  |  10 +
 drivers/soc/mediatek/Makefile                 |   1 +
 drivers/soc/mediatek/apusys/Makefile          |   2 +
 drivers/soc/mediatek/apusys/mtk-apu-pm.c      | 613 ++++++++++++++++++
 include/dt-bindings/clock/mt8192-clk.h        |  14 +-
 include/dt-bindings/power/mt8192-apu-power.h  |  11 +
 11 files changed, 995 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.yaml
 create mode 100644 drivers/soc/mediatek/apusys/Makefile
 create mode 100644 drivers/soc/mediatek/apusys/mtk-apu-pm.c
 create mode 100644 include/dt-bindings/power/mt8192-apu-power.h
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH 1/8 dt-bindings: clock: Add MT8192 APU clock bindings

Add clock bindings for APU on MT8192.

---
 include/dt-bindings/clock/mt8192-clk.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
include/dt-bindings/clock/mt8192-clk.h +12 -2
index ece5b4c0356c..71e07858f5dc 100644
@@ -164,7 +164,15 @@
 #define CLK_TOP_APLL12_DIV9		152
 #define CLK_TOP_SSUSB_TOP_REF		153
 #define CLK_TOP_SSUSB_PHY_REF		154
-#define CLK_TOP_NR_CLK			155
+#define CLK_TOP_DSP_SEL			155
+#define CLK_TOP_DSP1_SEL		156
+#define CLK_TOP_DSP1_NPUPLL_SEL		157
+#define CLK_TOP_DSP2_SEL		158
+#define CLK_TOP_DSP2_NPUPLL_SEL		159
+#define CLK_TOP_DSP5_SEL		160
+#define CLK_TOP_DSP5_APUPLL_SEL		161
+#define CLK_TOP_IPU_IF_SEL		162
+#define CLK_TOP_NR_CLK			163
 
 /* INFRACFG */
 
@@ -309,7 +317,9 @@
 #define CLK_APMIXED_APLL1		8
 #define CLK_APMIXED_APLL2		9
 #define CLK_APMIXED_MIPID26M		10
-#define CLK_APMIXED_NR_CLK		11
+#define CLK_APMIXED_APUPLL		11
+#define CLK_APMIXED_NPUPLL		12
+#define CLK_APMIXED_NR_CLK		13
 
 /* SCP_ADSP */
 
Signature · 1 line
2.18.0
author
#3 lore raw

PATCH 2/8 clk: mediatek: mt8192: Add APU clocks support

In reply to Flora Fu

Add APU clocks support on MT8192.

---
 drivers/clk/mediatek/clk-mt8192.c | 91 +++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
drivers/clk/mediatek/clk-mt8192.c +91 -0
index bf6a2084a348..4eb61f006306 100644
@@ -244,6 +244,65 @@ static const char * const ccu_parents[] = {
 	"univpll_d6_d2"
 };
 
+static const char * const dsp_parents[] = {
+	"clk26m",
+	"univpll_d6_d2",
+	"univpll_d4_d2",
+	"univpll_d5",
+	"univpll_d4",
+	"mmpll_d4",
+	"mainpll_d3",
+	"univpll_d3"
+};
+
+static const char * const dsp1_parents[] = {
+	"clk26m",
+	"npupll_ck",
+	"mainpll_d4_d2",
+	"univpll_d5",
+	"univpll_d4",
+	"mainpll_d3",
+	"univpll_d3",
+	"apupll_ck"
+};
+
+static const char * const dsp1_npupll_parents[] = {
+	"dsp1_sel",
+	"npupll_ck"
+};
+
+static const char * const dsp2_parents[] = {
+	"clk26m",
+	"npupll_ck",
+	"mainpll_d4_d2",
+	"univpll_d5",
+	"univpll_d4",
+	"mainpll_d3",
+	"univpll_d3",
+	"apupll_ck"
+};
+
+static const char * const dsp2_npupll_parents[] = {
+	"dsp2_sel",
+	"npupll_ck"
+};
+
+static const char * const dsp5_parents[] = {
+	"clk26m",
+	"apupll_ck",
+	"univpll_d4_d2",
+	"mainpll_d4",
+	"univpll_d4",
+	"mmpll_d4",
+	"mainpll_d3",
+	"univpll_d3"
+};
+
+static const char * const dsp5_apupll_parents[] = {
+	"dsp5_sel",
+	"apupll_ck"
+};
+
 static const char * const dsp7_parents[] = {
 	"clk26m",
 	"mainpll_d4_d2",
@@ -255,6 +314,17 @@ static const char * const dsp7_parents[] = {
 	"mmpll_d4"
 };
 
+static const char * const ipu_if_parents[] = {
+	"clk26m",
+	"univpll_d6_d2",
+	"mainpll_d4_d2",
+	"univpll_d4_d2",
+	"univpll_d5",
+	"mainpll_d4",
+	"tvdpll_ck",
+	"univpll_d4"
+};
+
 static const char * const mfg_ref_parents[] = {
 	"clk26m",
 	"clk26m",
@@ -734,9 +804,26 @@ static const struct mtk_mux top_mtk_muxes[] = {
 		cam_parents, 0x030, 0x034, 0x038, 16, 4, 23, 0x004, 10),
 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CCU_SEL, "ccu_sel",
 		ccu_parents, 0x030, 0x034, 0x038, 24, 4, 31, 0x004, 11),
+	/* CLK_CFG_3 */
+	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP_SEL, "dsp_sel",
+		dsp_parents, 0x040, 0x044, 0x048, 0, 3, 7, 0x004, 12),
+	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP1_SEL, "dsp1_sel",
+		dsp1_parents, 0x040, 0x044, 0x048, 8, 3, 15, 0x004, 13),
+	MUX_CLR_SET_UPD(CLK_TOP_DSP1_NPUPLL_SEL, "dsp1_npupll_sel",
+		dsp1_npupll_parents, 0x040, 0x044, 0x048, 11, 1, -1, -1),
+	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP2_SEL, "dsp2_sel",
+		dsp2_parents, 0x040, 0x044, 0x048, 16, 3, 23, 0x004, 14),
+	MUX_CLR_SET_UPD(CLK_TOP_DSP2_NPUPLL_SEL, "dsp2_npupll_sel",
+		dsp2_npupll_parents, 0x040, 0x044, 0x048, 19, 1, -1, -1),
+	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP5_SEL, "dsp5_sel",
+		dsp5_parents, 0x040, 0x044, 0x048, 24, 3, 31, 0x004, 15),
+	MUX_CLR_SET_UPD(CLK_TOP_DSP5_APUPLL_SEL, "dsp5_apupll_sel",
+		dsp5_apupll_parents, 0x040, 0x044, 0x048, 27, 1, -1, -1),
 	/* CLK_CFG_4 */
 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP7_SEL, "dsp7_sel",
 		dsp7_parents, 0x050, 0x054, 0x058, 0, 3, 7, 0x004, 16),
+	MUX_GATE_CLR_SET_UPD(CLK_TOP_IPU_IF_SEL, "ipu_if_sel",
+		ipu_if_parents, 0x050, 0x054, 0x058, 8, 3, 15, 0x004, 17),
 	MUX_GATE_CLR_SET_UPD(CLK_TOP_MFG_REF_SEL, "mfg_ref_sel",
 		mfg_ref_parents, 0x050, 0x054, 0x058, 16, 2, 23, 0x004, 18),
 	MUX_CLR_SET_UPD(CLK_TOP_MFG_PLL_SEL, "mfg_pll_sel",
@@ -1175,6 +1262,10 @@ static const struct mtk_pll_data plls[] = {
 		0, 0, 32, 0x031c, 24, 0x0040, 0x000c, 0, 0x0320, 0),
 	PLL_B(CLK_APMIXED_APLL2, "apll2", 0x032c, 0x033c, 0x00000000,
 		0, 0, 32, 0x0330, 24, 0, 0, 0, 0x0334, 0),
+	PLL_B(CLK_APMIXED_APUPLL, "apupll", 0x03a0, 0x03ac, 0xff000001,
+		HAVE_RST_BAR, BIT(23), 22, 0x03a4, 24, 0, 0, 0, 0x03a4, 0),
+	PLL_B(CLK_APMIXED_NPUPLL, "npupll", 0x03b4, 0x03c0, 0x00000001,
+		0, 0, 22, 0x03b8, 24, 0, 0, 0, 0x03b8, 0),
 };
 
 static struct clk_onecell_data *top_clk_data;
Signature · 1 line
2.18.0
author
#4 lore raw

PATCH 3/8 dt-bindings: apu: Add MT8192 APU power domain

In reply to Flora Fu

Create MT8192 APU power domain bindings.
Add top power domain id.

---
 include/dt-bindings/power/mt8192-apu-power.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 include/dt-bindings/power/mt8192-apu-power.h
include/dt-bindings/power/mt8192-apu-power.h new file +11 -0
new file mode 100644
index 000000000000..b821bd4811a6
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (c) 2021 MediaTek Inc.
+ */
+
+#ifndef _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+#define _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+
+#define MT8192_POWER_DOMAIN_APUSYS_TOP	0
+
+#endif
Signature · 1 line
2.18.0
author
#12 lore raw

PATCH 5/8 dt-bindings: soc: mediatek: apusys: Add new document for APU power domain

In reply to Flora Fu

Document the bindings for APU power domain on MediaTek SoC.

---
 .../soc/mediatek/mediatek,apu-pm.yaml         | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.yaml
Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.yaml new file +146 -0
new file mode 100644
index 000000000000..c99e812977f9
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,apu-pm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek APU Power Domains
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description: |
+  Mediatek AI Process Unit (APU) include support for power domains which can be
+  powered up/down by software.
+  APU subsys belonging to a power domain should contain a 'power-domains'
+  property that is a phandle for apuspm node representing the domain.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu-pm
+      - const: syscon
+
+  reg:
+    description: Address range of the APU power domain controller.
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  '#power-domain-cells':
+    const: 1
+
+  vsram-supply:
+    description: apu sram regulator supply.
+
+  mediatek,scpsys:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to the device containing the scpsys register range.
+
+  mediatek,apu_conn:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to the device containing the scpsys apu conn register range.
+
+  mediatek,apu_conn1:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to the device containing the scpsys apu conn1 register range.
+
+  mediatek,apu_vcore:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to the device containing the scpsys apu vcore register range.
+
+patternProperties:
+  "^power-domain@[0-9a-f]+$":
+    type: object
+    description: |
+      Represents the power domains within the power controller node as
+      documented in Documentation/devicetree/bindings/power/power-domain.yaml.
+
+    properties:
+      reg:
+        description: |
+          Power domain index. Valid values are defined in:
+          "include/dt-bindings/power/mt8182-apu-power.h"
+        maxItems: 1
+
+      '#power-domain-cells':
+        description: |
+          Must be 0 for nodes representing a single PM domain and 1 for nodes
+          providing multiple PM.
+
+      clocks:
+        description: |
+          List of phandles of clocks list. Specify by order according to
+          power-up sequence.
+
+      clock-names:
+        description: |
+          List of names of clocks. Specify by order according to power-up
+          sequence.
+
+      assigned-clocks:
+        maxItems: 2
+
+      assigned-clock-parents:
+        maxItems: 2
+
+      domain-supply:
+        description: domain regulator supply.
+
+    required:
+      - reg
+      - '#power-domain-cells'
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - '#power-domain-cells'
+  - vsram-supply
+  - mediatek,scpsys
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/mt8192-clk.h>
+    #include <dt-bindings/power/mt8192-apu-power.h>
+    apuspm: power-domain@190f0000 {
+        compatible = "mediatek,mt8192-apu-pm", "syscon";
+        reg = <0x190f0000 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #power-domain-cells = <1>;
+        vsram-supply = <&mt6359_vsram_md_ldo_reg>;
+        mediatek,scpsys = <&scpsys>;
+        mediatek,apu_conn = <&apu_conn>;
+        mediatek,apu_vcore = <&apu_vcore>;
+
+        power-domain@MT8192_POWER_DOMAIN_APUSYS_TOP {
+            reg = <MT8192_POWER_DOMAIN_APUSYS_TOP>;
+            #power-domain-cells = <0>;
+            clocks = <&topckgen CLK_TOP_DSP_SEL>,
+                     <&topckgen CLK_TOP_IPU_IF_SEL>,
+                     <&clk26m>,
+                     <&topckgen CLK_TOP_UNIVPLL_D6_D2>;
+            clock-names = "clk_top_conn",
+                          "clk_top_ipu_if",
+                          "clk_off",
+                          "clk_on_default";
+            assigned-clocks = <&topckgen CLK_TOP_DSP_SEL>,
+                              <&topckgen CLK_TOP_IPU_IF_SEL>;
+            assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_D6_D2>,
+                                     <&topckgen CLK_TOP_UNIVPLL_D6_D2>;
+            domain-supply = <&mt6359_vproc1_buck_reg>;
+        };
+    };
Signature · 1 line
2.18.0
author
#16 lore raw

PATCH 7/8 arm64: dts: mt8192: Add APU node

In reply to Flora Fu

Add APU node to MT8192.

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +17 -0
index eb17274c3719..b1467ccbe5aa 100644
@@ -1016,6 +1016,23 @@
 			#clock-cells = <1>;
 		};
 
+		apu_mbox: apu_mbox@19000000 {
+			compatible = "mediatek,mt8192-apu_mbox", "syscon";
+			reg = <0 0x19000000 0 0x1000>;
+		};
+
+		apu_conn: apu_conn@19020000 {
+			compatible = "mediatek,mt8192-apu_conn", "syscon";
+			reg = <0 0x19020000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apu_vcore: apu_vcore@19029000 {
+			compatible = "mediatek,mt8192-apu_vcore", "syscon";
+			reg = <0 0x19029000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
 		larb13: larb@1a001000 {
 			compatible = "mediatek,mt8192-smi-larb";
 			reg = <0 0x1a001000 0 0x1000>;
Signature · 1 line
2.18.0
author
#7 lore raw

PATCH 4/8 dt-bindings: arm: mediatek: Add new document bindings for APU

In reply to Flora Fu

Document the apusys bindings.

---
 .../arm/mediatek/mediatek,apusys.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +56 -0
new file mode 100644
index 000000000000..dc04a46f1bad
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/mediatek/mediatek,apusys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek APUSYS Controller
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description:
+  The Mediatek apusys controller provides functional configurations and clocks
+  to the system.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu_mbox
+          - mediatek,mt8192-apu_conn
+          - mediatek,mt8192-apu_vcore
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    apu_mbox: apu_mbox@19000000 {
+        compatible = "mediatek,mt8192-apu_mbox", "syscon";
+        reg = <0x19000000 0x1000>;
+    };
+
+  - |
+    apu_conn: apu_conn@19020000 {
+        compatible = "mediatek,mt8192-apu_conn", "syscon";
+        reg = <0x19020000 0x1000>;
+        #clock-cells = <1>;
+    };
+
+  - |
+    apu_vcore: apu_vcore@19029000 {
+        compatible = "mediatek,mt8192-apu_vcore", "syscon";
+        reg = <0x19029000 0x1000>;
+        #clock-cells = <1>;
+    };
Signature · 1 line
2.18.0
author
#15 lore raw

PATCH 6/8 soc: mediatek: apu: Add apusys and add apu power domain driver

In reply to Flora Fu

Add the apusys in soc.
Add driver for apu power domains.

---
 drivers/soc/mediatek/Kconfig             |  10 +
 drivers/soc/mediatek/Makefile            |   1 +
 drivers/soc/mediatek/apusys/Makefile     |   2 +
 drivers/soc/mediatek/apusys/mtk-apu-pm.c | 613 +++++++++++++++++++++++
 4 files changed, 626 insertions(+)
 create mode 100644 drivers/soc/mediatek/apusys/Makefile
 create mode 100644 drivers/soc/mediatek/apusys/mtk-apu-pm.c
drivers/soc/mediatek/Kconfig +10 -0
index fdd8bc08569e..76ee7e354b27 100644
@@ -5,6 +5,16 @@
 menu "MediaTek SoC drivers"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
 
+config MTK_APUSYS
+	bool "MediaTek APUSYS Support"
+	select REGMAP
+	select PM_GENERIC_DOMAINS if PM
+	help
+	  Say yes here to add support for the MediaTek AI Processing Unit
+	  Subsystem(APUSYS).
+	  The APUSYS is a proprietary hardware in SoC to support AI
+	  operations.
+
 config MTK_CMDQ
 	tristate "MediaTek CMDQ Support"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/soc/mediatek/Makefile +1 -0
index c916b6799baa..4ca2d59b75cb 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_MTK_APUSYS) += apusys/
 obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
 obj-$(CONFIG_MTK_DEVAPC) += mtk-devapc.o
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
drivers/soc/mediatek/apusys/Makefile new file +2 -0
new file mode 100644
index 000000000000..01c339e35b80
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_MTK_APUSYS) += mtk-apu-pm.o
drivers/soc/mediatek/apusys/mtk-apu-pm.c new file +613 -0

613 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#17 lore raw

PATCH 8/8 arm64: dts: mt8192: Add APU power domain node

In reply to Flora Fu

Add APU power domain node to MT8192.

---
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts |  7 +++++
 arch/arm64/boot/dts/mediatek/mt8192.dtsi    | 29 +++++++++++++++++++++
 2 files changed, 36 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192-evb.dts +7 -0
index 1769f3a9b510..9e89efb3dc8a 100644
@@ -65,3 +65,10 @@
 &mt6359_vrf12_ldo_reg {
 	regulator-always-on;
 };
+
+&apuspm {
+	vsram-supply = <&mt6359_vsram_md_ldo_reg>;
+	power-domain@MT8192_POWER_DOMAIN_APUSYS_TOP {
+		domain-supply = <&mt6359_vproc1_buck_reg>;
+	};
+};
arch/arm64/boot/dts/mediatek/mt8192.dtsi +29 -0
index b1467ccbe5aa..546c058ef560 100644
@@ -11,6 +11,7 @@
 #include <dt-bindings/memory/mt8192-larb-port.h>
 #include <dt-bindings/pinctrl/mt8192-pinfunc.h>
 #include <dt-bindings/power/mt8192-power.h>
+#include <dt-bindings/power/mt8192-apu-power.h>
 
 / {
 	compatible = "mediatek,mt8192";
@@ -1033,6 +1034,34 @@
 			#clock-cells = <1>;
 		};
 
+		apuspm: power-domain@190f0000 {
+			compatible = "mediatek,mt8192-apu-pm", "syscon";
+			reg = <0 0x190f0000 0 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			#power-domain-cells = <1>;
+			mediatek,scpsys = <&scpsys>;
+			mediatek,apu_conn = <&apu_conn>;
+			mediatek,apu_vcore = <&apu_vcore>;
+
+			power-domain@MT8192_POWER_DOMAIN_APUSYS_TOP {
+				reg = <MT8192_POWER_DOMAIN_APUSYS_TOP>;
+				#power-domain-cells = <0>;
+				clocks = <&topckgen CLK_TOP_DSP_SEL>,
+					 <&topckgen CLK_TOP_IPU_IF_SEL>,
+					 <&clk26m>,
+					 <&topckgen CLK_TOP_UNIVPLL_D6_D2>;
+				clock-names = "clk_top_conn",
+					      "clk_top_ipu_if",
+					      "clk_off",
+					      "clk_on_default";
+				assigned-clocks = <&topckgen CLK_TOP_DSP_SEL>,
+						  <&topckgen CLK_TOP_IPU_IF_SEL>;
+				assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_D6_D2>,
+							 <&topckgen CLK_TOP_UNIVPLL_D6_D2>;
+			};
+		};
+
 		larb13: larb@1a001000 {
 			compatible = "mediatek,mt8192-smi-larb";
 			reg = <0 0x1a001000 0 0x1000>;
Signature · 1 line
2.18.0
maintainer
#13 lore raw

Re: [PATCH 5/8] dt-bindings: soc: mediatek: apusys: Add new document for APU power domain

In reply to Flora Fu
Quoted 8 lines · Flora Fu

Document the bindings for APU power domain on MediaTek SoC.

---
 .../soc/mediatek/mediatek,apu-pm.yaml         | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.example.dts:19:18: fatal error: dt-bindings/clock/mt8192-clk.h: No such file or directory
19 | #include <dt-bindings/clock/mt8192-clk.h>

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
make[1]: *** [scripts/Makefile.lib:377: Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1414: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1463115

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

author
#14 lore raw

Re: [PATCH 5/8] dt-bindings: soc: mediatek: apusys: Add new document for APU power domain

Hi, Rob,

The error is resulted from some un-merged patch.

Please note that the patch depends MT8192 clock patches which haven't yet been accepted.
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

Thanks for your review.

Quoted 37 lines · Rob Herring
Quoted 8 lines · Flora Fu

Document the bindings for APU power domain on MediaTek SoC.

---
 .../soc/mediatek/mediatek,apu-pm.yaml         | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.example.dts:19:18: fatal error: dt-bindings/clock/mt8192-clk.h: No such file or directory
19 | #include <dt-bindings/clock/mt8192-clk.h>

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
make[1]: *** [scripts/Makefile.lib:377: Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pm.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1414: dt_binding_check] Error 2

See https://urldefense.com/v3/__https://patchwork.ozlabs.org/patch/1463115__;!!CTRNKA9wMg0ARbw!0XUn1LcNHfvUShNClpM_yH73TAR9qdm29SZMckasoCQ8UzeKS-vZW0QUu3Ssn-s6$

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

maintainer
#5 lore raw

Re: [PATCH 3/8] dt-bindings: apu: Add MT8192 APU power domain

In reply to Flora Fu
Quoted 15 lines · Flora Fu

Create MT8192 APU power domain bindings.
Add top power domain id.

---
 include/dt-bindings/power/mt8192-apu-power.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 include/dt-bindings/power/mt8192-apu-power.h
include/dt-bindings/power/mt8192-apu-power.h new file +0 -0
new file mode 100644
index 000000000000..b821bd4811a6

include/dt-bindings/power/mt8192-apu-power.h line 9

Quoted 9 lines
include/dt-bindings/power/mt8192-apu-power.h new file +9 -0
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (c) 2021 MediaTek Inc.
+ */
+
+#ifndef _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+#define _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+
+#define MT8192_POWER_DOMAIN_APUSYS_TOP	0

Really, you don't know what the other power domains are? Please make this as complete as possible. These headers create a merge mess.

Rob

maintainer
#8 lore raw

Re: [PATCH 4/8] dt-bindings: arm: mediatek: Add new document bindings for APU

In reply to Flora Fu
Quoted 26 lines · Flora Fu

Document the apusys bindings.

---
 .../arm/mediatek/mediatek,apusys.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +12 -0
new file mode 100644
index 000000000000..dc04a46f1bad
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/mediatek/mediatek,apusys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek APUSYS Controller
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description:

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +10 -0
+  The Mediatek apusys controller provides functional configurations and clocks
+  to the system.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu_mbox
+          - mediatek,mt8192-apu_conn
+          - mediatek,mt8192-apu_vcore

s/_/-/

Quoted 7 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +7 -0
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 39

Quoted 10 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +10 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    apu_mbox: apu_mbox@19000000 {

mailbox@...? Is this a mailbox provider?

Quoted 20 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +17 -0
+        compatible = "mediatek,mt8192-apu_mbox", "syscon";
+        reg = <0x19000000 0x1000>;
+    };
+
+  - |
+    apu_conn: apu_conn@19020000 {
+        compatible = "mediatek,mt8192-apu_conn", "syscon";
+        reg = <0x19020000 0x1000>;
+        #clock-cells = <1>;
+    };
+
+  - |
+    apu_vcore: apu_vcore@19029000 {
+        compatible = "mediatek,mt8192-apu_vcore", "syscon";
+        reg = <0x19029000 0x1000>;
+        #clock-cells = <1>;
+    };
Signature · 1 line
2.18.0
author
#9 lore raw

Re: [PATCH 4/8] dt-bindings: arm: mediatek: Add new document bindings for APU

Quoted 31 lines · Rob Herring
Quoted 30 lines · Flora Fu

Document the apusys bindings.

---
 .../arm/mediatek/mediatek,apusys.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +16 -0
new file mode 100644
index 000000000000..dc04a46f1bad
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: https://urldefense.com/v3/__http://devicetree.org/schemas/arm/mediatek/mediatek,apusys.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrAYYvZWcw$ 
+$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrARlhCQ0w$ 
+
+title: MediaTek APUSYS Controller
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description:
+  The Mediatek apusys controller provides functional configurations and clocks
+  to the system.
+
+properties:
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 22

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +6 -0
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu_mbox
+          - mediatek,mt8192-apu_conn
+          - mediatek,mt8192-apu_vcore

s/_/-/

OK. I will update expression strings in the next version.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +11 -0
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 39

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +6 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    apu_mbox: apu_mbox@19000000 {

mailbox@...? Is this a mailbox provider?

Yes, the apu_mbox is the for setup mailbox in the APU hardware.

Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +17 -0
+        compatible = "mediatek,mt8192-apu_mbox", "syscon";
+        reg = <0x19000000 0x1000>;
+    };
+
+  - |
+    apu_conn: apu_conn@19020000 {
+        compatible = "mediatek,mt8192-apu_conn", "syscon";
+        reg = <0x19020000 0x1000>;
+        #clock-cells = <1>;
+    };
+
+  - |
+    apu_vcore: apu_vcore@19029000 {
+        compatible = "mediatek,mt8192-apu_vcore", "syscon";
+        reg = <0x19029000 0x1000>;
+        #clock-cells = <1>;
+    };
Signature · 1 line
2.18.0
author
#6 lore raw

Re: [PATCH 3/8] dt-bindings: apu: Add MT8192 APU power domain

In reply to Rob Herring

Hi, Rob,

In mt8192 hardware, we only control top power domain in kernel. It is unnecessary to create a specific header just for such purpose. I will update the patch in the next version.
Thanks for your review.

Thanks,
Flora

Quoted 30 lines · Rob Herring
Quoted 15 lines · Flora Fu

Create MT8192 APU power domain bindings.
Add top power domain id.

---
 include/dt-bindings/power/mt8192-apu-power.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 include/dt-bindings/power/mt8192-apu-power.h
include/dt-bindings/power/mt8192-apu-power.h new file +0 -0
new file mode 100644
index 000000000000..b821bd4811a6

include/dt-bindings/power/mt8192-apu-power.h line 9

Quoted 9 lines
include/dt-bindings/power/mt8192-apu-power.h new file +9 -0
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (c) 2021 MediaTek Inc.
+ */
+
+#ifndef _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+#define _DT_BINDINGS_POWER_MT8192_APU_POWER_H
+
+#define MT8192_POWER_DOMAIN_APUSYS_TOP	0

Really, you don't know what the other power domains are? Please make this as complete as possible. These headers create a merge mess.

Rob

maintainer
#10 lore raw

Re: [PATCH 4/8] dt-bindings: arm: mediatek: Add new document bindings for APU

In reply to Flora Fu
Quoted 66 lines · Flora Fu
Quoted 31 lines · Rob Herring
Quoted 30 lines · Flora Fu

Document the apusys bindings.

---
 .../arm/mediatek/mediatek,apusys.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +16 -0
new file mode 100644
index 000000000000..dc04a46f1bad
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: https://urldefense.com/v3/__http://devicetree.org/schemas/arm/mediatek/mediatek,apusys.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrAYYvZWcw$
+$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrARlhCQ0w$
+
+title: MediaTek APUSYS Controller
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description:
+  The Mediatek apusys controller provides functional configurations and clocks
+  to the system.
+
+properties:
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 22

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +6 -0
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu_mbox
+          - mediatek,mt8192-apu_conn
+          - mediatek,mt8192-apu_vcore

s/_/-/

OK. I will update expression strings in the next version.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +11 -0
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 39

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +6 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    apu_mbox: apu_mbox@19000000 {

mailbox@...? Is this a mailbox provider?

Quoted 1 line

Yes, the apu_mbox is the for setup mailbox in the APU hardware.

Then you need #mbox-cells here.

And in that case, what makes it a syscon?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +3 -0
+        compatible = "mediatek,mt8192-apu_mbox", "syscon";
+        reg = <0x19000000 0x1000>;
+    };
author
#11 lore raw

Re: [PATCH 4/8] dt-bindings: arm: mediatek: Add new document bindings for APU

Quoted 67 lines · Rob Herring
Quoted 66 lines · Flora Fu
Quoted 31 lines · Rob Herring
Quoted 30 lines · Flora Fu

Document the apusys bindings.

---
 .../arm/mediatek/mediatek,apusys.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +16 -0
new file mode 100644
index 000000000000..dc04a46f1bad
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: https://urldefense.com/v3/__http://devicetree.org/schemas/arm/mediatek/mediatek,apusys.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrAYYvZWcw$
+$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!3ryKFTA2CvsVss4Pt2ZOG7wv4jgR-2LPxuGn30IxFmpxoxSRdzNdf8FrARlhCQ0w$
+
+title: MediaTek APUSYS Controller
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+description:
+  The Mediatek apusys controller provides functional configurations and clocks
+  to the system.
+
+properties:
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 22

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +6 -0
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu_mbox
+          - mediatek,mt8192-apu_conn
+          - mediatek,mt8192-apu_vcore

s/_/-/

OK. I will update expression strings in the next version.

Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +7 -0
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1

Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml line 39

Quoted 10 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +10 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    apu_mbox: apu_mbox@19000000 {

mailbox@...? Is this a mailbox provider?

Quoted 6 lines
Quoted 1 line

Yes, the apu_mbox is the for setup mailbox in the APU hardware.

Then you need #mbox-cells here.

And in that case, what makes it a syscon?

The apu_mbox are registers for setup mail box communications between apu processor and the AP side kernel drivers. It also has spare registers that reserved for keep specific information between apu and AP side. That's why I set it as syscon to avoid ioremap from users. Do you think it is reasonable or it is better to be kept inside the user nodes when using it?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,apusys.yaml new file +3 -0
+        compatible = "mediatek,mt8192-apu_mbox", "syscon";
+        reg = <0x19000000 0x1000>;
+    };