1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "nv50.h"
23#include "head.h"
24#include "ior.h"
25#include "channv50.h"
26#include "rootnv50.h"
27
28#include <core/gpuobj.h>
29#include <subdev/timer.h>
30
31int
32tu102_disp_init(struct nv50_disp *disp)
33{
34 struct nvkm_device *device = disp->base.engine.subdev.device;
35 struct nvkm_head *head;
36 int i, j;
37 u32 tmp;
38
39
40 if (nvkm_rd32(device, 0x6254e8) & 0x00000002) {
41 nvkm_mask(device, 0x6254e8, 0x00000001, 0x00000000);
42 if (nvkm_msec(device, 2000,
43 if (!(nvkm_rd32(device, 0x6254e8) & 0x00000002))
44 break;
45 ) < 0)
46 return -EBUSY;
47 }
48
49
50 tmp = 0x00000021;
51 nvkm_wr32(device, 0x640008, tmp);
52
53
54 for (i = 0; i < disp->sor.nr; i++) {
55 tmp = nvkm_rd32(device, 0x61c000 + (i * 0x800));
56 nvkm_mask(device, 0x640000, 0x00000100 << i, 0x00000100 << i);
57 nvkm_wr32(device, 0x640144 + (i * 0x08), tmp);
58 }
59
60
61 list_for_each_entry(head, &disp->base.head, head) {
62 const int id = head->id;
63
64
65 tmp = nvkm_rd32(device, 0x616300 + (id * 0x800));
66 nvkm_wr32(device, 0x640048 + (id * 0x020), tmp);
67
68
69 for (j = 0; j < 5 * 4; j += 4) {
70 tmp = nvkm_rd32(device, 0x616140 + (id * 0x800) + j);
71 nvkm_wr32(device, 0x640680 + (id * 0x20) + j, tmp);
72 }
73 }
74
75
76 for (i = 0; i < disp->wndw.nr; i++) {
77 nvkm_mask(device, 0x640004, 1 << i, 1 << i);
78 for (j = 0; j < 6 * 4; j += 4) {
79 tmp = nvkm_rd32(device, 0x630100 + (i * 0x800) + j);
80 nvkm_mask(device, 0x640780 + (i * 0x20) + j, 0xffffffff, tmp);
81 }
82 nvkm_mask(device, 0x64000c, 0x00000100, 0x00000100);
83 }
84
85
86 for (i = 0; i < 3; i++) {
87 tmp = nvkm_rd32(device, 0x62e000 + (i * 0x04));
88 nvkm_wr32(device, 0x640010 + (i * 0x04), tmp);
89 }
90
91 nvkm_mask(device, 0x610078, 0x00000001, 0x00000001);
92
93
94 switch (nvkm_memory_target(disp->inst->memory)) {
95 case NVKM_MEM_TARGET_VRAM: tmp = 0x00000001; break;
96 case NVKM_MEM_TARGET_NCOH: tmp = 0x00000002; break;
97 case NVKM_MEM_TARGET_HOST: tmp = 0x00000003; break;
98 default:
99 break;
100 }
101 nvkm_wr32(device, 0x610010, 0x00000008 | tmp);
102 nvkm_wr32(device, 0x610014, disp->inst->addr >> 16);
103
104
105 nvkm_wr32(device, 0x611cf0, 0x00000187);
106 nvkm_wr32(device, 0x611db0, 0x00000187);
107
108
109 nvkm_wr32(device, 0x611cec, disp->head.mask << 16 |
110 0x00000001);
111 nvkm_wr32(device, 0x611dac, 0x00000000);
112
113
114 nvkm_wr32(device, 0x611ce8, disp->wndw.mask);
115 nvkm_wr32(device, 0x611da8, 0x00000000);
116
117
118 nvkm_wr32(device, 0x611ce4, disp->wndw.mask);
119 nvkm_wr32(device, 0x611da4, 0x00000000);
120
121
122 list_for_each_entry(head, &disp->base.head, head) {
123 const u32 hoff = head->id * 4;
124 nvkm_wr32(device, 0x611cc0 + hoff, 0x00000004);
125 nvkm_wr32(device, 0x611d80 + hoff, 0x00000000);
126 }
127
128
129 nvkm_wr32(device, 0x611cf4, 0x00000000);
130 nvkm_wr32(device, 0x611db4, 0x00000000);
131 return 0;
132}
133
134static const struct nv50_disp_func
135tu102_disp = {
136 .init = tu102_disp_init,
137 .fini = gv100_disp_fini,
138 .intr = gv100_disp_intr,
139 .uevent = &gv100_disp_chan_uevent,
140 .super = gv100_disp_super,
141 .root = &tu102_disp_root_oclass,
142 .wndw = { .cnt = gv100_disp_wndw_cnt },
143 .head = { .cnt = gv100_head_cnt, .new = gv100_head_new },
144 .sor = { .cnt = gv100_sor_cnt, .new = tu102_sor_new },
145 .ramht_size = 0x2000,
146};
147
148int
149tu102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
150 struct nvkm_disp **pdisp)
151{
152 return nv50_disp_new_(&tu102_disp, device, type, inst, pdisp);
153}
154