diff options
author | shanlong.li <shanlong.li@starfivetech.com> | 2023-12-19 13:17:41 +0300 |
---|---|---|
committer | shanlong.li <shanlong.li@starfivetech.com> | 2023-12-19 14:50:38 +0300 |
commit | 481e332944091c95f337335dbdb3e93466f27c13 (patch) | |
tree | fe453161c9005d96f20053dd478a968cc933c6fe | |
parent | 1a82e0446fca9d5950bf83a3ad73dfbaf0dd8001 (diff) | |
download | linux-481e332944091c95f337335dbdb3e93466f27c13.tar.xz |
linux:driver:gpu: the adaption of gpu' frequence for bin1 and bin2
for bin1 594MHz , bin2 396MHz
Signed-off-by: shanlong.li <shanlong.li@starfivetech.com>
-rw-r--r-- | drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.c b/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.c index fbb5e93148fb..574b402855e2 100644 --- a/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.c +++ b/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.c @@ -68,6 +68,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kernel_compatibility.h" #include <linux/pm_runtime.h> +#include <linux/of.h> struct sf7110_cfg sf_cfg_t = {0,}; @@ -250,6 +251,7 @@ static int create_sf7110_cfg(struct device *dev) return -ENOMEM; psf->gpu_reg_start = STARFIVE_7110_GPU_PBASE; psf->gpu_reg_size = STARFIVE_7110_GPU_SIZE; + psf->rate = RGX_STARFIVE_7100_CORE_CLOCK_SPEED; psf->clk_apb = devm_clk_get_optional(dev, "clk_apb"); if (IS_ERR(psf->clk_apb)) { @@ -299,6 +301,10 @@ static int create_sf7110_cfg(struct device *dev) goto err_gpu_unmap; } + if (of_find_node_by_path("/opp-table-0/opp-1250000000")) { + psf->rate = RGX_STARFIVE_7100_CORE_CLOCK_SPEED_BIN2; + } + psf->runtime_resume = sys_gpu_runtime_resume; psf->runtime_suspend = sys_gpu_runtime_suspend; @@ -312,7 +318,7 @@ void u0_img_gpu_enable(void) { clk_prepare_enable(sf_cfg_t.clk_apb); clk_prepare_enable(sf_cfg_t.clk_rtc); - clk_set_rate(sf_cfg_t.clk_div, RGX_STARFIVE_7100_CORE_CLOCK_SPEED); + clk_set_rate(sf_cfg_t.clk_div, sf_cfg_t.rate); clk_prepare_enable(sf_cfg_t.clk_core); clk_prepare_enable(sf_cfg_t.clk_sys); @@ -437,7 +443,6 @@ PVRSRV_ERROR SysDevInit(void *pvOSDevice, PVRSRV_DEVICE_CONFIG **ppsDevConfig) /* * Setup RGX specific timing data */ - gsRGXTimingInfo.ui32CoreClockSpeed = RGX_STARFIVE_7100_CORE_CLOCK_SPEED; gsRGXTimingInfo.bEnableActivePM = IMG_TRUE; gsRGXTimingInfo.bEnableRDPowIsland = IMG_TRUE; gsRGXTimingInfo.ui32ActivePMLatencyms = SYS_RGX_ACTIVE_POWER_LATENCY_MS; @@ -497,6 +502,7 @@ PVRSRV_ERROR SysDevInit(void *pvOSDevice, PVRSRV_DEVICE_CONFIG **ppsDevConfig) return PVRSRV_ERROR_BAD_MAPPING; } gsDevices[0].hSysData = &sf_cfg_t; + gsRGXTimingInfo.ui32CoreClockSpeed = sf_cfg_t.rate; pm_runtime_enable(sf_cfg_t.dev); /* power management on HW system */ diff --git a/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.h b/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.h index 435f6373a5f4..bdb095511676 100644 --- a/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.h +++ b/drivers/gpu/drm/img/img-rogue/services/system/rogue/sf_7110/sysconfig.h @@ -76,6 +76,7 @@ struct sf7110_cfg { struct device *dev; SYS_DEV_CLK_GET runtime_resume; SYS_DEV_CLK_GET runtime_suspend; + unsigned long rate; }; #define mk_crg_offset(x) ((x) - (U0_SYS_CRG__SAIF_BD_APBS__BASE_ADDR)) @@ -85,6 +86,7 @@ struct sf7110_cfg { #define SYS_RGX_ACTIVE_POWER_LATENCY_MS (80000) #else #define RGX_STARFIVE_7100_CORE_CLOCK_SPEED (594.0 * 1000 * 1000)//maybe 400M? +#define RGX_STARFIVE_7100_CORE_CLOCK_SPEED_BIN2 (396.0 * 1000 * 1000) #define SYS_RGX_ACTIVE_POWER_LATENCY_MS (100) #endif |