Skip to content

Commit 6bf7805

Browse files
vldlyrobclark
authored andcommitted
drm/msm/a5xx: Add support for Adreno 506 GPU
This GPU is found on SoCs such as MSM8953 (650 MHz), SDM450 (600 MHz), SDM632 (725 MHz). Signed-off-by: Vladimir Lypak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent 3a90543 commit 6bf7805

File tree

3 files changed

+47
-15
lines changed

3 files changed

+47
-15
lines changed

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

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ void a5xx_set_hwcg(struct msm_gpu *gpu, bool state)
439439
const struct adreno_five_hwcg_regs *regs;
440440
unsigned int i, sz;
441441

442-
if (adreno_is_a508(adreno_gpu)) {
442+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu)) {
443443
regs = a50x_hwcg;
444444
sz = ARRAY_SIZE(a50x_hwcg);
445445
} else if (adreno_is_a509(adreno_gpu) || adreno_is_a512(adreno_gpu)) {
@@ -483,7 +483,7 @@ static int a5xx_me_init(struct msm_gpu *gpu)
483483
OUT_RING(ring, 0x00000000);
484484

485485
/* Specify workarounds for various microcode issues */
486-
if (adreno_is_a530(adreno_gpu)) {
486+
if (adreno_is_a506(adreno_gpu) || adreno_is_a530(adreno_gpu)) {
487487
/* Workaround for token end syncs
488488
* Force a WFI after every direct-render 3D mode draw and every
489489
* 2D mode 3 draw
@@ -618,8 +618,16 @@ static int a5xx_ucode_init(struct msm_gpu *gpu)
618618

619619
static int a5xx_zap_shader_resume(struct msm_gpu *gpu)
620620
{
621+
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
621622
int ret;
622623

624+
/*
625+
* Adreno 506 have CPZ Retention feature and doesn't require
626+
* to resume zap shader
627+
*/
628+
if (adreno_is_a506(adreno_gpu))
629+
return 0;
630+
623631
ret = qcom_scm_set_remote_state(SCM_GPU_ZAP_SHADER_RESUME, GPU_PAS_ID);
624632
if (ret)
625633
DRM_ERROR("%s: zap-shader resume failed: %d\n",
@@ -731,9 +739,10 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
731739
0x00100000 + adreno_gpu->gmem - 1);
732740
gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x00000000);
733741

734-
if (adreno_is_a508(adreno_gpu) || adreno_is_a510(adreno_gpu)) {
742+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
743+
adreno_is_a510(adreno_gpu)) {
735744
gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x20);
736-
if (adreno_is_a508(adreno_gpu))
745+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu))
737746
gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
738747
else
739748
gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x20);
@@ -749,7 +758,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
749758
gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
750759
}
751760

752-
if (adreno_is_a508(adreno_gpu))
761+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu))
753762
gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
754763
(0x100 << 11 | 0x100 << 22));
755764
else if (adreno_is_a509(adreno_gpu) || adreno_is_a510(adreno_gpu) ||
@@ -767,8 +776,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
767776
* Disable the RB sampler datapath DP2 clock gating optimization
768777
* for 1-SP GPUs, as it is enabled by default.
769778
*/
770-
if (adreno_is_a508(adreno_gpu) || adreno_is_a509(adreno_gpu) ||
771-
adreno_is_a512(adreno_gpu))
779+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
780+
adreno_is_a509(adreno_gpu) || adreno_is_a512(adreno_gpu))
772781
gpu_rmw(gpu, REG_A5XX_RB_DBG_ECO_CNTL, 0, (1 << 9));
773782

774783
/* Disable UCHE global filter as SP can invalidate/flush independently */
@@ -849,9 +858,9 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
849858
/* UCHE */
850859
gpu_write(gpu, REG_A5XX_CP_PROTECT(16), ADRENO_PROTECT_RW(0xE80, 16));
851860

