Skip to contentSkip to conversation

support gce on mt8192 platform

PATCH In review Hsin-Yi Wang 2 participants 5 messages Feb 5, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover support gce on mt8192 platform

Change since v2:
- add controy_by_sw for mt8192

Change since v1:
- move out shift jump patch
- remove useless patch

Yongqiang Niu (3):
dt-binding: gce: add gce header file for mt8192
arm64: dts: mt8192: add gce node
mailbox: cmdq: add mt8192 support

 .../devicetree/bindings/mailbox/mtk-gce.txt   |   7 +-
 arch/arm64/boot/dts/mediatek/mt8192.dtsi      |  10 +
 drivers/mailbox/mtk-cmdq-mailbox.c            |  10 +
 include/dt-bindings/gce/mt8192-gce.h          | 419 ++++++++++++++++++
 4 files changed, 443 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/gce/mt8192-gce.h
Signature · 7 lines
2.30.0.365.g02bc693789-goog


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

PATCH v3 1/3 dt-binding: gce: add gce header file for mt8192

From: Yongqiang Niu <[email protected]>

Add documentation for the mt8192 gce.

Add gce header file defined the gce hardware event, subsys number and constant for mt8192.

---
 .../devicetree/bindings/mailbox/mtk-gce.txt   |   7 +-
 include/dt-bindings/gce/mt8192-gce.h          | 419 ++++++++++++++++++
 2 files changed, 423 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/gce/mt8192-gce.h
Documentation/devicetree/bindings/mailbox/mtk-gce.txt +4 -3
index 7771ecaac5868..ac4245050d17d 100644
@@ -9,8 +9,8 @@ CMDQ driver uses mailbox framework for communication. Please refer to
 mailbox.txt for generic information about mailbox device-tree bindings.
 
 Required properties:
-- compatible: can be "mediatek,mt8173-gce", "mediatek,mt8183-gce" or
-  "mediatek,mt6779-gce".
+- compatible: can be "mediatek,mt8173-gce", "mediatek,mt8183-gce",
+  "mediatek,mt8192-gce" or "mediatek,mt6779-gce".
 - reg: Address range of the GCE unit
 - interrupts: The interrupt signal from the GCE block
 - clock: Clocks according to the common clock binding
@@ -36,7 +36,8 @@ Optional properties for a client device:
   size: the total size of register address that GCE can access.
 
 Some vaules of properties are defined in 'dt-bindings/gce/mt8173-gce.h',
-'dt-binding/gce/mt8183-gce.h' or 'dt-bindings/gce/mt6779-gce.h'. Such as
+'dt-binding/gce/mt8183-gce.h', 'dt-binding/gce/mt8192-gce.h' or
+'dt-bindings/gce/mt6779-gce.h'. Such as
 sub-system ids, thread priority, event ids.
 
 Example:
include/dt-bindings/gce/mt8192-gce.h new file +419 -0

419 lines not on this page · raw message

Signature · 7 lines
2.30.0.365.g02bc693789-goog


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

Re: [PATCH v3 1/3] dt-binding: gce: add gce header file for mt8192

Hi, Hsin-Yi:

Hsin-Yi Wang <[email protected]> 於 2021年2月5日 週五 下午3:19寫道:

Quoted 96 lines

From: Yongqiang Niu <[email protected]>

Add documentation for the mt8192 gce.

Add gce header file defined the gce hardware event, subsys number and constant for mt8192.

---
 .../devicetree/bindings/mailbox/mtk-gce.txt   |   7 +-
 include/dt-bindings/gce/mt8192-gce.h          | 419 ++++++++++++++++++
 2 files changed, 423 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/gce/mt8192-gce.h
Documentation/devicetree/bindings/mailbox/mtk-gce.txt +4 -3
index 7771ecaac5868..ac4245050d17d 100644
@@ -9,8 +9,8 @@ CMDQ driver uses mailbox framework for communication. Please refer to
 mailbox.txt for generic information about mailbox device-tree bindings.
 
 Required properties:
-- compatible: can be "mediatek,mt8173-gce", "mediatek,mt8183-gce" or
-  "mediatek,mt6779-gce".
+- compatible: can be "mediatek,mt8173-gce", "mediatek,mt8183-gce",
+  "mediatek,mt8192-gce" or "mediatek,mt6779-gce".
 - reg: Address range of the GCE unit
 - interrupts: The interrupt signal from the GCE block
 - clock: Clocks according to the common clock binding
