diff options
author | Brian Swetland <swetland@google.com> | 2010-11-14 19:06:31 -0800 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 17:49:55 -0800 |
commit | a52b15158207cc554508a4dd6d6506c14f3a620a (patch) | |
tree | 86f17047cb6aaab4456a47f3818b5249130dbcee /drivers/gpu/pvr/s5pc110 | |
parent | 690da81fe3a5ec874a8dcff4a36aea9d0f5bb6b7 (diff) | |
download | kernel_samsung_crespo-a52b15158207cc554508a4dd6d6506c14f3a620a.zip kernel_samsung_crespo-a52b15158207cc554508a4dd6d6506c14f3a620a.tar.gz kernel_samsung_crespo-a52b15158207cc554508a4dd6d6506c14f3a620a.tar.bz2 |
PVR: Added PVR/IMG driver for S5PC11X - SGX DDK 1.6.16.3947.
Change-Id: Ib43459f5bd765d3841bd1ffb9c63b6355c2db2dd
Signed-off-by: hoony.yu <hoony.yu@samsung.com>
Signed-off-by: Brian Swetland <swetland@google.com>
Diffstat (limited to 'drivers/gpu/pvr/s5pc110')
-rw-r--r-- | drivers/gpu/pvr/s5pc110/oemfuncs.h | 73 | ||||
-rw-r--r-- | drivers/gpu/pvr/s5pc110/sysconfig.c | 799 | ||||
-rw-r--r-- | drivers/gpu/pvr/s5pc110/sysconfig.h | 56 | ||||
-rw-r--r-- | drivers/gpu/pvr/s5pc110/sysinfo.h | 61 | ||||
-rw-r--r-- | drivers/gpu/pvr/s5pc110/sysutils.c | 36 |
5 files changed, 1025 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/s5pc110/oemfuncs.h b/drivers/gpu/pvr/s5pc110/oemfuncs.h new file mode 100644 index 0000000..60ca21b --- /dev/null +++ b/drivers/gpu/pvr/s5pc110/oemfuncs.h @@ -0,0 +1,73 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * Samsung Electronics System LSI. modify + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * +******************************************************************************/ + +#if !defined(__OEMFUNCS_H__) +#define __OEMFUNCS_H__ + +#if defined (__cplusplus) +extern "C" { +#endif + + +#define OEM_EXCHANGE_POWER_STATE (1<<0) +#define OEM_DEVICE_MEMORY_POWER (1<<1) +#define OEM_DISPLAY_POWER (1<<2) +#define OEM_GET_EXT_FUNCS (1<<3) + +typedef struct OEM_ACCESS_INFO_TAG +{ + IMG_UINT32 ui32Size; + IMG_UINT32 ui32FBPhysBaseAddress; + IMG_UINT32 ui32FBMemAvailable; + IMG_UINT32 ui32SysPhysBaseAddress; + IMG_UINT32 ui32SysSize; + IMG_UINT32 ui32DevIRQ; +} OEM_ACCESS_INFO, *POEM_ACCESS_INFO; + + +typedef IMG_UINT32 (*PFN_SRV_BRIDGEDISPATCH)( IMG_UINT32 Ioctl, + IMG_BYTE *pInBuf, + IMG_UINT32 InBufLen, + IMG_BYTE *pOutBuf, + IMG_UINT32 OutBufLen, + IMG_UINT32 *pdwBytesTransferred); + + +typedef PVRSRV_ERROR (*PFN_SRV_READREGSTRING)(PPVRSRV_REGISTRY_INFO psRegInfo); + + +typedef struct PVRSRV_DC_OEM_JTABLE_TAG +{ + PFN_SRV_BRIDGEDISPATCH pfnOEMBridgeDispatch; + PFN_SRV_READREGSTRING pfnOEMReadRegistryString; + PFN_SRV_READREGSTRING pfnOEMWriteRegistryString; + +} PVRSRV_DC_OEM_JTABLE; +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/drivers/gpu/pvr/s5pc110/sysconfig.c b/drivers/gpu/pvr/s5pc110/sysconfig.c new file mode 100644 index 0000000..960649d --- /dev/null +++ b/drivers/gpu/pvr/s5pc110/sysconfig.c @@ -0,0 +1,799 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * Samsung Electronics System LSI. modify + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#include "sgxdefs.h" +#include "services_headers.h" +#include "kerneldisplay.h" +#include "oemfuncs.h" +#include "sgxinfo.h" +#include "sgxinfokm.h" +#include "pdump_km.h" +#include "servicesext.h" + + +#if defined(SLSI_S5PC110) +#include <linux/clk.h> +#include <linux/err.h> +#endif + +#define REAL_HARDWARE 1 +#define SGX540_BASEADDR 0xf3000000 +#define MAPPING_SIZE 0x10000 +//#define IRQ_3D 106 +#define SGX540_IRQ IRQ_3D +//static struct resource *mem; +//static void __iomem *io; + +#define SYS_SGX_CLOCK_SPEED (200000000) + +#if 0 +#define SYS_SGX_HWRECOVERY_TIMEOUT_FREQ (100) // 10ms (100hz) +#define SYS_SGX_PDS_TIMER_FREQ (1000) // 1ms (1000hz) +#define SYS_SGX_ACTIVE_POWER_LATENCY_MS (500) +#else +#define SYS_SGX_HWRECOVERY_TIMEOUT_FREQ (100) // 10ms (100hz) +#define SYS_SGX_PDS_TIMER_FREQ (1000) // 1ms (1000hz) +#ifndef SYS_SGX_ACTIVE_POWER_LATENCY_MS +#define SYS_SGX_ACTIVE_POWER_LATENCY_MS (500) +#endif +#endif + +typedef struct _SYS_SPECIFIC_DATA_TAG_ +{ + IMG_UINT32 ui32SysSpecificData; + +} SYS_SPECIFIC_DATA; +#define SYS_SPECIFIC_DATA_ENABLE_IRQ 0x00000001UL +#define SYS_SPECIFIC_DATA_ENABLE_LISR 0x00000002UL +#define SYS_SPECIFIC_DATA_ENABLE_MISR 0x00000004UL + +SYS_SPECIFIC_DATA gsSysSpecificData; + + +SYS_DATA* gpsSysData = (SYS_DATA*)IMG_NULL; +SYS_DATA gsSysData; + + +static IMG_UINT32 gui32SGXDeviceID; +static SGX_DEVICE_MAP gsSGXDeviceMap; + + +IMG_CPU_VIRTADDR gsSGXRegsCPUVAddr; +IMG_CPU_VIRTADDR gsSGXSPCPUVAddr; + +char version_string[] = "SGX540 S5PC110"; + +IMG_UINT32 PVRSRV_BridgeDispatchKM( IMG_UINT32 Ioctl, + IMG_BYTE *pInBuf, + IMG_UINT32 InBufLen, + IMG_BYTE *pOutBuf, + IMG_UINT32 OutBufLen, + IMG_UINT32 *pdwBytesTransferred); + +#if defined(SLSI_S5PC110) +static struct clk *g3d_clock; +PVRSRV_ERROR EnableSGXClocks(void) +{ + + + clk_enable(g3d_clock); + + //printk("\n=== 3D clk enabled dummy\n"); + + return PVRSRV_OK; + +} +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) +static PVRSRV_ERROR DisableSGXClocks(void) +{ + clk_disable(g3d_clock); + //printk("\n=== 3D clk disabled dummy\n"); + return PVRSRV_OK; +} +#endif +#endif + +static PVRSRV_ERROR SysLocateDevices(SYS_DATA *psSysData) +{ +// PVRSRV_ERROR eError; +// IMG_CPU_PHYADDR sCpuPAddr; + + PVR_UNREFERENCED_PARAMETER(psSysData); + + +#if 0 + + gsSGXDeviceMap.ui32Flags = 0x0; + sCpuPAddr.uiAddr = SGX540_BASEADDR; + gsSGXDeviceMap.sRegsCpuPBase = sCpuPAddr; + gsSGXDeviceMap.sRegsSysPBase = SysCpuPAddrToSysPAddr(gsSGXDeviceMap.sRegsCpuPBase);; + gsSGXDeviceMap.ui32RegsSize = SGX_REG_SIZE; +// gsSGXDeviceMap.pvRegsCpuVBase = (IMG_CPU_VIRTADDR)io; + +#else + + gsSGXDeviceMap.sRegsSysPBase.uiAddr = SGX540_BASEADDR; + gsSGXDeviceMap.sRegsCpuPBase = SysSysPAddrToCpuPAddr(gsSGXDeviceMap.sRegsSysPBase); + gsSGXDeviceMap.ui32RegsSize = SGX_REG_SIZE; + gsSGXDeviceMap.ui32IRQ = SGX540_IRQ; +#endif + + +#if defined(SGX_FEATURE_HOST_PORT) + + gsSGXDeviceMap.sHPSysPBase.uiAddr = 0; + gsSGXDeviceMap.sHPCpuPBase.uiAddr = 0; + gsSGXDeviceMap.ui32HPSize = 0; +#endif + + + gsSGXDeviceMap.sLocalMemSysPBase.uiAddr = 0; + gsSGXDeviceMap.sLocalMemDevPBase.uiAddr = 0; + gsSGXDeviceMap.sLocalMemCpuPBase.uiAddr = 0; + gsSGXDeviceMap.ui32LocalMemSize = 0; + + + gsSGXDeviceMap.ui32IRQ = SGX540_IRQ; + + + + return PVRSRV_OK; +} + + + + +PVRSRV_ERROR SysInitialise(IMG_VOID) +{ + IMG_UINT32 i; + PVRSRV_ERROR eError; + PVRSRV_DEVICE_NODE *psDeviceNode; + SGX_TIMING_INFORMATION* psTimingInfo; + + gpsSysData = &gsSysData; + OSMemSet(gpsSysData, 0, sizeof(SYS_DATA)); + + g3d_clock = clk_get(NULL, "sclk_g3d"); + if (IS_ERR(g3d_clock)) { + printk("\n3D failed to find g3d clock source-enable\n"); + + return PVRSRV_ERROR_INIT_FAILURE; + } + +// added by ksoo (2010.03.12) +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + EnableSGXClocks(); +#endif + + eError = OSInitEnvData(&gpsSysData->pvEnvSpecificData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to setup env structure")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } +#if defined(SGX540) +//printk("SGX540 defined\n"); +#endif +//printk("SGX_CORE_REV=%d\n",SGX_CORE_REV); +#if defined(SGX_FEATURE_SYSTEM_CACHE) +//printk("SGX_FEATURE_SYSTEM_CACHE defined!!!!!!!!!!!!!!\n"); +#if defined(FIX_HW_BRN_25659) +//printk("FIX_HW_BRN_25659 defined!!!!!!!!!!!!!!\n"); + +#endif +#endif + +#if defined(SGX_BYPASS_SYSTEM_CACHE) +// printk("SGX_BYPASS_SYSTEM_CACHE defined!!!!!!!!!!!!!!!\n"); +#endif + + gpsSysData->pvSysSpecificData = (IMG_PVOID)&gsSysSpecificData; + OSMemSet(&gsSGXDeviceMap, 0, sizeof(SGX_DEVICE_MAP)); + + + psTimingInfo = &gsSGXDeviceMap.sTimingInfo; + psTimingInfo->ui32CoreClockSpeed = SYS_SGX_CLOCK_SPEED; + psTimingInfo->ui32HWRecoveryFreq = SYS_SGX_HWRECOVERY_TIMEOUT_FREQ; + psTimingInfo->ui32ActivePowManLatencyms = SYS_SGX_ACTIVE_POWER_LATENCY_MS; + psTimingInfo->ui32uKernelFreq = SYS_SGX_PDS_TIMER_FREQ; + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + psTimingInfo->bEnableActivePM = IMG_TRUE; +#else + psTimingInfo->bEnableActivePM = IMG_FALSE; +#endif + gpsSysData->ui32NumDevices = SYS_DEVICE_COUNT; + + + for(i=0; i<SYS_DEVICE_COUNT; i++) + { + gpsSysData->sDeviceID[i].uiID = i; + gpsSysData->sDeviceID[i].bInUse = IMG_FALSE; + } + + gpsSysData->psDeviceNodeList = IMG_NULL; + gpsSysData->psQueueList = IMG_NULL; + + eError = SysInitialiseCommon(gpsSysData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed in SysInitialiseCommon")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + + + eError = SysLocateDevices(gpsSysData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to locate devices")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + + + eError = PVRSRVRegisterDevice(gpsSysData, SGXRegisterDevice, 1, &gui32SGXDeviceID); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to register device!")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + + + psDeviceNode = gpsSysData->psDeviceNodeList; + while(psDeviceNode) + { + + switch(psDeviceNode->sDevId.eDeviceType) + { + case PVRSRV_DEVICE_TYPE_SGX: + { + DEVICE_MEMORY_INFO *psDevMemoryInfo; + DEVICE_MEMORY_HEAP_INFO *psDeviceMemoryHeap; + IMG_UINT32 ui32MemConfig; + + if(gpsSysData->apsLocalDevMemArena[0] != IMG_NULL) + { + + psDeviceNode->psLocalDevMemArena = gpsSysData->apsLocalDevMemArena[0]; + ui32MemConfig = PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG; + } + else + { + + psDeviceNode->psLocalDevMemArena = IMG_NULL; + ui32MemConfig = PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG; + } + + + psDevMemoryInfo = &psDeviceNode->sDevMemoryInfo; + psDeviceMemoryHeap = psDevMemoryInfo->psDeviceMemoryHeap; + + + for(i=0; i<psDevMemoryInfo->ui32HeapCount; i++) + { +#if defined(SGX_FEATURE_VARIABLE_MMU_PAGE_SIZE) + IMG_CHAR *pStr; + + switch(psDeviceMemoryHeap[i].ui32HeapID) + { + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_GENERAL_HEAP_ID): + { + pStr = "GeneralHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_GENERAL_MAPPING_HEAP_ID): + { + pStr = "GeneralMappingHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_TADATA_HEAP_ID): + { + pStr = "TADataHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_KERNEL_CODE_HEAP_ID): + { + pStr = "KernelCodeHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_KERNEL_DATA_HEAP_ID): + { + pStr = "KernelDataHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_PIXELSHADER_HEAP_ID): + { + pStr = "PixelShaderHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_VERTEXSHADER_HEAP_ID): + { + pStr = "VertexShaderHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_PDSPIXEL_CODEDATA_HEAP_ID): + { + pStr = "PDSPixelHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_PDSVERTEX_CODEDATA_HEAP_ID): + { + pStr = "PDSVertexHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_SYNCINFO_HEAP_ID): + { + pStr = "SyncInfoHeapPageSize"; + break; + } + case HEAP_ID(PVRSRV_DEVICE_TYPE_SGX, SGX_3DPARAMETERS_HEAP_ID): + { + pStr = "3DParametersHeapPageSize"; + break; + } + default: + { + + pStr = IMG_NULL; + break; + } + } + if (pStr + && OSReadRegistryDWORDFromString(0, + PVRSRV_REGISTRY_ROOT, + pStr, + &psDeviceMemoryHeap[i].ui32DataPageSize) == IMG_TRUE) + { + PVR_DPF((PVR_DBG_VERBOSE,"SysInitialise: set Heap %s page size to %d", pStr, psDeviceMemoryHeap[i].ui32DataPageSize)); + } +#endif + + psDeviceMemoryHeap[i].psLocalDevMemArena = gpsSysData->apsLocalDevMemArena[0]; + + + psDeviceMemoryHeap[i].ui32Attribs |= ui32MemConfig; + } + + break; + } + default: + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to find SGX device node!")); + return PVRSRV_ERROR_INIT_FAILURE; + } + + + psDeviceNode = psDeviceNode->psNext; + } + + + + PDUMPINIT(); + + + eError = PVRSRVInitialiseDevice (gui32SGXDeviceID); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to initialise device!")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + + DisableSGXClocks(); +#endif + + return PVRSRV_OK; +} + + +PVRSRV_ERROR SysFinalise(IMG_VOID) +{ + PVRSRV_ERROR eError; + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + eError = EnableSGXClocks(); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysInitialise: Failed to Enable SGX clocks (%d)", eError)); + (IMG_VOID)SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } +#endif +#if defined(SYS_USING_INTERRUPTS) + + eError = OSInstallMISR(gpsSysData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"OSInstallMISR: Failed to install MISR")); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_MISR; + + + eError = OSInstallSystemLISR(gpsSysData, gsSGXDeviceMap.ui32IRQ); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"OSInstallSystemLISR: Failed to install ISR")); + OSUninstallMISR(gpsSysData); + SysDeinitialise(gpsSysData); + gpsSysData = IMG_NULL; + return eError; + } + gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_LISR; + +// SysEnableInterrupts(gpsSysData); + gsSysSpecificData.ui32SysSpecificData |= SYS_SPECIFIC_DATA_ENABLE_IRQ; +#endif + + +#if 0 + gpsSysData->pszVersionString = SysCreateVersionString(gsSGXDeviceMap.sRegsCpuPBase); +#else + gpsSysData->pszVersionString=version_string; +#endif + if (!gpsSysData->pszVersionString) + { + PVR_DPF((PVR_DBG_ERROR,"SysFinalise: Failed to create a system version string")); + } + else + { + PVR_DPF((PVR_DBG_WARNING, "SysFinalise: Version string: %s", gpsSysData->pszVersionString)); + } + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + + DisableSGXClocks(); +#endif +// gsSysSpecificData.bSGXInitComplete= IMG_TRUE; don't know + + return PVRSRV_OK; +} + + + +PVRSRV_ERROR SysDeinitialise (SYS_DATA *psSysData) +{ + SYS_SPECIFIC_DATA * psSysSpecData; + PVRSRV_ERROR eError; + + + PVR_UNREFERENCED_PARAMETER(psSysData); + + if (psSysData == IMG_NULL) { + PVR_DPF((PVR_DBG_ERROR, "SysDeinitialise: Called with NULL SYS_DATA pointer. Probably called before.")); + return PVRSRV_OK; + } + +#if defined(SYS_USING_INTERRUPTS) + + psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; + + if (psSysSpecData->ui32SysSpecificData & SYS_SPECIFIC_DATA_ENABLE_IRQ) + { +// SysDisableInterrupts(psSysData); + } + if (psSysSpecData->ui32SysSpecificData & SYS_SPECIFIC_DATA_ENABLE_LISR) + { + eError = OSUninstallSystemLISR(psSysData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: OSUninstallSystemLISR failed")); + return eError; + } + } + if (psSysSpecData->ui32SysSpecificData & SYS_SPECIFIC_DATA_ENABLE_MISR) + { + eError = OSUninstallMISR(psSysData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: OSUninstallMISR failed")); + return eError; + } + } +#endif + + + eError = PVRSRVDeinitialiseDevice (gui32SGXDeviceID); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: failed to de-init the device")); + return eError; + } + + eError = OSDeInitEnvData(gpsSysData->pvEnvSpecificData); + if (eError != PVRSRV_OK) + { + PVR_DPF((PVR_DBG_ERROR,"SysDeinitialise: failed to de-init env structure")); + return eError; + } + + SysDeinitialiseCommon(gpsSysData); + + + #if REAL_HARDWARE +// iounmap(io); +// release_resource(mem); +// kfree(mem); + #else + + OSBaseFreeContigMemory(SGX_REG_SIZE, gsSGXRegsCPUVAddr, gsSGXDeviceMap.sRegsCpuPBase); + OSBaseFreeContigMemory(SGX_SP_SIZE, gsSGXSPCPUVAddr, gsSGXDeviceMap.sSPCpuPBase); + #endif + + gpsSysData = IMG_NULL; + + PDUMPDEINIT(); + + return PVRSRV_OK; +} + + + +PVRSRV_ERROR SysGetDeviceMemoryMap(PVRSRV_DEVICE_TYPE eDeviceType, + IMG_VOID **ppvDeviceMap) +{ + + switch(eDeviceType) + { + case PVRSRV_DEVICE_TYPE_SGX: + { + + *ppvDeviceMap = (IMG_VOID*)&gsSGXDeviceMap; + + break; + } + default: + { + PVR_DPF((PVR_DBG_ERROR,"SysGetDeviceMemoryMap: unsupported device type")); + } + } + return PVRSRV_OK; +} + + + +IMG_DEV_PHYADDR SysCpuPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, + IMG_CPU_PHYADDR CpuPAddr) +{ + IMG_DEV_PHYADDR DevPAddr; + + PVR_UNREFERENCED_PARAMETER(eDeviceType); + + + DevPAddr.uiAddr = CpuPAddr.uiAddr; + + return DevPAddr; +} + + +IMG_CPU_PHYADDR SysSysPAddrToCpuPAddr (IMG_SYS_PHYADDR sys_paddr) +{ + IMG_CPU_PHYADDR cpu_paddr; + + + cpu_paddr.uiAddr = sys_paddr.uiAddr; + return cpu_paddr; +} + + +IMG_SYS_PHYADDR SysCpuPAddrToSysPAddr (IMG_CPU_PHYADDR cpu_paddr) +{ + IMG_SYS_PHYADDR sys_paddr; + + + sys_paddr.uiAddr = cpu_paddr.uiAddr; + return sys_paddr; +} + + + +IMG_DEV_PHYADDR SysSysPAddrToDevPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_SYS_PHYADDR SysPAddr) +{ + IMG_DEV_PHYADDR DevPAddr; + + PVR_UNREFERENCED_PARAMETER(eDeviceType); + + + DevPAddr.uiAddr = SysPAddr.uiAddr; + + return DevPAddr; +} + + + +IMG_SYS_PHYADDR SysDevPAddrToSysPAddr (PVRSRV_DEVICE_TYPE eDeviceType, IMG_DEV_PHYADDR DevPAddr) +{ + IMG_SYS_PHYADDR SysPAddr; + + PVR_UNREFERENCED_PARAMETER(eDeviceType); + + + SysPAddr.uiAddr = DevPAddr.uiAddr; + + return SysPAddr; +} + + + +IMG_VOID SysRegisterExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode) +{ + PVR_UNREFERENCED_PARAMETER(psDeviceNode); +} + + + +IMG_VOID SysRemoveExternalDevice(PVRSRV_DEVICE_NODE *psDeviceNode) +{ + PVR_UNREFERENCED_PARAMETER(psDeviceNode); +} + + + +IMG_UINT32 SysGetInterruptSource(SYS_DATA* psSysData, + PVRSRV_DEVICE_NODE *psDeviceNode) +{ + PVR_UNREFERENCED_PARAMETER(psSysData); +#if defined(NO_HARDWARE) + + return 0xFFFFFFFF; +#else + + //return psDeviceNode->ui32SOCInterruptBit; + return 0x1; +#endif +} + + + +IMG_VOID SysClearInterrupts(SYS_DATA* psSysData, IMG_UINT32 ui32ClearBits) +{ + PVR_UNREFERENCED_PARAMETER(psSysData); + PVR_UNREFERENCED_PARAMETER(ui32ClearBits); + + //printk("SysClearInterrupts\n"); +#if !defined(NO_HARDWARE) +// OSReadHWReg(((PVRSRV_SGXDEV_INFO *)gpsSGXDevNode->pvDevice)->pvRegsBaseKM, +// EUR_CR_EVENT_HOST_CLEAR); //do something here +#endif + +} + + + +PVRSRV_ERROR SysSystemPrePowerState(PVRSRV_SYS_POWER_STATE eNewPowerState) +{ + PVRSRV_ERROR eError = PVRSRV_OK; + return eError; +} + + +PVRSRV_ERROR SysSystemPostPowerState(PVRSRV_SYS_POWER_STATE eNewPowerState) +{ + PVRSRV_ERROR eError = PVRSRV_OK; + return eError; +} + + + +PVRSRV_ERROR SysDevicePrePowerState(IMG_UINT32 ui32DeviceIndex, + PVRSRV_DEV_POWER_STATE eNewPowerState, + PVRSRV_DEV_POWER_STATE eCurrentPowerState) +{ + PVR_UNREFERENCED_PARAMETER(eCurrentPowerState); + + if (ui32DeviceIndex != gui32SGXDeviceID) + { + return PVRSRV_OK; + } + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + if (eNewPowerState == PVRSRV_DEV_POWER_STATE_OFF) + { + PVRSRVSetDCState(DC_STATE_FLUSH_COMMANDS); + PVR_DPF((PVR_DBG_MESSAGE, "SysDevicePrePowerState: SGX Entering state D3")); + DisableSGXClocks(); + PVRSRVSetDCState(DC_STATE_NO_FLUSH_COMMANDS); + } +#else + PVR_UNREFERENCED_PARAMETER(eNewPowerState); +#endif + return PVRSRV_OK; +} + + + +PVRSRV_ERROR SysDevicePostPowerState(IMG_UINT32 ui32DeviceIndex, + PVRSRV_DEV_POWER_STATE eNewPowerState, + PVRSRV_DEV_POWER_STATE eCurrentPowerState) +{ + PVRSRV_ERROR eError = PVRSRV_OK; + + PVR_UNREFERENCED_PARAMETER(eNewPowerState); + + if (ui32DeviceIndex != gui32SGXDeviceID) + { + return eError; + } + +#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) + if (eNewPowerState == PVRSRV_DEV_POWER_STATE_ON) + { + PVR_DPF((PVR_DBG_MESSAGE, "SysDevicePostPowerState: SGX Leaving state D3")); + eError = EnableSGXClocks(); + } +#else + PVR_UNREFERENCED_PARAMETER(eCurrentPowerState); +#endif + + return eError; +} + + + +PVRSRV_ERROR SysOEMFunction(IMG_UINT32 ui32ID, + IMG_VOID *pvIn, + IMG_UINT32 ulInSize, + IMG_VOID *pvOut, + IMG_UINT32 ulOutSize) +{ + if (ulInSize || pvIn); + + if ((ui32ID == OEM_GET_EXT_FUNCS) && + (ulOutSize == sizeof(PVRSRV_DC_OEM_JTABLE))) + { + PVRSRV_DC_OEM_JTABLE *psOEMJTable = (PVRSRV_DC_OEM_JTABLE*)pvOut; + psOEMJTable->pfnOEMBridgeDispatch = &PVRSRV_BridgeDispatchKM; + + return PVRSRV_OK; + } + + return PVRSRV_ERROR_INVALID_PARAMS; +} + + +PVRSRV_ERROR SysPowerLockWrap(SYS_DATA unref__ *psSysData) +{ + return PVRSRV_OK; +} + +IMG_VOID SysPowerLockUnwrap(SYS_DATA unref__ *psSysData) +{ +} + + + diff --git a/drivers/gpu/pvr/s5pc110/sysconfig.h b/drivers/gpu/pvr/s5pc110/sysconfig.h new file mode 100644 index 0000000..f1dc12c --- /dev/null +++ b/drivers/gpu/pvr/s5pc110/sysconfig.h @@ -0,0 +1,56 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * Samsung Electronics System LSI. modify + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#if !defined(__SOCCONFIG_H__) +#define __SOCCONFIG_H__ + +#include "syscommon.h" + +#define VS_PRODUCT_NAME "s5pc110" + +#define SYS_SGX_USSE_COUNT (1) + +#define SGX_REG_SIZE 0x4000 +#define SGX_SP_SIZE (0x10000-SGX_REG_SIZE) + +#if defined(SGX_FEATURE_HOST_PORT) + + #define SYS_SGX_HP_SIZE 0x0 + + #define SYS_SGX_HOSTPORT_BASE_DEVVADDR 0x0 + #if defined(FIX_HW_BRN_22997) && defined(FIX_HW_BRN_23030) + + #define SYS_SGX_HOSTPORT_BRN23030_OFFSET 0x0 + #endif +#endif + +#if defined(SLSI_S5PC110) + +extern PVRSRV_ERROR EnableSGXClocks(void); +#endif + + +#endif diff --git a/drivers/gpu/pvr/s5pc110/sysinfo.h b/drivers/gpu/pvr/s5pc110/sysinfo.h new file mode 100644 index 0000000..c8da67a --- /dev/null +++ b/drivers/gpu/pvr/s5pc110/sysinfo.h @@ -0,0 +1,61 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * Samsung Electronics System LSI. modify + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#if !defined(__SYSINFO_H__) +#define __SYSINFO_H__ + + +#define MAX_HW_TIME_US (500000) +#if defined (SLSI_S5PC110) +//#define WAIT_TRY_COUNT (30000) +#define WAIT_TRY_COUNT (10000) +#else +#define WAIT_TRY_COUNT (10000) +#endif + + +typedef enum _SYS_DEVICE_TYPE_ +{ + SYS_DEVICE_SGX = 0, + + SYS_DEVICE_FORCE_I16 = 0x7fff + +} SYS_DEVICE_TYPE; + +#define SYS_DEVICE_COUNT 3 + + + +#define SGX_SP_FIFO_DWSIZE 123 + + +#define SGX_SP_FIFO_RESERVEBYTES (SGX_SP_FIFO_DWSIZE & -4) +#define SGX_SP_FIFO_MAXALLOWEDBYTES (SGX_SP_FIFO_DWSIZE * 4) - SGX_SP_FIFO_RESERVEBYTES + +#define SGX_EXTRACT_FIFO_COUNT(x) (((x) & SGX_INT_TA_FREEVCOUNT_MASK) >> SGX_INT_TA_FREEVCOUNT_SHIFT) + + +#endif diff --git a/drivers/gpu/pvr/s5pc110/sysutils.c b/drivers/gpu/pvr/s5pc110/sysutils.c new file mode 100644 index 0000000..b9ff66f --- /dev/null +++ b/drivers/gpu/pvr/s5pc110/sysutils.c @@ -0,0 +1,36 @@ +/********************************************************************** + * + * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. + * Samsung Electronics System LSI. modify + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful but, except + * as otherwise stated in writing, without any warranty; without even the + * implied warranty of merchantability or fitness for a particular purpose. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + * + * Contact Information: + * Imagination Technologies Ltd. <gpl-support@imgtec.com> + * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK + * + ******************************************************************************/ + +#include "services_headers.h" +#include "sysinfo.h" + + + + + + + + |