xref: /linux/drivers/interconnect/imx/imx8mq.c (revision 97884ca8c2925d14c32188e865069f21378b4b4f)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Interconnect framework driver for i.MX8MQ SoC
4  *
5  * Copyright (c) 2019-2020, NXP
6  */
7 
8 #include <linux/module.h>
9 #include <linux/platform_device.h>
10 #include <dt-bindings/interconnect/imx8mq.h>
11 
12 #include "imx.h"
13 
14 static const struct imx_icc_node_adj_desc imx8mq_dram_adj = {
15 	.bw_mul = 1,
16 	.bw_div = 4,
17 	.phandle_name = "fsl,ddrc",
18 };
19 
20 static const struct imx_icc_node_adj_desc imx8mq_noc_adj = {
21 	.bw_mul = 1,
22 	.bw_div = 4,
23 	.main_noc = true,
24 };
25 
26 /*
27  * Describe bus masters, slaves and connections between them
28  *
29  * This is a simplified subset of the bus diagram, there are several other
30  * PL301 nics which are skipped/merged into PL301_MAIN
31  */
32 static struct imx_icc_node_desc nodes[] = {
33 	DEFINE_BUS_INTERCONNECT("NOC", IMX8MQ_ICN_NOC, &imx8mq_noc_adj,
34 			IMX8MQ_ICS_DRAM, IMX8MQ_ICN_MAIN),
35 
36 	DEFINE_BUS_SLAVE("DRAM", IMX8MQ_ICS_DRAM, &imx8mq_dram_adj),
37 	DEFINE_BUS_SLAVE("OCRAM", IMX8MQ_ICS_OCRAM, NULL),
38 	DEFINE_BUS_MASTER("A53", IMX8MQ_ICM_A53, IMX8MQ_ICN_NOC),
39 
40 	/* VPUMIX */
41 	DEFINE_BUS_MASTER("VPU", IMX8MQ_ICM_VPU, IMX8MQ_ICN_VIDEO),
42 	DEFINE_BUS_INTERCONNECT("PL301_VIDEO", IMX8MQ_ICN_VIDEO, NULL, IMX8MQ_ICN_NOC),
43 
44 	/* GPUMIX */
45 	DEFINE_BUS_MASTER("GPU", IMX8MQ_ICM_GPU, IMX8MQ_ICN_GPU),
46 	DEFINE_BUS_INTERCONNECT("PL301_GPU", IMX8MQ_ICN_GPU, NULL, IMX8MQ_ICN_NOC),
47 
48 	/* DISPMIX (only for DCSS) */
49 	DEFINE_BUS_MASTER("DC", IMX8MQ_ICM_DCSS, IMX8MQ_ICN_DCSS),
50 	DEFINE_BUS_INTERCONNECT("PL301_DC", IMX8MQ_ICN_DCSS, NULL, IMX8MQ_ICN_NOC),
51 
52 	/* USBMIX */
53 	DEFINE_BUS_MASTER("USB1", IMX8MQ_ICM_USB1, IMX8MQ_ICN_USB),
54 	DEFINE_BUS_MASTER("USB2", IMX8MQ_ICM_USB2, IMX8MQ_ICN_USB),
55 	DEFINE_BUS_INTERCONNECT("PL301_USB", IMX8MQ_ICN_USB, NULL, IMX8MQ_ICN_NOC),
56 
57 	/* PL301_DISPLAY (IPs other than DCSS, inside SUPERMIX) */
58 	DEFINE_BUS_MASTER("CSI1", IMX8MQ_ICM_CSI1, IMX8MQ_ICN_DISPLAY),
59 	DEFINE_BUS_MASTER("CSI2", IMX8MQ_ICM_CSI2, IMX8MQ_ICN_DISPLAY),
60 	DEFINE_BUS_MASTER("LCDIF", IMX8MQ_ICM_LCDIF, IMX8MQ_ICN_DISPLAY),
61 	DEFINE_BUS_INTERCONNECT("PL301_DISPLAY", IMX8MQ_ICN_DISPLAY, NULL, IMX8MQ_ICN_MAIN),
62 
63 	/* AUDIO */
64 	DEFINE_BUS_MASTER("SDMA2", IMX8MQ_ICM_SDMA2, IMX8MQ_ICN_AUDIO),
65 	DEFINE_BUS_INTERCONNECT("PL301_AUDIO", IMX8MQ_ICN_AUDIO, NULL, IMX8MQ_ICN_DISPLAY),
66 
67 	/* ENET */
68 	DEFINE_BUS_MASTER("ENET", IMX8MQ_ICM_ENET, IMX8MQ_ICN_ENET),
69 	DEFINE_BUS_INTERCONNECT("PL301_ENET", IMX8MQ_ICN_ENET, NULL, IMX8MQ_ICN_MAIN),
70 
71 	/* OTHER */
72 	DEFINE_BUS_MASTER("SDMA1", IMX8MQ_ICM_SDMA1, IMX8MQ_ICN_MAIN),
73 	DEFINE_BUS_MASTER("NAND", IMX8MQ_ICM_NAND, IMX8MQ_ICN_MAIN),
74 	DEFINE_BUS_MASTER("USDHC1", IMX8MQ_ICM_USDHC1, IMX8MQ_ICN_MAIN),
75 	DEFINE_BUS_MASTER("USDHC2", IMX8MQ_ICM_USDHC2, IMX8MQ_ICN_MAIN),
76 	DEFINE_BUS_MASTER("PCIE1", IMX8MQ_ICM_PCIE1, IMX8MQ_ICN_MAIN),
77 	DEFINE_BUS_MASTER("PCIE2", IMX8MQ_ICM_PCIE2, IMX8MQ_ICN_MAIN),
78 	DEFINE_BUS_INTERCONNECT("PL301_MAIN", IMX8MQ_ICN_MAIN, NULL,
79 			IMX8MQ_ICN_NOC, IMX8MQ_ICS_OCRAM),
80 };
81 
82 static int imx8mq_icc_probe(struct platform_device *pdev)
83 {
84 	return imx_icc_register(pdev, nodes, ARRAY_SIZE(nodes));
85 }
86 
87 static int imx8mq_icc_remove(struct platform_device *pdev)
88 {
89 	return imx_icc_unregister(pdev);
90 }
91 
92 static struct platform_driver imx8mq_icc_driver = {
93 	.probe = imx8mq_icc_probe,
94 	.remove = imx8mq_icc_remove,
95 	.driver = {
96 		.name = "imx8mq-interconnect",
97 	},
98 };
99 
100 module_platform_driver(imx8mq_icc_driver);
101 MODULE_ALIAS("platform:imx8mq-interconnect");
102 MODULE_AUTHOR("Leonard Crestez <leonard.crestez@nxp.com>");
103 MODULE_LICENSE("GPL v2");
104