Skip to content

Commit 472f79d

Browse files
Russell Kinglynxeye-dev
authored andcommitted
drm/etnaviv: add helper for comparing model/revision IDs
Add and use a helper for comparing the model and revision IDs. Acked-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
1 parent 52f36ba commit 472f79d

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎drivers/gpu/drm/etnaviv/etnaviv_gpu.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
120120
return 0;
121121
}
122122

123+
124+
#define etnaviv_is_model_rev(gpu, mod, rev) \
125+
((gpu)->identity.model == chipModel_##mod && \
126+
(gpu)->identity.revision == rev)
123127
#define etnaviv_field(val, field) \
124128
(((val) & field##__MASK) >> field##__SHIFT)
125129

@@ -213,8 +217,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
213217

214218
switch (gpu->identity.instruction_count) {
215219
case 0:
216-
if ((gpu->identity.model == chipModel_GC2000 &&
217-
gpu->identity.revision == 0x5108) ||
220+
if (etnaviv_is_model_rev(gpu, GC2000, 0x5108) ||
218221
gpu->identity.model == chipModel_GC880)
219222
gpu->identity.instruction_count = 512;
220223
else
@@ -266,8 +269,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
266269
}
267270

268271
/* Another special case */
269-
if (gpu->identity.model == chipModel_GC300 &&
270-
gpu->identity.revision == 0x2201) {
272+
if (etnaviv_is_model_rev(gpu, GC300, 0x2201)) {
271273
u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE);
272274
u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME);
273275

@@ -435,10 +437,9 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
435437
{
436438
u16 prefetch;
437439

438-
if (gpu->identity.model == chipModel_GC320 &&
439-
gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400 &&
440-
(gpu->identity.revision == 0x5007 ||
441-
gpu->identity.revision == 0x5220)) {
440+
if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
441+
etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
442+
gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
442443
u32 mc_memory_debug;
443444

444445
mc_memory_debug = gpu_read(gpu, VIVS_MC_DEBUG_MEMORY) & ~0xff;
@@ -460,8 +461,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
460461
VIVS_HI_AXI_CONFIG_ARCACHE(2));
461462

462463
/* GC2000 rev 5108 needs a special bus config */
463-
if (gpu->identity.model == chipModel_GC2000 &&
464-
gpu->identity.revision == 0x5108) {
464+
if (etnaviv_is_model_rev(gpu, GC2000, 0x5108)) {
465465
u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG);
466466
bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK |
467467
VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK);

0 commit comments

Comments
 (0)