nvkm/clk/gf100+: Clean up PLL locking test
Subsystems (3)
PATCH v2 1/2 nvkm/clk/gf100+: Clean up PLL locking test
Corresponds with GT215. Don't rely on the lock test logic being unconditionally enabled, and disable test logic when done (presumably to save power).
v2: Remove warning, nvkm_msec already warns on time-out
Signed-off-by Roy Spliet <[email protected]>
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c | 8 +++++++- drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c +7 -1
@@ -366,11 +366,17 @@ gf100_clk_prog_2(struct gf100_clk *clk, int idx)if (info->coef) {nvkm_wr32 (device, addr +0x04 , info->coef);nvkm_mask (device, addr +0x00 ,0x00000001 ,0x00000001 ); + +/* Test PLL lock */ +nvkm_mask (device, addr +0x00 ,0x00000010 ,0x00000000 );nvkm_msec (device,2000 , if (nvkm_rd32(device, addr + 0x00) & 0x00020000) break; ); -nvkm_mask (device, addr +0x00 ,0x00020004 ,0x00000004 ); +nvkm_mask (device, addr +0x00 ,0x00000010 ,0x00000010 ); + +/* Enable sync mode */ +nvkm_mask (device, addr +0x00 ,0x00000004 ,0x00000004 ); } } }
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c +7 -1
@@ -393,11 +393,17 @@ gk104_clk_prog_2(struct gk104_clk *clk, int idx)if (info->coef) {nvkm_wr32 (device, addr +0x04 , info->coef);nvkm_mask (device, addr +0x00 ,0x00000001 ,0x00000001 ); + +/* Test PLL lock */ +nvkm_mask (device, addr +0x00 ,0x00000010 ,0x00000000 );nvkm_msec (device,2000 , if (nvkm_rd32(device, addr + 0x00) & 0x00020000) break; ); -nvkm_mask (device, addr +0x00 ,0x00020004 ,0x00000004 ); +nvkm_mask (device, addr +0x00 ,0x00000010 ,0x00000010 ); + +/* Enable sync mode */ +nvkm_mask (device, addr +0x00 ,0x00000004 ,0x00000004 ); } }
Signature · 6 lines
2.5.5 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1466198174-22089-1-git-send-email-nouveau-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org
PATCH v2 2/2 nvkm/clk/gf100: Read secondary bypass postdiv when required
v2: fix typo it's -> its
Signed-off-by Roy Spliet <[email protected]>
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c +14 -6
@@ -99,7 +99,7 @@ read_div(struct gf100_clk *clk, int doff, u32 dsrc, u32 dctl) {struct nvkm_device *device = clk->base.subdev.device;u32 ssrc =nvkm_rd32 (device, dsrc + (doff *4 )); -u32 sctl =nvkm_rd32 (device, dctl + (doff *4 )); +u32 sclk, sctl, sdiv =2 ;switch (ssrc &0x00000003 ) {case 0 :
@@ -109,13 +109,21 @@ read_div(struct gf100_clk *clk, int doff, u32 dsrc, u32 dctl)case 2 :return 100000 ;case 3 : -if (sctl &0x80000000 ) { -u32 sclk =read_vco (clk, dsrc + (doff *4 )); -u32 sdiv = (sctl &0x0000003f ) +2 ; -return (sclk *2 ) / sdiv; + sclk =read_vco (clk, dsrc + (doff *4 )); + +/* Memclk has doff of 0 despite its alt. location */ +if (doff <=2 ) { + sctl =nvkm_rd32 (device, dctl + (doff *4 )); + +if (sctl &0x80000000 ) { +if (ssrc &0x100 ) + sctl >>=8 ; + + sdiv = (sctl &0x3f ) +2 ; + } } -return read_vco (clk, dsrc + (doff *4 )); +return (sclk *2 ) / sdiv;default :return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau