Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Russell King and committed by
Lucas Stach
472f79dc 52f36ba1

+10 -10
+10 -10
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
··· 120 120 return 0; 121 121 } 122 122 123 + 124 + #define etnaviv_is_model_rev(gpu, mod, rev) \ 125 + ((gpu)->identity.model == chipModel_##mod && \ 126 + (gpu)->identity.revision == rev) 123 127 #define etnaviv_field(val, field) \ 124 128 (((val) & field##__MASK) >> field##__SHIFT) 125 129 ··· 217 213 218 214 switch (gpu->identity.instruction_count) { 219 215 case 0: 220 - if ((gpu->identity.model == chipModel_GC2000 && 221 - gpu->identity.revision == 0x5108) || 216 + if (etnaviv_is_model_rev(gpu, GC2000, 0x5108) || 222 217 gpu->identity.model == chipModel_GC880) 223 218 gpu->identity.instruction_count = 512; 224 219 else ··· 269 266 } 270 267 271 268 /* Another special case */ 272 - if (gpu->identity.model == chipModel_GC300 && 273 - gpu->identity.revision == 0x2201) { 269 + if (etnaviv_is_model_rev(gpu, GC300, 0x2201)) { 274 270 u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE); 275 271 u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME); 276 272 ··· 437 435 { 438 436 u16 prefetch; 439 437 440 - if (gpu->identity.model == chipModel_GC320 && 441 - gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400 && 442 - (gpu->identity.revision == 0x5007 || 443 - gpu->identity.revision == 0x5220)) { 438 + if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) || 439 + etnaviv_is_model_rev(gpu, GC320, 0x5220)) && 440 + gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) { 444 441 u32 mc_memory_debug; 445 442 446 443 mc_memory_debug = gpu_read(gpu, VIVS_MC_DEBUG_MEMORY) & ~0xff; ··· 461 460 VIVS_HI_AXI_CONFIG_ARCACHE(2)); 462 461 463 462 /* GC2000 rev 5108 needs a special bus config */ 464 - if (gpu->identity.model == chipModel_GC2000 && 465 - gpu->identity.revision == 0x5108) { 463 + if (etnaviv_is_model_rev(gpu, GC2000, 0x5108)) { 466 464 u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG); 467 465 bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK | 468 466 VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK);