3838/* cpufreq transisition latency */
3939#define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */
4040
41- enum cluster {
42- CLUSTER0 ,
43- CLUSTER1 ,
44- CLUSTER2 ,
45- CLUSTER3 ,
46- MAX_CLUSTERS ,
47- };
48-
4941struct tegra_cpu_ctr {
5042 u32 cpu ;
5143 u32 coreclk_cnt , last_coreclk_cnt ;
@@ -67,12 +59,12 @@ struct tegra_cpufreq_ops {
6759struct tegra_cpufreq_soc {
6860 struct tegra_cpufreq_ops * ops ;
6961 int maxcpus_per_cluster ;
62+ unsigned int num_clusters ;
7063 phys_addr_t actmon_cntr_base ;
7164};
7265
7366struct tegra194_cpufreq_data {
7467 void __iomem * regs ;
75- size_t num_clusters ;
7668 struct cpufreq_frequency_table * * tables ;
7769 const struct tegra_cpufreq_soc * soc ;
7870};
@@ -166,6 +158,14 @@ static const struct tegra_cpufreq_soc tegra234_cpufreq_soc = {
166158 .ops = & tegra234_cpufreq_ops ,
167159 .actmon_cntr_base = 0x9000 ,
168160 .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 ,
169169};
170170
171171static 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)
378378
379379 data -> soc -> ops -> get_cpu_cluster_id (policy -> cpu , NULL , & clusterid );
380380
381- if (clusterid >= data -> num_clusters || !data -> tables [clusterid ])
381+ if (clusterid >= data -> soc -> num_clusters || !data -> tables [clusterid ])
382382 return - EINVAL ;
383383
384384 start_cpu = rounddown (policy -> cpu , maxcpus_per_cluster );
@@ -429,6 +429,7 @@ static struct tegra_cpufreq_ops tegra194_cpufreq_ops = {
429429static const struct tegra_cpufreq_soc tegra194_cpufreq_soc = {
430430 .ops = & tegra194_cpufreq_ops ,
431431 .maxcpus_per_cluster = 2 ,
432+ .num_clusters = 4 ,
432433};
433434
434435static void tegra194_cpufreq_free_resources (void )
@@ -521,15 +522,14 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
521522
522523 soc = of_device_get_match_data (& pdev -> dev );
523524
524- if (soc -> ops && soc -> maxcpus_per_cluster ) {
525+ if (soc -> ops && soc -> maxcpus_per_cluster && soc -> num_clusters ) {
525526 data -> soc = soc ;
526527 } else {
527528 dev_err (& pdev -> dev , "soc data missing\n" );
528529 return - EINVAL ;
529530 }
530531
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 ,
533533 sizeof (* data -> tables ), GFP_KERNEL );
534534 if (!data -> tables )
535535 return - ENOMEM ;
@@ -554,7 +554,7 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
554554 goto put_bpmp ;
555555 }
556556
557- for (i = 0 ; i < data -> num_clusters ; i ++ ) {
557+ for (i = 0 ; i < data -> soc -> num_clusters ; i ++ ) {
558558 data -> tables [i ] = init_freq_table (pdev , bpmp , i );
559559 if (IS_ERR (data -> tables [i ])) {
560560 err = PTR_ERR (data -> tables [i ]);
@@ -586,6 +586,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev)
586586static const struct of_device_id tegra194_cpufreq_of_match [] = {
587587 { .compatible = "nvidia,tegra194-ccplex" , .data = & tegra194_cpufreq_soc },
588588 { .compatible = "nvidia,tegra234-ccplex-cluster" , .data = & tegra234_cpufreq_soc },
589+ { .compatible = "nvidia,tegra239-ccplex-cluster" , .data = & tegra239_cpufreq_soc },
589590 { /* sentinel */ }
590591};
591592
0 commit comments