gpu.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
  4. */
  5. /* Tegra vpr routines */
  6. #include <common.h>
  7. #include <asm/io.h>
  8. #include <asm/arch/tegra.h>
  9. #include <asm/arch/mc.h>
  10. #include <fdt_support.h>
  11. static bool _configured;
  12. void tegra_gpu_config(void)
  13. {
  14. struct mc_ctlr *mc = (struct mc_ctlr *)NV_PA_MC_BASE;
  15. /* Turn VPR off */
  16. writel(0, &mc->mc_video_protect_size_mb);
  17. writel(TEGRA_MC_VIDEO_PROTECT_REG_WRITE_ACCESS_DISABLED,
  18. &mc->mc_video_protect_reg_ctrl);
  19. /* read back to ensure the write went through */
  20. readl(&mc->mc_video_protect_reg_ctrl);
  21. debug("configured VPR\n");
  22. _configured = true;
  23. }
  24. #if defined(CONFIG_OF_LIBFDT)
  25. int tegra_gpu_enable_node(void *blob, const char *compat)
  26. {
  27. int offset;
  28. if (!_configured)
  29. return 0;
  30. offset = fdt_node_offset_by_compatible(blob, -1, compat);
  31. while (offset != -FDT_ERR_NOTFOUND) {
  32. fdt_status_okay(blob, offset);
  33. offset = fdt_node_offset_by_compatible(blob, offset, compat);
  34. }
  35. return 0;
  36. }
  37. #endif