Skip to contentSkip to conversation

add Mali-450 support to MT7623 SoC

PATCH Superseded [email protected] 3 participants 13 messages Apr 18, 2018 – Apr 24, 2018

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add Mali-450 support to MT7623 SoC

From: Sean Wang <[email protected]>

Hi,

The series adds a required resource setup to allow Mali-450 to work on MT7623. This also can benefits other MediaTek SoCs having Mali-450 device.

In order to prove the setup is proper, I also have added mediatek port to linux-lima at [1] and make a few of tests along with off-screen rendering [2][3][4][5][6][7] through mesa-lima [8]. All work correctly.

[1] https://github.com/objelf/linux-lima/tree/mediatek-lima-4.16-rc5
[2] simple triangle: https://github.com/yuq/gfx/tree/master/gbm-surface
[3] vertex shader uniform: https://github.com/yuq/gfx/tree/master/gbm-surface-move
[4] multi varying: https://github.com/yuq/gfx/tree/master/gbm-surface-color
[5] multi draw: https://github.com/yuq/gfx/tree/master/gbm-surface-draw
[6] FBO: https://github.com/yuq/gfx/tree/master/gbm-surface-fbo
[7] kmscube: https://github.com/yuq/kmscube
[8] https://github.com/yuq/mesa-lima

Hope these patches can help people working on BPI-R2.

Sean

Sean Wang (4):
dt-bindings: gpu: mali-utgard: add mediatek,mt7623-mali compatible
dt-bindings: clock: mediatek: add g3dsys bindings
clk: mediatek: add g3dsys support for MT2701 and MT7623
arm: dts: mt7623: add Mali-450 and related device nodes

 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 +++++++
 .../devicetree/bindings/gpu/arm,mali-utgard.txt    |  9 ++
 arch/arm/boot/dts/mt7623.dtsi                      | 70 ++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi                     |  4 +
 drivers/clk/mediatek/Kconfig                       |  6 ++
 drivers/clk/mediatek/Makefile                      |  1 +
 drivers/clk/mediatek/clk-mt2701-g3d.c              | 95 ++++++++++++++++++++++
 include/dt-bindings/clock/mt2701-clk.h             |  4 +
 include/dt-bindings/reset/mt2701-resets.h          |  3 +
 9 files changed, 222 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt
 create mode 100644 drivers/clk/mediatek/clk-mt2701-g3d.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 dt-bindings: gpu: mali-utgard: add mediatek,mt7623-mali compatible

From: Sean Wang <[email protected]>

The MediaTek MT7623 SoC contains a Mali-450, so add a compatible for it and define its own vendor-specific properties.

---
 Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt +9 -0
index c1f65d1..e149995 100644
@@ -20,6 +20,7 @@ Required properties:
       + rockchip,rk3228-mali
       + rockchip,rk3328-mali
       + stericsson,db8500-mali
+      + mediatek,mt7623-mali
 
   - reg: Physical base address and length of the GPU registers
 
@@ -86,6 +87,14 @@ to specify one more vendor-specific compatible, among:
       * interrupt-names and interrupts:
         + combined: combined interrupt of all of the above lines
 
+  - mediatek,mt7623-mali
+     Required properties:
+      * resets: phandle to the reset line for the GPU
+      * mediatek,larb: phandle pointed to the local arbiter used to control the
+	access to external memory on the SoC.
+	see Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
+	for details
+
 Example:
 
 mali: gpu@1c40000 {
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH v1 1/4] dt-bindings: gpu: mali-utgard: add mediatek,mt7623-mali compatible

Quoted 9 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

The MediaTek MT7623 SoC contains a Mali-450, so add a compatible for it and define its own vendor-specific properties.

---
 Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
#3 lore raw

PATCH 2/4 dt-bindings: clock: mediatek: add g3dsys bindings

In reply to [email protected]

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +30 -0
new file mode 100644
index 0000000..ff2d70c
@@ -0,0 +1,30 @@
+MediaTek g3dsys controller
+============================
+
+The MediaTek g3dsys controller provides various clocks and reset controller to
+the GPU.
+
+Required Properties:
+
+- compatible: Should be:
+	- "mediatek,mt2701-g3dsys", "syscon":
+		for MT2701 SoC
+	- "mediatek,mt7623-ethsys", "mediatek,mt2701-g3dsys", "syscon":
+		for MT7623 SoC
+- #clock-cells: Must be 1
+- #reset-cells: Must be 1
+
+The ethsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+g3dsys: clock-controller@13000000 {
+	compatible = "mediatek,mt7623-g3dsys",
+		     "mediatek,mt2701-g3dsys",
+		     "syscon";
+	reg = <0 0x13000000 0 0x200>;
+	#clock-cells = <1>;
+	#reset-cells = <1>;
+};
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: mediatek: add g3dsys bindings

Quoting sean.wang at mediatek.com (2018-04-18 03:24:54)

Quoted 8 lines

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++

Why isn't this under bindings/clock/ ?

author
#5 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: mediatek: add g3dsys bindings

Quoted 12 lines · Stephen Boyd

Quoting [email protected] (2018-04-18 03:24:54)

Quoted 8 lines

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++

Why isn't this under bindings/clock/ ?

Tons of bindings for clock controller have been present at binding/arm/mediatek. g3dsys just have a follow-up to them.

It's worth another patch moving them all from bindings/arm/mediatek/ to bindings/clock/mediatek.

what's your opinion for either doing it prior to g3dsys binding being added or doing it in the future ?

Quoted 5 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

maintainer
#6 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: mediatek: add g3dsys bindings

Quoting Sean Wang (2018-04-18 20:50:02)

Quoted 14 lines · Stephen Boyd
Quoted 12 lines

Quoting sean.wang at mediatek.com (2018-04-18 03:24:54)

Quoted 8 lines

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++

Why isn't this under bindings/clock/ ?

Quoted 9 lines

Tons of bindings for clock controller have been present at binding/arm/mediatek. g3dsys just have a follow-up to them.

It's worth another patch moving them all from bindings/arm/mediatek/ to bindings/clock/mediatek.

what's your opinion for either doing it prior to g3dsys binding being added or doing it in the future ?

Doing it at a later time is fine. Just wondering why they're all getting dumped into the arm/ directory.

maintainer
#7 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: mediatek: add g3dsys bindings

In reply to [email protected]
Quoted 20 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +3 -0
new file mode 100644
index 0000000..ff2d70c
@@ -0,0 +1,30 @@
+MediaTek g3dsys controller
+============================
+

Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +10 -0
+The MediaTek g3dsys controller provides various clocks and reset controller to
+the GPU.
+
+Required Properties:
+
+- compatible: Should be:
+	- "mediatek,mt2701-g3dsys", "syscon":
+		for MT2701 SoC
+	- "mediatek,mt7623-ethsys", "mediatek,mt2701-g3dsys", "syscon":
+		for MT7623 SoC

ethsys?

Quoted 20 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +17 -0
+- #clock-cells: Must be 1
+- #reset-cells: Must be 1
+
+The ethsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+g3dsys: clock-controller at 13000000 {
+	compatible = "mediatek,mt7623-g3dsys",
+		     "mediatek,mt2701-g3dsys",
+		     "syscon";
+	reg = <0 0x13000000 0 0x200>;
+	#clock-cells = <1>;
+	#reset-cells = <1>;
+};
Signature · 1 line
2.7.4
author
#8 lore raw

Re: [PATCH v1 2/4] dt-bindings: clock: mediatek: add g3dsys bindings

Quoted 25 lines · Rob Herring
Quoted 24 lines · On Wed, Apr 18, 2018 at 06:24:54PM +0800, [email protected] wrote:

From: Sean Wang <[email protected]>

Add bindings to g3dsys providing necessary clock and reset control to Mali-450.

---
 .../bindings/arm/mediatek/mediatek,g3dsys.txt      | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +7 -0
new file mode 100644
index 0000000..ff2d70c
@@ -0,0 +1,30 @@
+MediaTek g3dsys controller
+============================
+
+The MediaTek g3dsys controller provides various clocks and reset controller to
+the GPU.
+
+Required Properties:
Quoted 9 lines

Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt line 13

Quoted 6 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +6 -0
+
+- compatible: Should be:
+	- "mediatek,mt2701-g3dsys", "syscon":
+		for MT2701 SoC
+	- "mediatek,mt7623-ethsys", "mediatek,mt2701-g3dsys", "syscon":
+		for MT7623 SoC

ethsys?

thanks! I'll also fix it up in the next version.

Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/arm/mediatek/mediatek,g3dsys.txt new file +17 -0
+- #clock-cells: Must be 1
+- #reset-cells: Must be 1
+
+The ethsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+g3dsys: clock-controller@13000000 {
+	compatible = "mediatek,mt7623-g3dsys",
+		     "mediatek,mt2701-g3dsys",
+		     "syscon";
+	reg = <0 0x13000000 0 0x200>;
+	#clock-cells = <1>;
+	#reset-cells = <1>;
+};
Signature · 1 line
2.7.4
#9 lore raw

