Bryan Wu | df3443d | 2014-06-24 11:45:29 +0900 | [diff] [blame] | 1 | /* |
Alexandre Courbot | 871d78e | 2015-07-09 16:33:00 +0900 | [diff] [blame] | 2 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
Bryan Wu | df3443d | 2014-06-24 11:45:29 +0900 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | /* Tegra vpr routines */ |
| 18 | |
| 19 | #include <common.h> |
| 20 | #include <asm/io.h> |
| 21 | #include <asm/arch/tegra.h> |
| 22 | #include <asm/arch/mc.h> |
| 23 | |
Alexandre Courbot | 871d78e | 2015-07-09 16:33:00 +0900 | [diff] [blame] | 24 | #include <fdt_support.h> |
| 25 | |
| 26 | static bool _configured; |
| 27 | |
Alexandre Courbot | eca676b | 2015-10-19 13:57:03 +0900 | [diff] [blame^] | 28 | void tegra_gpu_config(void) |
Bryan Wu | df3443d | 2014-06-24 11:45:29 +0900 | [diff] [blame] | 29 | { |
| 30 | struct mc_ctlr *mc = (struct mc_ctlr *)NV_PA_MC_BASE; |
| 31 | |
| 32 | /* Turn VPR off */ |
| 33 | writel(0, &mc->mc_video_protect_size_mb); |
| 34 | writel(TEGRA_MC_VIDEO_PROTECT_REG_WRITE_ACCESS_DISABLED, |
| 35 | &mc->mc_video_protect_reg_ctrl); |
| 36 | /* read back to ensure the write went through */ |
| 37 | readl(&mc->mc_video_protect_reg_ctrl); |
Alexandre Courbot | 871d78e | 2015-07-09 16:33:00 +0900 | [diff] [blame] | 38 | |
| 39 | debug("configured VPR\n"); |
| 40 | |
| 41 | _configured = true; |
| 42 | } |
| 43 | |
Alexandre Courbot | a38a3c4 | 2015-07-09 16:33:01 +0900 | [diff] [blame] | 44 | #if defined(CONFIG_OF_LIBFDT) |
| 45 | |
Alexandre Courbot | eca676b | 2015-10-19 13:57:03 +0900 | [diff] [blame^] | 46 | int tegra_gpu_enable_node(void *blob, const char *gpupath) |
Alexandre Courbot | a38a3c4 | 2015-07-09 16:33:01 +0900 | [diff] [blame] | 47 | { |
| 48 | int offset; |
| 49 | |
Alexandre Courbot | 36e5f7c | 2015-10-19 13:57:01 +0900 | [diff] [blame] | 50 | if (_configured) { |
Alexandre Courbot | a38a3c4 | 2015-07-09 16:33:01 +0900 | [diff] [blame] | 51 | offset = fdt_path_offset(blob, gpupath); |
| 52 | if (offset > 0) { |
| 53 | fdt_status_okay(blob, offset); |
| 54 | debug("enabled GPU node %s\n", gpupath); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | #endif |