852-
if (adreno_is_a508(adreno_gpu) || adreno_is_a509(adreno_gpu) ||
853-
adreno_is_a510(adreno_gpu) || adreno_is_a512(adreno_gpu) ||
854-
adreno_is_a530(adreno_gpu))
861+
if (adreno_is_a506(adreno_gou) || adreno_is_a508(adreno_gpu) ||
862+
adreno_is_a509(adreno_gpu) || adreno_is_a510(adreno_gpu) ||
863+
adreno_is_a512(adreno_gpu) || adreno_is_a530(adreno_gpu))
855864
gpu_write(gpu, REG_A5XX_CP_PROTECT(17),
856865
ADRENO_PROTECT_RW(0x10000, 0x8000));
857866

@@ -893,8 +902,7 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
893902
if (ret)
894903
return ret;
895904

896-
if (!(adreno_is_a508(adreno_gpu) || adreno_is_a509(adreno_gpu) ||
897-
adreno_is_a510(adreno_gpu) || adreno_is_a512(adreno_gpu)))
905+
if (adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu))
898906
a5xx_gpmu_ucode_init(gpu);
899907

900908
ret = a5xx_ucode_init(gpu);
@@ -1344,7 +1352,7 @@ static int a5xx_pm_resume(struct msm_gpu *gpu)
13441352
if (ret)
13451353
return ret;
13461354

1347-
/* Adreno 508, 509, 510, 512 needs manual RBBM sus/res control */
1355+
/* Adreno 506, 508, 509, 510, 512 needs manual RBBM sus/res control */
13481356
if (!(adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu))) {
13491357
/* Halt the sp_input_clk at HM level */
13501358
gpu_write(gpu, REG_A5XX_RBBM_CLOCK_CNTL, 0x00000055);
@@ -1387,8 +1395,9 @@ static int a5xx_pm_suspend(struct msm_gpu *gpu)
13871395
u32 mask = 0xf;
13881396
int i, ret;
13891397

1390-
/* A508, A510 have 3 XIN ports in VBIF */
1391-
if (adreno_is_a508(adreno_gpu) || adreno_is_a510(adreno_gpu))
1398+
/* A506, A508, A510 have 3 XIN ports in VBIF */
1399+
if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
1400+
adreno_is_a510(adreno_gpu))
13921401
mask = 0x7;
13931402

13941403
/* Clear the VBIF pipe before shutting down */

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,24 @@ static const struct adreno_info gpulist[] = {
131131
.gmem = (SZ_1M + SZ_512K),
132132
.inactive_period = DRM_MSM_INACTIVE_PERIOD,
133133
.init = a4xx_gpu_init,
134+
}, {
135+
.rev = ADRENO_REV(5, 0, 6, ANY_ID),
136+
.revn = 506,
137+
.name = "A506",
138+
.fw = {
139+
[ADRENO_FW_PM4] = "a530_pm4.fw",
140+
[ADRENO_FW_PFP] = "a530_pfp.fw",
141+
},
142+
.gmem = (SZ_128K + SZ_8K),
143+
/*
144+
* Increase inactive period to 250 to avoid bouncing
145+
* the GDSC which appears to make it grumpy
146+
*/
147+
.inactive_period = 250,
148+
.quirks = ADRENO_QUIRK_TWO_PASS_USE_WFI |
149+
ADRENO_QUIRK_LMLOADKILL_DISABLE,
150+
.init = a5xx_gpu_init,
151+
.zapfw = "a506_zap.mdt",
134152
}, {
135153
.rev = ADRENO_REV(5, 0, 8, ANY_ID),
136154
.revn = 508,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ static inline int adreno_is_a430(struct adreno_gpu *gpu)
201201
return gpu->revn == 430;
202202
}
203203

204+
static inline int adreno_is_a506(struct adreno_gpu *gpu)
205+
{
206+
return gpu->revn == 506;
207+
}
208+
204209
static inline int adreno_is_a508(struct adreno_gpu *gpu)
205210
{
206211
return gpu->revn == 508;

0 commit comments

Comments
 (0)