^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Interconnect framework driver for i.MX SoC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2019, BayLibre
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2019-2020, NXP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Author: Alexandre Bailon <abailon@baylibre.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Author: Leonard Crestez <leonard.crestez@nxp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __DRIVERS_INTERCONNECT_IMX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __DRIVERS_INTERCONNECT_IMX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define IMX_ICC_MAX_LINKS 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * struct imx_icc_node_adj - Describe a dynamic adjustable node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct imx_icc_node_adj_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned int bw_mul, bw_div;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) const char *phandle_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) bool main_noc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * struct imx_icc_node - Describe an interconnect node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * @name: name of the node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * @id: an unique id to identify the node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * @links: an array of slaves' node id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * @num_links: number of id defined in links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct imx_icc_node_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u16 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u16 links[IMX_ICC_MAX_LINKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u16 num_links;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) const struct imx_icc_node_adj_desc *adj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define DEFINE_BUS_INTERCONNECT(_name, _id, _adj, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .id = _id, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .name = _name, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .adj = _adj, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .links = { __VA_ARGS__ }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define DEFINE_BUS_MASTER(_name, _id, _dest_id) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DEFINE_BUS_INTERCONNECT(_name, _id, NULL, _dest_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define DEFINE_BUS_SLAVE(_name, _id, _adj) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DEFINE_BUS_INTERCONNECT(_name, _id, _adj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int imx_icc_register(struct platform_device *pdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct imx_icc_node_desc *nodes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int nodes_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int imx_icc_unregister(struct platform_device *pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif /* __DRIVERS_INTERCONNECT_IMX_H */