diff options
author | Dave Airlie <airlied@dave6.(none)> | 2010-06-04 15:23:24 +1000 |
---|---|---|
committer | Dave Airlie <airlied@dave6.(none)> | 2010-06-04 15:23:24 +1000 |
commit | b8e594bf9a38eb59a0c23a11809aa534acbcd30a (patch) | |
tree | 048a6dfbec7afc086c96de6f3c74e55d7eba06a4 | |
parent | 73042e03a8ed97f263e60c042090d2e7ddaa8ce2 (diff) |
radeon: fix clock cntl smashing on setting a value
-rw-r--r-- | radeontool.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/radeontool.c b/radeontool.c index 520a8af..ba20c78 100644 --- a/radeontool.c +++ b/radeontool.c @@ -102,9 +102,15 @@ static unsigned int radeon_get_indexed(unsigned long index_offset, static void radeon_set_indexed(unsigned long index_offset, unsigned long data_offset, unsigned long offset, - const char *name, unsigned int value) + const char *name, unsigned int value, int index_mask) { - radeon_set(index_offset, "index", offset); + unsigned int temp = offset; + if (index_mask) { + temp = radeon_get(index_offset, "index"); + temp &= ~index_mask; + temp += offset; + } + radeon_set(index_offset, "index", temp); radeon_set(data_offset, name, value); } @@ -119,7 +125,7 @@ static void radeon_set_clk(unsigned long offset, const char *name, unsigned int value) { return radeon_set_indexed(RADEON_CLOCK_CNTL_INDEX, RADEON_CLOCK_CNTL_DATA, - offset | RADEON_PLL_WR_EN, name, value); + offset | RADEON_PLL_WR_EN, name, value, 0xff); } static unsigned int radeon_get_mcind(unsigned long offset, const char *name) @@ -130,7 +136,7 @@ static unsigned int radeon_get_mcind(unsigned long offset, const char *name) static void radeon_set_mcind(unsigned long offset, const char *name, unsigned int value) { - return radeon_set_indexed(0x1f8, 0x1fc, offset | (1 << 8), name, value); + return radeon_set_indexed(0x1f8, 0x1fc, offset | (1 << 8), name, value, 0); } static void usage(void) |