diff options
author | Peter Boonstoppel <pboonstoppel@nvidia.com> | 2016-10-07 18:30:59 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-11-15 15:30:06 -0500 |
commit | 01e61860fafbc0ee045c2db931a79f6c0d5300aa (patch) | |
tree | 83c8da282d83fd8d9edc441d561dede6b9a8dece /drivers/gpu/nvgpu/gk20a | |
parent | 3a6d47db9d00f86d90a1230dd2225bf4ae8944b8 (diff) |
gpu: nvgpu: gm20b expose gpcclk through CCF
Register gpcclk with Common Clock Framework to expose GPCPLL frequency
control
Bug 200233943
Change-Id: Id6f7bbaca15f22157b91b092c2a035af933fa71e
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/1236979
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/clk_gk20a.h | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 12 |
4 files changed, 27 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h index aefbc5d5..43583f2e 100644 --- a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define CLK_GK20A_H | 17 | #define CLK_GK20A_H |
18 | 18 | ||
19 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
20 | #include <linux/clk-provider.h> | ||
20 | 21 | ||
21 | #define GPUFREQ_TABLE_END ~(u32)1 | 22 | #define GPUFREQ_TABLE_END ~(u32)1 |
22 | enum { | 23 | enum { |
@@ -79,6 +80,9 @@ struct namemap_cfg; | |||
79 | struct clk_gk20a { | 80 | struct clk_gk20a { |
80 | struct gk20a *g; | 81 | struct gk20a *g; |
81 | struct clk *tegra_clk; | 82 | struct clk *tegra_clk; |
83 | #if defined(CONFIG_COMMON_CLK) | ||
84 | struct clk_hw hw; | ||
85 | #endif | ||
82 | struct pll gpc_pll; | 86 | struct pll gpc_pll; |
83 | struct pll gpc_pll_last; | 87 | struct pll gpc_pll_last; |
84 | struct mutex clk_mutex; | 88 | struct mutex clk_mutex; |
@@ -89,6 +93,10 @@ struct clk_gk20a { | |||
89 | bool debugfs_set; | 93 | bool debugfs_set; |
90 | }; | 94 | }; |
91 | 95 | ||
96 | #if defined(CONFIG_COMMON_CLK) | ||
97 | #define to_clk_gk20a(_hw) container_of(_hw, struct clk_gk20a, hw) | ||
98 | #endif | ||
99 | |||
92 | struct gpu_ops; | 100 | struct gpu_ops; |
93 | #ifdef CONFIG_TEGRA_CLK_FRAMEWORK | 101 | #ifdef CONFIG_TEGRA_CLK_FRAMEWORK |
94 | void gk20a_init_clk_ops(struct gpu_ops *gops); | 102 | void gk20a_init_clk_ops(struct gpu_ops *gops); |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 55ebcc8f..d60fce33 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -636,9 +636,12 @@ static ssize_t fmax_at_vmin_safe_read(struct device *dev, | |||
636 | { | 636 | { |
637 | struct gk20a *g = get_gk20a(dev); | 637 | struct gk20a *g = get_gk20a(dev); |
638 | unsigned long gpu_fmax_at_vmin_hz = 0; | 638 | unsigned long gpu_fmax_at_vmin_hz = 0; |
639 | struct clk *clk = g->clk.tegra_clk; | ||
639 | 640 | ||
640 | gpu_fmax_at_vmin_hz = tegra_dvfs_get_fmax_at_vmin_safe_t( | 641 | #ifdef CONFIG_TEGRA_CLK_FRAMEWORK |
641 | clk_get_parent(g->clk.tegra_clk)); | 642 | clk = clk_get_parent(clk); |
643 | #endif | ||
644 | gpu_fmax_at_vmin_hz = tegra_dvfs_get_fmax_at_vmin_safe_t(clk); | ||
642 | 645 | ||
643 | return snprintf(buf, PAGE_SIZE, "%d\n", (int)(gpu_fmax_at_vmin_hz)); | 646 | return snprintf(buf, PAGE_SIZE, "%d\n", (int)(gpu_fmax_at_vmin_hz)); |
644 | } | 647 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 94b8d157..f13a11ea 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -179,6 +179,8 @@ struct gk20a_platform { | |||
179 | int (*clk_set_rate)(struct device *dev, | 179 | int (*clk_set_rate)(struct device *dev, |
180 | unsigned long rate); | 180 | unsigned long rate); |
181 | 181 | ||
182 | /* Called to register GPCPLL with common clk framework */ | ||
183 | int (*clk_register)(struct gk20a *g); | ||
182 | 184 | ||
183 | /* Postscale callback is called after frequency change */ | 185 | /* Postscale callback is called after frequency change */ |
184 | void (*postscale)(struct device *dev, | 186 | void (*postscale)(struct device *dev, |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index 40e7cead..35d524f1 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "hal_gk20a.h" | 40 | #include "hal_gk20a.h" |
41 | #include "platform_gk20a.h" | 41 | #include "platform_gk20a.h" |
42 | #include "gk20a_scale.h" | 42 | #include "gk20a_scale.h" |
43 | #include "gm20b/clk_gm20b.h" | ||
43 | 44 | ||
44 | #define TEGRA_GK20A_BW_PER_FREQ 32 | 45 | #define TEGRA_GK20A_BW_PER_FREQ 32 |
45 | #define TEGRA_GM20B_BW_PER_FREQ 64 | 46 | #define TEGRA_GM20B_BW_PER_FREQ 64 |
@@ -787,6 +788,7 @@ static int gk20a_tegra_probe(struct device *dev) | |||
787 | const __be32 *host1x_ptr; | 788 | const __be32 *host1x_ptr; |
788 | struct platform_device *host1x_pdev = NULL; | 789 | struct platform_device *host1x_pdev = NULL; |
789 | bool joint_xpu_rail = false; | 790 | bool joint_xpu_rail = false; |
791 | int ret; | ||
790 | 792 | ||
791 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); | 793 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); |
792 | if (host1x_ptr) { | 794 | if (host1x_ptr) { |
@@ -834,6 +836,12 @@ static int gk20a_tegra_probe(struct device *dev) | |||
834 | 836 | ||
835 | gk20a_tegra_get_clocks(dev); | 837 | gk20a_tegra_get_clocks(dev); |
836 | 838 | ||
839 | if (platform->clk_register) { | ||
840 | ret = platform->clk_register(platform->g); | ||
841 | if (ret) | ||
842 | return ret; | ||
843 | } | ||
844 | |||
837 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) | 845 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) |
838 | pmc = ioremap(TEGRA_PMC_BASE, 4096); | 846 | pmc = ioremap(TEGRA_PMC_BASE, 4096); |
839 | #endif | 847 | #endif |
@@ -1019,6 +1027,10 @@ struct gk20a_platform gm20b_tegra_platform = { | |||
1019 | .get_clk_freqs = gk20a_clk_get_freqs, | 1027 | .get_clk_freqs = gk20a_clk_get_freqs, |
1020 | #endif | 1028 | #endif |
1021 | 1029 | ||
1030 | #ifdef CONFIG_COMMON_CLK | ||
1031 | .clk_register = gm20b_register_gpcclk, | ||
1032 | #endif | ||
1033 | |||
1022 | /* frequency scaling configuration */ | 1034 | /* frequency scaling configuration */ |
1023 | .prescale = gk20a_tegra_prescale, | 1035 | .prescale = gk20a_tegra_prescale, |
1024 | .postscale = gk20a_tegra_postscale, | 1036 | .postscale = gk20a_tegra_postscale, |