2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-06-24 02:45:29 +00:00
|
|
|
/*
|
2015-07-09 07:33:00 +00:00
|
|
|
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
2014-06-24 02:45:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Tegra vpr routines */
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2014-06-24 02:45:29 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/tegra.h>
|
|
|
|
#include <asm/arch/mc.h>
|
2018-07-31 18:39:07 +00:00
|
|
|
#include <asm/arch-tegra/ap.h>
|
2014-06-24 02:45:29 +00:00
|
|
|
|
2015-07-09 07:33:00 +00:00
|
|
|
#include <fdt_support.h>
|
|
|
|
|
|
|
|
static bool _configured;
|
|
|
|
|
2015-10-19 04:57:03 +00:00
|
|
|
void tegra_gpu_config(void)
|
2014-06-24 02:45:29 +00:00
|
|
|
{
|
|
|
|
struct mc_ctlr *mc = (struct mc_ctlr *)NV_PA_MC_BASE;
|
|
|
|
|
2018-07-31 18:39:07 +00:00
|
|
|
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
|
|
|
|
if (!tegra_cpu_is_non_secure())
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
/* Turn VPR off */
|
|
|
|
writel(0, &mc->mc_video_protect_size_mb);
|
|
|
|
writel(TEGRA_MC_VIDEO_PROTECT_REG_WRITE_ACCESS_DISABLED,
|
|
|
|
&mc->mc_video_protect_reg_ctrl);
|
|
|
|
/* read back to ensure the write went through */
|
|
|
|
readl(&mc->mc_video_protect_reg_ctrl);
|
|
|
|
}
|
2015-07-09 07:33:00 +00:00
|
|
|
|
|
|
|
debug("configured VPR\n");
|
|
|
|
|
|
|
|
_configured = true;
|
|
|
|
}
|
|
|
|
|
2015-07-09 07:33:01 +00:00
|
|
|
#if defined(CONFIG_OF_LIBFDT)
|
|
|
|
|
2016-04-12 17:17:39 +00:00
|
|
|
int tegra_gpu_enable_node(void *blob, const char *compat)
|
2015-07-09 07:33:01 +00:00
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
|
2016-04-12 17:17:39 +00:00
|
|
|
if (!_configured)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
offset = fdt_node_offset_by_compatible(blob, -1, compat);
|
|
|
|
while (offset != -FDT_ERR_NOTFOUND) {
|
|
|
|
fdt_status_okay(blob, offset);
|
|
|
|
offset = fdt_node_offset_by_compatible(blob, offset, compat);
|
2015-07-09 07:33:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|