1 /**********************************************************************
\r
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
\r
5 * This program is free software; you can redistribute it and/or modify it
\r
6 * under the terms and conditions of the GNU General Public License,
\r
7 * version 2, as published by the Free Software Foundation.
\r
9 * This program is distributed in the hope it will be useful but, except
\r
10 * as otherwise stated in writing, without any warranty; without even the
\r
11 * implied warranty of merchantability or fitness for a particular purpose.
\r
12 * See the GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along with
\r
15 * this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
\r
18 * The full GNU General Public License is included in this distribution in
\r
19 * the file called "COPYING".
\r
21 * Contact Information:
\r
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
\r
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
\r
25 ******************************************************************************/
\r
27 #include <linux/version.h>
\r
28 #include <linux/clk.h>
\r
29 #include <linux/err.h>
\r
30 #include <linux/hardirq.h>
\r
31 #include <linux/spinlock.h>
\r
32 #include <asm/bug.h>
\r
33 #include <linux/platform_device.h>
\r
35 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,33))
\r
36 #include <linux/semaphore.h>
\r
37 #include <asm-generic/resource.h>
\r
38 #include <plat/omap-pm.h>
\r
41 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
\r
42 #include <linux/semaphore.h>
\r
43 #include <plat/resource.h>
\r
44 #include <plat/omap-pm.h>
\r
47 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26))
\r
48 #include <linux/semaphore.h>
\r
49 #include <mach/resource.h>
\r
50 #include <mach/omap-pm.h>
\r
52 #include <asm/semaphore.h>
\r
53 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22))
\r
54 #include <asm/arch/resource.h>
\r
60 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) && \
\r
61 (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,29))
\r
62 #define CONSTRAINT_NOTIFICATIONS
\r
64 #include "sgxdefs.h"
\r
65 #include "services_headers.h"
\r
66 #include "sysinfo.h"
\r
67 #include "sgxapi_km.h"
\r
68 #include "sysconfig.h"
\r
69 #include "sgxinfokm.h"
\r
70 #include "syslocal.h"
\r
71 void set_vdd2_constraint(void);
\r
72 void remove_vdd2_constraint(void);
\r
73 #define ONE_MHZ 1000000
\r
74 #define HZ_TO_MHZ(m) ((m) / ONE_MHZ)
\r
76 #if defined(SUPPORT_OMAP3630_SGXFCLK_96M)
\r
77 #define SGX_PARENT_CLOCK "cm_96m_fck"
\r
78 #elif defined(SUPPORT_OMAP3630_SGXFCLK_192M)
\r
79 #define SGX_PARENT_CLOCK "omap_192m_alwon_ck"
\r
80 #elif defined(SUPPORT_OMAP3630_SGXFCLK_corex2)
\r
81 #define SGX_PARENT_CLOCK "corex2_fck"
\r
83 #define SGX_PARENT_CLOCK "core_ck"
\r
86 #if !defined(PDUMP) && !defined(NO_HARDWARE)
\r
87 struct sgx_platform_data {
\r
88 void(*set_min_bus_tput)(struct device *dev, u8 agent_id, unsigned long r);
\r
91 static struct sgx_platform_data pdata = {
\r
93 //.set_min_bus_tput = &omap_pm_set_min_bus_tput,
\r
94 .set_min_bus_tput = NULL,
\r
97 static struct platform_device sgx_dev = {
\r
100 .dev.platform_data = &pdata,
\r
102 void set_vdd2_constraint(void)
\r
104 if(pdata.set_min_bus_tput){
\r
105 pdata.set_min_bus_tput(&(sgx_dev.dev), OCP_INITIATOR_AGENT,800000);
\r
109 void remove_vdd2_constraint(void)
\r
111 if(pdata.set_min_bus_tput)
\r
112 pdata.set_min_bus_tput(&(sgx_dev.dev), OCP_INITIATOR_AGENT, 0);
\r
116 #if !defined(PDUMP) && !defined(NO_HARDWARE)
\r
117 static IMG_BOOL PowerLockWrappedOnCPU(SYS_SPECIFIC_DATA *psSysSpecData)
\r
120 IMG_BOOL bLocked = IMG_FALSE;
\r
122 if (!in_interrupt())
\r
125 bLocked = (iCPU == atomic_read(&psSysSpecData->sPowerLockCPU));
\r
133 static IMG_VOID PowerLockWrap(SYS_SPECIFIC_DATA *psSysSpecData)
\r
137 if (!in_interrupt())
\r
143 PVR_ASSERT(iCPU != -1);
\r
145 PVR_ASSERT(!PowerLockWrappedOnCPU(psSysSpecData));
\r
147 spin_lock(&psSysSpecData->sPowerLock);
\r
149 atomic_set(&psSysSpecData->sPowerLockCPU, iCPU);
\r
153 static IMG_VOID PowerLockUnwrap(SYS_SPECIFIC_DATA *psSysSpecData)
\r
155 if (!in_interrupt())
\r
157 PVR_ASSERT(PowerLockWrappedOnCPU(psSysSpecData));
\r
159 atomic_set(&psSysSpecData->sPowerLockCPU, -1);
\r
161 spin_unlock(&psSysSpecData->sPowerLock);
\r
167 PVRSRV_ERROR SysPowerLockWrap(SYS_DATA *psSysData)
\r
169 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
171 PowerLockWrap(psSysSpecData);
\r
176 IMG_VOID SysPowerLockUnwrap(SYS_DATA *psSysData)
\r
178 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
180 PowerLockUnwrap(psSysSpecData);
\r
183 static IMG_BOOL PowerLockWrappedOnCPU(SYS_SPECIFIC_DATA unref__ *psSysSpecData)
\r
188 static IMG_VOID PowerLockWrap(SYS_SPECIFIC_DATA unref__ *psSysSpecData)
\r
192 static IMG_VOID PowerLockUnwrap(SYS_SPECIFIC_DATA unref__ *psSysSpecData)
\r
196 PVRSRV_ERROR SysPowerLockWrap(SYS_DATA unref__ *psSysData)
\r
201 IMG_VOID SysPowerLockUnwrap(SYS_DATA unref__ *psSysData)
\r
206 IMG_BOOL WrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData)
\r
208 IMG_BOOL bPowerLock = PowerLockWrappedOnCPU(psSysSpecData);
\r
212 PowerLockUnwrap(psSysSpecData);
\r
218 IMG_VOID UnwrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData)
\r
220 PowerLockWrap(psSysSpecData);
\r
223 static inline IMG_UINT32 scale_by_rate(IMG_UINT32 val, IMG_UINT32 rate1, IMG_UINT32 rate2)
\r
225 if (rate1 >= rate2)
\r
227 return val * (rate1 / rate2);
\r
230 return val / (rate2 / rate1);
\r
233 static inline IMG_UINT32 scale_prop_to_SGX_clock(IMG_UINT32 val, IMG_UINT32 rate)
\r
235 return scale_by_rate(val, rate, SYS_SGX_CLOCK_SPEED);
\r
238 static inline IMG_UINT32 scale_inv_prop_to_SGX_clock(IMG_UINT32 val, IMG_UINT32 rate)
\r
240 return scale_by_rate(val, SYS_SGX_CLOCK_SPEED, rate);
\r
243 IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo)
\r
247 #if defined(NO_HARDWARE)
\r
248 rate = SYS_SGX_CLOCK_SPEED;
\r
250 PVR_ASSERT(atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0);
\r
252 rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK);
\r
253 PVR_ASSERT(rate != 0);
\r
255 psTimingInfo->ui32CoreClockSpeed = rate;
\r
256 psTimingInfo->ui32HWRecoveryFreq = scale_prop_to_SGX_clock(SYS_SGX_HWRECOVERY_TIMEOUT_FREQ, rate);
\r
257 psTimingInfo->ui32uKernelFreq = scale_prop_to_SGX_clock(SYS_SGX_PDS_TIMER_FREQ, rate);
\r
258 psTimingInfo->ui32ActivePowManLatencyms = SYS_SGX_ACTIVE_POWER_LATENCY_MS;
\r
261 #if defined(CONSTRAINT_NOTIFICATIONS)
\r
262 #if !defined(SGX_DYNAMIC_TIMING_INFO)
\r
263 #error "SGX_DYNAMIC_TIMING_INFO must be defined for this platform"
\r
266 #if !defined(PDUMP) && !defined(NO_HARDWARE)
\r
267 static inline IMG_BOOL ConstraintNotificationsEnabled(SYS_SPECIFIC_DATA *psSysSpecData)
\r
269 return (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0) && psSysSpecData->bSGXInitComplete && psSysSpecData->bConstraintNotificationsEnabled;
\r
273 static IMG_BOOL NotifyLockedOnCPU(SYS_SPECIFIC_DATA *psSysSpecData)
\r
275 IMG_INT iCPU = get_cpu();
\r
276 IMG_BOOL bLocked = (iCPU == atomic_read(&psSysSpecData->sNotifyLockCPU));
\r
283 static IMG_VOID NotifyLock(SYS_SPECIFIC_DATA *psSysSpecData)
\r
287 BUG_ON(in_interrupt());
\r
293 PVR_ASSERT(iCPU != -1);
\r
295 PVR_ASSERT(!NotifyLockedOnCPU(psSysSpecData));
\r
297 spin_lock(&psSysSpecData->sNotifyLock);
\r
299 atomic_set(&psSysSpecData->sNotifyLockCPU, iCPU);
\r
303 static IMG_VOID NotifyUnlock(SYS_SPECIFIC_DATA *psSysSpecData)
\r
305 PVR_ASSERT(NotifyLockedOnCPU(psSysSpecData));
\r
307 atomic_set(&psSysSpecData->sNotifyLockCPU, -1);
\r
309 spin_unlock(&psSysSpecData->sNotifyLock);
\r
314 static IMG_INT VDD2PostFunc(struct notifier_block *n, IMG_UINT32 event, IMG_VOID *ptr)
\r
316 PVR_UNREFERENCED_PARAMETER(n);
\r
317 PVR_UNREFERENCED_PARAMETER(event);
\r
318 PVR_UNREFERENCED_PARAMETER(ptr);
\r
320 if (in_interrupt())
\r
322 PVR_DPF((PVR_DBG_ERROR, "%s Called in interrupt context. Ignoring.", __FUNCTION__));
\r
327 if (!NotifyLockedOnCPU(gpsSysSpecificData))
\r
333 if (ConstraintNotificationsEnabled(gpsSysSpecificData))
\r
337 rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK);
\r
339 PVR_ASSERT(rate != 0);
\r
341 PVR_DPF((PVR_DBG_MESSAGE, "%s: SGX clock rate: %dMHz", __FUNCTION__, HZ_TO_MHZ(rate)));
\r
344 if (gpsSysSpecificData->bCallVDD2PostFunc)
\r
346 PVRSRVDevicePostClockSpeedChange(gpsSysSpecificData->psSGXDevNode->sDevId.ui32DeviceIndex, IMG_TRUE, IMG_NULL);
\r
348 gpsSysSpecificData->bCallVDD2PostFunc = IMG_FALSE;
\r
352 if (ConstraintNotificationsEnabled(gpsSysSpecificData))
\r
354 PVR_TRACE(("%s: Not calling PVR clock speed notification functions", __FUNCTION__));
\r
358 NotifyUnlock(gpsSysSpecificData);
\r
363 static IMG_INT VDD2PreFunc(struct notifier_block *n, IMG_UINT32 event, IMG_VOID *ptr)
\r
365 PVR_UNREFERENCED_PARAMETER(n);
\r
366 PVR_UNREFERENCED_PARAMETER(event);
\r
367 PVR_UNREFERENCED_PARAMETER(ptr);
\r
369 if (in_interrupt())
\r
371 PVR_DPF((PVR_DBG_WARNING, "%s Called in interrupt context. Ignoring.", __FUNCTION__));
\r
375 if (PowerLockWrappedOnCPU(gpsSysSpecificData))
\r
377 PVR_DPF((PVR_DBG_WARNING, "%s Called from within a power transition. Ignoring.", __FUNCTION__));
\r
381 NotifyLock(gpsSysSpecificData);
\r
383 PVR_ASSERT(!gpsSysSpecificData->bCallVDD2PostFunc);
\r
385 if (ConstraintNotificationsEnabled(gpsSysSpecificData))
\r
387 PVRSRV_ERROR eError;
\r
389 eError = PVRSRVDevicePreClockSpeedChange(gpsSysSpecificData->psSGXDevNode->sDevId.ui32DeviceIndex, IMG_TRUE, IMG_NULL);
\r
391 gpsSysSpecificData->bCallVDD2PostFunc = (eError == PVRSRV_OK);
\r
397 static IMG_VOID RegisterConstraintNotifications(IMG_VOID)
\r
399 PVR_TRACE(("Registering constraint notifications"));
\r
401 PVR_ASSERT(!gpsSysSpecificData->bConstraintNotificationsEnabled);
\r
404 NotifyLock(gpsSysSpecificData);
\r
405 gpsSysSpecificData->bConstraintNotificationsEnabled = IMG_TRUE;
\r
406 NotifyUnlock(gpsSysSpecificData);
\r
408 PVR_TRACE(("VDD2 constraint notifications registered"));
\r
411 static IMG_VOID UnRegisterConstraintNotifications(IMG_VOID)
\r
413 PVR_TRACE(("Unregistering constraint notifications"));
\r
416 NotifyLock(gpsSysSpecificData);
\r
417 gpsSysSpecificData->bConstraintNotificationsEnabled = IMG_FALSE;
\r
418 NotifyUnlock(gpsSysSpecificData);
\r
422 static IMG_VOID RegisterConstraintNotifications(IMG_VOID)
\r
426 static IMG_VOID UnRegisterConstraintNotifications(IMG_VOID)
\r
432 PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
\r
434 #if !defined(NO_HARDWARE)
\r
435 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
440 if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0)
\r
445 PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
\r
450 IMG_UINT32 rate = clk_get_rate(psSysSpecData->psMPU_CK);
\r
451 PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: CPU Clock is %dMhz", HZ_TO_MHZ(rate)));
\r
455 res = clk_enable(psSysSpecData->psSGX_FCK);
\r
458 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
\r
459 return PVRSRV_ERROR_GENERIC;
\r
462 res = clk_enable(psSysSpecData->psSGX_ICK);
\r
465 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res));
\r
467 clk_disable(psSysSpecData->psSGX_FCK);
\r
468 return PVRSRV_ERROR_GENERIC;
\r
471 lNewRate = clk_round_rate(psSysSpecData->psSGX_FCK, SYS_SGX_CLOCK_SPEED + ONE_MHZ);
\r
472 //PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: New SGX Func Clk = (%d)", lNewRate));
\r
475 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't round SGX functional clock rate"));
\r
476 return PVRSRV_ERROR_GENERIC;
\r
479 res = clk_set_rate(psSysSpecData->psSGX_FCK, lNewRate);
\r
482 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't set SGX function clock rate (%d)", res));
\r
483 return PVRSRV_ERROR_GENERIC;
\r
490 IMG_UINT32 rate = clk_get_rate(psSysSpecData->psSGX_FCK);
\r
491 PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: SGX Functional Clock is %dMhz", HZ_TO_MHZ(rate)));
\r
495 set_vdd2_constraint();
\r
497 lNewRate = clk_get_rate(psSysSpecData->psSGX_FCK);
\r
498 atomic_set(&psSysSpecData->sSGXClocksEnabled, 1);
\r
499 //PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Final SGX Func Clk = (%d)", lNewRate));
\r
502 PVR_UNREFERENCED_PARAMETER(psSysData);
\r
508 IMG_VOID DisableSGXClocks(SYS_DATA *psSysData)
\r
510 #if !defined(NO_HARDWARE)
\r
511 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
513 if (atomic_read(&psSysSpecData->sSGXClocksEnabled) == 0)
\r
518 PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
\r
520 if (psSysSpecData->psSGX_ICK)
\r
522 clk_disable(psSysSpecData->psSGX_ICK);
\r
525 if (psSysSpecData->psSGX_FCK)
\r
527 clk_disable(psSysSpecData->psSGX_FCK);
\r
530 remove_vdd2_constraint();
\r
532 atomic_set(&psSysSpecData->sSGXClocksEnabled, 0);
\r
535 PVR_UNREFERENCED_PARAMETER(psSysData);
\r
539 PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
\r
541 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
544 PVRSRV_ERROR eError;
\r
545 IMG_BOOL bPowerLock;
\r
547 #if defined(DEBUG) || defined(TIMING)
\r
549 struct clk *sys_ck;
\r
550 IMG_CPU_PHYADDR TimerRegPhysBase;
\r
551 IMG_HANDLE hTimerEnable;
\r
552 IMG_UINT32 *pui32TimerEnable;
\r
556 PVR_TRACE(("EnableSystemClocks: Enabling System Clocks"));
\r
558 if (!psSysSpecData->bSysClocksOneTimeInit)
\r
560 bPowerLock = IMG_FALSE;
\r
562 spin_lock_init(&psSysSpecData->sPowerLock);
\r
563 atomic_set(&psSysSpecData->sPowerLockCPU, -1);
\r
564 spin_lock_init(&psSysSpecData->sNotifyLock);
\r
565 atomic_set(&psSysSpecData->sNotifyLockCPU, -1);
\r
567 atomic_set(&psSysSpecData->sSGXClocksEnabled, 0);
\r
569 psCLK = clk_get(NULL, SGX_PARENT_CLOCK);
\r
572 PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get Core Clock"));
\r
575 psSysSpecData->psCORE_CK = psCLK;
\r
577 psCLK = clk_get(NULL, "sgx_fck");
\r
580 PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock"));
\r
583 psSysSpecData->psSGX_FCK = psCLK;
\r
585 psCLK = clk_get(NULL, "sgx_ick");
\r
588 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock"));
\r
591 psSysSpecData->psSGX_ICK = psCLK;
\r
594 psCLK = clk_get(NULL, "mpu_ck");
\r
597 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get MPU Clock"));
\r
600 psSysSpecData->psMPU_CK = psCLK;
\r
602 res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK);
\r
605 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set SGX parent clock (%d)", res));
\r
609 psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE;
\r
614 bPowerLock = PowerLockWrappedOnCPU(psSysSpecData);
\r
617 PowerLockUnwrap(psSysSpecData);
\r
621 #if defined(CONSTRAINT_NOTIFICATIONS)
\r
623 RegisterConstraintNotifications();
\r
626 #if defined(DEBUG) || defined(TIMING)
\r
628 psCLK = clk_get(NULL, "gpt11_fck");
\r
631 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock"));
\r
632 goto ExitUnRegisterConstraintNotifications;
\r
634 psSysSpecData->psGPT11_FCK = psCLK;
\r
636 psCLK = clk_get(NULL, "gpt11_ick");
\r
639 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock"));
\r
640 goto ExitUnRegisterConstraintNotifications;
\r
642 psSysSpecData->psGPT11_ICK = psCLK;
\r
644 sys_ck = clk_get(NULL, "sys_ck");
\r
645 if (IS_ERR(sys_ck))
\r
647 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock"));
\r
648 goto ExitUnRegisterConstraintNotifications;
\r
651 if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck)
\r
653 PVR_TRACE(("Setting GPTIMER11 parent to System Clock"));
\r
654 res = clk_set_parent(psSysSpecData->psGPT11_FCK, sys_ck);
\r
657 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER11 parent clock (%d)", res));
\r
658 goto ExitUnRegisterConstraintNotifications;
\r
662 rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
\r
663 PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate)));
\r
665 res = clk_enable(psSysSpecData->psGPT11_FCK);
\r
668 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res));
\r
669 goto ExitUnRegisterConstraintNotifications;
\r
672 res = clk_enable(psSysSpecData->psGPT11_ICK);
\r
675 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res));
\r
676 goto ExitDisableGPT11FCK;
\r
680 TimerRegPhysBase.uiAddr = SYS_OMAP3430_GP11TIMER_TSICR_SYS_PHYS_BASE;
\r
681 pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase,
\r
683 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
686 if (pui32TimerEnable == IMG_NULL)
\r
688 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed"));
\r
689 goto ExitDisableGPT11ICK;
\r
692 rate = *pui32TimerEnable;
\r
695 PVR_TRACE(("Setting GPTIMER11 mode to posted (currently is non-posted)"));
\r
698 *pui32TimerEnable = rate | 4;
\r
701 OSUnMapPhysToLin(pui32TimerEnable,
\r
703 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
707 TimerRegPhysBase.uiAddr = SYS_OMAP3430_GP11TIMER_ENABLE_SYS_PHYS_BASE;
\r
708 pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase,
\r
710 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
713 if (pui32TimerEnable == IMG_NULL)
\r
715 PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed"));
\r
716 goto ExitDisableGPT11ICK;
\r
720 *pui32TimerEnable = 3;
\r
722 OSUnMapPhysToLin(pui32TimerEnable,
\r
724 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
729 eError = PVRSRV_OK;
\r
732 #if defined(DEBUG) || defined(TIMING)
\r
733 ExitDisableGPT11ICK:
\r
734 clk_disable(psSysSpecData->psGPT11_ICK);
\r
735 ExitDisableGPT11FCK:
\r
736 clk_disable(psSysSpecData->psGPT11_FCK);
\r
737 ExitUnRegisterConstraintNotifications:
\r
739 #if defined(CONSTRAINT_NOTIFICATIONS)
\r
740 UnRegisterConstraintNotifications();
\r
744 eError = PVRSRV_ERROR_GENERIC;
\r
748 PowerLockWrap(psSysSpecData);
\r
751 #if !defined(SUPPORT_ACTIVE_POWER_MANAGEMENT)
\r
752 if (eError == PVRSRV_OK)
\r
755 eError = EnableSGXClocks(psSysData);
\r
761 IMG_VOID DisableSystemClocks(SYS_DATA *psSysData)
\r
763 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
\r
764 IMG_BOOL bPowerLock;
\r
765 #if defined(DEBUG) || defined(TIMING)
\r
766 IMG_CPU_PHYADDR TimerRegPhysBase;
\r
767 IMG_HANDLE hTimerDisable;
\r
768 IMG_UINT32 *pui32TimerDisable;
\r
771 PVR_TRACE(("DisableSystemClocks: Disabling System Clocks"));
\r
773 DisableSGXClocks(psSysData);
\r
775 bPowerLock = PowerLockWrappedOnCPU(psSysSpecData);
\r
779 PowerLockUnwrap(psSysSpecData);
\r
782 #if defined(CONSTRAINT_NOTIFICATIONS)
\r
783 UnRegisterConstraintNotifications();
\r
786 #if defined(DEBUG) || defined(TIMING)
\r
788 TimerRegPhysBase.uiAddr = SYS_OMAP3430_GP11TIMER_ENABLE_SYS_PHYS_BASE;
\r
789 pui32TimerDisable = OSMapPhysToLin(TimerRegPhysBase,
\r
791 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
794 if (pui32TimerDisable == IMG_NULL)
\r
796 PVR_DPF((PVR_DBG_ERROR, "DisableSystemClocks: OSMapPhysToLin failed"));
\r
800 *pui32TimerDisable = 0;
\r
802 OSUnMapPhysToLin(pui32TimerDisable,
\r
804 PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED,
\r
808 clk_disable(psSysSpecData->psGPT11_ICK);
\r
810 clk_disable(psSysSpecData->psGPT11_FCK);
\r
815 PowerLockWrap(psSysSpecData);
\r