/*! ****************************************************************************** @Function EnableSystemClocks @Description Setup up the clocks for the graphics device to work. @Return PVRSRV_ERROR ******************************************************************************/ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) { SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; #if !defined(PM_RUNTIME_SUPPORT) struct clk *psCLK; #endif PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); if (!psSysSpecData->bSysClocksOneTimeInit) { mutex_init(&psSysSpecData->sPowerLock); atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; #if !defined(PM_RUNTIME_SUPPORT) psCLK = clk_get(NULL, "sgx_ck"); if (IS_ERR(psCLK)) { PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock")); return PVRSRV_ERROR_UNABLE_TO_GET_CLOCK; } psSysSpecData->psSGX_FCK = psCLK; #endif } return AcquireGPTimer(psSysSpecData); }
/*! ****************************************************************************** @Function EnableSystemClocks @Description Setup up the clocks for the graphics device to work. @Return PVRSRV_ERROR ******************************************************************************/ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) { SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; #if !defined(PM_RUNTIME_SUPPORT) struct clk *psCLK; IMG_INT res; #endif PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); if (!psSysSpecData->bSysClocksOneTimeInit) { mutex_init(&psSysSpecData->sPowerLock); atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); psCLK = clk_get(NULL, SGX_PARENT_CLOCK); if (IS_ERR(psCLK)) { PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get Core Clock")); return PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK; } psSysSpecData->psCORE_CK = psCLK; // psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; #if !defined(PM_RUNTIME_SUPPORT) psCLK = clk_get(NULL, "sgx_fck"); if (IS_ERR(psCLK)) { PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock")); return PVRSRV_ERROR_UNABLE_TO_GET_CLOCK; } psSysSpecData->psSGX_FCK = psCLK; psCLK = clk_get(NULL, "sgx_ick"); if (IS_ERR(psCLK)) { PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock")); return PVRSRV_ERROR_UNABLE_TO_GET_CLOCK; } psSysSpecData->psSGX_ICK = psCLK; res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK); if (res < 0) { PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set SGX parent clock (%d)", res)); return PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK; } psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; #endif } return AcquireGPTimer(psSysSpecData); }
/*! ****************************************************************************** @Function EnableSystemClocks @Description Setup up the clocks for the graphics device to work. @Return PVRSRV_ERROR ******************************************************************************/ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) { SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); if (!psSysSpecData->bSysClocksOneTimeInit) { mutex_init(&psSysSpecData->sPowerLock); atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; } return AcquireGPTimer(psSysSpecData); }
PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData) { SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; PVR_TRACE(("EnableSystemClocks: Enabling System Clocks")); if (!psSysSpecData->bSysClocksOneTimeInit) { struct clk *sgx_clk, *parent_clk; int res; sgx_clk = clk_get(&gpsPVRLDMDev->dev, "gpu_fck"); if (IS_ERR_OR_NULL(sgx_clk)) { /* try another name that the sgx clock might be known as.. */ sgx_clk = clk_get(&gpsPVRLDMDev->dev, "sgx_clk_mux_ck"); } if (IS_ERR_OR_NULL(sgx_clk)) { PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: could not get clock (%ld)", -PTR_ERR(sgx_clk))); return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; } parent_clk = clk_get(&gpsPVRLDMDev->dev, "dpll_per_m7x2_ck"); if (IS_ERR_OR_NULL(parent_clk)) { PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: could not get clock (%ld)", -PTR_ERR(parent_clk))); clk_put(sgx_clk); return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; } res = clk_set_parent(sgx_clk, parent_clk); if (IS_ERR_VALUE(res)) { PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: could not set clock (%d)", -res)); clk_put(sgx_clk); clk_put(parent_clk); return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; } mutex_init(&psSysSpecData->sPowerLock); atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; } return AcquireGPTimer(psSysSpecData); }