1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "channv50.h"
23
24#include <core/ramht.h>
25#include <subdev/timer.h>
26
27static int
28gv100_disp_dmac_idle(struct nv50_disp_chan *chan)
29{
30 struct nvkm_device *device = chan->disp->base.engine.subdev.device;
31 const u32 soff = (chan->chid.ctrl - 1) * 0x04;
32 nvkm_msec(device, 2000,
33 u32 stat = nvkm_rd32(device, 0x610664 + soff);
34 if ((stat & 0x000f0000) == 0x00040000)
35 return 0;
36 );
37 return -EBUSY;
38}
39
40int
41gv100_disp_dmac_bind(struct nv50_disp_chan *chan,
42 struct nvkm_object *object, u32 handle)
43{
44 return nvkm_ramht_insert(chan->disp->ramht, object,
45 chan->chid.user, -9, handle,
46 chan->chid.user << 25 | 0x00000040);
47}
48
49void
50gv100_disp_dmac_fini(struct nv50_disp_chan *chan)
51{
52 struct nvkm_device *device = chan->disp->base.engine.subdev.device;
53 const u32 coff = chan->chid.ctrl * 0x04;
54 nvkm_mask(device, 0x6104e0 + coff, 0x00000010, 0x00000000);
55 gv100_disp_dmac_idle(chan);
56 nvkm_mask(device, 0x6104e0 + coff, 0x00000002, 0x00000000);
57}
58
59int
60gv100_disp_dmac_init(struct nv50_disp_chan *chan)
61{
62 struct nvkm_subdev *subdev = &chan->disp->base.engine.subdev;
63 struct nvkm_device *device = subdev->device;
64 const u32 uoff = (chan->chid.ctrl - 1) * 0x1000;
65 const u32 poff = chan->chid.ctrl * 0x10;
66 const u32 coff = chan->chid.ctrl * 0x04;
67
68 nvkm_wr32(device, 0x610b24 + poff, lower_32_bits(chan->push));
69 nvkm_wr32(device, 0x610b20 + poff, upper_32_bits(chan->push));
70 nvkm_wr32(device, 0x610b28 + poff, 0x00000001);
71 nvkm_wr32(device, 0x610b2c + poff, 0x00000040);
72
73 nvkm_mask(device, 0x6104e0 + coff, 0x00000010, 0x00000010);
74 nvkm_wr32(device, 0x690000 + uoff, 0x00000000);
75 nvkm_wr32(device, 0x6104e0 + coff, 0x00000013);
76 return gv100_disp_dmac_idle(chan);
77}
78