Commit 472f79dc authored by Russell King's avatar Russell King Committed by Lucas Stach

drm/etnaviv: add helper for comparing model/revision IDs

Add and use a helper for comparing the model and revision IDs.
Acked-by: default avatarChristian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
parent 52f36ba1
...@@ -120,6 +120,10 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value) ...@@ -120,6 +120,10 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
return 0; return 0;
} }
#define etnaviv_is_model_rev(gpu, mod, rev) \
((gpu)->identity.model == chipModel_##mod && \
(gpu)->identity.revision == rev)
#define etnaviv_field(val, field) \ #define etnaviv_field(val, field) \
(((val) & field##__MASK) >> field##__SHIFT) (((val) & field##__MASK) >> field##__SHIFT)
...@@ -213,8 +217,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu) ...@@ -213,8 +217,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
switch (gpu->identity.instruction_count) { switch (gpu->identity.instruction_count) {
case 0: case 0:
if ((gpu->identity.model == chipModel_GC2000 && if (etnaviv_is_model_rev(gpu, GC2000, 0x5108) ||
gpu->identity.revision == 0x5108) ||
gpu->identity.model == chipModel_GC880) gpu->identity.model == chipModel_GC880)
gpu->identity.instruction_count = 512; gpu->identity.instruction_count = 512;
else else
...@@ -266,8 +269,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu) ...@@ -266,8 +269,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
} }
/* Another special case */ /* Another special case */
if (gpu->identity.model == chipModel_GC300 && if (etnaviv_is_model_rev(gpu, GC300, 0x2201)) {
gpu->identity.revision == 0x2201) {
u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE); u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE);
u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME); u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME);
...@@ -435,10 +437,9 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu) ...@@ -435,10 +437,9 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
{ {
u16 prefetch; u16 prefetch;
if (gpu->identity.model == chipModel_GC320 && if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400 && etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
(gpu->identity.revision == 0x5007 || gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
gpu->identity.revision == 0x5220)) {
u32 mc_memory_debug; u32 mc_memory_debug;
mc_memory_debug = gpu_read(gpu, VIVS_MC_DEBUG_MEMORY) & ~0xff; 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,8 +461,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
VIVS_HI_AXI_CONFIG_ARCACHE(2)); VIVS_HI_AXI_CONFIG_ARCACHE(2));
/* GC2000 rev 5108 needs a special bus config */ /* GC2000 rev 5108 needs a special bus config */
if (gpu->identity.model == chipModel_GC2000 && if (etnaviv_is_model_rev(gpu, GC2000, 0x5108)) {
gpu->identity.revision == 0x5108) {
u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG); u32 bus_config = gpu_read(gpu, VIVS_MC_BUS_CONFIG);
bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK | bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK |
VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK); VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment