Add the per-SoC data and compatible strings for the MT8189 vdosys0
OVL0 -> RDMA0 -> DSI0 pipeline. It reuses IP that the existing drivers
already handle:

  - MUTEX: the SOF selector encoding matches the mt8366 generation, and
    so do the OVL and RDMA module indices, but the DSI sits at index 22
    rather than 13, so the pipeline gets data of its own.
  - OVL: the mt8366 data applies as is (10 GMC bits, SMI id enable and
    extended colour format support).
  - DSI: the path and the mmsys display data path muxes are the mt8366
    ones, so reuse mt8366_dsi_path and mt8366_ddp_ovl_to_dsi(). The
    register layout is the mt8188 one that mtk_dsi already implements,
    including the command queue at 0xd00 that has to be sized explicitly
    for long packets. Unlike the mt8366, which has no shadow control,
    this SoC keeps it at 0xc00, where upstream Linux has it for the
    mt8188. Match "mediatek,mt8189-dsi", which the in-flight Linux
    binding documents without a fallback.
  - SMI: the larbs are the MT8188 IP, with the ports controlled by the
    secure world, and the display smi_common block needs no per-SoC data.

Signed-off-by: David Lechner <[email protected]>
---
 drivers/memory/mtk-smi.c                |  7 ++++++-
 drivers/video/mediatek/mtk_disp_mutex.c | 19 +++++++++++++++++++
 drivers/video/mediatek/mtk_disp_ovl.c   |  5 +++++
 drivers/video/mediatek/mtk_dsi.c        | 20 ++++++++++++++++++--
 4 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index 28f026c3ed9..da1f0de121e 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -74,7 +74,7 @@ struct mtk_smi_larb_priv {
        unsigned int enable_count;
 };
 
-/* the MT8366 larbs are the MT8188 IP */
+/* the MT8189 and MT8366 larbs are the MT8188 IP */
 static const struct mtk_smi_larb_data mt8188_larb_data = {
        .port_sec_ctl = true,
 };
