162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci#ifndef __SOC_MEDIATEK_MT8186_MMSYS_H
462306a36Sopenharmony_ci#define __SOC_MEDIATEK_MT8186_MMSYS_H
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci/* Values for DPI configuration in MMSYS address space */
762306a36Sopenharmony_ci#define MT8186_MMSYS_DPI_OUTPUT_FORMAT		0x400
862306a36Sopenharmony_ci#define MT8186_DPI_FORMAT_MASK				GENMASK(1, 0)
962306a36Sopenharmony_ci#define MT8186_DPI_RGB888_SDR_CON			0
1062306a36Sopenharmony_ci#define MT8186_DPI_RGB888_DDR_CON			1
1162306a36Sopenharmony_ci#define MT8186_DPI_RGB565_SDR_CON			2
1262306a36Sopenharmony_ci#define MT8186_DPI_RGB565_DDR_CON			3
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define MT8186_MMSYS_OVL_CON			0xF04
1562306a36Sopenharmony_ci#define MT8186_MMSYS_OVL0_CON_MASK			0x3
1662306a36Sopenharmony_ci#define MT8186_MMSYS_OVL0_2L_CON_MASK			0xC
1762306a36Sopenharmony_ci#define MT8186_OVL0_GO_BLEND				BIT(0)
1862306a36Sopenharmony_ci#define MT8186_OVL0_GO_BG				BIT(1)
1962306a36Sopenharmony_ci#define MT8186_OVL0_2L_GO_BLEND				BIT(2)
2062306a36Sopenharmony_ci#define MT8186_OVL0_2L_GO_BG				BIT(3)
2162306a36Sopenharmony_ci#define MT8186_DISP_RDMA0_SOUT_SEL		0xF0C
2262306a36Sopenharmony_ci#define MT8186_RDMA0_SOUT_SEL_MASK			0xF
2362306a36Sopenharmony_ci#define MT8186_RDMA0_SOUT_TO_DSI0			(0)
2462306a36Sopenharmony_ci#define MT8186_RDMA0_SOUT_TO_COLOR0			(1)
2562306a36Sopenharmony_ci#define MT8186_RDMA0_SOUT_TO_DPI0			(2)
2662306a36Sopenharmony_ci#define MT8186_DISP_OVL0_2L_MOUT_EN		0xF14
2762306a36Sopenharmony_ci#define MT8186_OVL0_2L_MOUT_EN_MASK			0xF
2862306a36Sopenharmony_ci#define MT8186_OVL0_2L_MOUT_TO_RDMA0			BIT(0)
2962306a36Sopenharmony_ci#define MT8186_OVL0_2L_MOUT_TO_RDMA1			BIT(3)
3062306a36Sopenharmony_ci#define MT8186_DISP_OVL0_MOUT_EN		0xF18
3162306a36Sopenharmony_ci#define MT8186_OVL0_MOUT_EN_MASK			0xF
3262306a36Sopenharmony_ci#define MT8186_OVL0_MOUT_TO_RDMA0			BIT(0)
3362306a36Sopenharmony_ci#define MT8186_OVL0_MOUT_TO_RDMA1			BIT(3)
3462306a36Sopenharmony_ci#define MT8186_DISP_DITHER0_MOUT_EN		0xF20
3562306a36Sopenharmony_ci#define MT8186_DITHER0_MOUT_EN_MASK			0xF
3662306a36Sopenharmony_ci#define MT8186_DITHER0_MOUT_TO_DSI0			BIT(0)
3762306a36Sopenharmony_ci#define MT8186_DITHER0_MOUT_TO_RDMA1			BIT(2)
3862306a36Sopenharmony_ci#define MT8186_DITHER0_MOUT_TO_DPI0			BIT(3)
3962306a36Sopenharmony_ci#define MT8186_DISP_RDMA0_SEL_IN		0xF28
4062306a36Sopenharmony_ci#define MT8186_RDMA0_SEL_IN_MASK			0xF
4162306a36Sopenharmony_ci#define MT8186_RDMA0_FROM_OVL0				0
4262306a36Sopenharmony_ci#define MT8186_RDMA0_FROM_OVL0_2L			2
4362306a36Sopenharmony_ci#define MT8186_DISP_DSI0_SEL_IN			0xF30
4462306a36Sopenharmony_ci#define MT8186_DSI0_SEL_IN_MASK				0xF
4562306a36Sopenharmony_ci#define MT8186_DSI0_FROM_RDMA0				0
4662306a36Sopenharmony_ci#define MT8186_DSI0_FROM_DITHER0			1
4762306a36Sopenharmony_ci#define MT8186_DSI0_FROM_RDMA1				2
4862306a36Sopenharmony_ci#define MT8186_DISP_RDMA1_MOUT_EN		0xF3C
4962306a36Sopenharmony_ci#define MT8186_RDMA1_MOUT_EN_MASK			0xF
5062306a36Sopenharmony_ci#define MT8186_RDMA1_MOUT_TO_DPI0_SEL			BIT(0)
5162306a36Sopenharmony_ci#define MT8186_RDMA1_MOUT_TO_DSI0_SEL			BIT(2)
5262306a36Sopenharmony_ci#define MT8186_DISP_RDMA1_SEL_IN		0xF40
5362306a36Sopenharmony_ci#define MT8186_RDMA1_SEL_IN_MASK			0xF
5462306a36Sopenharmony_ci#define MT8186_RDMA1_FROM_OVL0				0
5562306a36Sopenharmony_ci#define MT8186_RDMA1_FROM_OVL0_2L			2
5662306a36Sopenharmony_ci#define MT8186_RDMA1_FROM_DITHER0			3
5762306a36Sopenharmony_ci#define MT8186_DISP_DPI0_SEL_IN			0xF44
5862306a36Sopenharmony_ci#define MT8186_DPI0_SEL_IN_MASK				0xF
5962306a36Sopenharmony_ci#define MT8186_DPI0_FROM_RDMA1				0
6062306a36Sopenharmony_ci#define MT8186_DPI0_FROM_DITHER0			1
6162306a36Sopenharmony_ci#define MT8186_DPI0_FROM_RDMA0				2
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define MT8186_MMSYS_SW0_RST_B				0x160
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_cistatic const struct mtk_mmsys_routes mmsys_mt8186_routing_table[] = {
6662306a36Sopenharmony_ci	{
6762306a36Sopenharmony_ci		DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
6862306a36Sopenharmony_ci		MT8186_DISP_OVL0_MOUT_EN, MT8186_OVL0_MOUT_EN_MASK,
6962306a36Sopenharmony_ci		MT8186_OVL0_MOUT_TO_RDMA0
7062306a36Sopenharmony_ci	},
7162306a36Sopenharmony_ci	{
7262306a36Sopenharmony_ci		DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
7362306a36Sopenharmony_ci		MT8186_DISP_RDMA0_SEL_IN, MT8186_RDMA0_SEL_IN_MASK,
7462306a36Sopenharmony_ci		MT8186_RDMA0_FROM_OVL0
7562306a36Sopenharmony_ci	},
7662306a36Sopenharmony_ci	{
7762306a36Sopenharmony_ci		DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
7862306a36Sopenharmony_ci		MT8186_MMSYS_OVL_CON, MT8186_MMSYS_OVL0_CON_MASK,
7962306a36Sopenharmony_ci		MT8186_OVL0_GO_BLEND
8062306a36Sopenharmony_ci	},
8162306a36Sopenharmony_ci	{
8262306a36Sopenharmony_ci		DDP_COMPONENT_RDMA0, DDP_COMPONENT_COLOR0,
8362306a36Sopenharmony_ci		MT8186_DISP_RDMA0_SOUT_SEL, MT8186_RDMA0_SOUT_SEL_MASK,
8462306a36Sopenharmony_ci		MT8186_RDMA0_SOUT_TO_COLOR0
8562306a36Sopenharmony_ci	},
8662306a36Sopenharmony_ci	{
8762306a36Sopenharmony_ci		DDP_COMPONENT_DITHER0, DDP_COMPONENT_DSI0,
8862306a36Sopenharmony_ci		MT8186_DISP_DITHER0_MOUT_EN, MT8186_DITHER0_MOUT_EN_MASK,
8962306a36Sopenharmony_ci		MT8186_DITHER0_MOUT_TO_DSI0,
9062306a36Sopenharmony_ci	},
9162306a36Sopenharmony_ci	{
9262306a36Sopenharmony_ci		DDP_COMPONENT_DITHER0, DDP_COMPONENT_DSI0,
9362306a36Sopenharmony_ci		MT8186_DISP_DSI0_SEL_IN, MT8186_DSI0_SEL_IN_MASK,
9462306a36Sopenharmony_ci		MT8186_DSI0_FROM_DITHER0
9562306a36Sopenharmony_ci	},
9662306a36Sopenharmony_ci	{
9762306a36Sopenharmony_ci		DDP_COMPONENT_OVL_2L0, DDP_COMPONENT_RDMA1,
9862306a36Sopenharmony_ci		MT8186_DISP_OVL0_2L_MOUT_EN, MT8186_OVL0_2L_MOUT_EN_MASK,
9962306a36Sopenharmony_ci		MT8186_OVL0_2L_MOUT_TO_RDMA1
10062306a36Sopenharmony_ci	},
10162306a36Sopenharmony_ci	{
10262306a36Sopenharmony_ci		DDP_COMPONENT_OVL_2L0, DDP_COMPONENT_RDMA1,
10362306a36Sopenharmony_ci		MT8186_DISP_RDMA1_SEL_IN, MT8186_RDMA1_SEL_IN_MASK,
10462306a36Sopenharmony_ci		MT8186_RDMA1_FROM_OVL0_2L
10562306a36Sopenharmony_ci	},
10662306a36Sopenharmony_ci	{
10762306a36Sopenharmony_ci		DDP_COMPONENT_OVL_2L0, DDP_COMPONENT_RDMA1,
10862306a36Sopenharmony_ci		MT8186_MMSYS_OVL_CON, MT8186_MMSYS_OVL0_2L_CON_MASK,
10962306a36Sopenharmony_ci		MT8186_OVL0_2L_GO_BLEND
11062306a36Sopenharmony_ci	},
11162306a36Sopenharmony_ci	{
11262306a36Sopenharmony_ci		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0,
11362306a36Sopenharmony_ci		MT8186_DISP_RDMA1_MOUT_EN, MT8186_RDMA1_MOUT_EN_MASK,
11462306a36Sopenharmony_ci		MT8186_RDMA1_MOUT_TO_DPI0_SEL
11562306a36Sopenharmony_ci	},
11662306a36Sopenharmony_ci	{
11762306a36Sopenharmony_ci		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0,
11862306a36Sopenharmony_ci		MT8186_DISP_DPI0_SEL_IN, MT8186_DPI0_SEL_IN_MASK,
11962306a36Sopenharmony_ci		MT8186_DPI0_FROM_RDMA1
12062306a36Sopenharmony_ci	},
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#endif /* __SOC_MEDIATEK_MT8186_MMSYS_H */
124