xref: /openbmc/linux/drivers/soc/mediatek/mtk-mmsys.h (revision 1a931707ad4a46e79d4ecfee56d8f6e8cc8d4f28)
144014763SCK Hu /* SPDX-License-Identifier: GPL-2.0-only */
244014763SCK Hu 
344014763SCK Hu #ifndef __SOC_MEDIATEK_MTK_MMSYS_H
444014763SCK Hu #define __SOC_MEDIATEK_MTK_MMSYS_H
544014763SCK Hu 
644014763SCK Hu #define DISP_REG_CONFIG_DISP_OVL0_MOUT_EN	0x040
744014763SCK Hu #define DISP_REG_CONFIG_DISP_OVL1_MOUT_EN	0x044
844014763SCK Hu #define DISP_REG_CONFIG_DISP_OD_MOUT_EN		0x048
944014763SCK Hu #define DISP_REG_CONFIG_DISP_GAMMA_MOUT_EN	0x04c
1044014763SCK Hu #define DISP_REG_CONFIG_DISP_UFOE_MOUT_EN	0x050
1144014763SCK Hu #define DISP_REG_CONFIG_DISP_COLOR0_SEL_IN	0x084
1244014763SCK Hu #define DISP_REG_CONFIG_DISP_COLOR1_SEL_IN	0x088
1344014763SCK Hu #define DISP_REG_CONFIG_DSIE_SEL_IN		0x0a4
1444014763SCK Hu #define DISP_REG_CONFIG_DSIO_SEL_IN		0x0a8
1544014763SCK Hu #define DISP_REG_CONFIG_DPI_SEL_IN		0x0ac
1644014763SCK Hu #define DISP_REG_CONFIG_DISP_RDMA2_SOUT		0x0b8
1744014763SCK Hu #define DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN	0x0c4
1844014763SCK Hu #define DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN	0x0c8
1944014763SCK Hu #define DISP_REG_CONFIG_MMSYS_CG_CON0		0x100
2044014763SCK Hu 
2144014763SCK Hu #define DISP_REG_CONFIG_DISP_OVL_MOUT_EN	0x030
2244014763SCK Hu #define DISP_REG_CONFIG_OUT_SEL			0x04c
2344014763SCK Hu #define DISP_REG_CONFIG_DSI_SEL			0x050
2444014763SCK Hu #define DISP_REG_CONFIG_DPI_SEL			0x064
2544014763SCK Hu 
2644014763SCK Hu #define OVL0_MOUT_EN_COLOR0			0x1
2744014763SCK Hu #define OD_MOUT_EN_RDMA0			0x1
2844014763SCK Hu #define OD1_MOUT_EN_RDMA1			BIT(16)
2944014763SCK Hu #define UFOE_MOUT_EN_DSI0			0x1
3044014763SCK Hu #define COLOR0_SEL_IN_OVL0			0x1
3144014763SCK Hu #define OVL1_MOUT_EN_COLOR1			0x1
3244014763SCK Hu #define GAMMA_MOUT_EN_RDMA1			0x1
3344014763SCK Hu #define RDMA0_SOUT_DPI0				0x2
3444014763SCK Hu #define RDMA0_SOUT_DPI1				0x3
3544014763SCK Hu #define RDMA0_SOUT_DSI1				0x1
3644014763SCK Hu #define RDMA0_SOUT_DSI2				0x4
3744014763SCK Hu #define RDMA0_SOUT_DSI3				0x5
387bdcead7SCK Hu #define RDMA0_SOUT_MASK				0x7
3944014763SCK Hu #define RDMA1_SOUT_DPI0				0x2
4044014763SCK Hu #define RDMA1_SOUT_DPI1				0x3
4144014763SCK Hu #define RDMA1_SOUT_DSI1				0x1
4244014763SCK Hu #define RDMA1_SOUT_DSI2				0x4
4344014763SCK Hu #define RDMA1_SOUT_DSI3				0x5
447bdcead7SCK Hu #define RDMA1_SOUT_MASK				0x7
4544014763SCK Hu #define RDMA2_SOUT_DPI0				0x2
4644014763SCK Hu #define RDMA2_SOUT_DPI1				0x3
4744014763SCK Hu #define RDMA2_SOUT_DSI1				0x1
4844014763SCK Hu #define RDMA2_SOUT_DSI2				0x4
4944014763SCK Hu #define RDMA2_SOUT_DSI3				0x5
507bdcead7SCK Hu #define RDMA2_SOUT_MASK				0x7
5144014763SCK Hu #define DPI0_SEL_IN_RDMA1			0x1
5244014763SCK Hu #define DPI0_SEL_IN_RDMA2			0x3
537bdcead7SCK Hu #define DPI0_SEL_IN_MASK			0x3
5444014763SCK Hu #define DPI1_SEL_IN_RDMA1			(0x1 << 8)
5544014763SCK Hu #define DPI1_SEL_IN_RDMA2			(0x3 << 8)
567bdcead7SCK Hu #define DPI1_SEL_IN_MASK			(0x3 << 8)
5744014763SCK Hu #define DSI0_SEL_IN_RDMA1			0x1
5844014763SCK Hu #define DSI0_SEL_IN_RDMA2			0x4
597bdcead7SCK Hu #define DSI0_SEL_IN_MASK			0x7
6044014763SCK Hu #define DSI1_SEL_IN_RDMA1			0x1
6144014763SCK Hu #define DSI1_SEL_IN_RDMA2			0x4
627bdcead7SCK Hu #define DSI1_SEL_IN_MASK			0x7
6344014763SCK Hu #define DSI2_SEL_IN_RDMA1			(0x1 << 16)
6444014763SCK Hu #define DSI2_SEL_IN_RDMA2			(0x4 << 16)
657bdcead7SCK Hu #define DSI2_SEL_IN_MASK			(0x7 << 16)
6644014763SCK Hu #define DSI3_SEL_IN_RDMA1			(0x1 << 16)
6744014763SCK Hu #define DSI3_SEL_IN_RDMA2			(0x4 << 16)
687bdcead7SCK Hu #define DSI3_SEL_IN_MASK			(0x7 << 16)
6944014763SCK Hu #define COLOR1_SEL_IN_OVL1			0x1
7044014763SCK Hu 
7144014763SCK Hu #define OVL_MOUT_EN_RDMA			0x1
7244014763SCK Hu #define BLS_TO_DSI_RDMA1_TO_DPI1		0x8
7344014763SCK Hu #define BLS_TO_DPI_RDMA1_TO_DSI			0x2
747bdcead7SCK Hu #define BLS_RDMA1_DSI_DPI_MASK			0xf
7544014763SCK Hu #define DSI_SEL_IN_BLS				0x0
7644014763SCK Hu #define DPI_SEL_IN_BLS				0x0
777bdcead7SCK Hu #define DPI_SEL_IN_MASK				0x1
7844014763SCK Hu #define DSI_SEL_IN_RDMA				0x1
797bdcead7SCK Hu #define DSI_SEL_IN_MASK				0x1
8044014763SCK Hu 
8144014763SCK Hu struct mtk_mmsys_routes {
8244014763SCK Hu 	u32 from_comp;
8344014763SCK Hu 	u32 to_comp;
8444014763SCK Hu 	u32 addr;
857bdcead7SCK Hu 	u32 mask;
8644014763SCK Hu 	u32 val;
8744014763SCK Hu };
8844014763SCK Hu 
8944014763SCK Hu struct mtk_mmsys_driver_data {
9044014763SCK Hu 	const char *clk_driver;
9144014763SCK Hu 	const struct mtk_mmsys_routes *routes;
9244014763SCK Hu 	const unsigned int num_routes;
93*62dc3015SRex-BC Chen 	const u16 sw0_rst_offset;
9444014763SCK Hu 	const u32 num_resets;
9544014763SCK Hu 	const bool is_vppsys;
9644014763SCK Hu };
9744014763SCK Hu 
9844014763SCK Hu /*
9944014763SCK Hu  * Routes in mt2701 and mt2712 are different. That means
10044014763SCK Hu  * in the same register address, it controls different input/output
10144014763SCK Hu  * selection for each SoC. But, right now, they use the same table as
10244014763SCK Hu  * default routes meet their requirements. But we don't have the complete
10344014763SCK Hu  * route information for these three SoC, so just keep them in the same
10444014763SCK Hu  * table. After we've more information, we could separate mt2701, mt2712
10544014763SCK Hu  * to an independent table.
10644014763SCK Hu  */
10744014763SCK Hu static const struct mtk_mmsys_routes mmsys_default_routing_table[] = {
1087bdcead7SCK Hu 	{
1097bdcead7SCK Hu 		DDP_COMPONENT_BLS, DDP_COMPONENT_DSI0,
11044014763SCK Hu 		DISP_REG_CONFIG_OUT_SEL, BLS_RDMA1_DSI_DPI_MASK,
11144014763SCK Hu 		BLS_TO_DSI_RDMA1_TO_DPI1
1127bdcead7SCK Hu 	}, {
1137bdcead7SCK Hu 		DDP_COMPONENT_BLS, DDP_COMPONENT_DSI0,
11444014763SCK Hu 		DISP_REG_CONFIG_DSI_SEL, DSI_SEL_IN_MASK,
11544014763SCK Hu 		DSI_SEL_IN_BLS
1167bdcead7SCK Hu 	}, {
1177bdcead7SCK Hu 		DDP_COMPONENT_BLS, DDP_COMPONENT_DPI0,
11844014763SCK Hu 		DISP_REG_CONFIG_OUT_SEL, BLS_RDMA1_DSI_DPI_MASK,
11944014763SCK Hu 		BLS_TO_DPI_RDMA1_TO_DSI
1207bdcead7SCK Hu 	}, {
1217bdcead7SCK Hu 		DDP_COMPONENT_BLS, DDP_COMPONENT_DPI0,
12244014763SCK Hu 		DISP_REG_CONFIG_DSI_SEL, DSI_SEL_IN_MASK,
12344014763SCK Hu 		DSI_SEL_IN_RDMA
1247bdcead7SCK Hu 	}, {
1257bdcead7SCK Hu 		DDP_COMPONENT_BLS, DDP_COMPONENT_DPI0,
12644014763SCK Hu 		DISP_REG_CONFIG_DPI_SEL, DPI_SEL_IN_MASK,
12744014763SCK Hu 		DPI_SEL_IN_BLS
1287bdcead7SCK Hu 	}, {
1297bdcead7SCK Hu 		DDP_COMPONENT_GAMMA, DDP_COMPONENT_RDMA1,
13044014763SCK Hu 		DISP_REG_CONFIG_DISP_GAMMA_MOUT_EN, GAMMA_MOUT_EN_RDMA1,
13144014763SCK Hu 		GAMMA_MOUT_EN_RDMA1
1327bdcead7SCK Hu 	}, {
1337bdcead7SCK Hu 		DDP_COMPONENT_OD0, DDP_COMPONENT_RDMA0,
13444014763SCK Hu 		DISP_REG_CONFIG_DISP_OD_MOUT_EN, OD_MOUT_EN_RDMA0,
13544014763SCK Hu 		OD_MOUT_EN_RDMA0
1367bdcead7SCK Hu 	}, {
1377bdcead7SCK Hu 		DDP_COMPONENT_OD1, DDP_COMPONENT_RDMA1,
13844014763SCK Hu 		DISP_REG_CONFIG_DISP_OD_MOUT_EN, OD1_MOUT_EN_RDMA1,
13944014763SCK Hu 		OD1_MOUT_EN_RDMA1
1407bdcead7SCK Hu 	}, {
1417bdcead7SCK Hu 		DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0,
14244014763SCK Hu 		DISP_REG_CONFIG_DISP_OVL0_MOUT_EN, OVL0_MOUT_EN_COLOR0,
14344014763SCK Hu 		OVL0_MOUT_EN_COLOR0
1447bdcead7SCK Hu 	}, {
1457bdcead7SCK Hu 		DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0,
14644014763SCK Hu 		DISP_REG_CONFIG_DISP_COLOR0_SEL_IN, COLOR0_SEL_IN_OVL0,
14744014763SCK Hu 		COLOR0_SEL_IN_OVL0
1487bdcead7SCK Hu 	}, {
1497bdcead7SCK Hu 		DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0,
15044014763SCK Hu 		DISP_REG_CONFIG_DISP_OVL_MOUT_EN, OVL_MOUT_EN_RDMA,
15144014763SCK Hu 		OVL_MOUT_EN_RDMA
1527bdcead7SCK Hu 	}, {
1537bdcead7SCK Hu 		DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1,
15444014763SCK Hu 		DISP_REG_CONFIG_DISP_OVL1_MOUT_EN, OVL1_MOUT_EN_COLOR1,
15544014763SCK Hu 		OVL1_MOUT_EN_COLOR1
1567bdcead7SCK Hu 	}, {
1577bdcead7SCK Hu 		DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1,
15844014763SCK Hu 		DISP_REG_CONFIG_DISP_COLOR1_SEL_IN, COLOR1_SEL_IN_OVL1,
15944014763SCK Hu 		COLOR1_SEL_IN_OVL1
1607bdcead7SCK Hu 	}, {
1617bdcead7SCK Hu 		DDP_COMPONENT_RDMA0, DDP_COMPONENT_DPI0,
16244014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN, RDMA0_SOUT_MASK,
16344014763SCK Hu 		RDMA0_SOUT_DPI0
1647bdcead7SCK Hu 	}, {
1657bdcead7SCK Hu 		DDP_COMPONENT_RDMA0, DDP_COMPONENT_DPI1,
16644014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN, RDMA0_SOUT_MASK,
16744014763SCK Hu 		RDMA0_SOUT_DPI1
1687bdcead7SCK Hu 	}, {
1697bdcead7SCK Hu 		DDP_COMPONENT_RDMA0, DDP_COMPONENT_DSI1,
17044014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN, RDMA0_SOUT_MASK,
17144014763SCK Hu 		RDMA0_SOUT_DSI1
1727bdcead7SCK Hu 	}, {
1737bdcead7SCK Hu 		DDP_COMPONENT_RDMA0, DDP_COMPONENT_DSI2,
17444014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN, RDMA0_SOUT_MASK,
17544014763SCK Hu 		RDMA0_SOUT_DSI2
1767bdcead7SCK Hu 	}, {
1777bdcead7SCK Hu 		DDP_COMPONENT_RDMA0, DDP_COMPONENT_DSI3,
17844014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA0_SOUT_EN, RDMA0_SOUT_MASK,
17944014763SCK Hu 		RDMA0_SOUT_DSI3
1807bdcead7SCK Hu 	}, {
1817bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0,
18244014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN, RDMA1_SOUT_MASK,
18344014763SCK Hu 		RDMA1_SOUT_DPI0
1847bdcead7SCK Hu 	}, {
1857bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0,
18644014763SCK Hu 		DISP_REG_CONFIG_DPI_SEL_IN, DPI0_SEL_IN_MASK,
18744014763SCK Hu 		DPI0_SEL_IN_RDMA1
1887bdcead7SCK Hu 	}, {
1897bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI1,
19044014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN, RDMA1_SOUT_MASK,
19144014763SCK Hu 		RDMA1_SOUT_DPI1
1927bdcead7SCK Hu 	}, {
1937bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI1,
19444014763SCK Hu 		DISP_REG_CONFIG_DPI_SEL_IN, DPI1_SEL_IN_MASK,
19544014763SCK Hu 		DPI1_SEL_IN_RDMA1
1967bdcead7SCK Hu 	}, {
1977bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI0,
19844014763SCK Hu 		DISP_REG_CONFIG_DSIE_SEL_IN, DSI0_SEL_IN_MASK,
19944014763SCK Hu 		DSI0_SEL_IN_RDMA1
2007bdcead7SCK Hu 	}, {
2017bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI1,
20244014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN, RDMA1_SOUT_MASK,
20344014763SCK Hu 		RDMA1_SOUT_DSI1
2047bdcead7SCK Hu 	}, {
2057bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI1,
20644014763SCK Hu 		DISP_REG_CONFIG_DSIO_SEL_IN, DSI1_SEL_IN_MASK,
20744014763SCK Hu 		DSI1_SEL_IN_RDMA1
2087bdcead7SCK Hu 	}, {
2097bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI2,
21044014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN, RDMA1_SOUT_MASK,
21144014763SCK Hu 		RDMA1_SOUT_DSI2
2127bdcead7SCK Hu 	}, {
2137bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI2,
21444014763SCK Hu 		DISP_REG_CONFIG_DSIE_SEL_IN, DSI2_SEL_IN_MASK,
21544014763SCK Hu 		DSI2_SEL_IN_RDMA1
2167bdcead7SCK Hu 	}, {
2177bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI3,
21844014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA1_SOUT_EN, RDMA1_SOUT_MASK,
21944014763SCK Hu 		RDMA1_SOUT_DSI3
2207bdcead7SCK Hu 	}, {
2217bdcead7SCK Hu 		DDP_COMPONENT_RDMA1, DDP_COMPONENT_DSI3,
22244014763SCK Hu 		DISP_REG_CONFIG_DSIO_SEL_IN, DSI3_SEL_IN_MASK,
22344014763SCK Hu 		DSI3_SEL_IN_RDMA1
2247bdcead7SCK Hu 	}, {
2257bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DPI0,
22644014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA2_SOUT, RDMA2_SOUT_MASK,
22744014763SCK Hu 		RDMA2_SOUT_DPI0
2287bdcead7SCK Hu 	}, {
2297bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DPI0,
23044014763SCK Hu 		DISP_REG_CONFIG_DPI_SEL_IN, DPI0_SEL_IN_MASK,
23144014763SCK Hu 		DPI0_SEL_IN_RDMA2
2327bdcead7SCK Hu 	}, {
2337bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DPI1,
23444014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA2_SOUT, RDMA2_SOUT_MASK,
23544014763SCK Hu 		RDMA2_SOUT_DPI1
2367bdcead7SCK Hu 	}, {
2377bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DPI1,
23844014763SCK Hu 		DISP_REG_CONFIG_DPI_SEL_IN, DPI1_SEL_IN_MASK,
23944014763SCK Hu 		DPI1_SEL_IN_RDMA2
2407bdcead7SCK Hu 	}, {
2417bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI0,
24244014763SCK Hu 		DISP_REG_CONFIG_DSIE_SEL_IN, DSI0_SEL_IN_MASK,
24344014763SCK Hu 		DSI0_SEL_IN_RDMA2
2447bdcead7SCK Hu 	}, {
2457bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI1,
24644014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA2_SOUT, RDMA2_SOUT_MASK,
24744014763SCK Hu 		RDMA2_SOUT_DSI1
2487bdcead7SCK Hu 	}, {
2497bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI1,
25044014763SCK Hu 		DISP_REG_CONFIG_DSIO_SEL_IN, DSI1_SEL_IN_MASK,
25144014763SCK Hu 		DSI1_SEL_IN_RDMA2
2527bdcead7SCK Hu 	}, {
2537bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI2,
25444014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA2_SOUT, RDMA2_SOUT_MASK,
25544014763SCK Hu 		RDMA2_SOUT_DSI2
2567bdcead7SCK Hu 	}, {
2577bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI2,
25844014763SCK Hu 		DISP_REG_CONFIG_DSIE_SEL_IN, DSI2_SEL_IN_MASK,
25944014763SCK Hu 		DSI2_SEL_IN_RDMA2
2607bdcead7SCK Hu 	}, {
2617bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI3,
26244014763SCK Hu 		DISP_REG_CONFIG_DISP_RDMA2_SOUT, RDMA2_SOUT_MASK,
26344014763SCK Hu 		RDMA2_SOUT_DSI3
2647bdcead7SCK Hu 	}, {
2657bdcead7SCK Hu 		DDP_COMPONENT_RDMA2, DDP_COMPONENT_DSI3,
26625423731SEnric Balletbo i Serra 		DISP_REG_CONFIG_DSIO_SEL_IN, DSI3_SEL_IN_MASK,
26725423731SEnric Balletbo i Serra 		DSI3_SEL_IN_RDMA2
26825423731SEnric Balletbo i Serra 	}, {
26925423731SEnric Balletbo i Serra 		DDP_COMPONENT_UFOE, DDP_COMPONENT_DSI0,
27044014763SCK Hu 		DISP_REG_CONFIG_DISP_UFOE_MOUT_EN, UFOE_MOUT_EN_DSI0,
27144014763SCK Hu 		UFOE_MOUT_EN_DSI0
27244014763SCK Hu 	}
27344014763SCK Hu };
274 
275 #endif /* __SOC_MEDIATEK_MTK_MMSYS_H */
276