@@ -36,7 +36,8 @@ Optional properties for a client device:
   size: the total size of register address that GCE can access.
 
 Some vaules of properties are defined in 'dt-bindings/gce/mt8173-gce.h',
-'dt-binding/gce/mt8183-gce.h' or 'dt-bindings/gce/mt6779-gce.h'. Such as
+'dt-binding/gce/mt8183-gce.h', 'dt-binding/gce/mt8192-gce.h' or
+'dt-bindings/gce/mt6779-gce.h'. Such as
 sub-system ids, thread priority, event ids.
 
 Example:
include/dt-bindings/gce/mt8192-gce.h new file +48 -0
new file mode 100644
index 0000000000000..062754416bfda
@@ -0,0 +1,419 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 MediaTek Inc.
+ * Author: Yongqiang Niu <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_GCE_MT8192_H
+#define _DT_BINDINGS_GCE_MT8192_H
+
+/* assign timeout 0 also means default */
+#define CMDQ_NO_TIMEOUT                0xffffffff
+#define CMDQ_TIMEOUT_DEFAULT   1000
+
+/* GCE thread priority */
+#define CMDQ_THR_PRIO_LOWEST   0
+#define CMDQ_THR_PRIO_1                1
+#define CMDQ_THR_PRIO_2                2
+#define CMDQ_THR_PRIO_3                3
+#define CMDQ_THR_PRIO_4                4
+#define CMDQ_THR_PRIO_5                5
+#define CMDQ_THR_PRIO_6                6
+#define CMDQ_THR_PRIO_HIGHEST  7
+
+/* CPR count in 32bit register */
+#define GCE_CPR_COUNT          1312
+
+/* GCE subsys table */
+#define SUBSYS_1300XXXX                0
+#define SUBSYS_1400XXXX                1
+#define SUBSYS_1401XXXX                2
+#define SUBSYS_1402XXXX                3
+#define SUBSYS_1502XXXX                4
+#define SUBSYS_1880XXXX                5
+#define SUBSYS_1881XXXX                6
+#define SUBSYS_1882XXXX                7
+#define SUBSYS_1883XXXX                8
+#define SUBSYS_1884XXXX                9
+#define SUBSYS_1000XXXX                10
+#define SUBSYS_1001XXXX                11
+#define SUBSYS_1002XXXX                12
+#define SUBSYS_1003XXXX                13
+#define SUBSYS_1004XXXX                14
+#define SUBSYS_1005XXXX                15
+#define SUBSYS_1020XXXX                16
+#define SUBSYS_1028XXXX                17
+#define SUBSYS_1700XXXX                18
+#define SUBSYS_1701XXXX                19
+#define SUBSYS_1702XXXX                20

include/dt-bindings/gce/mt8192-gce.h line 58

Quoted 10 lines
include/dt-bindings/gce/mt8192-gce.h new file +10 -0
+#define SUBSYS_1703XXXX                21
+#define SUBSYS_1800XXXX                22
+#define SUBSYS_1801XXXX                23
+#define SUBSYS_1802XXXX                24
+#define SUBSYS_1804XXXX                25
+#define SUBSYS_1805XXXX                26
+#define SUBSYS_1808XXXX                27
+#define SUBSYS_180aXXXX                28
+#define SUBSYS_180bXXXX                29
+#define SUBSYS_NO_SUPPORT      99

Why define no support?

Quoted 20 lines
include/dt-bindings/gce/mt8192-gce.h new file +20 -0
+
+/* GCE General Purpose Register (GPR) support
+ * Leave note for scenario usage here
+ */
+/* GCE: write mask */
+#define GCE_GPR_R00            0x00
+#define GCE_GPR_R01            0x01
+/* MDP: P1: JPEG dest */
+#define GCE_GPR_R02            0x02
+#define GCE_GPR_R03            0x03
+/* MDP: PQ color */
+#define GCE_GPR_R04            0x04
+/* MDP: 2D sharpness */
+#define GCE_GPR_R05            0x05
+/* DISP: poll esd */
+#define GCE_GPR_R06            0x06
+#define GCE_GPR_R07            0x07
+/* MDP: P4: 2D sharpness dst */
+#define GCE_GPR_R08            0x08
+#define GCE_GPR_R09            0x09

