aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-02-05 18:58:09 -0500
committerBen Skeggs <bskeggs@redhat.com>2012-05-24 02:31:27 -0400
commit19a1e47799fcce3ef9fb8aa58729e0ad7ac3c268 (patch)
tree4d2e851bae44fc9f4bc4a547ab0571c15f438bc0 /drivers/gpu/drm/nouveau
parent2b20fd0ab497df5284743975e4204c1c2b03a397 (diff)
drm/nva3/pm: another few magic regs, and slightly better 0x004018 handling
Not entirely convinced 0x004018 transitions are correct yet, but, it's an improvement. The 750MHz value comes from fiddling with the binary driver + coolbits on two different DDR3 NVA8 chipsets (T510 NVS3100M, and NVS300), not a clue where this number comes from. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nva3_pm.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index 8cbe59a8852b..d51e8f86b4d5 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -248,6 +248,8 @@ struct nva3_pm_state {
248 u8 rammap_len; 248 u8 rammap_len;
249 u8 *ramcfg; 249 u8 *ramcfg;
250 u8 ramcfg_len; 250 u8 ramcfg_len;
251 u32 r004018;
252 u32 r100760;
251}; 253};
252 254
253void * 255void *
@@ -383,19 +385,19 @@ mclk_clock_set(struct nouveau_mem_exec_func *exec)
383 if (!(ctrl & 0x00000008) && info->mclk.pll) { 385 if (!(ctrl & 0x00000008) && info->mclk.pll) {
384 nv_wr32(dev, 0x004000, (ctrl |= 0x00000008)); 386 nv_wr32(dev, 0x004000, (ctrl |= 0x00000008));
385 nv_mask(dev, 0x1110e0, 0x00088000, 0x00088000); 387 nv_mask(dev, 0x1110e0, 0x00088000, 0x00088000);
386 nv_wr32(dev, 0x004018, 0x00001000); /*XXX*/ 388 nv_wr32(dev, 0x004018, 0x00001000);
387 nv_wr32(dev, 0x004000, (ctrl &= ~0x00000001)); 389 nv_wr32(dev, 0x004000, (ctrl &= ~0x00000001));
388 nv_wr32(dev, 0x004004, info->mclk.pll); 390 nv_wr32(dev, 0x004004, info->mclk.pll);
389 nv_wr32(dev, 0x004000, (ctrl |= 0x00000001)); 391 nv_wr32(dev, 0x004000, (ctrl |= 0x00000001));
390 udelay(64); 392 udelay(64);
391 nv_wr32(dev, 0x004018, 0x10005000); /*XXX*/ 393 nv_wr32(dev, 0x004018, 0x00005000 | info->r004018);
392 udelay(20); 394 udelay(20);
393 } else 395 } else
394 if (!info->mclk.pll) { 396 if (!info->mclk.pll) {
395 nv_mask(dev, 0x004168, 0x003f3040, info->mclk.clk); 397 nv_mask(dev, 0x004168, 0x003f3040, info->mclk.clk);
396 nv_wr32(dev, 0x004000, (ctrl |= 0x00000008)); 398 nv_wr32(dev, 0x004000, (ctrl |= 0x00000008));
397 nv_mask(dev, 0x1110e0, 0x00088000, 0x00088000); 399 nv_mask(dev, 0x1110e0, 0x00088000, 0x00088000);
398 nv_wr32(dev, 0x004018, 0x1000d000); /*XXX*/ 400 nv_wr32(dev, 0x004018, 0x0000d000 | info->r004018);
399 } 401 }
400 402
401 if (info->rammap) { 403 if (info->rammap) {
@@ -414,6 +416,9 @@ mclk_clock_set(struct nouveau_mem_exec_func *exec)
414 } else { 416 } else {
415 nv_mask(dev, 0x10053c, 0x00001000, 0x00001000); 417 nv_mask(dev, 0x10053c, 0x00001000, 0x00001000);
416 nv_mask(dev, 0x10f804, 0x80000000, 0x00000000); 418 nv_mask(dev, 0x10f804, 0x80000000, 0x00000000);
419 nv_mask(dev, 0x100760, 0x22222222, info->r100760);
420 nv_mask(dev, 0x1007a0, 0x22222222, info->r100760);
421 nv_mask(dev, 0x1007e0, 0x22222222, info->r100760);
417 } 422 }
418 } 423 }
419 424
@@ -480,6 +485,12 @@ prog_mem(struct drm_device *dev, struct nva3_pm_state *info)
480 }; 485 };
481 u32 ctrl; 486 u32 ctrl;
482 487
488 /* XXX: where the fuck does 750MHz come from? */
489 if (info->perflvl->memory <= 750000) {
490 info->r004018 = 0x10000000;
491 info->r100760 = 0x22222222;
492 }
493
483 ctrl = nv_rd32(dev, 0x004000); 494 ctrl = nv_rd32(dev, 0x004000);
484 if (ctrl & 0x00000008) { 495 if (ctrl & 0x00000008) {
485 if (info->mclk.pll) { 496 if (info->mclk.pll) {
@@ -489,7 +500,7 @@ prog_mem(struct drm_device *dev, struct nva3_pm_state *info)
489 nv_wr32(dev, 0x004000, (ctrl &= 0xffffffef)); 500 nv_wr32(dev, 0x004000, (ctrl &= 0xffffffef));
490 nv_wait(dev, 0x004000, 0x00020000, 0x00020000); 501 nv_wait(dev, 0x004000, 0x00020000, 0x00020000);
491 nv_wr32(dev, 0x004000, (ctrl |= 0x00000010)); 502 nv_wr32(dev, 0x004000, (ctrl |= 0x00000010));
492 nv_wr32(dev, 0x004018, 0x00005000); /*XXX*/ 503 nv_wr32(dev, 0x004018, 0x00005000 | info->r004018);
493 nv_wr32(dev, 0x004000, (ctrl |= 0x00000004)); 504 nv_wr32(dev, 0x004000, (ctrl |= 0x00000004));
494 } 505 }
495 } else { 506 } else {