@@ -149,6 +149,7 @@ static int mtk_smi_common_probe(struct udevice *dev)
 }
 
 static const struct udevice_id mtk_smi_common_ids[] = {
+       { .compatible = "mediatek,mt8189-smi-common" },
        { .compatible = "mediatek,mt8365-smi-common" },
        { .compatible = "mediatek,mt8366-smi-common" },
        { }
@@ -279,6 +280,10 @@ static const struct udevice_id mtk_smi_larb_ids[] = {
                .compatible = "mediatek,mt8188-smi-larb",
                .data = (ulong)&mt8188_larb_data,
        },
+       {
+               .compatible = "mediatek,mt8189-smi-larb",
+               .data = (ulong)&mt8188_larb_data,
+       },
        {
                .compatible = "mediatek,mt8366-smi-larb",
                .data = (ulong)&mt8188_larb_data,
diff --git a/drivers/video/mediatek/mtk_disp_mutex.c 
b/drivers/video/mediatek/mtk_disp_mutex.c
index 1d987ad06f8..99e46711db5 100644
--- a/drivers/video/mediatek/mtk_disp_mutex.c
+++ b/drivers/video/mediatek/mtk_disp_mutex.c
@@ -74,6 +74,14 @@
 #define MT8366_MUTEX_MOD_DISP_RDMA0    4
 #define MT8366_MUTEX_MOD_DISP_DSI0     13
 
+/* the MT8189 matches the MT8366, except for where the DSI sits in MOD0 */
+#define MT8189_MUTEX_SOF_DSI0          1
+#define MT8189_MUTEX_EOF_DSI0          (MT8189_MUTEX_SOF_DSI0 << 7)
+
+#define MT8189_MUTEX_MOD_DISP_OVL0     0
+#define MT8189_MUTEX_MOD_DISP_RDMA0    4
+#define MT8189_MUTEX_MOD_DISP_DSI0     22
+
 /**
  * struct mtk_disp_mutex_data - per-SoC mutex data
  * @dsi_mod: MOD0 bits of the components of the OVL -> DSI pipeline
@@ -132,6 +140,13 @@ static const struct mtk_disp_mutex_data mt8366_mutex_data 
= {
        .dsi_sof = MT8366_MUTEX_EOF_DSI0 | MT8366_MUTEX_SOF_DSI0,
 };
 
+static const struct mtk_disp_mutex_data mt8189_mutex_data = {
+       .dsi_mod = MUTEX_MOD_BIT(MT8189_MUTEX_MOD_DISP_OVL0) |
+                  MUTEX_MOD_BIT(MT8189_MUTEX_MOD_DISP_RDMA0) |
+                  MUTEX_MOD_BIT(MT8189_MUTEX_MOD_DISP_DSI0),
+       .dsi_sof = MT8189_MUTEX_EOF_DSI0 | MT8189_MUTEX_SOF_DSI0,
+};
+
 int mtk_disp_mutex_ovl_dsi_enable(struct udevice *dev)
 {
        struct mtk_disp_mutex_priv *mutex = dev_get_priv(dev);
@@ -170,6 +185,10 @@ static const struct udevice_id mtk_disp_mutex_ids[] = {
        {
                .compatible = "mediatek,mt8188-disp-mutex",
        },
+       {
+               .compatible = "mediatek,mt8189-disp-mutex",
+               .data = (ulong)&mt8189_mutex_data,
+       },
        {
                .compatible = "mediatek,mt8365-disp-mutex",
                .data = (ulong)&mt8365_mutex_data,
diff --git a/drivers/video/mediatek/mtk_disp_ovl.c 
b/drivers/video/mediatek/mtk_disp_ovl.c
index 865372a6263..da02e25671b 100644
--- a/drivers/video/mediatek/mtk_disp_ovl.c
+++ b/drivers/video/mediatek/mtk_disp_ovl.c
@@ -233,6 +233,11 @@ static const struct mtk_disp_ovl_data 
mt8366_ovl_driver_data = {
 };
 
 static const struct udevice_id mtk_disp_ovl_ids[] = {
+       {
+               /* the MT8189 OVL is the MT8366 one */
+               .compatible = "mediatek,mt8189-disp-ovl",
+               .data = (ulong)&mt8366_ovl_driver_data,
+       },
        {
                .compatible = "mediatek,mt8192-disp-ovl",
                .data = (ulong)&mt8192_ovl_driver_data,
diff --git a/drivers/video/mediatek/mtk_dsi.c b/drivers/video/mediatek/mtk_dsi.c
index a93e99d66ad..781dcec559a 100644
--- a/drivers/video/mediatek/mtk_dsi.c
+++ b/drivers/video/mediatek/mtk_dsi.c
@@ -145,10 +145,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CLK_HS_EXIT                   GENMASK(23, 16)
 
 /*
- * mt8183-style shadow control. The MT8366 follows the downstream mt8188
- * data, which has none, unlike the upstream Linux mt8188 one (at 0xc00).
+ * Shadow control, at 0x190 on the mt8183 and at 0xc00 on the mt8188 and
+ * mt8189, as in Linux. The MT8366 has none.
  */
 #define DSI_SHADOW_DEBUG       0x190
+#define DSI_SHADOW_DEBUG_MT8188        0xc00
 #define FORCE_COMMIT                  BIT(0)
 #define BYPASS_SHADOW                 BIT(1)
 
@@ -271,6 +272,17 @@ static const struct mtk_dsi_data mt8366_dsi_data = {
        .host_cmdq_off = 0xd00,
 };
 
+/* the MT8189 path and mmsys muxes are the MT8366 ones */
+static const struct mtk_dsi_data mt8189_dsi_data = {
+       .path = mt8366_dsi_path,
+       .path_len = ARRAY_SIZE(mt8366_dsi_path),
+       .ddp_connect = mt8366_ddp_ovl_to_dsi,
+       .cmdq_long_packet_ctl = true,
+       .shadow_dbg_off = DSI_SHADOW_DEBUG_MT8188,
+       .vm_cmdq_off = 0x200,
+       .host_cmdq_off = 0xd00,
+};
+
 static inline struct mtk_dsi_priv *host_to_dsi(struct mipi_dsi_host *host)
 {
        return container_of(host, struct mtk_dsi_priv, dsi_host);
@@ -1161,6 +1173,10 @@ static int mtk_dsi_bind(struct udevice *dev)
 }
 
 static const struct udevice_id mtk_dsi_ids[] = {
+       {
+               .compatible = "mediatek,mt8189-dsi",
+               .data = (ulong)&mt8189_dsi_data,
+       },
        {
                .compatible = "mediatek,mt8365-dsi",
                .data = (ulong)&mt8365_dsi_data,

-- 
2.53.0

Reply via email to