Skip to contentSkip to conversation

MediaTek MT8192 APU

PATCH New Flora Fu 1 participant 18 messages Dec 10, 2021

Subsystems (8)
lore
Share & tools
lore

Flora Fu

author
#0 lore raw

cover MediaTek MT8192 APU

The MediaTek AI Processing Unit (APU) is a proprietary hardware in the SoC to support AI functions.
The patches support the MT8192 APU runs on internal microprocessor. Software packages contins mailbox, iommu, APU remote processor, power control, middleware and debug looger.

This series is based on drivers implemented in
MT8192 apu power domain[1], apu SMC[2] and IOMMU[2] patches.
[1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=593809
[2] https://patchwork.kernel.org/patch/12670253
[3] https://patchwork.kernel.org/project/linux-mediatek/list/?series=551641
The device tree depends on [4][5][6] which haven't yet been accepted.
[4] https://patchwork.kernel.org/patch/12456165
[5] https://patchwork.kernel.org/patch/12134935
[6] https://patchwork.kernel.org/patch/12140237

Change notes:
Initial RFC: https://patchwork.kernel.org/project/linux-mediatek/list/?series=568939

Flora Fu (17):
dt-bindings: mailbox: mediatek: Add APU mailbox compatible
dt-bindings: memory: mediatek: Add MT8192 apu iommu bindings
dt-bindings: remoteproc: mediatek: Add APU rproc compatible
dt-bindings: soc: mediatek: apu: Add APU power compatible
dt-bindings: soc: mediatek: apu: Add apu logger compatible
mailbox: mediatek: add mtk-apu-mailbox driver iommu/mediatek: Support APU iommu and config data for mt8192
remoteproc: mediatek: Add APU remoteproc driver
soc: mediatek: apu: Add Apu power driver
soc: mediatek: apu: Add APU software logger dirver
soc: mediatek: apu: Add middleware driver
arm64: dts: mt8192: Add APU mtk-apu-mailbox node
arm64: dts: mt8192: Add APU-IOMMU nodes
arm64: dts: mt8192: Add apu tinysys node
arm64: dts: mt8192: Add APU power nodes
arm64: dts: mt8192: Add apu-sw-logger node
arm64: dts: mt8192: Set up regulators for APU subsys

 .../bindings/iommu/mediatek,iommu.yaml        |    7 +-
 .../mailbox/mediatek,apu-mailbox.yaml         |   47 +
 .../bindings/remoteproc/mediatek,apu-rv.yaml  |  106 ++
 .../soc/mediatek/mediatek,apu-logger.yaml     |   42 +
 .../soc/mediatek/mediatek,apu-pwr.yaml        |   80 ++
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts   |    5 +
 arch/arm64/boot/dts/mediatek/mt8192.dtsi      |  118 ++
 drivers/iommu/mtk_iommu.c                     |   45 +-
 drivers/mailbox/Kconfig                       |    9 +
 drivers/mailbox/Makefile                      |    2 +
 drivers/mailbox/mtk-apu-mailbox.c             |  162 +++
 drivers/remoteproc/Kconfig                    |   12 +
 drivers/remoteproc/Makefile                   |    2 +
 drivers/remoteproc/mtk-apu-ipi.c              |  474 ++++++++
 drivers/remoteproc/mtk-apu-rproc.c            | 1054 +++++++++++++++++
 drivers/soc/mediatek/apusys/Kconfig           |   23 +
 drivers/soc/mediatek/apusys/Makefile          |   17 +
 drivers/soc/mediatek/apusys/apu-device.h      |   39 +
 drivers/soc/mediatek/apusys/apu-pwr-dbg.c     |  167 +++
 drivers/soc/mediatek/apusys/apu-pwr-ipi.c     |  377 ++++++
 drivers/soc/mediatek/apusys/apu-pwr.c         |  613 ++++++++++
 drivers/soc/mediatek/apusys/apu-pwr.h         |  260 ++++
 drivers/soc/mediatek/apusys/apu-sw-logger.c   |  540 +++++++++
 drivers/soc/mediatek/apusys/mdw-cmd.c         |  618 ++++++++++
 drivers/soc/mediatek/apusys/mdw-drv.c         |  226 ++++
 drivers/soc/mediatek/apusys/mdw-ioctl.c       |  331 ++++++
 drivers/soc/mediatek/apusys/mdw-ioctl.h       |  256 ++++
 drivers/soc/mediatek/apusys/mdw-mem.c         |  938 +++++++++++++++
 drivers/soc/mediatek/apusys/mdw-mem.h         |   23 +
 drivers/soc/mediatek/apusys/mdw-rv-cmd.c      |  158 +++
 drivers/soc/mediatek/apusys/mdw-rv-dev.c      |  386 ++++++
 drivers/soc/mediatek/apusys/mdw-rv-msg.h      |   90 ++
 drivers/soc/mediatek/apusys/mdw-rv.c          |  131 ++
 drivers/soc/mediatek/apusys/mdw-rv.h          |   98 ++
 drivers/soc/mediatek/apusys/mdw-sysfs.c       |  200 ++++
 drivers/soc/mediatek/apusys/mdw.h             |  207 ++++
 include/dt-bindings/memory/mt8192-larb-port.h |    4 +
 include/linux/remoteproc/mtk-apu-config.h     |  100 ++
 include/linux/remoteproc/mtk-apu.h            |  217 ++++
 39 files changed, 8181 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/mediatek,apu-mailbox.yaml
 create mode 100644 Documentation/devicetree/bindings/remoteproc/mediatek,apu-rv.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-logger.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pwr.yaml
 create mode 100644 drivers/mailbox/mtk-apu-mailbox.c
 create mode 100644 drivers/remoteproc/mtk-apu-ipi.c
 create mode 100644 drivers/remoteproc/mtk-apu-rproc.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-device.h
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr-dbg.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr-ipi.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr.h
 create mode 100644 drivers/soc/mediatek/apusys/apu-sw-logger.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-cmd.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-drv.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-ioctl.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-ioctl.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-mem.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-mem.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-cmd.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-dev.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-msg.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-sysfs.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw.h
 create mode 100644 include/linux/remoteproc/mtk-apu-config.h
 create mode 100644 include/linux/remoteproc/mtk-apu.h
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH 1/17 dt-bindings: mailbox: mediatek: Add APU mailbox compatible

Add the mailbox compatible for the MediaTek APU.
The MT8192 and MT8195 SOC will use it.

---
 .../mailbox/mediatek,apu-mailbox.yaml         | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/mediatek,apu-mailbox.yaml
Documentation/devicetree/bindings/mailbox/mediatek,apu-mailbox.yaml new file +47 -0
new file mode 100644
index 000000000000..ffd0e1623955
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (C) 2021 MediaTek Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/mediatek,apu-mailbox.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek AI Processing Unit mailbox controller bindings
+
+description:
+  The APU mailbox controller provides access from the
+  application processor to the MediaTek AI Processing Unit.
+
+maintainers:
+  - Pi-Cheng Chen <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - mediatek,mtk-apu-mailbox
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  "#mbox-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    apu_mailbox: apu_mailbox@19000000 {
+      compatible = "mediatek,mtk-apu-mailbox";
+      reg = <0x19000000 0x100>;
+      interrupts = <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH 0>;
+      #mbox-cells = <1>;
+    };
Signature · 1 line
2.18.0
author
#2 lore raw

