1871d78edSAlexandre Courbot /* 2871d78edSAlexandre Courbot * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. 3871d78edSAlexandre Courbot * 4871d78edSAlexandre Courbot * This program is free software; you can redistribute it and/or modify it 5871d78edSAlexandre Courbot * under the terms and conditions of the GNU General Public License, 6871d78edSAlexandre Courbot * version 2, as published by the Free Software Foundation. 7871d78edSAlexandre Courbot * 8871d78edSAlexandre Courbot * This program is distributed in the hope it will be useful, but WITHOUT 9871d78edSAlexandre Courbot * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10871d78edSAlexandre Courbot * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11871d78edSAlexandre Courbot * more details. 12871d78edSAlexandre Courbot * 13871d78edSAlexandre Courbot * You should have received a copy of the GNU General Public License 14871d78edSAlexandre Courbot * along with this program. If not, see <http://www.gnu.org/licenses/>. 15871d78edSAlexandre Courbot */ 16871d78edSAlexandre Courbot 17871d78edSAlexandre Courbot /* Tegra vpr routines */ 18871d78edSAlexandre Courbot 19871d78edSAlexandre Courbot #include <common.h> 20871d78edSAlexandre Courbot #include <asm/io.h> 21871d78edSAlexandre Courbot #include <asm/arch/tegra.h> 22871d78edSAlexandre Courbot #include <asm/arch/mc.h> 23871d78edSAlexandre Courbot 24871d78edSAlexandre Courbot #include <fdt_support.h> 25871d78edSAlexandre Courbot 26871d78edSAlexandre Courbot static bool _configured; 27871d78edSAlexandre Courbot 28*eca676bdSAlexandre Courbot void tegra_gpu_config(void) 29871d78edSAlexandre Courbot { 30871d78edSAlexandre Courbot struct mc_ctlr *mc = (struct mc_ctlr *)NV_PA_MC_BASE; 31871d78edSAlexandre Courbot 32871d78edSAlexandre Courbot /* Turn VPR off */ 33871d78edSAlexandre Courbot writel(0, &mc->mc_video_protect_size_mb); 34871d78edSAlexandre Courbot writel(TEGRA_MC_VIDEO_PROTECT_REG_WRITE_ACCESS_DISABLED, 35871d78edSAlexandre Courbot &mc->mc_video_protect_reg_ctrl); 36871d78edSAlexandre Courbot /* read back to ensure the write went through */ 37871d78edSAlexandre Courbot readl(&mc->mc_video_protect_reg_ctrl); 38871d78edSAlexandre Courbot 39871d78edSAlexandre Courbot debug("configured VPR\n"); 40871d78edSAlexandre Courbot 41871d78edSAlexandre Courbot _configured = true; 42871d78edSAlexandre Courbot } 43871d78edSAlexandre Courbot 44a38a3c4aSAlexandre Courbot #if defined(CONFIG_OF_LIBFDT) 45a38a3c4aSAlexandre Courbot 46*eca676bdSAlexandre Courbot int tegra_gpu_enable_node(void *blob, const char *gpupath) 47a38a3c4aSAlexandre Courbot { 48a38a3c4aSAlexandre Courbot int offset; 49a38a3c4aSAlexandre Courbot 5036e5f7ceSAlexandre Courbot if (_configured) { 51a38a3c4aSAlexandre Courbot offset = fdt_path_offset(blob, gpupath); 52a38a3c4aSAlexandre Courbot if (offset > 0) { 53a38a3c4aSAlexandre Courbot fdt_status_okay(blob, offset); 54a38a3c4aSAlexandre Courbot debug("enabled GPU node %s\n", gpupath); 55a38a3c4aSAlexandre Courbot } 56a38a3c4aSAlexandre Courbot } 57a38a3c4aSAlexandre Courbot 58a38a3c4aSAlexandre Courbot return 0; 59a38a3c4aSAlexandre Courbot } 60a38a3c4aSAlexandre Courbot 61a38a3c4aSAlexandre Courbot #endif 62