aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2016-01-24 12:35:59 -0500
committerLucas Stach <l.stach@pengutronix.de>2016-01-26 12:53:58 -0500
commit472f79dcf21d34f4d667910002482efe3ca4ba34 (patch)
treed54caf3ca2fbdb600cf06e77507f407aa345aef7
parent52f36ba1d6134f5c1c45deb0da53442a5971358e (diff)
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>
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 2c27fac0d2de..d5fad472e91f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -120,6 +120,10 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
120 return 0; 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#define etnaviv_field(val, field) \ 127#define etnaviv_field(val, field) \
124 (((val) & field##__MASK) >> field##__SHIFT) 128 (((val) & field##__MASK) >> field##__SHIFT)
125 129
@@ -213,8 +217,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
213 217
214 switch (gpu->identity.instruction_count) { 218 switch (gpu->identity.instruction_count) {
215 case 0: 219 case 0:
216 if ((gpu->identity.model == chipModel_GC2000 && 220 if (etnaviv_is_model_rev(gpu, GC2000, 0x5108) ||
217 gpu->identity.revision == 0x5108) ||
218 gpu->identity.model == chipModel_GC880) 221 gpu->identity.model == chipModel_GC880)
219 gpu->identity.instruction_count = 512; 222 gpu->identity.instruction_count = 512;
220 else 223 else
@@ -266,8 +269,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
266 } 269 }
267 270
268 /* Another special case */ 271 /* Another special case */
269 if (gpu->identity.model == chipModel_GC300 && 272 if (etnaviv_is_model_rev(gpu, GC300, 0x2201)) {
270 gpu->identity.revision == 0x2201) {
271 u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE); 273 u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE);
272 u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME); 274 u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME);
273 275
@@ -435,10 +437,9 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
435{ 437{
436 u16 prefetch; 438 u16 prefetch;
437 439
438 if (gpu->identity.model == chipModel_GC320 && 440 if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
439 gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400 && 441 etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
440 (gpu->identity.revision == 0x5007 || 442 gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
441 gpu->identity.revision == 0x5220)) {
442 u32 mc_memory_debug; 443 u32 mc_memory_debug;
443 444
444 mc_memory_debug = gpu_read(gpu, VIVS_MC_DEBUG_MEMORY) & ~0xff; 445 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)
460 VIVS_HI_AXI_CONFIG_ARCACHE(2)); 461 VIVS_HI_AXI_CONFIG_ARCACHE(2));
461 462
462 /* GC2000 rev 5108 needs a special bus config */ 463 /* GC2000 rev 5108 needs a special bus config */
463 if (gpu->identity.model == chipModel_GC2000 && 464 if (etnaviv_is_model_rev(gpu, GC2000, 0x5108)) {
464 gpu->identity.revision == 0x5108) {
465 u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG); 465 u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG);
466 bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK | 466 bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK |
467 VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK); 467 VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK);