Skip to content

Commit f4c7896

Browse files
Finn Thaingregkh
authored andcommitted
powerpc/tau: Use appropriate temperature sample interval
[ Upstream commit 6694300 ] According to the MPC750 Users Manual, the SITV value in Thermal Management Register 3 is 13 bits long. The present code calculates the SITV value as 60 * 500 cycles. This would overflow to give 10 us on a 500 MHz CPU rather than the intended 60 us. (But according to the Microprocessor Datasheet, there is also a factor of 266 that has to be applied to this value on certain parts i.e. speed sort above 266 MHz.) Always use the maximum cycle count, as recommended by the Datasheet. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Stan Johnson <userm57@yahoo.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/896f542e5f0f1d6cf8218524c2b67d79f3d69b3c.1599260540.git.fthain@telegraphics.com.au Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8bcbb7e commit f4c7896

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

arch/powerpc/include/asm/reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@
683683
#define THRM1_TIN (1 << 31)
684684
#define THRM1_TIV (1 << 30)
685685
#define THRM1_THRES(x) ((x&0x7f)<<23)
686-
#define THRM3_SITV(x) ((x&0x3fff)<<1)
686+
#define THRM3_SITV(x) ((x & 0x1fff) << 1)
687687
#define THRM1_TID (1<<2)
688688
#define THRM1_TIE (1<<1)
689689
#define THRM1_V (1<<0)

arch/powerpc/kernel/tau_6xx.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,11 @@ static void tau_timeout(void * info)
174174
* complex sleep code needs to be added. One mtspr every time
175175
* tau_timeout is called is probably not a big deal.
176176
*
177-
* Enable thermal sensor and set up sample interval timer
178-
* need 20 us to do the compare.. until a nice 'cpu_speed' function
179-
* call is implemented, just assume a 500 mhz clock. It doesn't really
180-
* matter if we take too long for a compare since it's all interrupt
181-
* driven anyway.
182-
*
183-
* use a extra long time.. (60 us @ 500 mhz)
177+
* The "PowerPC 740 and PowerPC 750 Microprocessor Datasheet"
178+
* recommends that "the maximum value be set in THRM3 under all
179+
* conditions."
184180
*/
185-
mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E);
181+
mtspr(SPRN_THRM3, THRM3_SITV(0x1fff) | THRM3_E);
186182

187183
local_irq_restore(flags);
188184
}

0 commit comments

Comments
 (0)