PATCH 2/17 dt-bindings: memory: mediatek: Add MT8192 apu iommu bindings

In reply to Flora Fu

MT8192 has one APU iommu hardware and add apu iommu bindings.

---
 .../devicetree/bindings/iommu/mediatek,iommu.yaml          | 7 +++++--
 include/dt-bindings/memory/mt8192-larb-port.h              | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +5 -2
index c528a299afa9..14fae9642ec9 100644
@@ -77,6 +77,7 @@ properties:
           - mediatek,mt8173-m4u  # generation two
           - mediatek,mt8183-m4u  # generation two
           - mediatek,mt8192-m4u  # generation two
+          - mediatek,mt8192-iommu-apu        # generation two
           - mediatek,mt8195-iommu-vdo        # generation two
           - mediatek,mt8195-iommu-vpp        # generation two
           - mediatek,mt8195-iommu-infra      # generation two
@@ -154,6 +155,7 @@ allOf:
         compatible:
           enum:
             - mediatek,mt8192-m4u
+            - mediatek,mt8192-iommu-apu
             - mediatek,mt8195-iommu-vdo
             - mediatek,mt8195-iommu-vpp
 
@@ -165,8 +167,9 @@ allOf:
       not:
         properties:
           compatible:
-            contains:
-              const: mediatek,mt8195-iommu-infra
+            enum:
+              - mediatek,mt8192-iommu-apu
+              - mediatek,mt8195-iommu-infra
 
     then:
       required:
include/dt-bindings/memory/mt8192-larb-port.h +4 -0
index 23035a52c675..908d6831bf99 100644
@@ -240,4 +240,8 @@
 #define M4U_PORT_L20_IPE_RSC_RDMA0		MTK_M4U_ID(20, 4)
 #define M4U_PORT_L20_IPE_RSC_WDMA		MTK_M4U_ID(20, 5)
 
+#define IOMMU_PORT_APU_DATA			MTK_M4U_ID(0, 0)
+#define IOMMU_PORT_APU_VLM			MTK_M4U_ID(0, 1)
+#define IOMMU_PORT_APU_VPU			MTK_M4U_ID(0, 2)
+
 #endif
Signature · 1 line
2.18.0
author
#3 lore raw

PATCH 3/17 dt-bindings: remoteproc: mediatek: Add APU rproc compatible

In reply to Flora Fu

Add new binding document for the APU remote processor. The initial version is used for MT8192 SOC.

---
 .../bindings/remoteproc/mediatek,apu-rv.yaml  | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/mediatek,apu-rv.yaml
Documentation/devicetree/bindings/remoteproc/mediatek,apu-rv.yaml new file +106 -0
new file mode 100644
index 000000000000..c390b85040eb
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2021 (C) MediaTek Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/mediatek,apu-rv.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek APU remote processor controller bindings
+
+description: |
+  APU integrated subsystem having MD32RV33 (MD32) that runs tinysys.
+  The tinysys runs on a microprocessor in APU.
+  Its firmware is loaded and booted from Kernel side.
+  Kernel and tinysys uses IPI to send and receive messages.
+
+maintainers:
+  - Flora Fu <[email protected]>
+  - Pi-Cheng Chen <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apusys-rv
+      - const: simple-mfd
+
+  reg:
+    minItems: 1
+
+  reg-names:
+    minItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  iommus:
+    maxItems: 1
+
+  interrupts:
+    description: List of interrupts.
+
+  interrupt-names:
+    description: Name list of interrupts.
+
+  mboxes:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - power-domains
+  - interrupts
+  - mboxes
+
+additionalProperties:
+  type: object
+  description:
+    Represent subnodes that will register as rpmsg devices.
+  properties:
+    compatible:
+      enum:
+        - mediatek,apu-ctrl-rpmsg
+        - mediatek,apupwr-tx-rpmsg
+        - mediatek,apupwr-rx-rpmsg
+        - mediatek,apu-mdw-rpmsg
+    mediatek,rpmsg-name:
+      $ref: /schemas/types.yaml#/definitions/string-array
+      description:
+        Contains the name for the rpmsg device. Used to match
+        the subnode to rpmsg device announced by APU.
+  required:
+    - compatible
+
+examples:
+  - |
+    #include <dt-bindings/clock/mt8192-clk.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/memory/mt8192-larb-port.h>
+
+    apusys_rv@19001000 {
+      compatible = "mediatek,mt8192-apusys-rv", "simple-mfd";
+      reg = <0x19001000 0x1000>;
+      reg-names = "md32_sysctrl";
+      power-domains = <&apuspm 0>;
+      iommus = <&iommu_apu IOMMU_PORT_APU_DATA>;
+      interrupts = <GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH 0>;
+      interrupt-names = "apu_wdt";
+      mboxes = <&apu_mailbox 0>;
+      apu_ctrl {
+        compatible = "mediatek,apu-ctrl-rpmsg";
+        mediatek,rpmsg-name = "apu-ctrl-rpmsg";
+      };
+      apu_pwr_tx {
+        compatible = "mediatek,apupwr-tx-rpmsg";
+        mediatek,rpmsg-name = "apupwr-tx-rpmsg";
+      };
+      apu_pwr_rx {
+        compatible = "mediatek,apupwr-rx-rpmsg";
+        mediatek,rpmsg-name = "apupwr-rx-rpmsg";
+      };
+      apu_mdw_rpmsg {
+        compatible = "mediatek,apu-mdw-rpmsg";
+        mediatek,rpmsg-name = "apu-mdw-rpmsg";
+      };
+    };
Signature · 1 line
2.18.0
author
#4 lore raw

