LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v6 00/12] support gce on mt8183 platform
@ 2019-05-16  9:02 Bibby Hsieh
  2019-05-16  9:02 ` [PATCH v6 01/12] dt-binding: gce: remove thread-num property Bibby Hsieh
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Bibby Hsieh @ 2019-05-16  9:02 UTC (permalink / raw)
  To: Jassi Brar, Matthias Brugger, Rob Herring, CK HU
  Cc: Daniel Kurtz, Sascha Hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, srv_heupstream, Sascha Hauer,
	Philipp Zabel, Nicolas Boichat, YT Shen, Daoyuan Huang,
	Jiaguang Zhang, Dennis-YC Hsieh, Houlong Wei, ginny.chen,
	Bibby Hsieh

Changes since v5:
 - fix typo
 - remove gce-event-name form the dt-binding
 - add reasons in commit message

Changes since v4:
 - refine the architecture of the packet encoder function
 - refine the gce enevt property
 - change the patch's title

Changes since v3:
 - fix a typo in dt-binding and dtsi
 - cast the return value to right format

Changes since v2:
 - according to CK's review comment, change the property name and
   refine the parameter
 - change the patch's title
 - remove unused property from dt-binding and dts

Changes since v1:
 - add prefix "cmdq" in the commit subject
 - add dt-binding document for get event and subsys function
 - add fix up tag in fixup patch
 - fix up some coding style (alignment)

MTK will support gce function on mt8183 platform.
  dt-binding: gce: add gce header file for mt8183
  mailbox: mediatek: cmdq: support mt8183 gce function
  arm64: dts: add gce node for mt8183

Besides above patches, we refine gce driver on those patches.
  mailbox: mediatek: cmdq: move the CMDQ_IRQ_MASK into cmdq driver data
  soc: mediatek: cmdq: clear the event in cmdq initial flow

In order to enhance the convenience of gce usage, we add new helper
functions and refine the method of instruction combining.
  dt-binding: gce: remove thread-num property
  dt-binding: gce: add binding for gce subsys property
  dt-binding: gce: add binding for gce event property
  soc: mediatek: cmdq: define the instruction struct
  soc: mediatek: cmdq: add polling function
  soc: mediatek: cmdq: add cmdq_dev_get_subsys function
  soc: mediatek: cmdq: add cmdq_dev_get_event function

Bibby Hsieh (12):
  dt-binding: gce: remove thread-num property
  dt-binding: gce: add gce header file for mt8183
  dt-binding: gce: add binding for gce subsys property
  dt-binding: gce: add binding for gce event property
  mailbox: mediatek: cmdq: move the CMDQ_IRQ_MASK into cmdq driver data
  mailbox: mediatek: cmdq: support mt8183 gce function
  soc: mediatek: cmdq: clear the event in cmdq initial flow
  soc: mediatek: cmdq: define the instruction struct
  soc: mediatek: cmdq: add polling function
  soc: mediatek: cmdq: add cmdq_dev_get_subsys function
  soc: mediatek: cmdq: add cmdq_dev_get_event function
  arm64: dts: add gce node for mt8183

 .../devicetree/bindings/mailbox/mtk-gce.txt   |  28 ++-
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  11 ++
 drivers/mailbox/mtk-cmdq-mailbox.c            |  18 +-
 drivers/soc/mediatek/mtk-cmdq-helper.c        | 184 ++++++++++++++----
 include/dt-bindings/gce/mt8183-gce.h          | 177 +++++++++++++++++
 include/linux/mailbox/mtk-cmdq-mailbox.h      |   5 +
 include/linux/soc/mediatek/mtk-cmdq.h         |  62 +++++-
 7 files changed, 423 insertions(+), 62 deletions(-)
 create mode 100644 include/dt-bindings/gce/mt8183-gce.h

-- 
2.18.0


^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH v6 07/12] soc: mediatek: cmdq: clear the event in cmdq initial flow
@ 2019-05-16  9:27 Bibby Hsieh
  2019-05-16  9:27 ` [PATCH v6 11/12] soc: mediatek: cmdq: add cmdq_dev_get_event function Bibby Hsieh
  0 siblings, 1 reply; 19+ messages in thread
From: Bibby Hsieh @ 2019-05-16  9:27 UTC (permalink / raw)
  To: Jassi Brar, Matthias Brugger, Rob Herring, CK HU
  Cc: Daniel Kurtz, Sascha Hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, srv_heupstream, Sascha Hauer,
	Philipp Zabel, Nicolas Boichat, YT Shen, Daoyuan Huang,
	Jiaguang Zhang, Dennis-YC Hsieh, Houlong Wei, ginny.chen,
	Bibby Hsieh

