diff options
author | Hemant Hariyani <hemanthariyani@ti.com> | 2011-08-25 03:01:10 -0400 |
---|---|---|
committer | Paolo Pisati <paolo.pisati@canonical.com> | 2012-08-17 04:18:39 -0400 |
commit | b7f68b0d0649bec8d50054b78873ca40b267321b (patch) | |
tree | 56e9917cfa159b1728721dbae9d8c46f33bc2699 /drivers/gpu/pvr/omap4/sysutils_linux.c | |
parent | 8827e270c06639a9a89390799c8860bf9640ec5f (diff) |
OMAP4: SGX-KM: Upgrade DDK to version 1.7.17.4403
This patch upgrades the kernel side graphics driver to version
1.7.17.4403.
The corresponding change in the user side must be in place for this
to work.
Change-Id: Id3a713fa22a227dbcd0ec098589d62b350802247
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
Diffstat (limited to 'drivers/gpu/pvr/omap4/sysutils_linux.c')
-rw-r--r-- | drivers/gpu/pvr/omap4/sysutils_linux.c | 308 |
1 files changed, 131 insertions, 177 deletions
diff --git a/drivers/gpu/pvr/omap4/sysutils_linux.c b/drivers/gpu/pvr/omap4/sysutils_linux.c index 52ae877f05e..f7c3ac11424 100644 --- a/drivers/gpu/pvr/omap4/sysutils_linux.c +++ b/drivers/gpu/pvr/omap4/sysutils_linux.c | |||
@@ -41,16 +41,6 @@ | |||
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/pm_runtime.h> | 42 | #include <linux/pm_runtime.h> |
43 | 43 | ||
44 | #if !defined(PVR_LINUX_USING_WORKQUEUES) | ||
45 | #error "PVR_LINUX_USING_WORKQUEUES must be defined" | ||
46 | #endif | ||
47 | |||
48 | #if ((defined(DEBUG) || defined(TIMING)) && \ | ||
49 | (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))) && \ | ||
50 | !defined(PVR_NO_OMAP_TIMER) | ||
51 | #define PVR_OMAP4_TIMING_PRCM | ||
52 | #endif | ||
53 | |||
54 | #define ONE_MHZ 1000000 | 44 | #define ONE_MHZ 1000000 |
55 | #define HZ_TO_MHZ(m) ((m) / ONE_MHZ) | 45 | #define HZ_TO_MHZ(m) ((m) / ONE_MHZ) |
56 | 46 | ||
@@ -60,7 +50,7 @@ | |||
60 | #define SGX_PARENT_CLOCK "core_ck" | 50 | #define SGX_PARENT_CLOCK "core_ck" |
61 | #endif | 51 | #endif |
62 | 52 | ||
63 | #if defined(LDM_PLATFORM) && !defined(SUPPORT_DRI_DRM) | 53 | #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI) |
64 | extern struct platform_device *gpsPVRLDMDev; | 54 | extern struct platform_device *gpsPVRLDMDev; |
65 | #endif | 55 | #endif |
66 | 56 | ||
@@ -134,17 +124,9 @@ IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo) | |||
134 | { | 124 | { |
135 | IMG_UINT32 rate; | 125 | IMG_UINT32 rate; |
136 | 126 | ||
137 | #if defined(NO_HARDWARE) | ||
138 | rate = SYS_SGX_CLOCK_SPEED; | 127 | rate = SYS_SGX_CLOCK_SPEED; |
139 | #else | 128 | #if !defined(NO_HARDWARE) |
140 | PVR_ASSERT(atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0); | 129 | PVR_ASSERT(atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0); |
141 | |||
142 | #if defined(OMAP4_PRCM_ENABLE) | ||
143 | rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK); | ||
144 | #else | ||
145 | rate = SYS_SGX_CLOCK_SPEED; | ||
146 | #endif | ||
147 | PVR_ASSERT(rate != 0); | ||
148 | #endif | 130 | #endif |
149 | psTimingInfo->ui32CoreClockSpeed = rate; | 131 | psTimingInfo->ui32CoreClockSpeed = rate; |
150 | psTimingInfo->ui32HWRecoveryFreq = scale_prop_to_SGX_clock(SYS_SGX_HWRECOVERY_TIMEOUT_FREQ, rate); | 132 | psTimingInfo->ui32HWRecoveryFreq = scale_prop_to_SGX_clock(SYS_SGX_HWRECOVERY_TIMEOUT_FREQ, rate); |
@@ -161,11 +143,6 @@ PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData) | |||
161 | { | 143 | { |
162 | #if !defined(NO_HARDWARE) | 144 | #if !defined(NO_HARDWARE) |
163 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; | 145 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; |
164 | #if defined(OMAP4_PRCM_ENABLE) | ||
165 | long lNewRate; | ||
166 | long lRate; | ||
167 | IMG_INT res; | ||
168 | #endif | ||
169 | 146 | ||
170 | 147 | ||
171 | if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0) | 148 | if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0) |
@@ -175,61 +152,18 @@ PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData) | |||
175 | 152 | ||
176 | PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks")); | 153 | PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks")); |
177 | 154 | ||
178 | #if defined(LDM_PLATFORM) && !defined(SUPPORT_DRI_DRM) | 155 | #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI) |
179 | pm_runtime_get_sync(&gpsPVRLDMDev->dev); | ||
180 | #endif | ||
181 | |||
182 | #if defined(OMAP4_PRCM_ENABLE) | ||
183 | |||
184 | #if defined(DEBUG) | ||
185 | { | ||
186 | IMG_UINT32 rate = clk_get_rate(psSysSpecData->psMPU_CK); | ||
187 | PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: CPU Clock is %dMhz", HZ_TO_MHZ(rate))); | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | res = clk_enable(psSysSpecData->psSGX_FCK); | ||
192 | if (res < 0) | ||
193 | { | 156 | { |
194 | PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res)); | ||
195 | return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; | ||
196 | } | ||
197 | 157 | ||
198 | res = clk_enable(psSysSpecData->psSGX_ICK); | 158 | int res = pm_runtime_get_sync(&gpsPVRLDMDev->dev); |
199 | if (res < 0) | ||
200 | { | ||
201 | PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res)); | ||
202 | |||
203 | clk_disable(psSysSpecData->psSGX_FCK); | ||
204 | return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; | ||
205 | } | ||
206 | |||
207 | lNewRate = clk_round_rate(psSysSpecData->psSGX_FCK, SYS_SGX_CLOCK_SPEED + ONE_MHZ); | ||
208 | if (lNewRate <= 0) | ||
209 | { | ||
210 | PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't round SGX functional clock rate")); | ||
211 | return PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE; | ||
212 | } | ||
213 | |||
214 | |||
215 | lRate = clk_get_rate(psSysSpecData->psSGX_FCK); | ||
216 | if (lRate != lNewRate) | ||
217 | { | ||
218 | res = clk_set_rate(psSysSpecData->psSGX_FCK, lNewRate); | ||
219 | if (res < 0) | 159 | if (res < 0) |
220 | { | 160 | { |
221 | PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Couldn't set SGX functional clock rate (%d)", res)); | 161 | PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: pm_runtime_get_sync failed (%d)", -res)); |
162 | return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; | ||
222 | } | 163 | } |
223 | } | 164 | } |
224 | |||
225 | #if defined(DEBUG) | ||
226 | { | ||
227 | IMG_UINT32 rate = clk_get_rate(psSysSpecData->psSGX_FCK); | ||
228 | PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: SGX Functional Clock is %dMhz", HZ_TO_MHZ(rate))); | ||
229 | } | ||
230 | #endif | 165 | #endif |
231 | 166 | SysEnableSGXInterrupts(psSysData); | |
232 | #endif | ||
233 | 167 | ||
234 | 168 | ||
235 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 1); | 169 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 1); |
@@ -254,21 +188,17 @@ IMG_VOID DisableSGXClocks(SYS_DATA *psSysData) | |||
254 | 188 | ||
255 | PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks")); | 189 | PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks")); |
256 | 190 | ||
257 | #if defined(LDM_PLATFORM) && !defined(SUPPORT_DRI_DRM) | 191 | SysDisableSGXInterrupts(psSysData); |
258 | pm_runtime_put_sync(&gpsPVRLDMDev->dev); | ||
259 | #endif | ||
260 | 192 | ||
261 | #if defined(OMAP4_PRCM_ENABLE) | 193 | #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI) |
262 | if (psSysSpecData->psSGX_ICK) | ||
263 | { | 194 | { |
264 | clk_disable(psSysSpecData->psSGX_ICK); | 195 | int res = pm_runtime_put_sync(&gpsPVRLDMDev->dev); |
265 | } | 196 | if (res < 0) |
266 | 197 | { | |
267 | if (psSysSpecData->psSGX_FCK) | 198 | PVR_DPF((PVR_DBG_ERROR, "DisableSGXClocks: pm_runtime_put_sync failed (%d)", -res)); |
268 | { | 199 | } |
269 | clk_disable(psSysSpecData->psSGX_FCK); | ||
270 | } | 200 | } |
271 | #endif | 201 | #endif |
272 | 202 | ||
273 | 203 | ||
274 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); | 204 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); |
@@ -278,86 +208,78 @@ IMG_VOID DisableSGXClocks(SYS_DATA *psSysData) | |||
278 | #endif | 208 | #endif |
279 | } | 209 | } |
280 | 210 | ||
281 | PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | 211 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) |
212 | #if defined(PVR_OMAP_USE_DM_TIMER_API) | ||
213 | #define GPTIMER_TO_USE 11 | ||
214 | static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) | ||
282 | { | 215 | { |
283 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; | 216 | PVR_ASSERT(psSysSpecData->psGPTimer == NULL); |
284 | #if (defined(OMAP4_PRCM_ENABLE) || defined(PVR_OMAP4_TIMING_PRCM)) | ||
285 | struct clk *psCLK; | ||
286 | IMG_INT res; | ||
287 | #endif | ||
288 | #if defined(PVR_OMAP4_TIMING_PRCM) | ||
289 | struct clk *sys_ck; | ||
290 | IMG_INT rate; | ||
291 | #endif | ||
292 | PVRSRV_ERROR eError; | ||
293 | 217 | ||
294 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) | ||
295 | IMG_CPU_PHYADDR TimerRegPhysBase; | ||
296 | IMG_HANDLE hTimerEnable; | ||
297 | IMG_UINT32 *pui32TimerEnable; | ||
298 | #endif | ||
299 | 218 | ||
300 | PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); | 219 | psSysSpecData->psGPTimer = omap_dm_timer_request_specific(GPTIMER_TO_USE); |
220 | if (psSysSpecData->psGPTimer == NULL) | ||
221 | { | ||
301 | 222 | ||
302 | if (!psSysSpecData->bSysClocksOneTimeInit) | 223 | PVR_DPF((PVR_DBG_WARNING, "%s: omap_dm_timer_request_specific failed", __FUNCTION__)); |
224 | return PVRSRV_ERROR_CLOCK_REQUEST_FAILED; | ||
225 | } | ||
226 | |||
227 | |||
228 | omap_dm_timer_set_source(psSysSpecData->psGPTimer, OMAP_TIMER_SRC_SYS_CLK); | ||
229 | omap_dm_timer_enable(psSysSpecData->psGPTimer); | ||
230 | |||
231 | |||
232 | omap_dm_timer_set_load_start(psSysSpecData->psGPTimer, 1, 0); | ||
233 | |||
234 | omap_dm_timer_start(psSysSpecData->psGPTimer); | ||
235 | |||
236 | |||
237 | psSysSpecData->sTimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_REGS_SYS_PHYS_BASE; | ||
238 | |||
239 | return PVRSRV_OK; | ||
240 | } | ||
241 | |||
242 | static void ReleaseGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) | ||
243 | { | ||
244 | if (psSysSpecData->psGPTimer != NULL) | ||
303 | { | 245 | { |
304 | mutex_init(&psSysSpecData->sPowerLock); | ||
305 | 246 | ||
306 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); | 247 | (void) omap_dm_timer_stop(psSysSpecData->psGPTimer); |
307 | 248 | ||
308 | #if defined(OMAP4_PRCM_ENABLE) | 249 | omap_dm_timer_disable(psSysSpecData->psGPTimer); |
309 | psCLK = clk_get(NULL, SGX_PARENT_CLOCK); | ||
310 | if (IS_ERR(psCLK)) | ||
311 | { | ||
312 | PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get Core Clock")); | ||
313 | goto ExitError; | ||
314 | } | ||
315 | psSysSpecData->psCORE_CK = psCLK; | ||
316 | 250 | ||
317 | psCLK = clk_get(NULL, "sgx_fck"); | 251 | omap_dm_timer_free(psSysSpecData->psGPTimer); |
318 | if (IS_ERR(psCLK)) | ||
319 | { | ||
320 | PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock")); | ||
321 | goto ExitError; | ||
322 | } | ||
323 | psSysSpecData->psSGX_FCK = psCLK; | ||
324 | 252 | ||
325 | psCLK = clk_get(NULL, "sgx_ick"); | 253 | psSysSpecData->sTimerRegPhysBase.uiAddr = 0; |
326 | if (IS_ERR(psCLK)) | ||
327 | { | ||
328 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock")); | ||
329 | goto ExitError; | ||
330 | } | ||
331 | psSysSpecData->psSGX_ICK = psCLK; | ||
332 | 254 | ||
333 | #if defined(DEBUG) | 255 | psSysSpecData->psGPTimer = NULL; |
334 | psCLK = clk_get(NULL, "mpu_ck"); | 256 | } |
335 | if (IS_ERR(psCLK)) | 257 | |
336 | { | 258 | } |
337 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get MPU Clock")); | 259 | #else |
338 | goto ExitError; | 260 | static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) |
339 | } | 261 | { |
340 | psSysSpecData->psMPU_CK = psCLK; | 262 | #if defined(PVR_OMAP4_TIMING_PRCM) |
263 | struct clk *psCLK; | ||
264 | IMG_INT res; | ||
265 | struct clk *sys_ck; | ||
266 | IMG_INT rate; | ||
341 | #endif | 267 | #endif |
342 | res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK); | 268 | PVRSRV_ERROR eError; |
343 | if (res < 0) | ||
344 | { | ||
345 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set SGX parent clock (%d)", res)); | ||
346 | goto ExitError; | ||
347 | } | ||
348 | #endif | ||
349 | 269 | ||
350 | psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; | 270 | IMG_CPU_PHYADDR sTimerRegPhysBase; |
351 | } | 271 | IMG_HANDLE hTimerEnable; |
272 | IMG_UINT32 *pui32TimerEnable; | ||
273 | |||
274 | PVR_ASSERT(psSysSpecData->sTimerRegPhysBase.uiAddr == 0); | ||
352 | 275 | ||
353 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) | ||
354 | #if defined(PVR_OMAP4_TIMING_PRCM) | 276 | #if defined(PVR_OMAP4_TIMING_PRCM) |
355 | 277 | ||
356 | psCLK = clk_get(NULL, "gpt11_fck"); | 278 | psCLK = clk_get(NULL, "gpt11_fck"); |
357 | if (IS_ERR(psCLK)) | 279 | if (IS_ERR(psCLK)) |
358 | { | 280 | { |
359 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock")); | 281 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock")); |
360 | goto ExitUnRegisterConstraintNotifications; | 282 | goto ExitError; |
361 | } | 283 | } |
362 | psSysSpecData->psGPT11_FCK = psCLK; | 284 | psSysSpecData->psGPT11_FCK = psCLK; |
363 | 285 | ||
@@ -365,7 +287,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
365 | if (IS_ERR(psCLK)) | 287 | if (IS_ERR(psCLK)) |
366 | { | 288 | { |
367 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock")); | 289 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock")); |
368 | goto ExitUnRegisterConstraintNotifications; | 290 | goto ExitError; |
369 | } | 291 | } |
370 | psSysSpecData->psGPT11_ICK = psCLK; | 292 | psSysSpecData->psGPT11_ICK = psCLK; |
371 | 293 | ||
@@ -373,7 +295,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
373 | if (IS_ERR(sys_ck)) | 295 | if (IS_ERR(sys_ck)) |
374 | { | 296 | { |
375 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock")); | 297 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock")); |
376 | goto ExitUnRegisterConstraintNotifications; | 298 | goto ExitError; |
377 | } | 299 | } |
378 | 300 | ||
379 | if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck) | 301 | if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck) |
@@ -383,7 +305,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
383 | if (res < 0) | 305 | if (res < 0) |
384 | { | 306 | { |
385 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER11 parent clock (%d)", res)); | 307 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER11 parent clock (%d)", res)); |
386 | goto ExitUnRegisterConstraintNotifications; | 308 | goto ExitError; |
387 | } | 309 | } |
388 | } | 310 | } |
389 | 311 | ||
@@ -394,7 +316,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
394 | if (res < 0) | 316 | if (res < 0) |
395 | { | 317 | { |
396 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res)); | 318 | PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res)); |
397 | goto ExitUnRegisterConstraintNotifications; | 319 | goto ExitError; |
398 | } | 320 | } |
399 | 321 | ||
400 | res = clk_enable(psSysSpecData->psGPT11_ICK); | 322 | res = clk_enable(psSysSpecData->psGPT11_ICK); |
@@ -406,8 +328,8 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
406 | #endif | 328 | #endif |
407 | 329 | ||
408 | 330 | ||
409 | TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_TSICR_SYS_PHYS_BASE; | 331 | sTimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_TSICR_SYS_PHYS_BASE; |
410 | pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase, | 332 | pui32TimerEnable = OSMapPhysToLin(sTimerRegPhysBase, |
411 | 4, | 333 | 4, |
412 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, | 334 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, |
413 | &hTimerEnable); | 335 | &hTimerEnable); |
@@ -432,8 +354,8 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
432 | hTimerEnable); | 354 | hTimerEnable); |
433 | 355 | ||
434 | 356 | ||
435 | TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE; | 357 | sTimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE; |
436 | pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase, | 358 | pui32TimerEnable = OSMapPhysToLin(sTimerRegPhysBase, |
437 | 4, | 359 | 4, |
438 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, | 360 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, |
439 | &hTimerEnable); | 361 | &hTimerEnable); |
@@ -452,48 +374,36 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | |||
452 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, | 374 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, |
453 | hTimerEnable); | 375 | hTimerEnable); |
454 | 376 | ||
455 | #endif | 377 | psSysSpecData->sTimerRegPhysBase = sTimerRegPhysBase; |
456 | 378 | ||
457 | eError = PVRSRV_OK; | 379 | eError = PVRSRV_OK; |
380 | |||
458 | goto Exit; | 381 | goto Exit; |
459 | 382 | ||
460 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) | ||
461 | ExitDisableGPT11ICK: | 383 | ExitDisableGPT11ICK: |
462 | #if defined(PVR_OMAP4_TIMING_PRCM) | 384 | #if defined(PVR_OMAP4_TIMING_PRCM) |
463 | clk_disable(psSysSpecData->psGPT11_ICK); | 385 | clk_disable(psSysSpecData->psGPT11_ICK); |
464 | ExitDisableGPT11FCK: | 386 | ExitDisableGPT11FCK: |
465 | clk_disable(psSysSpecData->psGPT11_FCK); | 387 | clk_disable(psSysSpecData->psGPT11_FCK); |
466 | ExitUnRegisterConstraintNotifications: | ||
467 | #endif | ||
468 | #endif | ||
469 | #if defined(OMAP4_PRCM_ENABLE) | ||
470 | ExitError: | 388 | ExitError: |
471 | #endif | 389 | #endif |
472 | eError = PVRSRV_ERROR_DISABLE_CLOCK_FAILURE; | 390 | eError = PVRSRV_ERROR_CLOCK_REQUEST_FAILED; |
473 | Exit: | 391 | Exit: |
474 | return eError; | 392 | return eError; |
475 | } | 393 | } |
476 | 394 | ||
477 | IMG_VOID DisableSystemClocks(SYS_DATA *psSysData) | 395 | static void ReleaseGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) |
478 | { | 396 | { |
479 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) | ||
480 | #if defined(PVR_OMAP4_TIMING_PRCM) | ||
481 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; | ||
482 | #endif | ||
483 | IMG_CPU_PHYADDR TimerRegPhysBase; | ||
484 | IMG_HANDLE hTimerDisable; | 397 | IMG_HANDLE hTimerDisable; |
485 | IMG_UINT32 *pui32TimerDisable; | 398 | IMG_UINT32 *pui32TimerDisable; |
486 | #endif | ||
487 | 399 | ||
488 | PVR_TRACE(("DisableSystemClocks: Disabling System Clocks")); | 400 | if (psSysSpecData->sTimerRegPhysBase.uiAddr == 0) |
489 | 401 | { | |
490 | 402 | return; | |
491 | DisableSGXClocks(psSysData); | 403 | } |
492 | 404 | ||
493 | #if (defined(DEBUG) || defined(TIMING)) && !defined(PVR_NO_OMAP_TIMER) | ||
494 | 405 | ||
495 | TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE; | 406 | pui32TimerDisable = OSMapPhysToLin(psSysSpecData->sTimerRegPhysBase, |
496 | pui32TimerDisable = OSMapPhysToLin(TimerRegPhysBase, | ||
497 | 4, | 407 | 4, |
498 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, | 408 | PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, |
499 | &hTimerDisable); | 409 | &hTimerDisable); |
@@ -512,17 +422,61 @@ IMG_VOID DisableSystemClocks(SYS_DATA *psSysData) | |||
512 | hTimerDisable); | 422 | hTimerDisable); |
513 | } | 423 | } |
514 | 424 | ||
425 | psSysSpecData->sTimerRegPhysBase.uiAddr = 0; | ||
426 | |||
515 | #if defined(PVR_OMAP4_TIMING_PRCM) | 427 | #if defined(PVR_OMAP4_TIMING_PRCM) |
516 | clk_disable(psSysSpecData->psGPT11_ICK); | 428 | clk_disable(psSysSpecData->psGPT11_ICK); |
517 | 429 | ||
518 | clk_disable(psSysSpecData->psGPT11_FCK); | 430 | clk_disable(psSysSpecData->psGPT11_FCK); |
519 | #endif | 431 | #endif |
432 | } | ||
433 | #endif | ||
434 | #else | ||
435 | static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) | ||
436 | { | ||
437 | PVR_UNREFERENCED_PARAMETER(psSysSpecData); | ||
438 | |||
439 | return PVRSRV_OK; | ||
440 | } | ||
441 | static void ReleaseGPTimer(SYS_SPECIFIC_DATA *psSysSpecData) | ||
442 | { | ||
443 | PVR_UNREFERENCED_PARAMETER(psSysSpecData); | ||
444 | } | ||
520 | #endif | 445 | #endif |
446 | |||
447 | PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) | ||
448 | { | ||
449 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; | ||
450 | |||
451 | PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); | ||
452 | |||
453 | if (!psSysSpecData->bSysClocksOneTimeInit) | ||
454 | { | ||
455 | mutex_init(&psSysSpecData->sPowerLock); | ||
456 | |||
457 | atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); | ||
458 | |||
459 | psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; | ||
460 | } | ||
461 | |||
462 | return AcquireGPTimer(psSysSpecData); | ||
463 | } | ||
464 | |||
465 | IMG_VOID DisableSystemClocks(SYS_DATA *psSysData) | ||
466 | { | ||
467 | SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; | ||
468 | |||
469 | PVR_TRACE(("DisableSystemClocks: Disabling System Clocks")); | ||
470 | |||
471 | |||
472 | DisableSGXClocks(psSysData); | ||
473 | |||
474 | ReleaseGPTimer(psSysSpecData); | ||
521 | } | 475 | } |
522 | 476 | ||
523 | PVRSRV_ERROR SysPMRuntimeRegister(void) | 477 | PVRSRV_ERROR SysPMRuntimeRegister(void) |
524 | { | 478 | { |
525 | #if defined(LDM_PLATFORM) && !defined(SUPPORT_DRI_DRM) | 479 | #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI) |
526 | pm_runtime_enable(&gpsPVRLDMDev->dev); | 480 | pm_runtime_enable(&gpsPVRLDMDev->dev); |
527 | #endif | 481 | #endif |
528 | return PVRSRV_OK; | 482 | return PVRSRV_OK; |
@@ -530,7 +484,7 @@ PVRSRV_ERROR SysPMRuntimeRegister(void) | |||
530 | 484 | ||
531 | PVRSRV_ERROR SysPMRuntimeUnregister(void) | 485 | PVRSRV_ERROR SysPMRuntimeUnregister(void) |
532 | { | 486 | { |
533 | #if defined(LDM_PLATFORM) && !defined(SUPPORT_DRI_DRM) | 487 | #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI) |
534 | pm_runtime_disable(&gpsPVRLDMDev->dev); | 488 | pm_runtime_disable(&gpsPVRLDMDev->dev); |
535 | #endif | 489 | #endif |
536 | return PVRSRV_OK; | 490 | return PVRSRV_OK; |