PATCH 4/17 dt-bindings: soc: mediatek: apu: Add APU power compatible

In reply to Flora Fu

Add new document for APU power compatible.

---
 .../soc/mediatek/mediatek,apu-pwr.yaml        | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pwr.yaml
Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-pwr.yaml new file +80 -0
new file mode 100644
index 000000000000..00f67dddb162
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2021 (C) MediaTek Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,apu-pwr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek APU Power driver bindings
+
+description: |
+  MediaTek AI Process Unit (APU) power driver supports for subsys clock and
+  regulator controller.
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8192-apu-power
+  reg:
+    minItems: 1
+
+  reg-names:
+    minItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  vvpu-supply:
+    description: apu vpu regulator supply.
+
+  vmdla-supply:
+    description: apu mdla regulator supply.
+
+  clocks:
+    description: Contains module clock source and clock names
+
+  clock-names:
+    description: Names of the clocks list in clocks property
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - vvpu-supply
+  - vmdla-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/mt8192-clk.h>
+    apusys_power: apusys_power@190f1000 {
+      compatible = "mediatek,mt8192-apu-power";
+      reg = <0x190f1000 0x1000>;
+      reg-names = "apu_pcu";
+      power-domains = <&apuspm 0>;
+      vvpu-supply = <&mt6359_vproc1_buck_reg>;
+      vmdla-supply = <&mt6359_vproc2_buck_reg>;
+      clocks = <&topckgen CLK_TOP_DSP_SEL>,
+               <&topckgen CLK_TOP_DSP1_SEL>,
+               <&topckgen CLK_TOP_DSP1_NPUPLL_SEL>,
+               <&topckgen CLK_TOP_DSP2_SEL>,
+               <&topckgen CLK_TOP_DSP2_NPUPLL_SEL>,
+               <&topckgen CLK_TOP_DSP5_SEL>,
+               <&topckgen CLK_TOP_DSP5_APUPLL_SEL>,
+               <&topckgen CLK_TOP_IPU_IF_SEL>,
+               <&clk26m>;
+      clock-names = "clk_top_dsp_sel",
+                    "clk_top_dsp1_sel",
+                    "clk_top_dsp1_npupll_sel",
+                    "clk_top_dsp2_sel",
+                    "clk_top_dsp2_npupll_sel",
+                    "clk_top_dsp5_sel",
+                    "clk_top_dsp5_apupll_sel",
+                    "clk_top_ipu_if_sel",
+                    "clk_top_clk26m";
+    };
Signature · 1 line
2.18.0
author
#5 lore raw

PATCH 5/17 dt-bindings: soc: mediatek: apu: Add apu logger compatible

In reply to Flora Fu

Add new document for apu logger compatible.

---
 .../soc/mediatek/mediatek,apu-logger.yaml     | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-logger.yaml
Documentation/devicetree/bindings/soc/mediatek/mediatek,apu-logger.yaml new file +42 -0
new file mode 100644
index 000000000000..9e56fb3b8080
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2021 (C) MediaTek Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/soc/mediatek/mediatek,apu-logger.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MediaTek APU Logger for debug into microprocessor
+
+description: |
+  The APU logger is for debug usage. The APU remote microprocessor's logs
+  will be output to the mapped memory and application processor can read
+  logs from the dedicated reserved registers.
+
+maintainers:
+  - Flora Fu <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,apu-sw-logger
+  reg:
+    maxItems: 1
+
+  iommus:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/memory/mt8192-larb-port.h>
+    apusys_sw_logger@19000040 {
+      compatible = "mediatek,apu-sw-logger";
+      reg = <0x19000040 0x10>;
+      iommus = <&iommu_apu IOMMU_PORT_APU_DATA>;
+    };
Signature · 1 line
2.18.0
author
#6 lore raw

PATCH 6/17 mailbox: mediatek: add mtk-apu-mailbox driver

In reply to Flora Fu

Add mtk-apu-mailbox driver to support communication with APU remote microprocessor.

---
 drivers/mailbox/Kconfig           |   9 ++
 drivers/mailbox/Makefile          |   2 +
 drivers/mailbox/mtk-apu-mailbox.c | 162 ++++++++++++++++++++++++++++++
 3 files changed, 173 insertions(+)
 create mode 100644 drivers/mailbox/mtk-apu-mailbox.c
drivers/mailbox/Kconfig +9 -0
index d9cd3606040e..aeaaadd4cb8d 100644
@@ -238,6 +238,15 @@ config STM32_IPCC
 	  with hardware for Inter-Processor Communication Controller (IPCC)
 	  between processors. Say Y here if you want to have this support.
 
