a5xx_gpu.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (c) 2016 The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef __A5XX_GPU_H__
  14. #define __A5XX_GPU_H__
  15. #include "adreno_gpu.h"
  16. /* Bringing over the hack from the previous targets */
  17. #undef ROP_COPY
  18. #undef ROP_XOR
  19. #include "a5xx.xml.h"
  20. struct a5xx_gpu {
  21. struct adreno_gpu base;
  22. struct platform_device *pdev;
  23. struct drm_gem_object *pm4_bo;
  24. uint64_t pm4_iova;
  25. struct drm_gem_object *pfp_bo;
  26. uint64_t pfp_iova;
  27. struct drm_gem_object *gpmu_bo;
  28. uint64_t gpmu_iova;
  29. uint32_t gpmu_dwords;
  30. uint32_t lm_leakage;
  31. };
  32. #define to_a5xx_gpu(x) container_of(x, struct a5xx_gpu, base)
  33. int a5xx_power_init(struct msm_gpu *gpu);
  34. void a5xx_gpmu_ucode_init(struct msm_gpu *gpu);
  35. static inline int spin_usecs(struct msm_gpu *gpu, uint32_t usecs,
  36. uint32_t reg, uint32_t mask, uint32_t value)
  37. {
  38. while (usecs--) {
  39. udelay(1);
  40. if ((gpu_read(gpu, reg) & mask) == value)
  41. return 0;
  42. cpu_relax();
  43. }
  44. return -ETIMEDOUT;
  45. }
  46. #endif /* __A5XX_GPU_H__ */