Lines Matching +full:sdm845 +full:- +full:osm +full:- +full:l3
1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/interconnect-provider.h>
15 #include <dt-bindings/interconnect/qcom,osm-l3.h>
18 #include "sdm845.h"
27 /* OSM Register offsets */
52 * struct qcom_icc_node - Qualcomm specific interconnect nodes
159 qn = src->data; in qcom_icc_set()
160 provider = src->provider; in qcom_icc_set()
163 list_for_each_entry(n, &provider->nodes, node_list) in qcom_icc_set()
164 provider->aggregate(n, 0, n->avg_bw, n->peak_bw, in qcom_icc_set()
169 do_div(rate, qn->buswidth); in qcom_icc_set()
171 for (index = 0; index < qp->max_state - 1; index++) { in qcom_icc_set()
172 if (qp->lut_tables[index] >= rate) in qcom_icc_set()
176 writel_relaxed(index, qp->base + qp->reg_perf_state); in qcom_icc_set()
185 icc_nodes_remove(&qp->provider); in qcom_osm_l3_remove()
186 return icc_provider_del(&qp->provider); in qcom_osm_l3_remove()
203 clk = clk_get(&pdev->dev, "xo"); in qcom_osm_l3_probe()
210 clk = clk_get(&pdev->dev, "alternate"); in qcom_osm_l3_probe()
217 qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); in qcom_osm_l3_probe()
219 return -ENOMEM; in qcom_osm_l3_probe()
221 qp->base = devm_platform_ioremap_resource(pdev, 0); in qcom_osm_l3_probe()
222 if (IS_ERR(qp->base)) in qcom_osm_l3_probe()
223 return PTR_ERR(qp->base); in qcom_osm_l3_probe()
226 if (!(readl_relaxed(qp->base + REG_ENABLE) & 0x1)) { in qcom_osm_l3_probe()
227 dev_err(&pdev->dev, "error hardware not enabled\n"); in qcom_osm_l3_probe()
228 return -ENODEV; in qcom_osm_l3_probe()
231 desc = device_get_match_data(&pdev->dev); in qcom_osm_l3_probe()
233 return -EINVAL; in qcom_osm_l3_probe()
235 qp->reg_perf_state = desc->reg_perf_state; in qcom_osm_l3_probe()
238 info = readl_relaxed(qp->base + desc->reg_freq_lut + in qcom_osm_l3_probe()
239 i * desc->lut_row_size); in qcom_osm_l3_probe()
251 dev_dbg(&pdev->dev, "index=%d freq=%d\n", i, freq); in qcom_osm_l3_probe()
253 qp->lut_tables[i] = freq; in qcom_osm_l3_probe()
256 qp->max_state = i; in qcom_osm_l3_probe()
258 qnodes = desc->nodes; in qcom_osm_l3_probe()
259 num_nodes = desc->num_nodes; in qcom_osm_l3_probe()
261 data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); in qcom_osm_l3_probe()
263 return -ENOMEM; in qcom_osm_l3_probe()
265 provider = &qp->provider; in qcom_osm_l3_probe()
266 provider->dev = &pdev->dev; in qcom_osm_l3_probe()
267 provider->set = qcom_icc_set; in qcom_osm_l3_probe()
268 provider->aggregate = icc_std_aggregate; in qcom_osm_l3_probe()
269 provider->xlate = of_icc_xlate_onecell; in qcom_osm_l3_probe()
270 INIT_LIST_HEAD(&provider->nodes); in qcom_osm_l3_probe()
271 provider->data = data; in qcom_osm_l3_probe()
275 dev_err(&pdev->dev, "error adding interconnect provider\n"); in qcom_osm_l3_probe()
282 node = icc_node_create(qnodes[i]->id); in qcom_osm_l3_probe()
288 node->name = qnodes[i]->name; in qcom_osm_l3_probe()
290 node->data = (void *)qnodes[i]; in qcom_osm_l3_probe()
293 for (j = 0; j < qnodes[i]->num_links; j++) in qcom_osm_l3_probe()
294 icc_link_create(node, qnodes[i]->links[j]); in qcom_osm_l3_probe()
296 data->nodes[i] = node; in qcom_osm_l3_probe()
298 data->num_nodes = num_nodes; in qcom_osm_l3_probe()
311 { .compatible = "qcom,sc7180-osm-l3", .data = &sc7180_icc_osm_l3 },
312 { .compatible = "qcom,sdm845-osm-l3", .data = &sdm845_icc_osm_l3 },
313 { .compatible = "qcom,sm8150-osm-l3", .data = &sm8150_icc_osm_l3 },
314 { .compatible = "qcom,sm8250-epss-l3", .data = &sm8250_icc_epss_l3 },
323 .name = "osm-l3",
330 MODULE_DESCRIPTION("Qualcomm OSM L3 interconnect driver");