+config MTK_APU_MBOX
+	tristate "MediaTek APU Mailbox Support"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	help
+	  Say yes here to add support for the MediaTek APU Mailbox
+	  driver. The mailbox implementation provides access from the
+	  application processor to the MediaTek AI Processing Unit.
+	  If unsure say N.
+
 config MTK_CMDQ_MBOX
 	tristate "MediaTek CMDQ Mailbox Support"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/mailbox/Makefile +2 -0
index 338cc05e5431..e24ad25c3378 100644
@@ -49,6 +49,8 @@ obj-$(CONFIG_TEGRA_HSP_MBOX)	+= tegra-hsp.o
 
 obj-$(CONFIG_STM32_IPCC) 	+= stm32-ipcc.o
 
+obj-$(CONFIG_MTK_APU_MBOX)	+= mtk-apu-mailbox.o
+
 obj-$(CONFIG_MTK_CMDQ_MBOX)	+= mtk-cmdq-mailbox.o
 
 obj-$(CONFIG_ZYNQMP_IPI_MBOX)	+= zynqmp-ipi-mailbox.o
drivers/mailbox/mtk-apu-mailbox.c new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#7 lore raw

PATCH 7/17 iommu/mediatek: Support APU iommu and config data for mt8192

In reply to Flora Fu

APU IOMMU is a new iommu HW. it uses a new pagetable. Add support for mt8192 apu iommu.

---
 drivers/iommu/mtk_iommu.c | 45 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)
drivers/iommu/mtk_iommu.c +44 -1
index 8377f3c37283..4bc7c76062e6 100644
@@ -133,6 +133,7 @@
 /* 2 bits: iommu type */
 #define MTK_IOMMU_TYPE_MM		(0x0 << 13)
 #define MTK_IOMMU_TYPE_INFRA		(0x1 << 13)
+#define MTK_IOMMU_TYPE_APU		(0x2 << 13)
 #define MTK_IOMMU_TYPE_MASK		(0x3 << 13)
 #define IFA_IOMMU_PCIe_SUPPORT		BIT(15)
 
@@ -185,6 +186,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data, unsigned int ban
 #define MTK_IOMMU_4GB_MODE_REMAP_BASE	 0x140000000UL
 
 static LIST_HEAD(m4ulist);	/* List all the M4U HWs */
+static LIST_HEAD(apulist);	/* List the apu iommu HWs */
 
 #define for_each_m4u(data, head)  list_for_each_entry(data, head, list)
 
@@ -209,6 +211,13 @@ static const struct mtk_iommu_iova_region mt8192_multi_dom[] = {
 	#endif
 };
 
+static const struct mtk_iommu_iova_region mt8192_multi_dom_apu[] = {
+	{ .iova_base = 0x0,		.size = SZ_4G}, /* APU DATA */
+	{ .iova_base = 0x4000000ULL,	.size = 0x4000000},  /* APU VLM */
+	{ .iova_base = 0x10000000ULL,	.size = 0x10000000}, /* APU VPU */
+	{ .iova_base = 0x70000000ULL,	.size = 0x12600000}, /* APU REG */
+};
+
 /* If 2 M4U share a domain(use the same hwlist), Put the corresponding info in first data.*/
 static struct mtk_iommu_data *mtk_iommu_get_frst_data(struct list_head *hwlist)
 {
@@ -638,24 +647,45 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
 
 static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
+	unsigned int flag = DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS;
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
-	struct mtk_iommu_data *data;
+	struct mtk_iommu_data *data, *curdata;
+	struct device_link *link;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_APU)) {
+		/*
+		 * The APU IOMMU HWs must work together. The consumer device
+		 * must connect with all the apu iommu HWs at the same time.
+		 */
+		for_each_m4u(curdata, data->hw_list) {
+			link = device_link_add(dev, curdata->dev, flag);
+			if (!link)
+				dev_err(dev, "Unable to link %s\n", dev_name(curdata->dev));
+		}
+	}
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	if (MTK_IOMMU_IS_TYPE(data->plat_data, MTK_IOMMU_TYPE_APU)) {
+		struct list_head *head = data->hw_list;
+
+		for_each_m4u(data, head)
+			device_link_remove(dev, data->dev);
+	}
 	iommu_fwspec_free(dev);
 }
 
@@ -1270,6 +1300,18 @@ static const struct mtk_iommu_plat_data mt8192_data = {
 			   {0, 14, 16}, {0, 13, 18, 17}},
 };
 
