drm/nouveau/fb/gddr5: make sure we update mr7 when we're supposed to
authorBen Skeggs <bskeggs@redhat.com>
Tue, 3 Dec 2013 01:09:55 +0000 (11:09 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 23 Jan 2014 03:39:02 +0000 (13:39 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c

index 16f0117e8e91640d8a647feba7dcf7935351f3b8..66fe959b4f7431dd2cc1b9ce6520263560fb769f 100644 (file)
 #include <subdev/bios.h>
 #include "priv.h"
 
+/* binary driver only executes this path if the condition (a) is true
+ * for any configuration (combination of rammap+ramcfg+timing) that
+ * can be reached on a given card.  for now, we will execute the branch
+ * unconditionally in the hope that a "false everywhere" in the bios
+ * tables doesn't actually mean "don't touch this".
+ */
+#define NOTE00(a) 1
+
 int
 nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts)
 {
@@ -99,10 +107,11 @@ nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts)
        ram->mr[6] |= (vo & 0xff) << 4;
        ram->mr[6] |= (pd & 0x01) << 0;
 
-       if (!(ram->mr[7] & 0x100))
-               vr = 0; /* binary driver does this.. bug? */
-       ram->mr[7] &= ~0x388;
-       ram->mr[7] |= (vr & 0x03) << 8;
+       if (NOTE00(vr)) {
+               ram->mr[7] &= ~0x300;
+               ram->mr[7] |= (vr & 0x03) << 8;
+       }
+       ram->mr[7] &= ~0x088;
        ram->mr[7] |= (vh & 0x01) << 7;
        ram->mr[7] |= (lf & 0x01) << 3;