aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-01-26 19:53:17 -0500
committerBen Skeggs <bskeggs@redhat.com>2012-05-24 02:31:16 -0400
commit27740383dde9e1f309a74cf39d96f3223dbf281c (patch)
treee34637989d61d6a16763a7ce0d5bcccdc8a7e8c6
parent65115bb05a9380a256907ae307135248ac1c29b4 (diff)
drm/nva3/pm: initial attempt at more magic PFB regs
The reg calculation may get moved elsewhere at some point, but lets figure out what exactly we need to do first. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_perf.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.h4
-rw-r--r--drivers/gpu/drm/nouveau/nva3_pm.c25
3 files changed, 28 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c
index 69a528d106e6..ea6acf1c4a78 100644
--- a/drivers/gpu/drm/nouveau/nouveau_perf.c
+++ b/drivers/gpu/drm/nouveau/nouveau_perf.c
@@ -83,7 +83,7 @@ nouveau_perf_entry(struct drm_device *dev, int idx,
83 return NULL; 83 return NULL;
84} 84}
85 85
86static u8 * 86u8 *
87nouveau_perf_rammap(struct drm_device *dev, u32 freq, 87nouveau_perf_rammap(struct drm_device *dev, u32 freq,
88 u8 *ver, u8 *hdr, u8 *cnt, u8 *len) 88 u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
89{ 89{
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.h b/drivers/gpu/drm/nouveau/nouveau_pm.h
index 3f82dfea61dd..07cac72c72b4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.h
@@ -61,8 +61,10 @@ int nouveau_voltage_gpio_set(struct drm_device *, int voltage);
61/* nouveau_perf.c */ 61/* nouveau_perf.c */
62void nouveau_perf_init(struct drm_device *); 62void nouveau_perf_init(struct drm_device *);
63void nouveau_perf_fini(struct drm_device *); 63void nouveau_perf_fini(struct drm_device *);
64u8 *nouveau_perf_timing(struct drm_device *, u32 freq, u8 *ver, u8 *len); 64u8 *nouveau_perf_rammap(struct drm_device *, u32 freq, u8 *ver,
65 u8 *hdr, u8 *cnt, u8 *len);
65u8 *nouveau_perf_ramcfg(struct drm_device *, u32 freq, u8 *ver, u8 *len); 66u8 *nouveau_perf_ramcfg(struct drm_device *, u32 freq, u8 *ver, u8 *len);
67u8 *nouveau_perf_timing(struct drm_device *, u32 freq, u8 *ver, u8 *len);
66 68
67/* nouveau_mem.c */ 69/* nouveau_mem.c */
68void nouveau_mem_timing_init(struct drm_device *); 70void nouveau_mem_timing_init(struct drm_device *);
diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index 3d397845dca9..86d0de084784 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -354,8 +354,11 @@ mclk_mrs(struct nouveau_mem_exec_func *exec, int mr, u32 data)
354static void 354static void
355mclk_clock_set(struct nouveau_mem_exec_func *exec) 355mclk_clock_set(struct nouveau_mem_exec_func *exec)
356{ 356{
357 struct nva3_pm_state *info = exec->priv;
358 struct drm_device *dev = exec->dev; 357 struct drm_device *dev = exec->dev;
358 struct nva3_pm_state *info = exec->priv;
359 struct nouveau_pm_level *perflvl = info->perflvl;
360 u32 freq = perflvl->memory;
361 u8 *rammap, *ramcfg, ver, hdr, cnt, len;
359 362
360 nv_wr32(dev, 0x004018, 0x00001000); 363 nv_wr32(dev, 0x004018, 0x00001000);
361 364
@@ -365,6 +368,26 @@ mclk_clock_set(struct nouveau_mem_exec_func *exec)
365 nv_wr32(dev, 0x004018, 0x1000d000); 368 nv_wr32(dev, 0x004018, 0x1000d000);
366 else 369 else
367 nv_wr32(dev, 0x004018, 0x10005000); 370 nv_wr32(dev, 0x004018, 0x10005000);
371
372 rammap = nouveau_perf_rammap(dev, freq, &ver, &hdr, &cnt, &len);
373 if (rammap && ver == 0x10 && hdr >= 5) {
374 ramcfg = nouveau_perf_ramcfg(dev, freq, &ver, &len);
375 if (ramcfg && (rammap[4] & 0x08)) {
376 u32 unk5a0 = (ROM16(ramcfg[5]) << 8) | ramcfg[5];
377 u32 unk5a4 = ROM16(ramcfg[7]);
378 u32 unk804 = (ramcfg[9] & 0xf0) << 16 |
379 (ramcfg[3] & 0x0f) << 16 |
380 (ramcfg[9] & 0x0f) |
381 0x80000000;
382 nv_wr32(dev, 0x1005a0, unk5a0);
383 nv_wr32(dev, 0x1005a4, unk5a4);
384 nv_wr32(dev, 0x10f804, unk804);
385 nv_mask(dev, 0x10053c, 0x00001000, 0x00000000);
386 } else {
387 nv_mask(dev, 0x10053c, 0x00001000, 0x00001000);
388 nv_mask(dev, 0x10f804, 0x80000000, 0x00000000);
389 }
390 }
368} 391}
369 392
370static void 393static void