+static const struct mtk_iommu_plat_data mt8192_data_apu = {
+	.m4u_plat       = M4U_MT8192,
+	.flags          = DCM_DISABLE | MTK_IOMMU_TYPE_APU |
+			  SHARE_PGTABLE,
+	.inv_sel_reg    = REG_MMU_INV_SEL_GEN2,
+	.hw_list        = &apulist,
+	.bank_nr	= 1,
+	.bank_enable    = {true},
+	.iova_region    = mt8192_multi_dom_apu,
+	.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom_apu),
+};
+
 static const struct mtk_iommu_plat_data mt8195_data_infra = {
 	.m4u_plat	  = M4U_MT8195,
 	.flags            = WR_THROT_EN | DCM_DISABLE |
@@ -1325,6 +1367,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
 	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
 	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
 	{ .compatible = "mediatek,mt8192-m4u", .data = &mt8192_data},
+	{ .compatible = "mediatek,mt8192-iommu-apu",   .data = &mt8192_data_apu},
 	{ .compatible = "mediatek,mt8195-iommu-infra", .data = &mt8195_data_infra},
 	{ .compatible = "mediatek,mt8195-iommu-vdo",   .data = &mt8195_data_vdo},
 	{ .compatible = "mediatek,mt8195-iommu-vpp",   .data = &mt8195_data_vpp},
Signature · 1 line
2.18.0
author
#8 lore raw

PATCH 8/17 remoteproc: mediatek: Add APU remoteproc driver

In reply to Flora Fu

APU integrated subsystem having MD32RV33 (MD32) that runs tinysys The tinysys is runs on a microprocessor in APU. Its firmware is loaded and booted from Kernel side. Kernel and tinysys use IPI to send and receive messages.

---
 drivers/remoteproc/Kconfig                |   12 +
 drivers/remoteproc/Makefile               |    2 +
 drivers/remoteproc/mtk-apu-ipi.c          |  474 +++++++++
 drivers/remoteproc/mtk-apu-rproc.c        | 1054 +++++++++++++++++++++
 include/linux/remoteproc/mtk-apu-config.h |  100 ++
 include/linux/remoteproc/mtk-apu.h        |  217 +++++
 6 files changed, 1859 insertions(+)
 create mode 100644 drivers/remoteproc/mtk-apu-ipi.c
 create mode 100644 drivers/remoteproc/mtk-apu-rproc.c
 create mode 100644 include/linux/remoteproc/mtk-apu-config.h
 create mode 100644 include/linux/remoteproc/mtk-apu.h
drivers/remoteproc/Kconfig +12 -0
index f2e961f998ca..72fc5fe7f4b5 100644
@@ -54,6 +54,18 @@ config INGENIC_VPU_RPROC
 	  This can be either built-in or a loadable module.
 	  If unsure say N.
 
+config MTK_APU_RPROC
+	tristate "MediaTek APU remoteproc support"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	select MAILBOX
+	select MTK_APU_MBOX
+	select MTK_SCP
+	help
+	  Say y here to support MediaTek AI Processing Unit Subsystem
+	  via the remote processor framework.
+
+	  It's safe to say N here.
+
 config MTK_SCP
 	tristate "Mediatek SCP support"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/remoteproc/Makefile +2 -0
index 0ac256b6c977..1c1f1e443c56 100644
@@ -15,6 +15,8 @@ obj-$(CONFIG_IMX_REMOTEPROC)		+= imx_rproc.o
 obj-$(CONFIG_IMX_DSP_REMOTEPROC)	+= imx_dsp_rproc.o
 obj-$(CONFIG_INGENIC_VPU_RPROC)		+= ingenic_rproc.o
 obj-$(CONFIG_MTK_SCP)			+= mtk_scp.o mtk_scp_ipi.o
+obj-$(CONFIG_MTK_APU_RPROC)	+= apu.o
+apu-objs	+= mtk-apu-rproc.o mtk-apu-ipi.o
 obj-$(CONFIG_OMAP_REMOTEPROC)		+= omap_remoteproc.o
 obj-$(CONFIG_WKUP_M3_RPROC)		+= wkup_m3_rproc.o
 obj-$(CONFIG_DA8XX_REMOTEPROC)		+= da8xx_remoteproc.o
drivers/remoteproc/mtk-apu-ipi.c new file +474 -0

474 lines not on this page · raw message

drivers/remoteproc/mtk-apu-rproc.c new file +1054 -0

1,054 lines not on this page · raw message

include/linux/remoteproc/mtk-apu-config.h new file +100 -0

100 lines not on this page · raw message

include/linux/remoteproc/mtk-apu.h new file +217 -0

217 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#9 lore raw

PATCH 9/17 soc: mediatek: apu: Add Apu power driver

In reply to Flora Fu

Add APU power driver to support for subsys clock and regulator controller.
Add MT8192 platform APU power driver's platform data.

---
 drivers/soc/mediatek/apusys/Kconfig       |  23 +
 drivers/soc/mediatek/apusys/Makefile      |   5 +
 drivers/soc/mediatek/apusys/apu-pwr-dbg.c | 167 ++++++
 drivers/soc/mediatek/apusys/apu-pwr-ipi.c | 377 +++++++++++++
 drivers/soc/mediatek/apusys/apu-pwr.c     | 613 ++++++++++++++++++++++
 drivers/soc/mediatek/apusys/apu-pwr.h     | 260 +++++++++
 6 files changed, 1445 insertions(+)
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr-dbg.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr-ipi.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr.c
 create mode 100644 drivers/soc/mediatek/apusys/apu-pwr.h
drivers/soc/mediatek/apusys/Kconfig +23 -0
index 332e323e02ae..1daf73c74c17 100644
@@ -11,4 +11,27 @@ config MTK_APU_PM
 	  APU power domain shall be enabled before accessing the
 	  internal sub modules.
 
+config MTK_APU
+	tristate "MediaTek APUSYS Support"
+	select REGMAP
+	select MAILBOX
+	select MTK_APU_MBOX
+	select MTK_APU_RPROC
+	select MTK_SCP
+	help
+	  Say yes here to add support for the APU tinysys and enable
+	  sub modules include apu power and middleware.
+	  The tinysys firmware is loaded and booted from Kernel side through
+	  rproc framework. The related sub modules in application processor
+	  use IPI to communicate with APU tinysys.
+
+config MTK_APU_DEBUG
+	tristate "MediaTek APUSYS debug functions"
+	depends on MTK_APU
+	help
+	  Say yes here to enable debug features in APU.
+	  The debug configuration will enable kernel driver debug and register a
+	  logger for retrieving debug logs from remote processor.
+	  Disable it if you don't need them.
+
 endif # MTK_APUSYS
drivers/soc/mediatek/apusys/Makefile +5 -0
index 8821c0f0b7b7..8fff18d63dc1 100644
@@ -1,2 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_MTK_APU_PM) += mtk-apu-pm.o
+
+obj-$(CONFIG_MTK_APU) += mtk_apu_pwr.o
+mtk_apu_pwr-objs += apu-pwr.o
+mtk_apu_pwr-objs += apu-pwr-ipi.o
+mtk_apu_pwr-$(CONFIG_MTK_APU_DEBUG) += apu-pwr-dbg.o
drivers/soc/mediatek/apusys/apu-pwr-dbg.c new file +167 -0

