1*26fbb4c8SBen Skeggs /*
2*26fbb4c8SBen Skeggs * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3*26fbb4c8SBen Skeggs *
4*26fbb4c8SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5*26fbb4c8SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6*26fbb4c8SBen Skeggs * to deal in the Software without restriction, including without limitation
7*26fbb4c8SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*26fbb4c8SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9*26fbb4c8SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10*26fbb4c8SBen Skeggs *
11*26fbb4c8SBen Skeggs * The above copyright notice and this permission notice shall be included in
12*26fbb4c8SBen Skeggs * all copies or substantial portions of the Software.
13*26fbb4c8SBen Skeggs *
14*26fbb4c8SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*26fbb4c8SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*26fbb4c8SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17*26fbb4c8SBen Skeggs * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18*26fbb4c8SBen Skeggs * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19*26fbb4c8SBen Skeggs * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20*26fbb4c8SBen Skeggs * DEALINGS IN THE SOFTWARE.
21*26fbb4c8SBen Skeggs */
22*26fbb4c8SBen Skeggs #include <subdev/privring.h>
23*26fbb4c8SBen Skeggs
24*26fbb4c8SBen Skeggs #include "priv.h"
25*26fbb4c8SBen Skeggs
26*26fbb4c8SBen Skeggs static int
gp10b_privring_init(struct nvkm_subdev * privring)27*26fbb4c8SBen Skeggs gp10b_privring_init(struct nvkm_subdev *privring)
28*26fbb4c8SBen Skeggs {
29*26fbb4c8SBen Skeggs struct nvkm_device *device = privring->device;
30*26fbb4c8SBen Skeggs
31*26fbb4c8SBen Skeggs nvkm_wr32(device, 0x1200a8, 0x0);
32*26fbb4c8SBen Skeggs
33*26fbb4c8SBen Skeggs /* init ring */
34*26fbb4c8SBen Skeggs nvkm_wr32(device, 0x12004c, 0x4);
35*26fbb4c8SBen Skeggs nvkm_wr32(device, 0x122204, 0x2);
36*26fbb4c8SBen Skeggs nvkm_rd32(device, 0x122204);
37*26fbb4c8SBen Skeggs
38*26fbb4c8SBen Skeggs /* timeout configuration */
39*26fbb4c8SBen Skeggs nvkm_wr32(device, 0x009080, 0x800186a0);
40*26fbb4c8SBen Skeggs
41*26fbb4c8SBen Skeggs return 0;
42*26fbb4c8SBen Skeggs }
43*26fbb4c8SBen Skeggs
44*26fbb4c8SBen Skeggs static const struct nvkm_subdev_func
45*26fbb4c8SBen Skeggs gp10b_privring = {
46*26fbb4c8SBen Skeggs .init = gp10b_privring_init,
47*26fbb4c8SBen Skeggs .intr = gk104_privring_intr,
48*26fbb4c8SBen Skeggs };
49*26fbb4c8SBen Skeggs
50*26fbb4c8SBen Skeggs int
gp10b_privring_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_subdev ** pprivring)51*26fbb4c8SBen Skeggs gp10b_privring_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
52*26fbb4c8SBen Skeggs struct nvkm_subdev **pprivring)
53*26fbb4c8SBen Skeggs {
54*26fbb4c8SBen Skeggs return nvkm_subdev_new_(&gp10b_privring, device, type, inst, pprivring);
55*26fbb4c8SBen Skeggs }
56