11// SPDX-License-Identifier: GPL-2.0
22/*
33 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
4+ * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
45 */
56
67#include <linux/args.h>
3233#define EPSS_REG_FREQ_LUT 0x100
3334#define EPSS_REG_PERF_STATE 0x320
3435
35- #define OSM_L3_MAX_LINKS 1
36-
3736#define to_osm_l3_provider (_provider ) \
3837 container_of(_provider, struct qcom_osm_l3_icc_provider, provider)
3938
@@ -48,16 +47,10 @@ struct qcom_osm_l3_icc_provider {
4847/**
4948 * struct qcom_osm_l3_node - Qualcomm specific interconnect nodes
5049 * @name: the node name used in debugfs
51- * @links: an array of nodes where we can go next while traversing
52- * @id: a unique node identifier
53- * @num_links: the total number of @links
5450 * @buswidth: width of the interconnect between a node and the bus
5551 */
5652struct qcom_osm_l3_node {
5753 const char * name ;
58- u16 links [OSM_L3_MAX_LINKS ];
59- u16 id ;
60- u16 num_links ;
6154 u16 buswidth ;
6255};
6356
@@ -69,30 +62,22 @@ struct qcom_osm_l3_desc {
6962 unsigned int reg_perf_state ;
7063};
7164
72- enum {
73- OSM_L3_MASTER_NODE = 10000 ,
74- OSM_L3_SLAVE_NODE ,
75- };
76-
77- #define DEFINE_QNODE (_name , _id , _buswidth , ...) \
65+ #define DEFINE_QNODE (_name , _buswidth ) \
7866 static const struct qcom_osm_l3_node _name = { \
7967 .name = #_name, \
80- .id = _id, \
8168 .buswidth = _buswidth, \
82- .num_links = COUNT_ARGS(__VA_ARGS__), \
83- .links = { __VA_ARGS__ }, \
8469 }
8570
86- DEFINE_QNODE (osm_l3_master , OSM_L3_MASTER_NODE , 16 , OSM_L3_SLAVE_NODE );
87- DEFINE_QNODE (osm_l3_slave , OSM_L3_SLAVE_NODE , 16 );
71+ DEFINE_QNODE (osm_l3_slave , 16 );
72+ DEFINE_QNODE (osm_l3_master , 16 );
8873
8974static const struct qcom_osm_l3_node * const osm_l3_nodes [] = {
9075 [MASTER_OSM_L3_APPS ] = & osm_l3_master ,
9176 [SLAVE_OSM_L3 ] = & osm_l3_slave ,
9277};
9378
94- DEFINE_QNODE (epss_l3_master , OSM_L3_MASTER_NODE , 32 , OSM_L3_SLAVE_NODE );
95- DEFINE_QNODE (epss_l3_slave , OSM_L3_SLAVE_NODE , 32 );
79+ DEFINE_QNODE (epss_l3_slave , 32 );
80+ DEFINE_QNODE (epss_l3_master , 32 );
9681
9782static const struct qcom_osm_l3_node * const epss_l3_nodes [] = {
9883 [MASTER_EPSS_L3_APPS ] = & epss_l3_master ,
@@ -242,10 +227,10 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
242227
243228 icc_provider_init (provider );
244229
230+ /* Create nodes */
245231 for (i = 0 ; i < num_nodes ; i ++ ) {
246- size_t j ;
232+ node = icc_node_create_dyn () ;
247233
248- node = icc_node_create (qnodes [i ]-> id );
249234 if (IS_ERR (node )) {
250235 ret = PTR_ERR (node );
251236 goto err ;
@@ -256,12 +241,12 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
256241 node -> data = (void * )qnodes [i ];
257242 icc_node_add (node , provider );
258243
259- for (j = 0 ; j < qnodes [i ]-> num_links ; j ++ )
260- icc_link_create (node , qnodes [i ]-> links [j ]);
261-
262244 data -> nodes [i ] = node ;
263245 }
264246
247+ /* Create link */
248+ icc_link_nodes (data -> nodes [MASTER_OSM_L3_APPS ], & data -> nodes [SLAVE_OSM_L3 ]);
249+
265250 ret = icc_provider_register (provider );
266251 if (ret )
267252 goto err ;
@@ -278,6 +263,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
278263static const struct of_device_id osm_l3_of_match [] = {
279264 { .compatible = "qcom,epss-l3" , .data = & epss_l3_l3_vote },
280265 { .compatible = "qcom,osm-l3" , .data = & osm_l3 },
266+ { .compatible = "qcom,sa8775p-epss-l3" , .data = & epss_l3_perf_state },
281267 { .compatible = "qcom,sc7180-osm-l3" , .data = & osm_l3 },
282268 { .compatible = "qcom,sc7280-epss-l3" , .data = & epss_l3_perf_state },
283269 { .compatible = "qcom,sdm845-osm-l3" , .data = & osm_l3 },
0 commit comments