xref: /linux/drivers/interconnect/imx/imx8mq.c (revision 67288f74d4837b82ef937170da3389b0779c17be)
163fc8029SLeonard Crestez // SPDX-License-Identifier: GPL-2.0
263fc8029SLeonard Crestez /*
363fc8029SLeonard Crestez  * Interconnect framework driver for i.MX8MQ SoC
463fc8029SLeonard Crestez  *
563fc8029SLeonard Crestez  * Copyright (c) 2019-2020, NXP
663fc8029SLeonard Crestez  */
763fc8029SLeonard Crestez 
863fc8029SLeonard Crestez #include <linux/module.h>
963fc8029SLeonard Crestez #include <linux/platform_device.h>
10*67288f74SMartin Kepplinger #include <linux/interconnect-provider.h>
1163fc8029SLeonard Crestez #include <dt-bindings/interconnect/imx8mq.h>
1263fc8029SLeonard Crestez 
1363fc8029SLeonard Crestez #include "imx.h"
1463fc8029SLeonard Crestez 
1563fc8029SLeonard Crestez static const struct imx_icc_node_adj_desc imx8mq_dram_adj = {
1663fc8029SLeonard Crestez 	.bw_mul = 1,
1763fc8029SLeonard Crestez 	.bw_div = 4,
1863fc8029SLeonard Crestez 	.phandle_name = "fsl,ddrc",
1963fc8029SLeonard Crestez };
2063fc8029SLeonard Crestez 
2163fc8029SLeonard Crestez static const struct imx_icc_node_adj_desc imx8mq_noc_adj = {
2263fc8029SLeonard Crestez 	.bw_mul = 1,
2363fc8029SLeonard Crestez 	.bw_div = 4,
2463fc8029SLeonard Crestez 	.main_noc = true,
2563fc8029SLeonard Crestez };
2663fc8029SLeonard Crestez 
2763fc8029SLeonard Crestez /*
2863fc8029SLeonard Crestez  * Describe bus masters, slaves and connections between them
2963fc8029SLeonard Crestez  *
3063fc8029SLeonard Crestez  * This is a simplified subset of the bus diagram, there are several other
3163fc8029SLeonard Crestez  * PL301 nics which are skipped/merged into PL301_MAIN
3263fc8029SLeonard Crestez  */
3363fc8029SLeonard Crestez static struct imx_icc_node_desc nodes[] = {
3463fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("NOC", IMX8MQ_ICN_NOC, &imx8mq_noc_adj,
3563fc8029SLeonard Crestez 			IMX8MQ_ICS_DRAM, IMX8MQ_ICN_MAIN),
3663fc8029SLeonard Crestez 
3763fc8029SLeonard Crestez 	DEFINE_BUS_SLAVE("DRAM", IMX8MQ_ICS_DRAM, &imx8mq_dram_adj),
3863fc8029SLeonard Crestez 	DEFINE_BUS_SLAVE("OCRAM", IMX8MQ_ICS_OCRAM, NULL),
3963fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("A53", IMX8MQ_ICM_A53, IMX8MQ_ICN_NOC),
4063fc8029SLeonard Crestez 
4163fc8029SLeonard Crestez 	/* VPUMIX */
4263fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("VPU", IMX8MQ_ICM_VPU, IMX8MQ_ICN_VIDEO),
4363fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_VIDEO", IMX8MQ_ICN_VIDEO, NULL, IMX8MQ_ICN_NOC),
4463fc8029SLeonard Crestez 
4563fc8029SLeonard Crestez 	/* GPUMIX */
4663fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("GPU", IMX8MQ_ICM_GPU, IMX8MQ_ICN_GPU),
4763fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_GPU", IMX8MQ_ICN_GPU, NULL, IMX8MQ_ICN_NOC),
4863fc8029SLeonard Crestez 
4963fc8029SLeonard Crestez 	/* DISPMIX (only for DCSS) */
5063fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("DC", IMX8MQ_ICM_DCSS, IMX8MQ_ICN_DCSS),
5163fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_DC", IMX8MQ_ICN_DCSS, NULL, IMX8MQ_ICN_NOC),
5263fc8029SLeonard Crestez 
5363fc8029SLeonard Crestez 	/* USBMIX */
5463fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("USB1", IMX8MQ_ICM_USB1, IMX8MQ_ICN_USB),
5563fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("USB2", IMX8MQ_ICM_USB2, IMX8MQ_ICN_USB),
5663fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_USB", IMX8MQ_ICN_USB, NULL, IMX8MQ_ICN_NOC),
5763fc8029SLeonard Crestez 
5863fc8029SLeonard Crestez 	/* PL301_DISPLAY (IPs other than DCSS, inside SUPERMIX) */
5963fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("CSI1", IMX8MQ_ICM_CSI1, IMX8MQ_ICN_DISPLAY),
6063fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("CSI2", IMX8MQ_ICM_CSI2, IMX8MQ_ICN_DISPLAY),
6163fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("LCDIF", IMX8MQ_ICM_LCDIF, IMX8MQ_ICN_DISPLAY),
6263fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_DISPLAY", IMX8MQ_ICN_DISPLAY, NULL, IMX8MQ_ICN_MAIN),
6363fc8029SLeonard Crestez 
6463fc8029SLeonard Crestez 	/* AUDIO */
6563fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("SDMA2", IMX8MQ_ICM_SDMA2, IMX8MQ_ICN_AUDIO),
6663fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_AUDIO", IMX8MQ_ICN_AUDIO, NULL, IMX8MQ_ICN_DISPLAY),
6763fc8029SLeonard Crestez 
6863fc8029SLeonard Crestez 	/* ENET */
6963fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("ENET", IMX8MQ_ICM_ENET, IMX8MQ_ICN_ENET),
7063fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_ENET", IMX8MQ_ICN_ENET, NULL, IMX8MQ_ICN_MAIN),
7163fc8029SLeonard Crestez 
7263fc8029SLeonard Crestez 	/* OTHER */
7363fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("SDMA1", IMX8MQ_ICM_SDMA1, IMX8MQ_ICN_MAIN),
7463fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("NAND", IMX8MQ_ICM_NAND, IMX8MQ_ICN_MAIN),
7563fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("USDHC1", IMX8MQ_ICM_USDHC1, IMX8MQ_ICN_MAIN),
7663fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("USDHC2", IMX8MQ_ICM_USDHC2, IMX8MQ_ICN_MAIN),
7763fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("PCIE1", IMX8MQ_ICM_PCIE1, IMX8MQ_ICN_MAIN),
7863fc8029SLeonard Crestez 	DEFINE_BUS_MASTER("PCIE2", IMX8MQ_ICM_PCIE2, IMX8MQ_ICN_MAIN),
7963fc8029SLeonard Crestez 	DEFINE_BUS_INTERCONNECT("PL301_MAIN", IMX8MQ_ICN_MAIN, NULL,
8063fc8029SLeonard Crestez 			IMX8MQ_ICN_NOC, IMX8MQ_ICS_OCRAM),
8163fc8029SLeonard Crestez };
8263fc8029SLeonard Crestez 
8363fc8029SLeonard Crestez static int imx8mq_icc_probe(struct platform_device *pdev)
8463fc8029SLeonard Crestez {
8563fc8029SLeonard Crestez 	return imx_icc_register(pdev, nodes, ARRAY_SIZE(nodes));
8663fc8029SLeonard Crestez }
8763fc8029SLeonard Crestez 
8863fc8029SLeonard Crestez static int imx8mq_icc_remove(struct platform_device *pdev)
8963fc8029SLeonard Crestez {
9063fc8029SLeonard Crestez 	return imx_icc_unregister(pdev);
9163fc8029SLeonard Crestez }
9263fc8029SLeonard Crestez 
9363fc8029SLeonard Crestez static struct platform_driver imx8mq_icc_driver = {
9463fc8029SLeonard Crestez 	.probe = imx8mq_icc_probe,
9563fc8029SLeonard Crestez 	.remove = imx8mq_icc_remove,
9663fc8029SLeonard Crestez 	.driver = {
9763fc8029SLeonard Crestez 		.name = "imx8mq-interconnect",
98*67288f74SMartin Kepplinger 		.sync_state = icc_sync_state,
9963fc8029SLeonard Crestez 	},
10063fc8029SLeonard Crestez };
10163fc8029SLeonard Crestez 
10263fc8029SLeonard Crestez module_platform_driver(imx8mq_icc_driver);
10363fc8029SLeonard Crestez MODULE_ALIAS("platform:imx8mq-interconnect");
10463fc8029SLeonard Crestez MODULE_AUTHOR("Leonard Crestez <leonard.crestez@nxp.com>");
10563fc8029SLeonard Crestez MODULE_LICENSE("GPL v2");
106