panthor_gpu.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 or MIT */
  2. /* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */
  3. /* Copyright 2019 Collabora ltd. */
  4. #ifndef __PANTHOR_GPU_H__
  5. #define __PANTHOR_GPU_H__
  6. struct panthor_device;
  7. int panthor_gpu_init(struct panthor_device *ptdev);
  8. void panthor_gpu_unplug(struct panthor_device *ptdev);
  9. void panthor_gpu_suspend(struct panthor_device *ptdev);
  10. void panthor_gpu_resume(struct panthor_device *ptdev);
  11. int panthor_gpu_block_power_on(struct panthor_device *ptdev,
  12. const char *blk_name,
  13. u32 pwron_reg, u32 pwrtrans_reg,
  14. u32 rdy_reg, u64 mask, u32 timeout_us);
  15. int panthor_gpu_block_power_off(struct panthor_device *ptdev,
  16. const char *blk_name,
  17. u32 pwroff_reg, u32 pwrtrans_reg,
  18. u64 mask, u32 timeout_us);
  19. /**
  20. * panthor_gpu_power_on() - Power on the GPU block.
  21. *
  22. * Return: 0 on success, a negative error code otherwise.
  23. */
  24. #define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
  25. panthor_gpu_block_power_on(ptdev, #type, \
  26. type ## _PWRON_LO, \
  27. type ## _PWRTRANS_LO, \
  28. type ## _READY_LO, \
  29. mask, timeout_us)
  30. /**
  31. * panthor_gpu_power_off() - Power off the GPU block.
  32. *
  33. * Return: 0 on success, a negative error code otherwise.
  34. */
  35. #define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
  36. panthor_gpu_block_power_off(ptdev, #type, \
  37. type ## _PWROFF_LO, \
  38. type ## _PWRTRANS_LO, \
  39. mask, timeout_us)
  40. int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
  41. int panthor_gpu_flush_caches(struct panthor_device *ptdev,
  42. u32 l2, u32 lsc, u32 other);
  43. int panthor_gpu_soft_reset(struct panthor_device *ptdev);
  44. #endif