aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_mem.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-01-24 03:30:10 -0500
committerBen Skeggs <bskeggs@redhat.com>2012-03-13 03:09:14 -0400
commit070be296b65d120c2fef58a5435f159ae32c4995 (patch)
tree5ed322feb58ab38c3404082ffc2e15d9c9a18467 /drivers/gpu/drm/nouveau/nouveau_mem.c
parent25c53c1068a804c6b51f86e937cebab6274dc056 (diff)
drm/nouveau/mem: handle dll_off for ddr2/ddr3
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Martin Peres <martin.peres@labri.fr>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_mem.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index e4ba4abca31a..8ff0027302a6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -735,8 +735,6 @@ nouveau_mem_gddr3_mr(struct drm_device *dev, u32 freq,
735 struct nouveau_pm_memtiming *boot, 735 struct nouveau_pm_memtiming *boot,
736 struct nouveau_pm_memtiming *t) 736 struct nouveau_pm_memtiming *t)
737{ 737{
738 u8 rver, rlen, *ramcfg = nouveau_perf_ramcfg(dev, freq, &rver, &rlen);
739
740 if (len < 15) { 738 if (len < 15) {
741 t->drive_strength = boot->drive_strength; 739 t->drive_strength = boot->drive_strength;
742 t->odt = boot->odt; 740 t->odt = boot->odt;
@@ -765,17 +763,9 @@ nouveau_mem_gddr3_mr(struct drm_device *dev, u32 freq,
765 /* CAS */ 763 /* CAS */
766 ((nv_mem_cl_lut_gddr3[e->tCL] & 0x7) << 4) | 764 ((nv_mem_cl_lut_gddr3[e->tCL] & 0x7) << 4) |
767 ((nv_mem_cl_lut_gddr3[e->tCL] & 0x8) >> 2); 765 ((nv_mem_cl_lut_gddr3[e->tCL] & 0x8) >> 2);
768
769 t->mr[1] = (boot->mr[1] & 0x100f40) | t->drive_strength | 766 t->mr[1] = (boot->mr[1] & 0x100f40) | t->drive_strength |
770 (t->odt << 2) | 767 (t->odt << 2) |
771 (nv_mem_wr_lut_gddr3[e->tWR] & 0xf) << 4; 768 (nv_mem_wr_lut_gddr3[e->tWR] & 0xf) << 4;
772 if (ramcfg && rver == 0x00) {
773 /* DLL enable/disable */
774 t->mr[1] &= ~0x00000040;
775 if (ramcfg[3] & 0x08)
776 t->mr[1] |= 0x00000040;
777 }
778
779 t->mr[2] = boot->mr[2]; 769 t->mr[2] = boot->mr[2];
780 770
781 NV_DEBUG(dev, "(%u) MR: %08x %08x %08x", t->id, 771 NV_DEBUG(dev, "(%u) MR: %08x %08x %08x", t->id,
@@ -832,7 +822,7 @@ nouveau_mem_timing_calc(struct drm_device *dev, u32 freq,
832 struct nouveau_pm_engine *pm = &dev_priv->engine.pm; 822 struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
833 struct nouveau_pm_memtiming *boot = &pm->boot.timing; 823 struct nouveau_pm_memtiming *boot = &pm->boot.timing;
834 struct nouveau_pm_tbl_entry *e; 824 struct nouveau_pm_tbl_entry *e;
835 u8 ver, len, *ptr; 825 u8 ver, len, *ptr, *ramcfg;
836 int ret; 826 int ret;
837 827
838 ptr = nouveau_perf_timing(dev, freq, &ver, &len); 828 ptr = nouveau_perf_timing(dev, freq, &ver, &len);
@@ -874,6 +864,28 @@ nouveau_mem_timing_calc(struct drm_device *dev, u32 freq,
874 break; 864 break;
875 default: 865 default:
876 ret = -EINVAL; 866 ret = -EINVAL;
867 break;
868 }
869
870 ramcfg = nouveau_perf_ramcfg(dev, freq, &ver, &len);
871 if (ramcfg) {
872 int dll_off;
873
874 if (ver == 0x00)
875 dll_off = !!(ramcfg[3] & 0x04);
876 else
877 dll_off = !!(ramcfg[2] & 0x40);
878
879 switch (dev_priv->vram_type) {
880 case NV_MEM_TYPE_GDDR3:
881 t->mr[1] &= ~0x00000040;
882 t->mr[1] |= 0x00000040 * dll_off;
883 break;
884 default:
885 t->mr[1] &= ~0x00000001;
886 t->mr[1] |= 0x00000001 * dll_off;
887 break;
888 }
877 } 889 }
878 890
879 return ret; 891 return ret;