PATCH 3/4 clk: mediatek: add g3dsys support for MT2701 and MT7623

In reply to [email protected]

From: Sean Wang <[email protected]>

Add clock driver support for g3dsys on MT2701 and MT7623, which is providing essential clock gate and reset controller to Mali-450.

---
 drivers/clk/mediatek/Kconfig              |  6 ++
 drivers/clk/mediatek/Makefile             |  1 +
 drivers/clk/mediatek/clk-mt2701-g3d.c     | 95 +++++++++++++++++++++++++++++++
 include/dt-bindings/clock/mt2701-clk.h    |  4 ++
 include/dt-bindings/reset/mt2701-resets.h |  3 +
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-g3d.c
drivers/clk/mediatek/Kconfig +6 -0
index 92afe59..3dd1dab 100644
@@ -60,6 +60,12 @@ config COMMON_CLK_MT2701_AUDSYS
 	---help---
 	  This driver supports Mediatek MT2701 audsys clocks.
 
+config COMMON_CLK_MT2701_G3DSYS
+	bool "Clock driver for MediaTek MT2701 g3dsys"
+	depends on COMMON_CLK_MT2701
+	---help---
+	  This driver supports MediaTek MT2701 g3dsys clocks.
+
 config COMMON_CLK_MT2712
 	bool "Clock driver for MediaTek MT2712"
 	depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index b80eff2..844b55d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_COMMON_CLK_MT2701) += clk-mt2701.o
 obj-$(CONFIG_COMMON_CLK_MT2701_AUDSYS) += clk-mt2701-aud.o
 obj-$(CONFIG_COMMON_CLK_MT2701_BDPSYS) += clk-mt2701-bdp.o
 obj-$(CONFIG_COMMON_CLK_MT2701_ETHSYS) += clk-mt2701-eth.o
+obj-$(CONFIG_COMMON_CLK_MT2701_G3DSYS) += clk-mt2701-g3d.o
 obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o
 obj-$(CONFIG_COMMON_CLK_MT2701_IMGSYS) += clk-mt2701-img.o
 obj-$(CONFIG_COMMON_CLK_MT2701_MMSYS) += clk-mt2701-mm.o
drivers/clk/mediatek/clk-mt2701-g3d.c new file +95 -0

95 lines not on this page · raw message

include/dt-bindings/clock/mt2701-clk.h +4 -0
index 24e93df..2ac62a6 100644
@@ -431,6 +431,10 @@
 #define CLK_ETHSYS_CRYPTO			8
 #define CLK_ETHSYS_NR				9
 
+/* G3DSYS */
+#define CLK_G3DSYS_CORE				1
+#define CLK_G3DSYS_NR				2
+
 /* BDP */
 
 #define CLK_BDP_BRG_BA				1
include/dt-bindings/reset/mt2701-resets.h +3 -0
index 21deb54..50b7f06 100644
@@ -87,4 +87,7 @@
 #define MT2701_ETHSYS_GMAC_RST			23
 #define MT2701_ETHSYS_PPE_RST			31
 
+/* G3DSYS resets */
+#define MT2701_G3DSYS_CORE_RST			0
+
 #endif  /* _DT_BINDINGS_RESET_CONTROLLER_MT2701 */
Signature · 1 line
2.7.4
maintainer
#10 lore raw

Re: [PATCH v1 3/4] clk: mediatek: add g3dsys support for MT2701 and MT7623

Quoted 5 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Add clock driver support for g3dsys on MT2701 and MT7623, which is providing essential clock gate and reset controller to Mali-450.

Quoted 8 lines
---
 drivers/clk/mediatek/Kconfig              |  6 ++
 drivers/clk/mediatek/Makefile             |  1 +
 drivers/clk/mediatek/clk-mt2701-g3d.c     | 95 +++++++++++++++++++++++++++++++
 include/dt-bindings/clock/mt2701-clk.h    |  4 ++
 include/dt-bindings/reset/mt2701-resets.h |  3 +

These below in the binding patch.

Quoted 2 lines
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-g3d.c
author
#11 lore raw

Re: [PATCH v1 3/4] clk: mediatek: add g3dsys support for MT2701 and MT7623

Quoted 12 lines · Rob Herring
Quoted 10 lines · On Wed, Apr 18, 2018 at 06:24:55PM +0800, [email protected] wrote:

From: Sean Wang <[email protected]>

Add clock driver support for g3dsys on MT2701 and MT7623, which is providing essential clock gate and reset controller to Mali-450.

