]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/device-ti-proprietary-open.git/blob - jacinto6/sgx_src/eurasia_km/services4/system/omap/syslocal.h
jacinto6: sgx: update DDK version to 1.12/2701748
[android-sdk/device-ti-proprietary-open.git] / jacinto6 / sgx_src / eurasia_km / services4 / system / omap / syslocal.h
1 /*************************************************************************/ /*!
2 @Title          Local system definitions
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description    This header provides local system declarations and macros
5 @License        Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
43 #if !defined(__SYSLOCAL_H__)
44 #define __SYSLOCAL_H__
46 #if defined(__linux__)
48 #include <linux/version.h>
49 #include <linux/clk.h>
50 #if defined(PVR_LINUX_USING_WORKQUEUES)
51 #include <linux/mutex.h>
52 #else
53 #include <linux/spinlock.h>
54 #endif
55 #include <asm/atomic.h>
57 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26))
58 #include <linux/semaphore.h>
59 #include <linux/resource.h>
60 #else /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) */
61 #include <asm/semaphore.h>
62 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22))
63 #include <asm/arch/resource.h>
64 #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)) */
65 #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) */
68 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
69 #if !defined(LDM_PLATFORM)
70 #error "LDM_PLATFORM must be set"
71 #endif
72 #define PVR_LINUX_DYNAMIC_SGX_RESOURCE_INFO
73 #include <linux/platform_device.h>
74 #endif
76 #if ((defined(DEBUG) || defined(TIMING)) && \
77     (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,34))) && \
78     !defined(PVR_NO_OMAP_TIMER)
79 /*
80  * We need to explicitly enable the GPTIMER11 clocks, or we'll get an
81  * abort when we try to access the timer registers.
82  */
83 #define PVR_OMAP4_TIMING_PRCM
84 #endif
86 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
87 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
88 #include <plat/gpu.h>
89 #endif
90 #if !defined(PVR_NO_OMAP_TIMER)
91 #define PVR_OMAP_USE_DM_TIMER_API
92 #include <plat/dmtimer.h>
93 #endif
94 #endif
96 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
97 #include <linux/wakelock.h>
98 #endif
100 #if !defined(PVR_NO_OMAP_TIMER)
101 #define PVR_OMAP_TIMER_BASE_IN_SYS_SPEC_DATA
102 #endif
103 #endif /* defined(__linux__) */
105 #if !defined(NO_HARDWARE) && \
106      defined(SYS_USING_INTERRUPTS)
107 #define SGX_OCP_REGS_ENABLED
108 #endif
110 #if defined(__linux__)
111 #if defined(SGX_OCP_REGS_ENABLED)
112 /* FIXME: Temporary workaround for OMAP4470 and active power off in 4430 */
113 #if !defined(SGX544) && defined(SUPPORT_ACTIVE_POWER_MANAGEMENT)
114 #define SGX_OCP_NO_INT_BYPASS
115 #endif
116 #endif
117 #endif
119 #if defined (__cplusplus)
120 extern "C" {
121 #endif
123 /*****************************************************************************
124  * system specific data structures
125  *****************************************************************************/
126  
127 /*****************************************************************************
128  * system specific function prototypes
129  *****************************************************************************/
130  
131 IMG_VOID DisableSystemClocks(SYS_DATA *psSysData);
132 PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData);
134 IMG_VOID DisableSGXClocks(SYS_DATA *psSysData);
135 PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData);
137 /*
138  * Various flags to indicate what has been initialised, and what
139  * has been temporarily deinitialised for power management purposes.
140  */
141 #define SYS_SPECIFIC_DATA_ENABLE_SYSCLOCKS      0x00000001
142 #define SYS_SPECIFIC_DATA_ENABLE_LISR           0x00000002
143 #define SYS_SPECIFIC_DATA_ENABLE_MISR           0x00000004
144 #define SYS_SPECIFIC_DATA_ENABLE_ENVDATA        0x00000008
145 #define SYS_SPECIFIC_DATA_ENABLE_LOCDEV         0x00000010
146 #define SYS_SPECIFIC_DATA_ENABLE_REGDEV         0x00000020
147 #define SYS_SPECIFIC_DATA_ENABLE_PDUMPINIT      0x00000040
148 #define SYS_SPECIFIC_DATA_ENABLE_INITDEV        0x00000080
149 #define SYS_SPECIFIC_DATA_ENABLE_LOCATEDEV      0x00000100
151 #define SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR     0x00000200
152 #define SYS_SPECIFIC_DATA_PM_DISABLE_SYSCLOCKS  0x00000400
153 #define SYS_SPECIFIC_DATA_ENABLE_OCPREGS        0x00000800
154 #define SYS_SPECIFIC_DATA_ENABLE_PM_RUNTIME     0x00001000
155 #define SYS_SPECIFIC_DATA_IRQ_ENABLED           0x00002000
156 #define SYS_SPECIFIC_DATA_DVFS_INIT                     0x00004000
158 #define SYS_SPECIFIC_DATA_SET(psSysSpecData, flag) ((IMG_VOID)((psSysSpecData)->ui32SysSpecificData |= (flag)))
160 #define SYS_SPECIFIC_DATA_CLEAR(psSysSpecData, flag) ((IMG_VOID)((psSysSpecData)->ui32SysSpecificData &= ~(flag)))
162 #define SYS_SPECIFIC_DATA_TEST(psSysSpecData, flag) (((psSysSpecData)->ui32SysSpecificData & (flag)) != 0)
163  
164 typedef struct _SYS_SPECIFIC_DATA_TAG_
166         IMG_UINT32      ui32SysSpecificData;
167         PVRSRV_DEVICE_NODE *psSGXDevNode;
168         IMG_BOOL        bSGXInitComplete;
169 #if defined(PVR_OMAP_TIMER_BASE_IN_SYS_SPEC_DATA)
170         IMG_CPU_PHYADDR sTimerRegPhysBase;
171 #endif
172 #if !defined(__linux__)
173         IMG_BOOL        bSGXClocksEnabled;
174 #endif
175         IMG_UINT32      ui32SrcClockDiv;
176 #if defined(__linux__)
177         IMG_BOOL        bSysClocksOneTimeInit;
178         atomic_t        sSGXClocksEnabled;
179 #if defined(PVR_LINUX_USING_WORKQUEUES)
180         struct mutex    sPowerLock;
181 #else
182         IMG_BOOL        bConstraintNotificationsEnabled;
183         spinlock_t      sPowerLock;
184         atomic_t        sPowerLockCPU;
185         spinlock_t      sNotifyLock;
186         atomic_t        sNotifyLockCPU;
187         IMG_BOOL        bCallVDD2PostFunc;
188 #endif
189 #if defined(DEBUG) || defined(TIMING)
190         struct clk      *psGPT11_FCK;
191         struct clk      *psGPT11_ICK;
192 #endif
193 #if defined(PVR_OMAP_USE_DM_TIMER_API)
194         struct omap_dm_timer *psGPTimer;
195 #endif
196 #if defined(CONFIG_HAS_WAKELOCK)
197         struct wake_lock wake_lock;
198 #endif /* CONFIG_HAS_WAKELOCK */
199 #endif  /* defined(__linux__) */
200 } SYS_SPECIFIC_DATA;
202 extern SYS_SPECIFIC_DATA *gpsSysSpecificData;
204 #if defined(SGX_OCP_REGS_ENABLED) && defined(SGX_OCP_NO_INT_BYPASS)
205 IMG_VOID SysEnableSGXInterrupts(SYS_DATA* psSysData);
206 IMG_VOID SysDisableSGXInterrupts(SYS_DATA* psSysData);
207 #else
208 #define SysEnableSGXInterrupts(psSysData)
209 #define SysDisableSGXInterrupts(psSysData)
210 #endif
212 #if defined(SYS_CUSTOM_POWERLOCK_WRAP)
213 IMG_BOOL WrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData);
214 IMG_VOID UnwrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData);
215 #endif
217 #if defined(__linux__)
219 PVRSRV_ERROR SysPMRuntimeRegister(void);
220 PVRSRV_ERROR SysPMRuntimeUnregister(void);
222 PVRSRV_ERROR SysDvfsInitialize(SYS_SPECIFIC_DATA *psSysSpecificData);
223 PVRSRV_ERROR SysDvfsDeinitialize(SYS_SPECIFIC_DATA *psSysSpecificData);
225 #else /* defined(__linux__) */
227 #ifdef INLINE_IS_PRAGMA
228 #pragma inline(SysPMRuntimeRegister)
229 #endif
230 static INLINE PVRSRV_ERROR SysPMRuntimeRegister(void)
232         return PVRSRV_OK;
235 #ifdef INLINE_IS_PRAGMA
236 #pragma inline(SysPMRuntimeUnregister)
237 #endif
238 static INLINE PVRSRV_ERROR SysPMRuntimeUnregister(void)
240         return PVRSRV_OK;
243 #ifdef INLINE_IS_PRAGMA
244 #pragma inline(SysDvfsInitialize)
245 #endif
246 static INLINE PVRSRV_ERROR SysDvfsInitialize(SYS_SPECIFIC_DATA *psSysSpecificData)
248         PVR_UNREFERENCED_PARAMETER(psSysSpecificData);
249         return PVRSRV_OK;
252 #ifdef INLINE_IS_PRAGMA
253 #pragma inline(SysDvfsDeinitialize)
254 #endif
255 static INLINE PVRSRV_ERROR SysDvfsDeinitialize(SYS_SPECIFIC_DATA *psSysSpecificData)
257         PVR_UNREFERENCED_PARAMETER(psSysSpecificData);
258         return PVRSRV_OK;
261 #endif /* defined(__linux__) */
263 #if defined(__cplusplus)
265 #endif
267 #endif  /* __SYSLOCAL_H__ */