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