include/dt-bindings/gce/mt8192-gce.h line 88

Quoted 10 lines
include/dt-bindings/gce/mt8192-gce.h new file +10 -0
+/* VCU: poll with timeout for GPR timer */
+#define GCE_GPR_R10            0x0A
+#define GCE_GPR_R11            0x0B
+/* CMDQ: debug */
+#define GCE_GPR_R12            0x0C
+#define GCE_GPR_R13            0x0D
+/* CMDQ: P7: debug */
+#define GCE_GPR_R14            0x0E
+#define GCE_GPR_R15            0x0F
+

If there are 1024 general registers, you would have 1024 definition here?

[snip]

include/dt-bindings/gce/mt8192-gce.h line 363

Quoted 1 line
include/dt-bindings/gce/mt8192-gce.h new file +1 -0
+#define CMDQ_EVENT_OUT_EVENT_0                         898

If the sw token is from 512 to 1023, is this sw token?

Quoted 26 lines
include/dt-bindings/gce/mt8192-gce.h new file +26 -0
+
+/* CMDQ sw tokens
+ * Following definitions are gce sw token which may use by clients
+ * event operation API.
+ * Note that token 512 to 639 may set secure
+ */
+
+/* end of hw event and begin of sw token */
+#define CMDQ_MAX_HW_EVENT                              512
+
+/* Config thread notify trigger thread */
+#define CMDQ_SYNC_TOKEN_CONFIG_DIRTY                   640
+/* Trigger thread notify config thread */
+#define CMDQ_SYNC_TOKEN_STREAM_EOF                     641
+/* Block Trigger thread until the ESD check finishes. */
+#define CMDQ_SYNC_TOKEN_ESD_EOF                                642
+#define CMDQ_SYNC_TOKEN_STREAM_BLOCK                   643
+/* check CABC setup finish */
+#define CMDQ_SYNC_TOKEN_CABC_EOF                       644
+
+/* Notify normal CMDQ there are some secure task done
+ * MUST NOT CHANGE, this token sync with secure world
+ */
+#define CMDQ_SYNC_SECURE_THR_EOF                       647
+
+/* CMDQ use sw token */

include/dt-bindings/gce/mt8192-gce.h line 399

Quoted 10 lines
include/dt-bindings/gce/mt8192-gce.h new file +10 -0
+#define CMDQ_SYNC_TOKEN_USER_0                         649
+#define CMDQ_SYNC_TOKEN_USER_1                         650
+#define CMDQ_SYNC_TOKEN_POLL_MONITOR                   651
+
+/* ISP sw token */
+#define CMDQ_SYNC_TOKEN_MSS                            665
+#define CMDQ_SYNC_TOKEN_MSF                            666
+
+/* DISP sw token */
+#define CMDQ_SYNC_TOKEN_SODI                           671

sw token is an event which is trigger by software. Each driver could choose some sw token to use. But I think each sw token could be used by any driver. So this definition is a software definition and it should be placed in driver.

include/dt-bindings/gce/mt8192-gce.h line 410

Quoted 11 lines
include/dt-bindings/gce/mt8192-gce.h new file +11 -0
+
+/* GPR access tokens (for HW register backup)
+ * There are 15 32-bit GPR, 3 GPR form a set
+ * (64-bit for address, 32-bit for value)
+ * MUST NOT CHANGE, these tokens sync with MDP
+ */
+#define CMDQ_SYNC_TOKEN_GPR_SET_0                      700
+#define CMDQ_SYNC_TOKEN_GPR_SET_1                      701
+#define CMDQ_SYNC_TOKEN_GPR_SET_2                      702
+#define CMDQ_SYNC_TOKEN_GPR_SET_3                      703
+#define CMDQ_SYNC_TOKEN_GPR_SET_4                      704

This looks like software definition.

include/dt-bindings/gce/mt8192-gce.h line 414

Quoted 4 lines
include/dt-bindings/gce/mt8192-gce.h new file +4 -0
+
+/* Resource lock event to control resource in GCE thread */
+#define CMDQ_SYNC_RESOURCE_WROT0                       710
+#define CMDQ_SYNC_RESOURCE_WROT1                       711

This looks like software definition.

Regards,
Chun-Kuang.

Quoted 9 lines
include/dt-bindings/gce/mt8192-gce.h new file +5 -1
+
+#define CMDQ_EVENT_MAX                                 0x3FF
+/* CMDQ sw tokens END */
+
+#endif
--

