diff options
author | Anton Blanchard <anton@samba.org> | 2006-06-20 04:47:26 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-06-21 01:01:33 -0400 |
commit | 0bb474a48e5d1ceb8e4005c7664b548c9834a784 (patch) | |
tree | 8ad98249b5fc854b0db2f02f7a4db5e4a9d56586 /arch | |
parent | ccba051c373e342de240ba00d542dac67ae0eb7e (diff) |
[POWERPC] support ibm,extended-*-frequency properties
Support the ibm,extended-*-frequency properties found in recent POWER5
firmware:
cpus/PowerPC,POWER5@0/clock-frequency
59aa5880 (1504336000)
cpus/PowerPC,POWER5@0/ibm,extended-clock-frequency
00000000 59aa5880
cpus/PowerPC,POWER5@0/timebase-frequency
0b354b10 (188042000)
cpus/PowerPC,POWER5@0/ibm,extended-timebase-frequency
00000000 0b354b10
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/time.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 528e7f84cb67..d20907561f46 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -857,42 +857,50 @@ int do_settimeofday(struct timespec *tv) | |||
857 | 857 | ||
858 | EXPORT_SYMBOL(do_settimeofday); | 858 | EXPORT_SYMBOL(do_settimeofday); |
859 | 859 | ||
860 | void __init generic_calibrate_decr(void) | 860 | static int __init get_freq(char *name, int cells, unsigned long *val) |
861 | { | 861 | { |
862 | struct device_node *cpu; | 862 | struct device_node *cpu; |
863 | unsigned int *fp; | 863 | unsigned int *fp; |
864 | int node_found; | 864 | int found = 0; |
865 | 865 | ||
866 | /* | 866 | /* The cpu node should have timebase and clock frequency properties */ |
867 | * The cpu node should have a timebase-frequency property | ||
868 | * to tell us the rate at which the decrementer counts. | ||
869 | */ | ||
870 | cpu = of_find_node_by_type(NULL, "cpu"); | 867 | cpu = of_find_node_by_type(NULL, "cpu"); |
871 | 868 | ||
872 | ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ | ||
873 | node_found = 0; | ||
874 | if (cpu) { | 869 | if (cpu) { |
875 | fp = (unsigned int *)get_property(cpu, "timebase-frequency", | 870 | fp = (unsigned int *)get_property(cpu, name, NULL); |
876 | NULL); | ||
877 | if (fp) { | 871 | if (fp) { |
878 | node_found = 1; | 872 | found = 1; |
879 | ppc_tb_freq = *fp; | 873 | *val = 0; |
874 | while (cells--) | ||
875 | *val = (*val << 32) | *fp++; | ||
880 | } | 876 | } |
877 | |||
878 | of_node_put(cpu); | ||
881 | } | 879 | } |
882 | if (!node_found) | 880 | |
881 | return found; | ||
882 | } | ||
883 | |||
884 | void __init generic_calibrate_decr(void) | ||
885 | { | ||
886 | ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ | ||
887 | |||
888 | if (!get_freq("ibm,extended-timebase-frequency", 2, &ppc_tb_freq) && | ||
889 | !get_freq("timebase-frequency", 1, &ppc_tb_freq)) { | ||
890 | |||
883 | printk(KERN_ERR "WARNING: Estimating decrementer frequency " | 891 | printk(KERN_ERR "WARNING: Estimating decrementer frequency " |
884 | "(not found)\n"); | 892 | "(not found)\n"); |
893 | } | ||
885 | 894 | ||
886 | ppc_proc_freq = DEFAULT_PROC_FREQ; | 895 | ppc_proc_freq = DEFAULT_PROC_FREQ; /* hardcoded default */ |
887 | node_found = 0; | 896 | |
888 | if (cpu) { | 897 | if (!get_freq("ibm,extended-clock-frequency", 2, &ppc_proc_freq) && |
889 | fp = (unsigned int *)get_property(cpu, "clock-frequency", | 898 | !get_freq("clock-frequency", 1, &ppc_proc_freq)) { |
890 | NULL); | 899 | |
891 | if (fp) { | 900 | printk(KERN_ERR "WARNING: Estimating processor frequency " |
892 | node_found = 1; | 901 | "(not found)\n"); |
893 | ppc_proc_freq = *fp; | ||
894 | } | ||
895 | } | 902 | } |
903 | |||
896 | #ifdef CONFIG_BOOKE | 904 | #ifdef CONFIG_BOOKE |
897 | /* Set the time base to zero */ | 905 | /* Set the time base to zero */ |
898 | mtspr(SPRN_TBWL, 0); | 906 | mtspr(SPRN_TBWL, 0); |
@@ -904,11 +912,6 @@ void __init generic_calibrate_decr(void) | |||
904 | /* Enable decrementer interrupt */ | 912 | /* Enable decrementer interrupt */ |
905 | mtspr(SPRN_TCR, TCR_DIE); | 913 | mtspr(SPRN_TCR, TCR_DIE); |
906 | #endif | 914 | #endif |
907 | if (!node_found) | ||
908 | printk(KERN_ERR "WARNING: Estimating processor frequency " | ||
909 | "(not found)\n"); | ||
910 | |||
911 | of_node_put(cpu); | ||
912 | } | 915 | } |
913 | 916 | ||
914 | unsigned long get_boot_time(void) | 917 | unsigned long get_boot_time(void) |