GCE hardware stored event information in own internal sysram,
if the initial value in those sysram is not zero value
it will cause a situation that gce can wait the event immediately
after client ask gce to wait event but not really trigger the
corresponding hardware.

In order to make sure that the wait event function is
exactly correct, we need to clear the sysram value in
cmdq initial flow.

Fixes: 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver")

Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
 drivers/mailbox/mtk-cmdq-mailbox.c       | 5 +++++
 include/linux/mailbox/mtk-cmdq-mailbox.h | 2 ++
 include/linux/soc/mediatek/mtk-cmdq.h    | 3 ---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 6db1e2dd2dea..2c1b80d82c3a 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -20,6 +20,7 @@
 #define CMDQ_NUM_CMD(t)			(t->cmd_buf_size / CMDQ_INST_SIZE)
 
 #define CMDQ_CURR_IRQ_STATUS		0x10
+#define CMDQ_SYNC_TOKEN_UPDATE		0x68
 #define CMDQ_THR_SLOT_CYCLES		0x30
 #define CMDQ_THR_BASE			0x100
 #define CMDQ_THR_SIZE			0x80
@@ -103,8 +104,12 @@ static void cmdq_thread_resume(struct cmdq_thread *thread)
 
 static void cmdq_init(struct cmdq *cmdq)
 {
+	int i;
+
 	WARN_ON(clk_enable(cmdq->clock) < 0);
 	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);
 	clk_disable(cmdq->clock);
 }
 
diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h
index ccb73422c2fa..911475da7a53 100644
--- a/include/linux/mailbox/mtk-cmdq-mailbox.h
+++ b/include/linux/mailbox/mtk-cmdq-mailbox.h
@@ -19,6 +19,8 @@
 #define CMDQ_WFE_UPDATE			BIT(31)
 #define CMDQ_WFE_WAIT			BIT(15)
 #define CMDQ_WFE_WAIT_VALUE		0x1
+/** cmdq event maximum */
+#define CMDQ_MAX_EVENT			0x3ff
 
 /*
  * CMDQ_CODE_MASK:
diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h
index 54ade13a9b15..4e8899972db4 100644
--- a/include/linux/soc/mediatek/mtk-cmdq.h
+++ b/include/linux/soc/mediatek/mtk-cmdq.h
@@ -13,9 +13,6 @@
 
 #define CMDQ_NO_TIMEOUT		0xffffffffu
 
-/** cmdq event maximum */
-#define CMDQ_MAX_EVENT				0x3ff
-
 struct cmdq_pkt;
 
 struct cmdq_client {
-- 
2.18.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-05-24 21:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16  9:02 [PATCH v6 00/12] support gce on mt8183 platform Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 01/12] dt-binding: gce: remove thread-num property Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 02/12] dt-binding: gce: add gce header file for mt8183 Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 03/12] dt-binding: gce: add binding for gce subsys property Bibby Hsieh
2019-05-17  1:55   ` CK Hu
2019-05-16  9:02 ` [PATCH v6 04/12] dt-binding: gce: add binding for gce event property Bibby Hsieh
2019-05-24 21:54   ` Rob Herring
2019-05-16  9:02 ` [PATCH v6 05/12] mailbox: mediatek: cmdq: move the CMDQ_IRQ_MASK into cmdq driver data Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 06/12] mailbox: mediatek: cmdq: support mt8183 gce function Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 07/12] soc: mediatek: cmdq: clear the event in cmdq initial flow Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 08/12] soc: mediatek: cmdq: define the instruction struct Bibby Hsieh
2019-05-17  3:32   ` CK Hu
2019-05-16  9:02 ` [PATCH v6 09/12] soc: mediatek: cmdq: add polling function Bibby Hsieh
2019-05-16  9:02 ` [PATCH v6 10/12] soc: mediatek: cmdq: add cmdq_dev_get_subsys function Bibby Hsieh
2019-05-17  1:43   ` CK Hu
2019-05-16  9:02 ` [PATCH v6 11/12] soc: mediatek: cmdq: add cmdq_dev_get_event function Bibby Hsieh
2019-05-16 10:27   ` CK Hu
2019-05-16  9:02 ` [PATCH v6 12/12] arm64: dts: add gce node for mt8183 Bibby Hsieh
2019-05-16  9:27 [PATCH v6 07/12] soc: mediatek: cmdq: clear the event in cmdq initial flow Bibby Hsieh
2019-05-16  9:27 ` [PATCH v6 11/12] soc: mediatek: cmdq: add cmdq_dev_get_event function Bibby Hsieh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).