0001-newclkapi.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. This patch adjusts the omap3630 portion of the powervr driver to use the new
  2. clk kernel api.
  3. Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
  4. [yann.morin.1998@free.fr: rebased ontop of 5.01.00.01]
  5. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  6. diff -durN ti-gfx-5_01_00_01.orig/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c ti-gfx-5_01_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c
  7. --- ti-gfx-5_01_00_01.orig/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c 2013-12-23 15:44:20.000000000 +0100
  8. +++ ti-gfx-5_01_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c 2014-02-26 19:17:39.829571846 +0100
  9. @@ -182,6 +182,49 @@
  10. @Return PVRSRV_ERROR
  11. ******************************************************************************/
  12. +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
  13. +int clk_disable_unprepare(struct clk *clk)
  14. +{
  15. + return clk_disable(clk);
  16. +}
  17. +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
  18. +int clk_disable_unprepare(struct clk *clk)
  19. +{
  20. + res = clk_disable(clk);
  21. + if (res < 0)
  22. + return res;
  23. +
  24. + res = clk_unprepare(clk);
  25. + if (ret < 0)
  26. + return res;
  27. +
  28. + return 0;
  29. +}
  30. +#endif
  31. +
  32. +
  33. +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
  34. +int clk_prepare_enable(struct clk *clk)
  35. +{
  36. + return clk_enable(clk);
  37. +}
  38. +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
  39. +int clk_prepare_enable(struct clk *clk)
  40. +{
  41. + res = clk_prepare(clk);
  42. + if (ret < 0)
  43. + return res;
  44. +
  45. + res = clk_enable(clk);
  46. + if (res < 0) {
  47. + clk_unprepare(clk);
  48. + return res;
  49. + }
  50. +
  51. + return 0;
  52. +}
  53. +#endif
  54. +
  55. PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
  56. {
  57. #if !defined(NO_HARDWARE)
  58. @@ -198,7 +241,7 @@
  59. #if !defined(PM_RUNTIME_SUPPORT)
  60. PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
  61. - res=clk_enable(psSysSpecData->psSGX_FCK);
  62. + res=clk_prepare_enable(psSysSpecData->psSGX_FCK);
  63. if (res < 0)
  64. {
  65. PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
  66. @@ -324,7 +367,7 @@
  67. PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
  68. #if !defined(PM_RUNTIME_SUPPORT)
  69. - clk_disable(psSysSpecData->psSGX_FCK);
  70. + clk_disable_unprepare(psSysSpecData->psSGX_FCK);
  71. #endif
  72. SysDisableSGXInterrupts(psSysData);
  73. @@ -540,14 +583,14 @@
  74. rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
  75. PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate)));
  76. - res = clk_enable(psSysSpecData->psGPT11_FCK);
  77. + res = clk_prepare_enable(psSysSpecData->psGPT11_FCK);
  78. if (res < 0)
  79. {
  80. PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res));
  81. goto ExitError;
  82. }
  83. - res = clk_enable(psSysSpecData->psGPT11_ICK);
  84. + res = clk_prepare_enable(psSysSpecData->psGPT11_ICK);
  85. if (res < 0)
  86. {
  87. PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res));
  88. @@ -610,9 +653,9 @@
  89. ExitDisableGPT11ICK:
  90. #if defined(PVR_OMAP4_TIMING_PRCM)
  91. - clk_disable(psSysSpecData->psGPT11_ICK);
  92. + clk_disable_unprepare(psSysSpecData->psGPT11_ICK);
  93. ExitDisableGPT11FCK:
  94. - clk_disable(psSysSpecData->psGPT11_FCK);
  95. + clk_disable_unprepare(psSysSpecData->psGPT11_FCK);
  96. ExitError:
  97. #endif /* defined(PVR_OMAP4_TIMING_PRCM) */
  98. eError = PVRSRV_ERROR_CLOCK_REQUEST_FAILED;
  99. @@ -664,9 +707,9 @@
  100. psSysSpecData->sTimerRegPhysBase.uiAddr = 0;
  101. #endif
  102. #if defined(PVR_OMAP4_TIMING_PRCM)
  103. - clk_disable(psSysSpecData->psGPT11_ICK);
  104. + clk_disable_unprepare(psSysSpecData->psGPT11_ICK);
  105. - clk_disable(psSysSpecData->psGPT11_FCK);
  106. + clk_disable_unprepare(psSysSpecData->psGPT11_FCK);
  107. #endif /* defined(PVR_OMAP4_TIMING_PRCM) */
  108. }
  109. #endif /* PVR_OMAP_USE_DM_TIMER_API */