Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28809
b: refs/heads/master
c: 0bb474a
h: refs/heads/master
i:
  28807: 17da13c
v: v3
  • Loading branch information
Anton Blanchard authored and Paul Mackerras committed Jun 21, 2006
1 parent 48ab91a commit 9328eb4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ccba051c373e342de240ba00d542dac67ae0eb7e
refs/heads/master: 0bb474a48e5d1ceb8e4005c7664b548c9834a784
57 changes: 30 additions & 27 deletions trunk/arch/powerpc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,42 +857,50 @@ int do_settimeofday(struct timespec *tv)

EXPORT_SYMBOL(do_settimeofday);

void __init generic_calibrate_decr(void)
static int __init get_freq(char *name, int cells, unsigned long *val)
{
struct device_node *cpu;
unsigned int *fp;
int node_found;
int found = 0;

/*
* The cpu node should have a timebase-frequency property
* to tell us the rate at which the decrementer counts.
*/
/* The cpu node should have timebase and clock frequency properties */
cpu = of_find_node_by_type(NULL, "cpu");

ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
node_found = 0;
if (cpu) {
fp = (unsigned int *)get_property(cpu, "timebase-frequency",
NULL);
fp = (unsigned int *)get_property(cpu, name, NULL);
if (fp) {
node_found = 1;
ppc_tb_freq = *fp;
found = 1;
*val = 0;
while (cells--)
*val = (*val << 32) | *fp++;
}

of_node_put(cpu);
}
if (!node_found)

return found;
}

void __init generic_calibrate_decr(void)
{
ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */

if (!get_freq("ibm,extended-timebase-frequency", 2, &ppc_tb_freq) &&
!get_freq("timebase-frequency", 1, &ppc_tb_freq)) {

printk(KERN_ERR "WARNING: Estimating decrementer frequency "
"(not found)\n");
}

ppc_proc_freq = DEFAULT_PROC_FREQ;
node_found = 0;
if (cpu) {
fp = (unsigned int *)get_property(cpu, "clock-frequency",
NULL);
if (fp) {
node_found = 1;
ppc_proc_freq = *fp;
}
ppc_proc_freq = DEFAULT_PROC_FREQ; /* hardcoded default */

if (!get_freq("ibm,extended-clock-frequency", 2, &ppc_proc_freq) &&
!get_freq("clock-frequency", 1, &ppc_proc_freq)) {

printk(KERN_ERR "WARNING: Estimating processor frequency "
"(not found)\n");
}

#ifdef CONFIG_BOOKE
/* Set the time base to zero */
mtspr(SPRN_TBWL, 0);
Expand All @@ -904,11 +912,6 @@ void __init generic_calibrate_decr(void)
/* Enable decrementer interrupt */
mtspr(SPRN_TCR, TCR_DIE);
#endif
if (!node_found)
printk(KERN_ERR "WARNING: Estimating processor frequency "
"(not found)\n");

of_node_put(cpu);
}

unsigned long get_boot_time(void)
Expand Down

0 comments on commit 9328eb4

Please sign in to comment.