Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54018
b: refs/heads/master
c: f86bd61
h: refs/heads/master
v: v3
  • Loading branch information
Uwe Kleine-König authored and Russell King committed Apr 21, 2007
1 parent d6c49a5 commit 03201bf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 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: 940089e007e8ed33295ef408b39a53e5ad518ebd
refs/heads/master: f86bd61fd70af02e666a893aaf22653181423e99
34 changes: 32 additions & 2 deletions trunk/include/asm-arm/arch-ns9xxx/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,43 @@
#ifndef __ASM_ARCH_CLOCK_H
#define __ASM_ARCH_CLOCK_H

#include <asm/arch-ns9xxx/regs-sys.h>

#define CRYSTAL 29491200 /* Hz */

/* The HRM calls this value f_vco */
static inline u32 ns9xxx_systemclock(void) __attribute__((const));
static inline u32 ns9xxx_systemclock(void)
{
u32 pll = SYS_PLL;

/*
* This should be a multiple of HZ * TIMERCLOCKSELECT (in time.c)
* The system clock should be a multiple of HZ * TIMERCLOCKSELECT (in
* time.c).
*
* The following values are given:
* - TIMERCLOCKSELECT == 2^i for an i in {0 .. 6}
* - CRYSTAL == 29491200 == 2^17 * 3^2 * 5^2
* - ND in {0 .. 31}
* - FS in {0 .. 3}
*
* Assuming the worst, we consider:
* - TIMERCLOCKSELECT == 64
* - ND == 0
* - FS == 3
*
* So HZ should be a divisor of:
* (CRYSTAL * (ND + 1) >> FS) / TIMERCLOCKSELECT
* == (2^17 * 3^2 * 5^2 * 1 >> 3) / 64
* == 2^8 * 3^2 * 5^2
* == 57600
*
* Currently HZ is defined to be 100 for this platform.
*
* Fine.
*/
return 353894400;
return CRYSTAL * (REGGET(pll, SYS_PLL, ND) + 1)
>> REGGET(pll, SYS_PLL, FS);
}

static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
Expand Down

0 comments on commit 03201bf

Please sign in to comment.