@@ -9,5 +9,9 @@ config BUSFREQ
depends on INTERCONNECT_IMX
help
A generic interconnect driver that could be used for any i.MX.
This provides a way to register master and slave and some opp
to use when one or more master are in use.
+
+config BUSFREQ_IMX8MM
+ bool "i.MX8MM busfreq driver"
+ depends on BUSFREQ
@@ -1 +1,2 @@
obj-$(CONFIG_BUSFREQ) += busfreq.o
+obj-$(CONFIG_BUSFREQ_IMX8MM) += busfreq-imx8mm.o
new file mode 100644
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Interconnect framework driver for i.MX SoC
+ *
+ * Copyright (c) 2019, BayLibre
+ * Author: Alexandre Bailon <abailon@baylibre.com>
+ */
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+
+#include <dt-bindings/interconnect/imx8mm.h>
+
+#include "busfreq.h"
+
+/*
+ * Describe bus masters, slaves and connections between them
+ *
+ * This is a simplified subset of the bus diagram, there are several other
+ * PL301 nics which are skipped/merged into PL301_MAIN
+ */
+static struct busfreq_icc_node imx8mm_icc_nodes[] = {
+ DEFINE_BUS_INTERCONNECT("NOC", IMX8MM_ICN_NOC, 2,
+ IMX8MM_ICS_DRAM,
+ IMX8MM_ICN_MAIN),
+
+ DEFINE_BUS_SLAVE("DRAM", IMX8MM_ICS_DRAM),
+ DEFINE_BUS_SLAVE("OCRAM", IMX8MM_ICS_OCRAM),
+ DEFINE_BUS_MASTER("A53", IMX8MM_ICM_A53, IMX8MM_ICN_NOC),
+
+ /* VPUMIX */
+ DEFINE_BUS_MASTER("VPU H1", IMX8MM_ICM_VPU_H1, IMX8MM_ICN_VIDEO),
+ DEFINE_BUS_MASTER("VPU G1", IMX8MM_ICM_VPU_G1, IMX8MM_ICN_VIDEO),
+ DEFINE_BUS_MASTER("VPU G2", IMX8MM_ICM_VPU_G2, IMX8MM_ICN_VIDEO),
+ DEFINE_BUS_INTERCONNECT("PL301_VIDEO", IMX8MM_ICN_VIDEO, 1, IMX8MM_ICN_NOC),
+
+ /* GPUMIX */
+ DEFINE_BUS_MASTER("GPU 2D", IMX8MM_ICM_GPU2D, IMX8MM_ICN_GPU),
+ DEFINE_BUS_MASTER("GPU 3D", IMX8MM_ICM_GPU3D, IMX8MM_ICN_GPU),
+ DEFINE_BUS_INTERCONNECT("PL301_GPU", IMX8MM_ICN_GPU, 1, IMX8MM_ICN_NOC),
+
+ /* DISPLAYMIX */
+ DEFINE_BUS_MASTER("CSI", IMX8MM_ICM_CSI, IMX8MM_ICN_MIPI),
+ DEFINE_BUS_MASTER("LCDIF", IMX8MM_ICM_LCDIF, IMX8MM_ICN_MIPI),
+ DEFINE_BUS_INTERCONNECT("PL301_MIPI", IMX8MM_ICN_MIPI, 1, IMX8MM_ICN_NOC),
+
+ /* HSIO */
+ DEFINE_BUS_MASTER("USB1", IMX8MM_ICM_USB1, IMX8MM_ICN_HSIO),
+ DEFINE_BUS_MASTER("USB2", IMX8MM_ICM_USB2, IMX8MM_ICN_HSIO),
+ DEFINE_BUS_MASTER("PCIE", IMX8MM_ICM_PCIE, IMX8MM_ICN_HSIO),
+ DEFINE_BUS_INTERCONNECT("PL301_HSIO", IMX8MM_ICN_HSIO, 1, IMX8MM_ICN_NOC),
+
+ /* Audio */
+ DEFINE_BUS_MASTER("SDMA2", IMX8MM_ICM_SDMA2, IMX8MM_ICN_AUDIO),
+ DEFINE_BUS_MASTER("SDMA3", IMX8MM_ICM_SDMA3, IMX8MM_ICN_AUDIO),
+ DEFINE_BUS_INTERCONNECT("PL301_AUDIO", IMX8MM_ICN_AUDIO, 1, IMX8MM_ICN_MAIN),
+
+ /* Ethernet */
+ DEFINE_BUS_MASTER("ENET", IMX8MM_ICM_ENET, IMX8MM_ICN_ENET),
+ DEFINE_BUS_INTERCONNECT("PL301_ENET", IMX8MM_ICN_ENET, 1, IMX8MM_ICN_MAIN),
+
+ /* Other */
+ DEFINE_BUS_MASTER("SDMA1", IMX8MM_ICM_SDMA1, IMX8MM_ICN_MAIN),
+ DEFINE_BUS_MASTER("NAND", IMX8MM_ICM_NAND, IMX8MM_ICN_MAIN),
+ DEFINE_BUS_MASTER("USDHC1", IMX8MM_ICM_USDHC1, IMX8MM_ICN_MAIN),
+ DEFINE_BUS_MASTER("USDHC2", IMX8MM_ICM_USDHC2, IMX8MM_ICN_MAIN),
+ DEFINE_BUS_MASTER("USDHC3", IMX8MM_ICM_USDHC3, IMX8MM_ICN_MAIN),
+ DEFINE_BUS_INTERCONNECT("PL301_MAIN", IMX8MM_ICN_MAIN, 2,
+ IMX8MM_ICN_NOC,
+ IMX8MM_ICS_OCRAM),
+};
+
+static struct busfreq_opp_clk imx8mm_low_freq_clks[] = {
+ DEFINE_OPP_CLOCK("dram", 25000000),
+ DEFINE_OPP_CLOCK("noc", 150000000),
+ DEFINE_OPP_CLOCK("ahb", 22222222),
+ DEFINE_OPP_CLOCK("axi", 24000000),
+};
+
+static struct busfreq_opp_clk imx8mm_audio_freq_clks[] = {
+ DEFINE_OPP_CLOCK("dram", 100000000),
+ DEFINE_OPP_CLOCK("noc", 150000000),
+ DEFINE_OPP_CLOCK("ahb", 22222222),
+ DEFINE_OPP_CLOCK("axi", 24000000),
+};
+
+static struct busfreq_opp_bw imx8mm_audio_freq_nodes[] = {
+ DEFINE_OPP_NODE(IMX8MM_ICM_SDMA2),
+ DEFINE_OPP_NODE(IMX8MM_ICM_SDMA3),
+};
+
+static struct busfreq_opp_clk imx8mm_high_freq_clks[] = {
+ DEFINE_OPP_CLOCK("dram", 750000000),
+ DEFINE_OPP_CLOCK("noc", 750000000),
+ DEFINE_OPP_CLOCK("ahb", 133333333),
+ DEFINE_OPP_CLOCK("axi", 333333333),
+};
+
+static struct busfreq_opp_bw imx8mm_high_freq_nodes[] = {
+ DEFINE_OPP_NODE(IMX8MM_ICM_SDMA2),
+ DEFINE_OPP_NODE(IMX8MM_ICM_SDMA3),
+ DEFINE_OPP_NODE(IMX8MM_ICM_VPU_H1),
+ DEFINE_OPP_NODE(IMX8MM_ICM_VPU_G1),
+ DEFINE_OPP_NODE(IMX8MM_ICM_VPU_G2),
+ DEFINE_OPP_NODE(IMX8MM_ICM_GPU2D),
+ DEFINE_OPP_NODE(IMX8MM_ICM_GPU3D),
+ DEFINE_OPP_NODE(IMX8MM_ICM_CSI),
+ DEFINE_OPP_NODE(IMX8MM_ICM_LCDIF),
+};
+
+static struct busfreq_plat_opp imx8mm_opps[] = {
+ DEFINE_OPP_NO_NODES(imx8mm_low_freq_clks, false),
+ DEFINE_OPP(imx8mm_audio_freq_clks, imx8mm_audio_freq_nodes, false),
+ DEFINE_OPP(imx8mm_high_freq_clks, imx8mm_high_freq_nodes, true),
+};
+
+static int imx8mm_busfreq_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ ret = busfreq_register(pdev, imx8mm_icc_nodes,
+ ARRAY_SIZE(imx8mm_icc_nodes),
+ imx8mm_opps, ARRAY_SIZE(imx8mm_opps));
+ return ret;
+}
+
+static int imx8mm_busfreq_remove(struct platform_device *pdev)
+{
+ return busfreq_unregister(pdev);
+}
+
+static const struct of_device_id busfreq_of_match[] = {
+ { .compatible = "fsl,imx8mm-interconnect" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, busfreq_of_match);
+
+static struct platform_driver imx8mm_busfreq_driver = {
+ .probe = imx8mm_busfreq_probe,
+ .remove = imx8mm_busfreq_remove,
+ .driver = {
+ .name = "imx8mm-interconnect",
+ .of_match_table = busfreq_of_match,
+ },
+};
+
+builtin_platform_driver(imx8mm_busfreq_driver);
+MODULE_AUTHOR("Alexandre Bailon <abailon@baylibre.com>");
+MODULE_LICENSE("GPL v2");
new file mode 100644
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Interconnect framework driver for i.MX SoC
+ *
+ * Copyright (c) 2019, BayLibre
+ * Author: Alexandre Bailon <abailon@baylibre.com>
+ */
+
+#ifndef __IMX8MM_ICM_INTERCONNECT_IDS_H
+#define __IMX8MM_ICM_INTERCONNECT_IDS_H
+
+#define IMX8MM_ICN_NOC 1
+#define IMX8MM_ICS_DRAM 2
+#define IMX8MM_ICS_OCRAM 3
+#define IMX8MM_ICM_A53 4
+
+#define IMX8MM_ICM_VPU_H1 5
+#define IMX8MM_ICM_VPU_G1 6
+#define IMX8MM_ICM_VPU_G2 7
+#define IMX8MM_ICN_VIDEO 8
+
+#define IMX8MM_ICM_GPU2D 9
+#define IMX8MM_ICM_GPU3D 10
+#define IMX8MM_ICN_GPU 11
+
+#define IMX8MM_ICM_CSI 12
+#define IMX8MM_ICM_LCDIF 13
+#define IMX8MM_ICN_MIPI 14
+
+#define IMX8MM_ICM_USB1 11
+#define IMX8MM_ICM_USB2 12
+#define IMX8MM_ICM_PCIE 13
+#define IMX8MM_ICN_HSIO 14
+
+#define IMX8MM_ICM_SDMA2 15
+#define IMX8MM_ICM_SDMA3 16
+#define IMX8MM_ICN_AUDIO 17
+
+#define IMX8MM_ICM_ENET 18
+#define IMX8MM_ICN_ENET 19
+
+#define IMX8MM_ICN_MAIN 20
+#define IMX8MM_ICM_NAND 21
+#define IMX8MM_ICM_SDMA1 22
+#define IMX8MM_ICM_USDHC1 23
+#define IMX8MM_ICM_USDHC2 24
+#define IMX8MM_ICM_USDHC3 25
+
+#endif /* __IMX8MM_ICM_INTERCONNECT_IDS_H */