diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-11-06 22:27:33 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-07 19:17:34 -0500 |
commit | 4350147a816b9c5b40fa59e4fa23f17490630b79 (patch) | |
tree | c333986047de60aa90809d669895726610c0c3e5 /include | |
parent | a82765b6eee3d1267ded3320ca67b39fe1844599 (diff) |
[PATCH] ppc64: SMU based macs cpufreq support
CPU freq support using 970FX powertune facility for iMac G5 and SMU
based single CPU desktop.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/reg.h | 9 | ||||
-rw-r--r-- | include/asm-powerpc/smu.h | 60 |
2 files changed, 67 insertions, 2 deletions
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index da848412f11b..489cf4c99c21 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
@@ -396,6 +396,9 @@ | |||
396 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ | 396 | #define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ |
397 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ | 397 | #define SPRN_XER 0x001 /* Fixed Point Exception Register */ |
398 | 398 | ||
399 | #define SPRN_SCOMC 0x114 /* SCOM Access Control */ | ||
400 | #define SPRN_SCOMD 0x115 /* SCOM Access DATA */ | ||
401 | |||
399 | /* Performance monitor SPRs */ | 402 | /* Performance monitor SPRs */ |
400 | #ifdef CONFIG_PPC64 | 403 | #ifdef CONFIG_PPC64 |
401 | #define SPRN_MMCR0 795 | 404 | #define SPRN_MMCR0 795 |
@@ -594,7 +597,11 @@ static inline void ppc64_runlatch_off(void) | |||
594 | mtspr(SPRN_CTRLT, ctrl); | 597 | mtspr(SPRN_CTRLT, ctrl); |
595 | } | 598 | } |
596 | } | 599 | } |
597 | #endif | 600 | |
601 | extern unsigned long scom970_read(unsigned int address); | ||
602 | extern void scom970_write(unsigned int address, unsigned long value); | ||
603 | |||
604 | #endif /* CONFIG_PPC64 */ | ||
598 | 605 | ||
599 | #define __get_SP() ({unsigned long sp; \ | 606 | #define __get_SP() ({unsigned long sp; \ |
600 | asm volatile("mr %0,1": "=r" (sp)); sp;}) | 607 | asm volatile("mr %0,1": "=r" (sp)); sp;}) |
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index dee8eefe47bc..959bad660233 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
@@ -144,7 +144,11 @@ | |||
144 | * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is | 144 | * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is |
145 | * used to set the voltage slewing point. The SMU replies with "DONE" | 145 | * used to set the voltage slewing point. The SMU replies with "DONE" |
146 | * I yet have to figure out their exact meaning of those 3 bytes in | 146 | * I yet have to figure out their exact meaning of those 3 bytes in |
147 | * both cases. | 147 | * both cases. They seem to be: |
148 | * x = processor mask | ||
149 | * y = op. point index | ||
150 | * z = processor freq. step index | ||
151 | * I haven't yet decyphered result codes | ||
148 | * | 152 | * |
149 | */ | 153 | */ |
150 | #define SMU_CMD_POWER_COMMAND 0xaa | 154 | #define SMU_CMD_POWER_COMMAND 0xaa |
@@ -333,6 +337,60 @@ extern int smu_queue_i2c(struct smu_i2c_cmd *cmd); | |||
333 | 337 | ||
334 | #endif /* __KERNEL__ */ | 338 | #endif /* __KERNEL__ */ |
335 | 339 | ||
340 | |||
341 | /* | ||
342 | * - SMU "sdb" partitions informations - | ||
343 | */ | ||
344 | |||
345 | |||
346 | /* | ||
347 | * Partition header format | ||
348 | */ | ||
349 | struct smu_sdbp_header { | ||
350 | __u8 id; | ||
351 | __u8 len; | ||
352 | __u8 version; | ||
353 | __u8 flags; | ||
354 | }; | ||
355 | |||
356 | /* | ||
357 | * 32 bits integers are usually encoded with 2x16 bits swapped, | ||
358 | * this demangles them | ||
359 | */ | ||
360 | #define SMU_U32_MIX(x) ((((x) << 16) & 0xffff0000u) | (((x) >> 16) & 0xffffu)) | ||
361 | |||
362 | /* This is the definition of the SMU sdb-partition-0x12 table (called | ||
363 | * CPU F/V/T operating points in Darwin). The definition for all those | ||
364 | * SMU tables should be moved to some separate file | ||
365 | */ | ||
366 | #define SMU_SDB_FVT_ID 0x12 | ||
367 | |||
368 | struct smu_sdbp_fvt { | ||
369 | __u32 sysclk; /* Base SysClk frequency in Hz for | ||
370 | * this operating point | ||
371 | */ | ||
372 | __u8 pad; | ||
373 | __u8 maxtemp; /* Max temp. supported by this | ||
374 | * operating point | ||
375 | */ | ||
376 | |||
377 | __u16 volts[3]; /* CPU core voltage for the 3 | ||
378 | * PowerTune modes, a mode with | ||
379 | * 0V = not supported. | ||
380 | */ | ||
381 | }; | ||
382 | |||
383 | #ifdef __KERNEL__ | ||
384 | /* | ||
385 | * This returns the pointer to an SMU "sdb" partition data or NULL | ||
386 | * if not found. The data format is described below | ||
387 | */ | ||
388 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, | ||
389 | unsigned int *size); | ||
390 | |||
391 | #endif /* __KERNEL__ */ | ||
392 | |||
393 | |||
336 | /* | 394 | /* |
337 | * - Userland interface - | 395 | * - Userland interface - |
338 | */ | 396 | */ |