Lines Matching +full:tx +full:- +full:cpu2

1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/dma-mapping.h>
13 #include <soc/tegra/bpmp-abi.h>
28 /* CPU0 - A57 Cluster */
33 /* CPU1 - Denver Cluster */
38 /* CPU2 - Denver Cluster */
43 /* CPU3 - A57 Cluster */
48 /* CPU4 - A57 Cluster */
53 /* CPU5 - A57 Cluster */
75 unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id; in tegra186_cpufreq_init()
77 policy->freq_table = data->clusters[cluster].table; in tegra186_cpufreq_init()
78 policy->cpuinfo.transition_latency = 300 * 1000; in tegra186_cpufreq_init()
79 policy->driver_data = NULL; in tegra186_cpufreq_init()
88 struct cpufreq_frequency_table *tbl = policy->freq_table + index; in tegra186_cpufreq_set_target()
89 unsigned int edvd_offset = data->cpus[policy->cpu].edvd_offset; in tegra186_cpufreq_set_target()
90 u32 edvd_val = tbl->driver_data; in tegra186_cpufreq_set_target()
92 writel(edvd_val, data->regs + edvd_offset); in tegra186_cpufreq_set_target()
109 edvd_offset = data->cpus[policy->cpu].edvd_offset; in tegra186_cpufreq_get()
110 ndiv = readl(data->regs + edvd_offset) & EDVD_CORE_VOLT_FREQ_F_MASK; in tegra186_cpufreq_get()
111 cluster_id = data->cpus[policy->cpu].bpmp_cluster_id; in tegra186_cpufreq_get()
112 cluster = &data->clusters[cluster_id]; in tegra186_cpufreq_get()
115 return (cluster->ref_clk_khz * ndiv) / cluster->div; in tegra186_cpufreq_get()
141 virt = dma_alloc_coherent(bpmp->dev, sizeof(*data), &phys, in init_vhint_table()
144 return ERR_PTR(-ENOMEM); in init_vhint_table()
154 msg.tx.data = &req; in init_vhint_table()
155 msg.tx.size = sizeof(req); in init_vhint_table()
163 table = ERR_PTR(-EINVAL); in init_vhint_table()
167 for (i = data->vfloor; i <= data->vceil; i++) { in init_vhint_table()
168 u16 ndiv = data->ndiv[i]; in init_vhint_table()
170 if (ndiv < data->ndiv_min || ndiv > data->ndiv_max) in init_vhint_table()
174 if (i > 0 && ndiv == data->ndiv[i - 1]) in init_vhint_table()
180 table = devm_kcalloc(&pdev->dev, num_rates + 1, sizeof(*table), in init_vhint_table()
183 table = ERR_PTR(-ENOMEM); in init_vhint_table()
187 cluster->ref_clk_khz = data->ref_clk_hz / 1000; in init_vhint_table()
188 cluster->div = data->pdiv * data->mdiv; in init_vhint_table()
190 for (i = data->vfloor, j = 0; i <= data->vceil; i++) { in init_vhint_table()
192 u16 ndiv = data->ndiv[i]; in init_vhint_table()
195 if (ndiv < data->ndiv_min || ndiv > data->ndiv_max) in init_vhint_table()
199 if (i > 0 && ndiv == data->ndiv[i - 1]) in init_vhint_table()
206 point->driver_data = edvd_val; in init_vhint_table()
207 point->frequency = (cluster->ref_clk_khz * ndiv) / cluster->div; in init_vhint_table()
213 dma_free_coherent(bpmp->dev, sizeof(*data), virt, phys); in init_vhint_table()
224 data = devm_kzalloc(&pdev->dev, in tegra186_cpufreq_probe()
228 return -ENOMEM; in tegra186_cpufreq_probe()
230 data->cpus = tegra186_cpus; in tegra186_cpufreq_probe()
232 bpmp = tegra_bpmp_get(&pdev->dev); in tegra186_cpufreq_probe()
236 data->regs = devm_platform_ioremap_resource(pdev, 0); in tegra186_cpufreq_probe()
237 if (IS_ERR(data->regs)) { in tegra186_cpufreq_probe()
238 err = PTR_ERR(data->regs); in tegra186_cpufreq_probe()
243 struct tegra186_cpufreq_cluster *cluster = &data->clusters[i]; in tegra186_cpufreq_probe()
245 cluster->table = init_vhint_table(pdev, bpmp, cluster, i); in tegra186_cpufreq_probe()
246 if (IS_ERR(cluster->table)) { in tegra186_cpufreq_probe()
247 err = PTR_ERR(cluster->table); in tegra186_cpufreq_probe()
268 { .compatible = "nvidia,tegra186-ccplex-cluster", },
275 .name = "tegra186-cpufreq",