xref: /rk3399_rockchip-uboot/arch/arm/mach-tegra/gpu.c (revision 871d78ed1b906a79d8a6dad96a9f83dea7b9170f)
1*871d78edSAlexandre Courbot /*
2*871d78edSAlexandre Courbot  * Copyright (c) 2014-2015, NVIDIA CORPORATION.  All rights reserved.
3*871d78edSAlexandre Courbot  *
4*871d78edSAlexandre Courbot  * This program is free software; you can redistribute it and/or modify it
5*871d78edSAlexandre Courbot  * under the terms and conditions of the GNU General Public License,
6*871d78edSAlexandre Courbot  * version 2, as published by the Free Software Foundation.
7*871d78edSAlexandre Courbot  *
8*871d78edSAlexandre Courbot  * This program is distributed in the hope it will be useful, but WITHOUT
9*871d78edSAlexandre Courbot  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10*871d78edSAlexandre Courbot  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11*871d78edSAlexandre Courbot  * more details.
12*871d78edSAlexandre Courbot  *
13*871d78edSAlexandre Courbot  * You should have received a copy of the GNU General Public License
14*871d78edSAlexandre Courbot  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15*871d78edSAlexandre Courbot  */
16*871d78edSAlexandre Courbot 
17*871d78edSAlexandre Courbot /* Tegra vpr routines */
18*871d78edSAlexandre Courbot 
19*871d78edSAlexandre Courbot #include <common.h>
20*871d78edSAlexandre Courbot #include <asm/io.h>
21*871d78edSAlexandre Courbot #include <asm/arch/tegra.h>
22*871d78edSAlexandre Courbot #include <asm/arch/mc.h>
23*871d78edSAlexandre Courbot 
24*871d78edSAlexandre Courbot #include <fdt_support.h>
25*871d78edSAlexandre Courbot 
26*871d78edSAlexandre Courbot static bool _configured;
27*871d78edSAlexandre Courbot 
28*871d78edSAlexandre Courbot void config_gpu(void)
29*871d78edSAlexandre Courbot {
30*871d78edSAlexandre Courbot 	struct mc_ctlr *mc = (struct mc_ctlr *)NV_PA_MC_BASE;
31*871d78edSAlexandre Courbot 
32*871d78edSAlexandre Courbot 	/* Turn VPR off */
33*871d78edSAlexandre Courbot 	writel(0, &mc->mc_video_protect_size_mb);
34*871d78edSAlexandre Courbot 	writel(TEGRA_MC_VIDEO_PROTECT_REG_WRITE_ACCESS_DISABLED,
35*871d78edSAlexandre Courbot 	       &mc->mc_video_protect_reg_ctrl);
36*871d78edSAlexandre Courbot 	/* read back to ensure the write went through */
37*871d78edSAlexandre Courbot 	readl(&mc->mc_video_protect_reg_ctrl);
38*871d78edSAlexandre Courbot 
39*871d78edSAlexandre Courbot 	debug("configured VPR\n");
40*871d78edSAlexandre Courbot 
41*871d78edSAlexandre Courbot 	_configured = true;
42*871d78edSAlexandre Courbot }
43*871d78edSAlexandre Courbot 
44*871d78edSAlexandre Courbot bool vpr_configured(void)
45*871d78edSAlexandre Courbot {
46*871d78edSAlexandre Courbot 	return _configured;
47*871d78edSAlexandre Courbot }
48