summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/clk_gp106.h
blob: 9adea2b27d0eb208dfa27d514e7d9025f964b993 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright (c) 2016-2017, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef CLK_GP106_H
#define CLK_GP106_H

#include <nvgpu/lock.h>

#define CLK_NAMEMAP_INDEX_GPC2CLK	0x00
#define CLK_NAMEMAP_INDEX_XBAR2CLK	0x02
#define CLK_NAMEMAP_INDEX_SYS2CLK	0x07	/* SYSPLL */
#define CLK_NAMEMAP_INDEX_DRAMCLK	0x20	/* DRAMPLL */

#define CLK_DEFAULT_CNTRL_SETTLE_RETRIES 10
#define CLK_DEFAULT_CNTRL_SETTLE_USECS   5

#define XTAL_CNTR_CLKS		27000	/* 1000usec at 27KHz XTAL */
#define XTAL_CNTR_DELAY		1000	/* we need acuracy up to the ms   */
#define XTAL_SCALE_TO_KHZ	1



struct namemap_cfg {
	u32 namemap;
	u32 is_enable;	/* Namemap enabled */
	u32 is_counter;	/* Using cntr */
	struct gk20a *g;
	union {
		struct {
			u32 reg_ctrl_addr;
			u32 reg_ctrl_idx;
			u32 reg_cntr_addr;
		} cntr;
		struct {
			/* Todo */
		} pll;
	};
	u32 scale;
	char name[24];
};

int gp106_init_clk_support(struct gk20a *g);
u32 gp106_crystal_clk_hz(struct gk20a *g);
unsigned long gp106_clk_measure_freq(struct gk20a *g, u32 api_domain);
int gp106_suspend_clk_support(struct gk20a *g);

#endif /* CLK_GP106_H */