Skip to content

Commit b1c53a2

Browse files
fltorobclark
authored andcommitted
drm/msm/a6xx: hwcg tables in gpulist
This will allow supporting different hwcg tables for a6xx. Signed-off-by: Jonathan Marek <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent af776a3 commit b1c53a2

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
154154
a6xx_flush(gpu, ring);
155155
}
156156

157-
static const struct {
158-
u32 offset;
159-
u32 value;
160-
} a6xx_hwcg[] = {
157+
const struct adreno_reglist a630_hwcg[] = {
161158
{REG_A6XX_RBBM_CLOCK_CNTL_SP0, 0x22222222},
162159
{REG_A6XX_RBBM_CLOCK_CNTL_SP1, 0x22222222},
163160
{REG_A6XX_RBBM_CLOCK_CNTL_SP2, 0x22222222},
@@ -262,17 +259,22 @@ static const struct {
262259
{REG_A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222},
263260
{REG_A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222},
264261
{REG_A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111},
265-
{REG_A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}
262+
{REG_A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555},
263+
{},
266264
};
267265

268266
static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
269267
{
270268
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
271269
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
272270
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
271+
const struct adreno_reglist *reg;
273272
unsigned int i;
274273
u32 val;
275274

275+
if (!adreno_gpu->info->hwcg)
276+
return;
277+
276278
val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);
277279

278280
/* Don't re-program the registers if they are already correct */
@@ -282,9 +284,8 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
282284
/* Disable SP clock before programming HWCG registers */
283285
gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 1, 0);
284286

285-
for (i = 0; i < ARRAY_SIZE(a6xx_hwcg); i++)
286-
gpu_write(gpu, a6xx_hwcg[i].offset,
287-
state ? a6xx_hwcg[i].value : 0);
287+
for (i = 0; (reg = &adreno_gpu->info->hwcg[i], reg->offset); i++)
288+
gpu_write(gpu, reg->offset, state ? reg->value : 0);
288289

289290
/* Enable SP clock */
290291
gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 0, 1);
@@ -440,12 +441,8 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
440441
gpu_write(gpu, REG_A6XX_TPL1_ADDR_MODE_CNTL, 0x1);
441442
gpu_write(gpu, REG_A6XX_RBBM_SECVID_TSB_ADDR_MODE_CNTL, 0x1);
442443

443-
/*
444-
* enable hardware clockgating
445-
* For now enable clock gating only for a630
446-
*/
447-
if (adreno_is_a630(adreno_gpu))
448-
a6xx_set_hwcg(gpu, true);
444+
/* enable hardware clockgating */
445+
a6xx_set_hwcg(gpu, true);
449446

450447
/* VBIF/GBIF start*/
451448
if (adreno_is_a640(adreno_gpu) || adreno_is_a650(adreno_gpu)) {

drivers/gpu/drm/msm/adreno/adreno_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ static const struct adreno_info gpulist[] = {
200200
.inactive_period = DRM_MSM_INACTIVE_PERIOD,
201201
.init = a6xx_gpu_init,
202202
.zapfw = "a630_zap.mdt",
203+
.hwcg = a630_hwcg,
203204
}, {
204205
.rev = ADRENO_REV(6, 4, 0, ANY_ID),
205206
.revn = 640,

drivers/gpu/drm/msm/adreno/adreno_gpu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ struct adreno_gpu_funcs {
6868
int (*get_timestamp)(struct msm_gpu *gpu, uint64_t *value);
6969
};
7070

71+
struct adreno_reglist {
72+
u32 offset;
73+
u32 value;
74+
};
75+
76+
extern const struct adreno_reglist a630_hwcg[];
77+
7178
struct adreno_info {
7279
struct adreno_rev rev;
7380
uint32_t revn;
@@ -78,6 +85,7 @@ struct adreno_info {
7885
struct msm_gpu *(*init)(struct drm_device *dev);
7986
const char *zapfw;
8087
u32 inactive_period;
88+
const struct adreno_reglist *hwcg;
8189
};
8290

8391
const struct adreno_info *adreno_info(struct adreno_rev rev);

0 commit comments

Comments
 (0)