38
38
/* cpufreq transisition latency */
39
39
#define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
40
40
41
- enum cluster {
42
- CLUSTER0 ,
43
- CLUSTER1 ,
44
- CLUSTER2 ,
45
- CLUSTER3 ,
46
- MAX_CLUSTERS ,
47
- };
48
-
49
41
struct tegra_cpu_ctr {
50
42
u32 cpu ;
51
43
u32 coreclk_cnt , last_coreclk_cnt ;
@@ -67,12 +59,12 @@ struct tegra_cpufreq_ops {
67
59
struct tegra_cpufreq_soc {
68
60
struct tegra_cpufreq_ops * ops ;
69
61
int maxcpus_per_cluster ;
62
+ unsigned int num_clusters ;
70
63
phys_addr_t actmon_cntr_base ;
71
64
};
72
65
73
66
struct tegra194_cpufreq_data {
74
67
void __iomem * regs ;
75
- size_t num_clusters ;
76
68
struct cpufreq_frequency_table * * tables ;
77
69
const struct tegra_cpufreq_soc * soc ;
78
70
};
@@ -166,6 +158,14 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
166
158
.ops = & tegra234_cpufreq_ops ,
167
159
.actmon_cntr_base = 0x9000 ,
168
160
.maxcpus_per_cluster = 4 ,
161
+ .num_clusters = 3 ,
162
+ };
163
+
164
+ const struct tegra_cpufreq_soc tegra239_cpufreq_soc = {
165
+ .ops = & tegra234_cpufreq_ops ,
166
+ .actmon_cntr_base = 0x4000 ,
167
+ .maxcpus_per_cluster = 8 ,
168
+ .num_clusters = 1 ,
169
169
};
170
170
171
171
static void tegra194_get_cpu_cluster_id (u32 cpu , u32 * cpuid , u32 * clusterid )
@@ -378,7 +378,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
378
378
379
379
data -> soc -> ops -> get_cpu_cluster_id (policy -> cpu , NULL , & clusterid );
380
380
381
- if (clusterid >= data -> num_clusters || !data -> tables [clusterid ])
381
+ if (clusterid >= data -> soc -> num_clusters || !data -> tables [clusterid ])
382
382
return - EINVAL ;
383
383
384
384
start_cpu = rounddown (policy -> cpu , maxcpus_per_cluster );
@@ -429,6 +429,7 @@ static struct tegra_cpufreq_ops tegra194_cpufreq_ops = {
429
429
static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
430
430
.ops = & tegra194_cpufreq_ops ,
431
431
.maxcpus_per_cluster = 2 ,
432
+ .num_clusters = 4 ,
432
433
};
433
434
434
435
static void tegra194_cpufreq_free_resources (void )
@@ -521,15 +522,14 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
521
522
522
523
soc = of_device_get_match_data (& pdev -> dev );
523
524
524
- if (soc -> ops && soc -> maxcpus_per_cluster ) {
525
+ if (soc -> ops && soc -> maxcpus_per_cluster && soc -> num_clusters ) {
525
526
data -> soc = soc ;
526
527
} else {
527
528
dev_err (& pdev -> dev , "soc data missing\n" );
528
529
return - EINVAL ;
529
530
}
530
531
531
- data -> num_clusters = MAX_CLUSTERS ;
532
- data -> tables = devm_kcalloc (& pdev -> dev , data -> num_clusters ,
532
+ data -> tables = devm_kcalloc (& pdev -> dev , data -> soc -> num_clusters ,
533
533
sizeof (* data -> tables ), GFP_KERNEL );
534
534
if (!data -> tables )
535
535
return - ENOMEM ;
@@ -554,7 +554,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
554
554
goto put_bpmp ;
555
555
}
556
556
557
- for (i = 0 ; i < data -> num_clusters ; i ++ ) {
557
+ for (i = 0 ; i < data -> soc -> num_clusters ; i ++ ) {
558
558
data -> tables [i ] = init_freq_table (pdev , bpmp , i );
559
559
if (IS_ERR (data -> tables [i ])) {
560
560
err = PTR_ERR (data -> tables [i ]);
@@ -586,6 +586,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev)
586
586
static const struct of_device_id tegra194_cpufreq_of_match [] = {
587
587
{ .compatible = "nvidia,tegra194-ccplex" , .data = & tegra194_cpufreq_soc },
588
588
{ .compatible = "nvidia,tegra234-ccplex-cluster" , .data = & tegra234_cpufreq_soc },
589
+ { .compatible = "nvidia,tegra239-ccplex-cluster" , .data = & tegra239_cpufreq_soc },
589
590
{ /* sentinel */ }
590
591
};
591
592
0 commit comments