diff options
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk.h')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk.h b/drivers/gpu/nvgpu/clk/clk.h new file mode 100644 index 00000000..b173a09e --- /dev/null +++ b/drivers/gpu/nvgpu/clk/clk.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * general clock structures & definitions | ||
3 | * | ||
4 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | #ifndef _CLK_H_ | ||
16 | #define _CLK_H_ | ||
17 | |||
18 | #include "clk_vin.h" | ||
19 | #include "clk_fll.h" | ||
20 | #include "clk_domain.h" | ||
21 | #include "clk_prog.h" | ||
22 | #include "clk_vf_point.h" | ||
23 | #include "clk_mclk.h" | ||
24 | #include "clk_freq_controller.h" | ||
25 | #include "gk20a/gk20a.h" | ||
26 | |||
27 | #define NV_PERF_DOMAIN_4X_CLOCK_DOMAIN_SKIP 0x10 | ||
28 | #define NV_PERF_DOMAIN_4X_CLOCK_DOMAIN_MASK 0x1F | ||
29 | #define NV_PERF_DOMAIN_4X_CLOCK_DOMAIN_SHIFT 0 | ||
30 | |||
31 | /* clock related defines for GPUs supporting clock control from pmu*/ | ||
32 | struct clk_pmupstate { | ||
33 | struct avfsvinobjs avfs_vinobjs; | ||
34 | struct avfsfllobjs avfs_fllobjs; | ||
35 | struct clk_domains clk_domainobjs; | ||
36 | struct clk_progs clk_progobjs; | ||
37 | struct clk_vf_points clk_vf_pointobjs; | ||
38 | struct clk_mclk_state clk_mclk; | ||
39 | struct clk_freq_controllers clk_freq_controllers; | ||
40 | }; | ||
41 | |||
42 | struct clockentry { | ||
43 | u8 vbios_clk_domain; | ||
44 | u8 clk_which; | ||
45 | u8 perf_index; | ||
46 | u32 api_clk_domain; | ||
47 | }; | ||
48 | |||
49 | struct set_fll_clk { | ||
50 | u32 voltuv; | ||
51 | u16 gpc2clkmhz; | ||
52 | u32 current_regime_id_gpc; | ||
53 | u32 target_regime_id_gpc; | ||
54 | u16 sys2clkmhz; | ||
55 | u32 current_regime_id_sys; | ||
56 | u32 target_regime_id_sys; | ||
57 | u16 xbar2clkmhz; | ||
58 | u32 current_regime_id_xbar; | ||
59 | u32 target_regime_id_xbar; | ||
60 | }; | ||
61 | |||
62 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_MAX_NUMCLKS 9 | ||
63 | |||
64 | struct vbios_clock_domain { | ||
65 | u8 clock_type; | ||
66 | u8 num_domains; | ||
67 | struct clockentry clock_entry[NV_PERF_HEADER_4X_CLOCKS_DOMAINS_MAX_NUMCLKS]; | ||
68 | }; | ||
69 | |||
70 | struct vbios_clocks_table_1x_hal_clock_entry { | ||
71 | enum nv_pmu_clk_clkwhich domain; | ||
72 | bool b_noise_aware_capable; | ||
73 | }; | ||
74 | |||
75 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_GPC2CLK 0 | ||
76 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_XBAR2CLK 1 | ||
77 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_DRAMCLK 2 | ||
78 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_SYS2CLK 3 | ||
79 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_HUB2CLK 4 | ||
80 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_MSDCLK 5 | ||
81 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_PWRCLK 6 | ||
82 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_DISPCLK 7 | ||
83 | #define NV_PERF_HEADER_4X_CLOCKS_DOMAINS_4_NUMCLKS 8 | ||
84 | |||
85 | #define PERF_CLK_MCLK 0 | ||
86 | #define PERF_CLK_DISPCLK 1 | ||
87 | #define PERF_CLK_GPC2CLK 2 | ||
88 | #define PERF_CLK_HOSTCLK 3 | ||
89 | #define PERF_CLK_LTC2CLK 4 | ||
90 | #define PERF_CLK_SYS2CLK 5 | ||
91 | #define PERF_CLK_HUB2CLK 6 | ||
92 | #define PERF_CLK_LEGCLK 7 | ||
93 | #define PERF_CLK_MSDCLK 8 | ||
94 | #define PERF_CLK_XCLK 9 | ||
95 | #define PERF_CLK_PWRCLK 10 | ||
96 | #define PERF_CLK_XBAR2CLK 11 | ||
97 | #define PERF_CLK_PCIEGENCLK 12 | ||
98 | #define PERF_CLK_NUM 13 | ||
99 | |||
100 | #define BOOT_GPC2CLK_MHZ 2581 | ||
101 | |||
102 | u32 clk_pmu_vin_load(struct gk20a *g); | ||
103 | u32 clk_domain_print_vf_table(struct gk20a *g, u32 clkapidomain); | ||
104 | u32 clk_domain_get_f_or_v( | ||
105 | struct gk20a *g, | ||
106 | u32 clkapidomain, | ||
107 | u16 *pclkmhz, | ||
108 | u32 *pvoltuv, | ||
109 | u8 railidx | ||
110 | ); | ||
111 | u32 clk_domain_get_f_points( | ||
112 | struct gk20a *g, | ||
113 | u32 clkapidomain, | ||
114 | u32 *fpointscount, | ||
115 | u16 *freqpointsinmhz | ||
116 | ); | ||
117 | int clk_get_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk); | ||
118 | int clk_set_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk); | ||
119 | int clk_pmu_freq_controller_load(struct gk20a *g, bool bload); | ||
120 | #endif | ||