0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __DRIVERS_INTERCONNECT_IMX_H
0011 #define __DRIVERS_INTERCONNECT_IMX_H
0012
0013 #include <linux/interconnect-provider.h>
0014 #include <linux/kernel.h>
0015
0016 #define IMX_ICC_MAX_LINKS 4
0017
0018
0019
0020
0021
0022 #define PRIORITY0_SHIFT 0
0023
0024
0025
0026
0027 #define PRIORITY1_SHIFT 8
0028 #define PRIORITY_MASK 0x7
0029
0030 #define PRIORITY_COMP_MARK BIT(31)
0031
0032 #define IMX_NOC_MODE_FIXED 0
0033 #define IMX_NOC_MODE_LIMITER 1
0034 #define IMX_NOC_MODE_BYPASS 2
0035 #define IMX_NOC_MODE_REGULATOR 3
0036 #define IMX_NOC_MODE_UNCONFIGURED 0xFF
0037
0038 #define IMX_NOC_PRIO_REG 0x8
0039 #define IMX_NOC_MODE_REG 0xC
0040 #define IMX_NOC_BANDWIDTH_REG 0x10
0041 #define IMX_NOC_SATURATION 0x14
0042 #define IMX_NOC_EXT_CTL_REG 0x18
0043
0044 struct imx_icc_provider {
0045 void __iomem *noc_base;
0046 struct icc_provider provider;
0047 };
0048
0049
0050
0051
0052 struct imx_icc_node_adj_desc {
0053 unsigned int bw_mul, bw_div;
0054 const char *phandle_name;
0055 bool main_noc;
0056 };
0057
0058
0059
0060
0061
0062
0063
0064
0065 struct imx_icc_node_desc {
0066 const char *name;
0067 u16 id;
0068 u16 links[IMX_ICC_MAX_LINKS];
0069 u16 num_links;
0070 const struct imx_icc_node_adj_desc *adj;
0071 };
0072
0073
0074
0075
0076
0077
0078
0079
0080 struct imx_icc_noc_setting {
0081 u32 reg;
0082 u32 prio_level;
0083 u32 mode;
0084 u32 ext_control;
0085 };
0086
0087 #define DEFINE_BUS_INTERCONNECT(_name, _id, _adj, ...) \
0088 { \
0089 .id = _id, \
0090 .name = _name, \
0091 .adj = _adj, \
0092 .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })), \
0093 .links = { __VA_ARGS__ }, \
0094 }
0095
0096 #define DEFINE_BUS_MASTER(_name, _id, _dest_id) \
0097 DEFINE_BUS_INTERCONNECT(_name, _id, NULL, _dest_id)
0098
0099 #define DEFINE_BUS_SLAVE(_name, _id, _adj) \
0100 DEFINE_BUS_INTERCONNECT(_name, _id, _adj)
0101
0102 int imx_icc_register(struct platform_device *pdev,
0103 struct imx_icc_node_desc *nodes,
0104 int nodes_count,
0105 struct imx_icc_noc_setting *noc_settings);
0106 int imx_icc_unregister(struct platform_device *pdev);
0107
0108 #endif