gpu: pvr: pdumpfs: add Kconfig and debugfs pdump mode handling
[sgx.git] / pvr / syslocal.h
1 /**********************************************************************
2  *
3  * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful but, except
10  * as otherwise stated in writing, without any warranty; without even the
11  * implied warranty of merchantability or fitness for a particular purpose.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * The full GNU General Public License is included in this distribution in
19  * the file called "COPYING".
20  *
21  * Contact Information:
22  * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23  * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24  *
25  ******************************************************************************/
26
27 #if !defined(__SYSLOCAL_H__)
28 #define __SYSLOCAL_H__
29
30 #include <linux/version.h>
31 #include <linux/clk.h>
32 #include <linux/spinlock.h>
33 #include <asm/atomic.h>
34
35 #include <linux/semaphore.h>
36 #include <linux/resource.h>
37
38 char *SysCreateVersionString(struct IMG_CPU_PHYADDR sRegRegion);
39
40 enum PVRSRV_ERROR InitSystemClocks(struct SYS_DATA *psSysData);
41 void CleanupSystemClocks(struct SYS_DATA *psSysData);
42 void DisableSystemClocks(struct SYS_DATA *psSysData);
43 enum PVRSRV_ERROR EnableSystemClocks(struct SYS_DATA *psSysData);
44
45 void DisableSGXClocks(struct SYS_DATA *psSysData);
46 enum PVRSRV_ERROR EnableSGXClocks(struct SYS_DATA *psSysData);
47
48 #define SYS_SPECIFIC_DATA_ENABLE_SYSCLOCKS      0x00000001
49 #define SYS_SPECIFIC_DATA_ENABLE_LISR           0x00000002
50 #define SYS_SPECIFIC_DATA_ENABLE_MISR           0x00000004
51 #define SYS_SPECIFIC_DATA_ENABLE_ENVDATA        0x00000008
52 #define SYS_SPECIFIC_DATA_ENABLE_LOCDEV         0x00000010
53 #define SYS_SPECIFIC_DATA_ENABLE_REGDEV         0x00000020
54 #define SYS_SPECIFIC_DATA_ENABLE_PDUMPINIT      0x00000040
55 #define SYS_SPECIFIC_DATA_ENABLE_INITDEV        0x00000080
56 #define SYS_SPECIFIC_DATA_ENABLE_LOCATEDEV      0x00000100
57
58 #define SYS_SPECIFIC_DATA_PM_UNINSTALL_LISR     0x00000200
59 #define SYS_SPECIFIC_DATA_PM_DISABLE_SYSCLOCKS  0x00000400
60 #define SYS_SPECIFIC_DATA_ENABLE_PERF           0x00000800
61
62 #define SYS_SPECIFIC_DATA_SET(psSysSpecData, flag) \
63                 ((void)((psSysSpecData)->ui32SysSpecificData |= (flag)))
64
65 #define SYS_SPECIFIC_DATA_CLEAR(psSysSpecData, flag) \
66                 ((void)((psSysSpecData)->ui32SysSpecificData &= ~(flag)))
67
68 #define SYS_SPECIFIC_DATA_TEST(psSysSpecData, flag) \
69                 (((psSysSpecData)->ui32SysSpecificData & (flag)) != 0)
70
71 struct SYS_SPECIFIC_DATA {
72         u32 ui32SysSpecificData;
73         struct PVRSRV_DEVICE_NODE *psSGXDevNode;
74         IMG_BOOL bSGXInitComplete;
75         u32 ui32SrcClockDiv;
76         IMG_BOOL bConstraintNotificationsEnabled;
77         atomic_t sSGXClocksEnabled;
78         spinlock_t sPowerLock;
79         atomic_t sPowerLockCPU;
80         spinlock_t sNotifyLock;
81         atomic_t sNotifyLockCPU;
82         IMG_BOOL bCallVDD2PostFunc;
83
84         struct clk *psCORE_CK;
85         struct clk *psSGX_FCK;
86         struct clk *psSGX_ICK;
87         struct clk *psMPU_CK;
88 #if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(TIMING)
89         struct clk *psGPT11_FCK;
90         struct clk *psGPT11_ICK;
91         void __iomem *gpt_base;
92 #endif
93         struct constraint_handle *pVdd2Handle;
94
95         unsigned long sgx_fck_max;
96 };
97
98 extern struct SYS_SPECIFIC_DATA *gpsSysSpecificData;
99
100 #endif