1f83d1c31SBen Skeggs /*
2f83d1c31SBen Skeggs * Copyright 2021 Red Hat Inc.
3f83d1c31SBen Skeggs *
4f83d1c31SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5f83d1c31SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6f83d1c31SBen Skeggs * to deal in the Software without restriction, including without limitation
7f83d1c31SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8f83d1c31SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9f83d1c31SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10f83d1c31SBen Skeggs *
11f83d1c31SBen Skeggs * The above copyright notice and this permission notice shall be included in
12f83d1c31SBen Skeggs * all copies or substantial portions of the Software.
13f83d1c31SBen Skeggs *
14f83d1c31SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15f83d1c31SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16f83d1c31SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17f83d1c31SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18f83d1c31SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19f83d1c31SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20f83d1c31SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21f83d1c31SBen Skeggs */
22f83d1c31SBen Skeggs #include "priv.h"
23f83d1c31SBen Skeggs
24*426cce57SBen Skeggs #include <subdev/gsp.h>
25*426cce57SBen Skeggs
2658c3d3c8SBen Skeggs #include <nvif/class.h>
2758c3d3c8SBen Skeggs
28e6507380SBen Skeggs static const struct nvkm_intr_data
29e6507380SBen Skeggs ga100_vfn_intrs[] = {
30e6507380SBen Skeggs { NVKM_ENGINE_DISP , 0, 4, 0x04000000, true },
31e6507380SBen Skeggs { NVKM_SUBDEV_GPIO , 0, 4, 0x00200000, true },
32e6507380SBen Skeggs { NVKM_SUBDEV_I2C , 0, 4, 0x00200000, true },
33e6507380SBen Skeggs { NVKM_SUBDEV_PRIVRING, 0, 4, 0x40000000, true },
34e6507380SBen Skeggs {}
35e6507380SBen Skeggs };
36e6507380SBen Skeggs
37f83d1c31SBen Skeggs static const struct nvkm_vfn_func
38f83d1c31SBen Skeggs ga100_vfn = {
39e6507380SBen Skeggs .intr = &tu102_vfn_intr,
40e6507380SBen Skeggs .intrs = ga100_vfn_intrs,
4158c3d3c8SBen Skeggs .user = { 0x030000, 0x010000, { -1, -1, AMPERE_USERMODE_A } },
42f83d1c31SBen Skeggs };
43f83d1c31SBen Skeggs
44f83d1c31SBen Skeggs int
ga100_vfn_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_vfn ** pvfn)45f83d1c31SBen Skeggs ga100_vfn_new(struct nvkm_device *device,
46f83d1c31SBen Skeggs enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn)
47f83d1c31SBen Skeggs {
48*426cce57SBen Skeggs if (nvkm_gsp_rm(device->gsp))
49*426cce57SBen Skeggs return r535_vfn_new(&ga100_vfn, device, type, inst, 0xb80000, pvfn);
50*426cce57SBen Skeggs
51f83d1c31SBen Skeggs return nvkm_vfn_new_(&ga100_vfn, device, type, inst, 0xb80000, pvfn);
52f83d1c31SBen Skeggs }
53