drm/nouveau/mc: allow for local definition of reset bits
authorBen Skeggs <bskeggs@redhat.com>
Fri, 8 Apr 2016 07:24:40 +0000 (17:24 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 20 May 2016 04:43:04 +0000 (14:43 +1000)
With the addition of PTOP-specified reset bits, it makes more sense to
move the definitions here rather than in individual subdev
implementations.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h

index 9518301..3793bc7 100644 (file)
@@ -81,8 +81,21 @@ static void
 nvkm_mc_reset_(struct nvkm_mc *mc, enum nvkm_devidx devidx)
 {
        struct nvkm_device *device = mc->subdev.device;
-       struct nvkm_subdev *subdev = nvkm_device_subdev(device, devidx);
-       u64 pmc_enable = subdev->pmc_enable;
+       const struct nvkm_mc_map *map;
+       u64 pmc_enable = 0;
+
+       for (map = mc->func->reset; map && map->stat; map++) {
+               if (map->unit == devidx) {
+                       pmc_enable = map->stat;
+                       break;
+               }
+       }
+
+       if (!pmc_enable) {
+               struct nvkm_subdev *subdev = nvkm_device_subdev(device, devidx);
+               pmc_enable = subdev->pmc_enable;
+       }
+
        if (pmc_enable) {
                nvkm_mask(device, 0x000200, pmc_enable, 0x00000000);
                nvkm_mask(device, 0x000200, pmc_enable, pmc_enable);
index fa2b2d6..b80385b 100644 (file)
@@ -20,6 +20,7 @@ struct nvkm_mc_func {
        void (*intr_rearm)(struct nvkm_mc *);
        /* retrieve pending interrupt mask (NV_PMC_INTR) */
        u32 (*intr_mask)(struct nvkm_mc *);
+       const struct nvkm_mc_map *reset;
        void (*unk260)(struct nvkm_mc *, u32);
 };