2.30.0.365.g02bc693789-goog

Quoted 4 lines

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

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

#3 lore raw

PATCH v3 2/3 arm64: dts: mt8192: add gce node

In reply to Hsin-Yi Wang

From: Yongqiang Niu <[email protected]>

add gce node for mt8192

---
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +10 -0
index 9757138a8bbd8..1afa6ad06b2b8 100644
@@ -5,6 +5,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gce/mt8192-gce.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pinctrl/mt8192-pinfunc.h>
@@ -291,6 +292,15 @@ systimer: timer@10017000 {
 			clock-names = "clk13m";
 		};
 
+		gce: mailbox@10228000 {
+			compatible = "mediatek,mt8192-gce";
+			reg = <0 0x10228000 0 0x4000>;
+			interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH 0>;
+			#mbox-cells = <3>;
+			clocks = <&infracfg CLK_INFRA_GCE>;
+			clock-names = "gce";
+		};
+
 		uart0: serial@11002000 {
 			compatible = "mediatek,mt8192-uart",
 				     "mediatek,mt6577-uart";
Signature · 7 lines
2.30.0.365.g02bc693789-goog


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

PATCH v3 3/3 mailbox: cmdq: add mt8192 support

In reply to Hsin-Yi Wang

From: Yongqiang Niu <[email protected]>

add mt8192 support

---
 drivers/mailbox/mtk-cmdq-mailbox.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mailbox/mtk-cmdq-mailbox.c +10 -0
index 5665b6ea8119f..de4793ef6798a 100644
@@ -36,6 +36,8 @@
 #define CMDQ_THR_WAIT_TOKEN		0x30
 #define CMDQ_THR_PRIORITY		0x40
 
+#define GCE_GCTL_VALUE			0x48
+
 #define CMDQ_THR_ACTIVE_SLOT_CYCLES	0x3200
 #define CMDQ_THR_ENABLED		0x1
 #define CMDQ_THR_DISABLED		0x0
@@ -76,11 +78,13 @@ struct cmdq {
 	struct clk		*clock;
 	bool			suspended;
 	u8			shift_pa;
+	bool			control_by_sw;
 };
 
 struct gce_plat {
 	u32 thread_nr;
 	u8 shift;
+	bool control_by_sw;
 };
 
 u8 cmdq_get_shift_pa(struct mbox_chan *chan)
@@ -121,6 +125,8 @@ static void cmdq_init(struct cmdq *cmdq)
 	int i;
 
 	WARN_ON(clk_enable(cmdq->clock) < 0);
+	if (cmdq->control_by_sw)
+		writel(0x7, cmdq->base + GCE_GCTL_VALUE);
 	writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
 	for (i = 0; i <= CMDQ_MAX_EVENT; i++)
 		writel(i, cmdq->base + CMDQ_SYNC_TOKEN_UPDATE);
@@ -536,6 +542,7 @@ static int cmdq_probe(struct platform_device *pdev)
 
 	cmdq->thread_nr = plat_data->thread_nr;
 	cmdq->shift_pa = plat_data->shift;
+	cmdq->control_by_sw = plat_data->control_by_sw;
 	cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
 	err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
 			       "mtk_cmdq", cmdq);
@@ -601,11 +608,14 @@ static const struct dev_pm_ops cmdq_pm_ops = {
 static const struct gce_plat gce_plat_v2 = {.thread_nr = 16};
 static const struct gce_plat gce_plat_v3 = {.thread_nr = 24};
 static const struct gce_plat gce_plat_v4 = {.thread_nr = 24, .shift = 3};
+static const struct gce_plat gce_plat_v5 = {.thread_nr = 24, .shift = 3,
+					    .control_by_sw = true};
 
 static const struct of_device_id cmdq_of_ids[] = {
 	{.compatible = "mediatek,mt8173-gce", .data = (void *)&gce_plat_v2},
 	{.compatible = "mediatek,mt8183-gce", .data = (void *)&gce_plat_v3},
 	{.compatible = "mediatek,mt6779-gce", .data = (void *)&gce_plat_v4},
+	{.compatible = "mediatek,mt8192-gce", .data = (void *)&gce_plat_v5},
 	{}
 };
 
Signature · 7 lines
2.30.0.365.g02bc693789-goog


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