This source file includes following definitions.
- gf100_devinit_pll_set
- gf100_devinit_disable
- gf100_devinit_preinit
- gf100_devinit_new
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "nv50.h"
25
26 #include <subdev/bios.h>
27 #include <subdev/bios/init.h>
28 #include <subdev/bios/pll.h>
29 #include <subdev/clk/pll.h>
30
31 int
32 gf100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
33 {
34 struct nvkm_subdev *subdev = &init->subdev;
35 struct nvkm_device *device = subdev->device;
36 struct nvbios_pll info;
37 int N, fN, M, P;
38 int ret;
39
40 ret = nvbios_pll_parse(device->bios, type, &info);
41 if (ret)
42 return ret;
43
44 ret = gt215_pll_calc(subdev, &info, freq, &N, &fN, &M, &P);
45 if (ret < 0)
46 return ret;
47
48 switch (info.type) {
49 case PLL_VPLL0:
50 case PLL_VPLL1:
51 case PLL_VPLL2:
52 case PLL_VPLL3:
53 nvkm_mask(device, info.reg + 0x0c, 0x00000000, 0x00000100);
54 nvkm_wr32(device, info.reg + 0x04, (P << 16) | (N << 8) | M);
55 nvkm_wr32(device, info.reg + 0x10, fN << 16);
56 break;
57 default:
58 nvkm_warn(subdev, "%08x/%dKhz unimplemented\n", type, freq);
59 ret = -EINVAL;
60 break;
61 }
62
63 return ret;
64 }
65
66 static u64
67 gf100_devinit_disable(struct nvkm_devinit *init)
68 {
69 struct nvkm_device *device = init->subdev.device;
70 u32 r022500 = nvkm_rd32(device, 0x022500);
71 u64 disable = 0ULL;
72
73 if (r022500 & 0x00000001)
74 disable |= (1ULL << NVKM_ENGINE_DISP);
75
76 if (r022500 & 0x00000002) {
77 disable |= (1ULL << NVKM_ENGINE_MSPDEC);
78 disable |= (1ULL << NVKM_ENGINE_MSPPP);
79 }
80
81 if (r022500 & 0x00000004)
82 disable |= (1ULL << NVKM_ENGINE_MSVLD);
83 if (r022500 & 0x00000008)
84 disable |= (1ULL << NVKM_ENGINE_MSENC);
85 if (r022500 & 0x00000100)
86 disable |= (1ULL << NVKM_ENGINE_CE0);
87 if (r022500 & 0x00000200)
88 disable |= (1ULL << NVKM_ENGINE_CE1);
89
90 return disable;
91 }
92
93 void
94 gf100_devinit_preinit(struct nvkm_devinit *base)
95 {
96 struct nv50_devinit *init = nv50_devinit(base);
97 struct nvkm_subdev *subdev = &init->base.subdev;
98 struct nvkm_device *device = subdev->device;
99
100
101
102
103
104 base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0);
105 }
106
107 static const struct nvkm_devinit_func
108 gf100_devinit = {
109 .preinit = gf100_devinit_preinit,
110 .init = nv50_devinit_init,
111 .post = nv04_devinit_post,
112 .pll_set = gf100_devinit_pll_set,
113 .disable = gf100_devinit_disable,
114 };
115
116 int
117 gf100_devinit_new(struct nvkm_device *device, int index,
118 struct nvkm_devinit **pinit)
119 {
120 return nv50_devinit_new_(&gf100_devinit, device, index, pinit);
121 }