[Nouveau] [PATCH 1/3] nvkm/clk/gf100+: Clean up PLL locking test

Roy Spliet nouveau at spliet.org
Sat Jun 4 23:49:11 UTC 2016


Corresponds with GT215. Don't rely on the lock test logic being unconditionally
enabled, and disable test logic when done (presumably to save power). Warn when
locking fails.

Signed-off-by: Roy Spliet <nouveau at spliet.org>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c | 15 ++++++++++++---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c | 15 ++++++++++++---
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
index 78c449b..f9a4918 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
@@ -366,11 +366,20 @@ 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);
-			nvkm_msec(device, 2000,
+
+			/* Test PLL lock */
+			nvkm_mask(device, addr + 0x00, 0x00000010, 0x00000000);
+			if (nvkm_msec(device, 2000,
 				if (nvkm_rd32(device, addr + 0x00) & 0x00020000)
 					break;
-			);
-			nvkm_mask(device, addr + 0x00, 0x00020004, 0x00000004);
+			) < 0) {
+				nvkm_warn(&clk->base.subdev,
+						"Could not lock PLL %d", idx);
+			}
+			nvkm_mask(device, addr + 0x00, 0x00000010, 0x00000010);
+
+			/* Enable sync mode */
+			nvkm_mask(device, addr + 0x00, 0x00000004, 0x00000004);
 		}
 	}
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
index 975c401..b650f0c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
@@ -393,11 +393,20 @@ 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);
-		nvkm_msec(device, 2000,
+
+		/* Test PLL lock */
+		nvkm_mask(device, addr + 0x00, 0x00000010, 0x00000000);
+		if (nvkm_msec(device, 2000,
 			if (nvkm_rd32(device, addr + 0x00) & 0x00020000)
 				break;
-		);
-		nvkm_mask(device, addr + 0x00, 0x00020004, 0x00000004);
+		) < 0) {
+			nvkm_warn(&clk->base.subdev, "Could not lock PLL %d",
+					idx);
+		}
+		nvkm_mask(device, addr + 0x00, 0x00000010, 0x00000010);
+
+		/* Enable sync mode */
+		nvkm_mask(device, addr + 0x00, 0x00000004, 0x00000004);
 	}
 }
 
-- 
2.5.5



More information about the Nouveau mailing list