167 lines not on this page · raw message

drivers/soc/mediatek/apusys/apu-pwr-ipi.c new file +377 -0

377 lines not on this page · raw message

drivers/soc/mediatek/apusys/apu-pwr.c new file +613 -0

613 lines not on this page · raw message

drivers/soc/mediatek/apusys/apu-pwr.h new file +260 -0

260 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#10 lore raw

PATCH 10/17 soc: mediatek: apu: Add APU software logger dirver

In reply to Flora Fu

The APU software logger is for debug for remote processor. The remote microprocessor's logs will be output to the mapped memory and application processor can read logs from the dedicated reserved registers

---
 drivers/soc/mediatek/apusys/Makefile        |   2 +
 drivers/soc/mediatek/apusys/apu-sw-logger.c | 540 ++++++++++++++++++++
 2 files changed, 542 insertions(+)
 create mode 100644 drivers/soc/mediatek/apusys/apu-sw-logger.c
drivers/soc/mediatek/apusys/Makefile +2 -0
index 8fff18d63dc1..6fb69abcf3b9 100644
@@ -5,3 +5,5 @@ obj-$(CONFIG_MTK_APU) += mtk_apu_pwr.o
 mtk_apu_pwr-objs += apu-pwr.o
 mtk_apu_pwr-objs += apu-pwr-ipi.o
 mtk_apu_pwr-$(CONFIG_MTK_APU_DEBUG) += apu-pwr-dbg.o
+
+obj-$(CONFIG_MTK_APU_DEBUG) += apu-sw-logger.o
drivers/soc/mediatek/apusys/apu-sw-logger.c new file +540 -0

540 lines not on this page · raw message

Signature · 1 line
2.18.0
author
#11 lore raw

PATCH 11/17 soc: mediatek: apu: Add middleware driver

In reply to Flora Fu

The APU middleware is responsible to receive all user's requests and control command and device related flow.
In Kernel side, the middleware use the IPI to send command to remote tinysys to dispatch commands to AI engines in APU.

---
 drivers/soc/mediatek/apusys/Makefile     |  10 +
 drivers/soc/mediatek/apusys/apu-device.h |  39 +
 drivers/soc/mediatek/apusys/mdw-cmd.c    | 618 +++++++++++++++
 drivers/soc/mediatek/apusys/mdw-drv.c    | 226 ++++++
 drivers/soc/mediatek/apusys/mdw-ioctl.c  | 331 ++++++++
 drivers/soc/mediatek/apusys/mdw-ioctl.h  | 256 +++++++
 drivers/soc/mediatek/apusys/mdw-mem.c    | 938 +++++++++++++++++++++++
 drivers/soc/mediatek/apusys/mdw-mem.h    |  23 +
 drivers/soc/mediatek/apusys/mdw-rv-cmd.c | 158 ++++
 drivers/soc/mediatek/apusys/mdw-rv-dev.c | 386 ++++++++++
 drivers/soc/mediatek/apusys/mdw-rv-msg.h |  90 +++
 drivers/soc/mediatek/apusys/mdw-rv.c     | 131 ++++
 drivers/soc/mediatek/apusys/mdw-rv.h     |  98 +++
 drivers/soc/mediatek/apusys/mdw-sysfs.c  | 200 +++++
 drivers/soc/mediatek/apusys/mdw.h        | 207 +++++
 15 files changed, 3711 insertions(+)
 create mode 100644 drivers/soc/mediatek/apusys/apu-device.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-cmd.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-drv.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-ioctl.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-ioctl.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-mem.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-mem.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-cmd.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-dev.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv-msg.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw-rv.h
 create mode 100644 drivers/soc/mediatek/apusys/mdw-sysfs.c
 create mode 100644 drivers/soc/mediatek/apusys/mdw.h
drivers/soc/mediatek/apusys/Makefile +10 -0
index 6fb69abcf3b9..9104c2979b85 100644
@@ -7,3 +7,13 @@ mtk_apu_pwr-objs += apu-pwr-ipi.o
 mtk_apu_pwr-$(CONFIG_MTK_APU_DEBUG) += apu-pwr-dbg.o
 
 obj-$(CONFIG_MTK_APU_DEBUG) += apu-sw-logger.o
+
+obj-$(CONFIG_MTK_APU) += mtk_apu_mdw.o
+mtk_apu_mdw-objs += mdw-drv.o
+mtk_apu_mdw-objs += mdw-ioctl.o
+mtk_apu_mdw-objs += mdw-mem.o
+mtk_apu_mdw-objs += mdw-cmd.o
+mtk_apu_mdw-objs += mdw-rv.o
+mtk_apu_mdw-objs += mdw-rv-cmd.o
+mtk_apu_mdw-objs += mdw-rv-dev.o
+mtk_apu_mdw-$(CONFIG_DEBUG_FS) += mdw-sysfs.o
drivers/soc/mediatek/apusys/apu-device.h new file +39 -0
new file mode 100644
index 000000000000..dddd8a3ddf8d
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2021 MediaTek Inc.
+ */
+
+#ifndef APUSYS_DEVICE_H
+#define APUSYS_DEVICE_H
+
+#include <linux/dma-buf.h>
+
+/* device type */
+enum {
+	APUSYS_DEVICE_NONE,
+
+	APUSYS_DEVICE_SAMPLE,
+	APUSYS_DEVICE_MDLA,
+	APUSYS_DEVICE_VPU,
+	APUSYS_DEVICE_EDMA,
+	APUSYS_DEVICE_RT = 32,
+	APUSYS_DEVICE_SAMPLE_RT,
+	APUSYS_DEVICE_MDLA_RT,
+	APUSYS_DEVICE_VPU_RT,
+
+	APUSYS_DEVICE_MAX = 64,
+};
+
+/* device definition */
+#define APUSYS_DEVICE_META_SIZE (32)
+
+struct apusys_device {
+	int dev_type;
+	int idx;
+	int preempt_type;
+	u8 preempt_level;
+	char meta_data[APUSYS_DEVICE_META_SIZE];
+	void *private;
+	int (*send_cmd)(int type, void *hnd, struct apusys_device *dev);
+};
+#endif
drivers/soc/mediatek/apusys/mdw-cmd.c new file +618 -0

