gpu.c 977 B

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