diff options
-rw-r--r-- | drivers/gpu/drm/etnaviv/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 65 |
4 files changed, 74 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/Makefile b/drivers/gpu/drm/etnaviv/Makefile index 9bb780c22501..46e5ffad69a6 100644 --- a/drivers/gpu/drm/etnaviv/Makefile +++ b/drivers/gpu/drm/etnaviv/Makefile | |||
@@ -9,6 +9,7 @@ etnaviv-y := \ | |||
9 | etnaviv_gem_submit.o \ | 9 | etnaviv_gem_submit.o \ |
10 | etnaviv_gem.o \ | 10 | etnaviv_gem.o \ |
11 | etnaviv_gpu.o \ | 11 | etnaviv_gpu.o \ |
12 | etnaviv_hwdb.o \ | ||
12 | etnaviv_iommu_v2.o \ | 13 | etnaviv_iommu_v2.o \ |
13 | etnaviv_iommu.o \ | 14 | etnaviv_iommu.o \ |
14 | etnaviv_mmu.o \ | 15 | etnaviv_mmu.o \ |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 42ad286d5ec0..dfb12717a742 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c | |||
@@ -374,6 +374,13 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu) | |||
374 | dev_info(gpu->dev, "model: GC%x, revision: %x\n", | 374 | dev_info(gpu->dev, "model: GC%x, revision: %x\n", |
375 | gpu->identity.model, gpu->identity.revision); | 375 | gpu->identity.model, gpu->identity.revision); |
376 | 376 | ||
377 | /* | ||
378 | * If there is a match in the HWDB, we aren't interested in the | ||
379 | * remaining register values, as they might be wrong. | ||
380 | */ | ||
381 | if (etnaviv_fill_identity_from_hwdb(gpu)) | ||
382 | return; | ||
383 | |||
377 | gpu->identity.features = gpu_read(gpu, VIVS_HI_CHIP_FEATURE); | 384 | gpu->identity.features = gpu_read(gpu, VIVS_HI_CHIP_FEATURE); |
378 | 385 | ||
379 | /* Disable fast clear on GC700. */ | 386 | /* Disable fast clear on GC700. */ |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h index 18460df401b7..1620015f90ae 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h | |||
@@ -170,6 +170,7 @@ static inline bool fence_completed(struct etnaviv_gpu *gpu, u32 fence) | |||
170 | int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value); | 170 | int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value); |
171 | 171 | ||
172 | int etnaviv_gpu_init(struct etnaviv_gpu *gpu); | 172 | int etnaviv_gpu_init(struct etnaviv_gpu *gpu); |
173 | bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu); | ||
173 | 174 | ||
174 | #ifdef CONFIG_DEBUG_FS | 175 | #ifdef CONFIG_DEBUG_FS |
175 | int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m); | 176 | int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m); |
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c new file mode 100644 index 000000000000..ea08bb38caaf --- /dev/null +++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Etnaviv Project | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License version 2 as published by | ||
6 | * the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include "etnaviv_gpu.h" | ||
18 | |||
19 | static const struct etnaviv_chip_identity etnaviv_chip_identities[] = { | ||
20 | { | ||
21 | .model = 0x7000, | ||
22 | .revision = 0x6214, | ||
23 | .stream_count = 16, | ||
24 | .register_max = 64, | ||
25 | .thread_count = 1024, | ||
26 | .shader_core_count = 4, | ||
27 | .vertex_cache_size = 16, | ||
28 | .vertex_output_buffer_size = 1024, | ||
29 | .pixel_pipes = 2, | ||
30 | .instruction_count = 512, | ||
31 | .num_constants = 320, | ||
32 | .buffer_size = 0, | ||
33 | .varyings_count = 16, | ||
34 | .features = 0xe0287cad, | ||
35 | .minor_features0 = 0xc1799eff, | ||
36 | .minor_features1 = 0xfefbfad9, | ||
37 | .minor_features2 = 0xeb9d4fbf, | ||
38 | .minor_features3 = 0xedfffced, | ||
39 | .minor_features4 = 0xdb0dafc7, | ||
40 | .minor_features5 = 0xbb5ac333, | ||
41 | .minor_features6 = 0xfc8ee200, | ||
42 | .minor_features7 = 0x03fbfa6f, | ||
43 | .minor_features8 = 0x00ef0ef0, | ||
44 | .minor_features9 = 0x0edbf03c, | ||
45 | .minor_features10 = 0x90044250, | ||
46 | .minor_features11 = 0x00000024, | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu) | ||
51 | { | ||
52 | struct etnaviv_chip_identity *ident = &gpu->identity; | ||
53 | int i; | ||
54 | |||
55 | for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) { | ||
56 | if (etnaviv_chip_identities[i].model == ident->model && | ||
57 | etnaviv_chip_identities[i].revision == ident->revision) { | ||
58 | memcpy(ident, &etnaviv_chip_identities[i], | ||
59 | sizeof(*ident)); | ||
60 | return true; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | return false; | ||
65 | } | ||