Skip to content

Commit

Permalink
drm/nouveau/clk/gf100: Read secondary bypass postdiv when required
Browse files Browse the repository at this point in the history
v2: fix typo it's -> its

Signed-off-by: Roy Spliet <nouveau@spliet.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Roy Spliet authored and Ben Skeggs committed Jul 14, 2016
1 parent 0f7fbb9 commit f8fa2e4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
}
Expand Down

0 comments on commit f8fa2e4

Please sign in to comment.