---
 drivers/clk/mediatek/Kconfig              |  6 ++
 drivers/clk/mediatek/Makefile             |  1 +
 drivers/clk/mediatek/clk-mt2701-g3d.c     | 95 +++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 2 lines
 include/dt-bindings/clock/mt2701-clk.h    |  4 ++
 include/dt-bindings/reset/mt2701-resets.h |  3 +

These below in the binding patch.

Thanks, I will split them out in the next version.

Quoted 2 lines
Quoted 2 lines
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt2701-g3d.c
#12 lore raw

PATCH 4/4 arm: dts: mt7623: add Mali-450 and related device nodes

In reply to [email protected]

From: Sean Wang <[email protected]>

Add nodes for Mali-450 device, g3dsys device providing required clock gate and reset control and larb3 offering an arbiter through iommu for controlling access to external memory requested from Mali-450.

---
 arch/arm/boot/dts/mt7623.dtsi  | 70 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/mt7623a.dtsi |  4 +++
 2 files changed, 74 insertions(+)
arch/arm/boot/dts/mt7623.dtsi +70 -0
index d1eb123..ace92b3 100644
@@ -274,6 +274,17 @@
 		clock-names = "system-clk", "rtc-clk";
 	};
 
+	smi_common: smi@1000c000 {
+		compatible = "mediatek,mt7623-smi-common",
+			     "mediatek,mt2701-smi-common";
+		reg = <0 0x1000c000 0 0x1000>;
+		clocks = <&infracfg CLK_INFRA_SMI>,
+			 <&mmsys CLK_MM_SMI_COMMON>,
+			 <&infracfg CLK_INFRA_SMI>;
+		clock-names = "apb", "smi", "async";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
+	};
+
 	pwrap: pwrap@1000d000 {
 		compatible = "mediatek,mt7623-pwrap",
 			     "mediatek,mt2701-pwrap";
@@ -305,6 +316,17 @@
 		reg = <0 0x10200100 0 0x1c>;
 	};
 
+	iommu: iommu@10205000 {
+		compatible = "mediatek,mt7623-m4u",
+			     "mediatek,mt2701-m4u";
+		reg = <0 0x10205000 0 0x1000>;
+		interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&infracfg CLK_INFRA_M4U>;
+		clock-names = "bclk";
+		mediatek,larbs = <&larb3>;
+		#iommu-cells = <1>;
+	};
+
 	efuse: efuse@10206000 {
 		compatible = "mediatek,mt7623-efuse",
 			     "mediatek,mt8173-efuse";
@@ -680,6 +702,54 @@
 		status = "disabled";
 	};
 
+	g3dsys: clock-controller@13000000 {
+		compatible = "mediatek,mt7623-g3dsys",
+			     "mediatek,mt2701-g3dsys",
+			     "syscon";
+		reg = <0 0x13000000 0 0x200>;
+		#clock-cells = <1>;
+		#reset-cells = <1>;
+	};
+
+	larb3: larb@13010000 {
+		compatible = "mediatek,mt7623-smi-larb",
+			     "mediatek,mt2701-smi-larb";
+		reg = <0 0x13010000 0 0x1000>;
+		mediatek,smi = <&smi_common>;
+		mediatek,larb-id = <3>;
+		clocks = <&clk26m>, <&clk26m>;
+		clock-names = "apb", "smi";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
+	};
+
+	mali: gpu@13040000 {
+		compatible = "mediatek,mt7623-mali", "arm,mali-450";
+		reg = <0 0x13040000 0 0x30000>;
+		interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 173 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 177 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1",
+				  "ppmmu1", "pp2", "ppmmu2", "pp";
+		clocks = <&topckgen CLK_TOP_MMPLL>,
+			 <&g3dsys CLK_G3DSYS_CORE>;
+		clock-names = "bus", "core";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
+		mediatek,larb = <&larb3>;
+		resets = <&g3dsys MT2701_G3DSYS_CORE_RST>;
+	};
+
+	mmsys: syscon@14000000 {
+		compatible = "mediatek,mt2701-mmsys", "syscon";
+		reg = <0 0x14000000 0 0x1000>;
+		#clock-cells = <1>;
+	};
+
 	hifsys: syscon@1a000000 {
 		compatible = "mediatek,mt7623-hifsys",
 			     "mediatek,mt2701-hifsys",
arch/arm/boot/dts/mt7623a.dtsi +4 -0
index 0735a1fb8..a42fd46 100644
@@ -21,6 +21,10 @@
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_ETH>;
 };
 
+&mali {
+	status = "disabled";
+};
+
 &nandc {
 	power-domains = <&scpsys MT7623A_POWER_DOMAIN_IFR_MSC>;
 };
Signature · 1 line
2.7.4