1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Interconnect framework driver for i.MX SoC
5 * Copyright (c) 2019, BayLibre
6 * Copyright (c) 2019-2020, NXP
10 #ifndef __DRIVERS_INTERCONNECT_IMX_H
11 #define __DRIVERS_INTERCONNECT_IMX_H
13 #include <linux/interconnect-provider.h>
14 #include <linux/kernel.h>
16 #define IMX_ICC_MAX_LINKS 4
19 * High throughput priority level in Regulator mode
20 * Read Priority in Fixed/Limiter mode
22 #define PRIORITY0_SHIFT 0
24 * Low throughput priority level in Regulator mode
25 * Write Priority in Fixed/Limiter mode
27 #define PRIORITY1_SHIFT 8
28 #define PRIORITY_MASK 0x7
30 #define PRIORITY_COMP_MARK BIT(31) /* Must set */
32 #define IMX_NOC_MODE_FIXED 0
33 #define IMX_NOC_MODE_LIMITER 1
34 #define IMX_NOC_MODE_BYPASS 2
35 #define IMX_NOC_MODE_REGULATOR 3
36 #define IMX_NOC_MODE_UNCONFIGURED 0xFF
38 #define IMX_NOC_PRIO_REG 0x8
39 #define IMX_NOC_MODE_REG 0xC
40 #define IMX_NOC_BANDWIDTH_REG 0x10
41 #define IMX_NOC_SATURATION 0x14
42 #define IMX_NOC_EXT_CTL_REG 0x18
44 struct imx_icc_provider {
45 void __iomem *noc_base;
46 struct icc_provider provider;
50 * struct imx_icc_node_adj - Describe a dynamic adjustable node
52 struct imx_icc_node_adj_desc {
53 unsigned int bw_mul, bw_div;
54 const char *phandle_name;
59 * struct imx_icc_node - Describe an interconnect node
60 * @name: name of the node
61 * @id: an unique id to identify the node
62 * @links: an array of slaves' node id
63 * @num_links: number of id defined in links
65 struct imx_icc_node_desc {
68 u16 links[IMX_ICC_MAX_LINKS];
70 const struct imx_icc_node_adj_desc *adj;
74 * struct imx_icc_noc_setting - Describe an interconnect node setting
75 * @reg: register offset inside the NoC
76 * @prio_level: priority level
77 * @mode: functional mode
78 * @ext_control: external input control
80 struct imx_icc_noc_setting {
87 #define DEFINE_BUS_INTERCONNECT(_name, _id, _adj, ...) \
92 .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })), \
93 .links = { __VA_ARGS__ }, \
96 #define DEFINE_BUS_MASTER(_name, _id, _dest_id) \
97 DEFINE_BUS_INTERCONNECT(_name, _id, NULL, _dest_id)
99 #define DEFINE_BUS_SLAVE(_name, _id, _adj) \
100 DEFINE_BUS_INTERCONNECT(_name, _id, _adj)
102 int imx_icc_register(struct platform_device *pdev,
103 struct imx_icc_node_desc *nodes,
105 struct imx_icc_noc_setting *noc_settings);
106 void imx_icc_unregister(struct platform_device *pdev);
108 #endif /* __DRIVERS_INTERCONNECT_IMX_H */