xref: /linux/drivers/interconnect/imx/imx8mn.c (revision ea518afc992032f7570c0a89ac9240b387dc0faf)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Interconnect framework driver for i.MX8MN 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/imx8mn.h>
11 
12 #include "imx.h"
13 
14 static const struct imx_icc_node_adj_desc imx8mn_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 imx8mn_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", IMX8MN_ICN_NOC, &imx8mn_noc_adj,
34 			IMX8MN_ICS_DRAM, IMX8MN_ICN_MAIN),
35 
36 	DEFINE_BUS_SLAVE("DRAM", IMX8MN_ICS_DRAM, &imx8mn_dram_adj),
37 	DEFINE_BUS_SLAVE("OCRAM", IMX8MN_ICS_OCRAM, NULL),
38 	DEFINE_BUS_MASTER("A53", IMX8MN_ICM_A53, IMX8MN_ICN_NOC),
39 
40 	/* GPUMIX */
41 	DEFINE_BUS_MASTER("GPU", IMX8MN_ICM_GPU, IMX8MN_ICN_GPU),
42 	DEFINE_BUS_INTERCONNECT("PL301_GPU", IMX8MN_ICN_GPU, NULL, IMX8MN_ICN_NOC),
43 
44 	/* DISPLAYMIX */
45 	DEFINE_BUS_MASTER("CSI1", IMX8MN_ICM_CSI1, IMX8MN_ICN_MIPI),
46 	DEFINE_BUS_MASTER("CSI2", IMX8MN_ICM_CSI2, IMX8MN_ICN_MIPI),
47 	DEFINE_BUS_MASTER("ISI", IMX8MN_ICM_ISI, IMX8MN_ICN_MIPI),
48 	DEFINE_BUS_MASTER("LCDIF", IMX8MN_ICM_LCDIF, IMX8MN_ICN_MIPI),
49 	DEFINE_BUS_INTERCONNECT("PL301_MIPI", IMX8MN_ICN_MIPI, NULL, IMX8MN_ICN_NOC),
50 
51 	/* USB goes straight to NOC */
52 	DEFINE_BUS_MASTER("USB", IMX8MN_ICM_USB, IMX8MN_ICN_NOC),
53 
54 	/* Audio */
55 	DEFINE_BUS_MASTER("SDMA2", IMX8MN_ICM_SDMA2, IMX8MN_ICN_AUDIO),
56 	DEFINE_BUS_MASTER("SDMA3", IMX8MN_ICM_SDMA3, IMX8MN_ICN_AUDIO),
57 	DEFINE_BUS_INTERCONNECT("PL301_AUDIO", IMX8MN_ICN_AUDIO, NULL, IMX8MN_ICN_MAIN),
58 
59 	/* Ethernet */
60 	DEFINE_BUS_MASTER("ENET", IMX8MN_ICM_ENET, IMX8MN_ICN_ENET),
61 	DEFINE_BUS_INTERCONNECT("PL301_ENET", IMX8MN_ICN_ENET, NULL, IMX8MN_ICN_MAIN),
62 
63 	/* Other */
64 	DEFINE_BUS_MASTER("SDMA1", IMX8MN_ICM_SDMA1, IMX8MN_ICN_MAIN),
65 	DEFINE_BUS_MASTER("NAND", IMX8MN_ICM_NAND, IMX8MN_ICN_MAIN),
66 	DEFINE_BUS_MASTER("USDHC1", IMX8MN_ICM_USDHC1, IMX8MN_ICN_MAIN),
67 	DEFINE_BUS_MASTER("USDHC2", IMX8MN_ICM_USDHC2, IMX8MN_ICN_MAIN),
68 	DEFINE_BUS_MASTER("USDHC3", IMX8MN_ICM_USDHC3, IMX8MN_ICN_MAIN),
69 	DEFINE_BUS_INTERCONNECT("PL301_MAIN", IMX8MN_ICN_MAIN, NULL,
70 			IMX8MN_ICN_NOC, IMX8MN_ICS_OCRAM),
71 };
72 
73 static int imx8mn_icc_probe(struct platform_device *pdev)
74 {
75 	return imx_icc_register(pdev, nodes, ARRAY_SIZE(nodes), NULL);
76 }
77 
78 static struct platform_driver imx8mn_icc_driver = {
79 	.probe = imx8mn_icc_probe,
80 	.remove_new = imx_icc_unregister,
81 	.driver = {
82 		.name = "imx8mn-interconnect",
83 	},
84 };
85 
86 module_platform_driver(imx8mn_icc_driver);
87 MODULE_ALIAS("platform:imx8mn-interconnect");
88 MODULE_AUTHOR("Leonard Crestez <leonard.crestez@nxp.com>");
89 MODULE_LICENSE("GPL v2");
90