618 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-drv.c new file +226 -0

226 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-ioctl.c new file +331 -0

331 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-ioctl.h new file +256 -0

256 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-mem.c new file +938 -0

938 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-mem.h new file +23 -0
new file mode 100644
index 000000000000..cb744f41d15e
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2021 MediaTek Inc.
+ */
+
+#ifndef __MTK_APU_MDW_MEM_H__
+#define __MTK_APU_MDW_MEM_H__
+
+struct mdw_mem *mdw_mem_alloc(struct mdw_fpriv *mpriv, u32 size,
+			      u32 align, u64 flags,
+			      enum mdw_mem_type type);
+struct mdw_mem *mdw_mem_import(struct mdw_fpriv *mpriv, u64 handle, u32 size);
+struct mdw_mem *mdw_mem_get(int handle);
+int mdw_mem_map(struct mdw_mem *m);
+int mdw_mem_unmap(struct mdw_mem *m);
+int mdw_mem_init(struct mdw_device *mdev);
+void mdw_mem_deinit(struct mdw_device *mdev);
+int mdw_mem_free(struct mdw_mem *mem);
+int mdw_mem_dma_map(struct mdw_mem *mem);
+int mdw_mem_dma_unmap(struct mdw_mem *mem);
+int apusys_mem_flush_kva(void *kva, u32 size);
+int apusys_mem_invalidate_kva(void *kva, u32 size);
+#endif
drivers/soc/mediatek/apusys/mdw-rv-cmd.c new file +158 -0

158 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-rv-dev.c new file +386 -0

386 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-rv-msg.h new file +90 -0

12 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-rv.c new file +131 -0

131 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-rv.h new file +98 -0

98 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw-sysfs.c new file +200 -0

200 lines not on this page · raw message

drivers/soc/mediatek/apusys/mdw.h new file +207 -0

207 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.18.0

Part of the diff is not shown here. View the raw message.

author
#12 lore raw

PATCH 12/17 arm64: dts: mt8192: Add APU mtk-apu-mailbox node

In reply to Flora Fu

Add mtk-apu-mailbox for mt8192 SOC.

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +7 -0
index cb2b171e0080..5c97dc7985b4 100644
@@ -906,6 +906,13 @@
 			#clock-cells = <1>;
 		};
 
+		apu_mailbox: apu_mailbox@19000000 {
+			compatible = "mediatek,mtk-apu-mailbox";
+			reg = <0 0x19000000 0 0x100>;
+			interrupts = <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH 0>;
+			#mbox-cells = <1>;
+		};
+
 		apu_conn: apu_conn@19020000 {
 			compatible = "mediatek,mt8192-apu-conn", "syscon";
 			reg = <0 0x19020000 0 0x1000>;
Signature · 1 line
2.18.0
author
#13 lore raw

PATCH 13/17 arm64: dts: mt8192: Add APU-IOMMU nodes

In reply to Flora Fu

Add APU-IOMMI nodes

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +9 -0
index 5c97dc7985b4..62acaba7b033 100644
@@ -8,6 +8,7 @@
 #include <dt-bindings/clock/mt8192-clk.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/memory/mt8192-larb-port.h>
 #include <dt-bindings/pinctrl/mt8192-pinfunc.h>
 #include <dt-bindings/power/mt8192-power.h>
 
@@ -913,6 +914,14 @@
 			#mbox-cells = <1>;
 		};
 
+		iommu_apu: iommu@19010000 {
+			compatible = "mediatek,mt8192-iommu-apu";
+			reg = <0 0x19010000 0 0x1000>;
+			interrupts = <GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH 0>;
+			power-domains = <&apuspm 0>;
+			#iommu-cells = <1>;
+		};
+
 		apu_conn: apu_conn@19020000 {
 			compatible = "mediatek,mt8192-apu-conn", "syscon";
 			reg = <0 0x19020000 0 0x1000>;
Signature · 1 line
2.18.0
author
#14 lore raw

PATCH 14/17 arm64: dts: mt8192: Add apu tinysys node

In reply to Flora Fu

Add node for APU tinysys.

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 35 ++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +35 -0
index 62acaba7b033..de73fbf0cb90 100644
@@ -914,6 +914,41 @@
 			#mbox-cells = <1>;
 		};
 
+		apusys_rv@19001000 {
+			compatible = "mediatek,mt8192-apusys-rv", "simple-mfd";
+			reg = <0 0x19000000 0 0x1000>,
+			      <0 0x19001000 0 0x1000>,
+			      <0 0x19002000 0 0x10>;
+			reg-names = "apu_mbox",
+				    "md32_sysctrl",
+				    "apu_wdt";
+			power-domains = <&apuspm 0>;
+			iommus = <&iommu_apu IOMMU_PORT_APU_DATA>;
+			interrupts = <GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH 0>;
+			interrupt-names = "apu_wdt";
+			mboxes = <&apu_mailbox 0>;
+
+			apu_ctrl {
+				compatible = "mediatek,apu-ctrl-rpmsg";
+				mtk,rpmsg-name = "apu-ctrl-rpmsg";
+			};
+
+			apu_pwr_tx {
+				compatible = "mediatek,apupwr-tx-rpmsg";
+				mtk,rpmsg-name = "apupwr-tx-rpmsg";
+			};
+
+			apu_pwr_rx {
+				compatible = "mediatek,apupwr-rx-rpmsg";
+				mtk,rpmsg-name = "apupwr-rx-rpmsg";
+			};
+
+			apu_mdw_rpmsg {
+				compatible = "mediatek,apu-mdw-rpmsg";
+				mtk,rpmsg-name = "apu-mdw-rpmsg";
+			};
+		};
+
 		iommu_apu: iommu@19010000 {
 			compatible = "mediatek,mt8192-iommu-apu";
 			reg = <0 0x19010000 0 0x1000>;
Signature · 1 line
2.18.0
author
#15 lore raw

PATCH 15/17 arm64: dts: mt8192: Add APU power nodes

In reply to Flora Fu

Add APU power node for MT8192.

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 61 ++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +61 -0
index de73fbf0cb90..f95d381ff1cc 100644
@@ -996,6 +996,67 @@
 			};
 		};
 
