gpu.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 *compat)
  27. {
  28. int offset;
  29. if (!_configured)
  30. return 0;
  31. offset = fdt_node_offset_by_compatible(blob, -1, compat);
  32. while (offset != -FDT_ERR_NOTFOUND) {
  33. fdt_status_okay(blob, offset);
  34. offset = fdt_node_offset_by_compatible(blob, offset, compat);
  35. }
  36. return 0;
  37. }
  38. #endif