+		apusys_power: apusys_power@190f1000 {
+			compatible = "mediatek,mt8192-apu-power";
+			reg = <0 0x190f1000 0 0x1000>,
+			      <0 0x19000600 0 0x100>;
+			reg-names = "apu_pcu",
+				    "apu_spare";
+			power-domains = <&apuspm 0>;
+			clocks = <&topckgen CLK_TOP_DSP_SEL>,
+				<&topckgen CLK_TOP_DSP1_SEL>,
+				<&topckgen CLK_TOP_DSP1_NPUPLL_SEL>,
+				<&topckgen CLK_TOP_DSP2_SEL>,
+				<&topckgen CLK_TOP_DSP2_NPUPLL_SEL>,
+				<&topckgen CLK_TOP_DSP5_SEL>,
+				<&topckgen CLK_TOP_DSP5_APUPLL_SEL>,
+				<&topckgen CLK_TOP_IPU_IF_SEL>,
+				<&clk26m>,
+				<&topckgen CLK_TOP_MAINPLL_D4_D2>,
+				<&topckgen CLK_TOP_UNIVPLL_D4_D2>,
+				<&topckgen CLK_TOP_UNIVPLL_D6_D2>,
+				<&topckgen CLK_TOP_MMPLL_D6>,
+				<&topckgen CLK_TOP_MMPLL_D5>,
+				<&topckgen CLK_TOP_MMPLL_D4>,
+				<&topckgen CLK_TOP_UNIVPLL_D5>,
+				<&topckgen CLK_TOP_UNIVPLL_D4>,
+				<&topckgen CLK_TOP_UNIVPLL_D3>,
+				<&topckgen CLK_TOP_MAINPLL_D6>,
+				<&topckgen CLK_TOP_MAINPLL_D4>,
+				<&topckgen CLK_TOP_MAINPLL_D3>,
+				<&topckgen CLK_TOP_TVDPLL>,
+				<&topckgen CLK_TOP_APUPLL>,
+				<&topckgen CLK_TOP_NPUPLL>,
+				<&apmixedsys CLK_APMIXED_APUPLL>,
+				<&apmixedsys CLK_APMIXED_NPUPLL>;
+			clock-names = "clk_top_dsp_sel",
+				"clk_top_dsp1_sel",
+				"clk_top_dsp1_npupll_sel",
+				"clk_top_dsp2_sel",
+				"clk_top_dsp2_npupll_sel",
+				"clk_top_dsp5_sel",
+				"clk_top_dsp5_apupll_sel",
+				"clk_top_ipu_if_sel",
+				"clk_top_clk26m",
+				"clk_top_mainpll_d4_d2",
+				"clk_top_univpll_d4_d2",
+				"clk_top_univpll_d6_d2",
+				"clk_top_mmpll_d6",
+				"clk_top_mmpll_d5",
+				"clk_top_mmpll_d4",
+				"clk_top_univpll_d5",
+				"clk_top_univpll_d4",
+				"clk_top_univpll_d3",
+				"clk_top_mainpll_d6",
+				"clk_top_mainpll_d4",
+				"clk_top_mainpll_d3",
+				"clk_top_tvdpll_ck",
+				"clk_top_apupll_ck",
+				"clk_top_npupll_ck",
+				"clk_apmixed_apupll_rate",
+				"clk_apmixed_npupll_rate";
+		};
+
 		camsys: clock-controller@1a000000 {
 			compatible = "mediatek,mt8192-camsys";
 			reg = <0 0x1a000000 0 0x1000>;
Signature · 1 line
2.18.0
author
#16 lore raw

PATCH 16/17 arm64: dts: mt8192: Add apu-sw-logger node

In reply to Flora Fu

Add apu-sw-logger node to enable debug into tinysys.

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +6 -0
index f95d381ff1cc..c8cc58e74f3c 100644
@@ -914,6 +914,12 @@
 			#mbox-cells = <1>;
 		};
 
+		apusys_sw_logger@19000040 {
+			compatible = "mediatek,apu-sw-logger";
+			reg = <0 0x19000040 0 0x10>;
+			iommus = <&iommu_apu IOMMU_PORT_APU_DATA>;
+		};
+
 		apusys_rv@19001000 {
 			compatible = "mediatek,mt8192-apusys-rv", "simple-mfd";
 			reg = <0 0x19000000 0 0x1000>,
Signature · 1 line
2.18.0
author
#17 lore raw

PATCH 17/17 arm64: dts: mt8192: Set up regulators for APU subsys

In reply to Flora Fu

Set up APU regulators for mdla and vvpu.

---
 arch/arm64/boot/dts/mediatek/mt8192-evb.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192-evb.dts +5 -0
index 5d9e108e41f5..431008466d77 100644
@@ -35,3 +35,8 @@
 		domain-supply = <&mt6359_vproc1_buck_reg>;
 	};
 };
+
+&apusys_power {
+	vvpu-supply = <&mt6359_vproc1_buck_reg>;
+	vmdla-supply = <&mt6359_vproc2_buck_reg>;
+};
Signature · 1 line
2.18.0