diff options
author | Jayachandran C <jayachandranc@netlogicmicro.com> | 2011-11-16 00:21:29 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-07 22:04:56 +0000 |
commit | 2aa54b2009bb4f85cdc42d16dde18093dd832a31 (patch) | |
tree | 0e9adc109b4c8bc8e2cfe983bef40380b72c12bf /arch/mips/netlogic/xlp/nlm_hal.c | |
parent | 66d29985fab8207b1b2c03ac34a2c294c5b47a30 (diff) | |
download | linux-2aa54b2009bb4f85cdc42d16dde18093dd832a31.tar.gz linux-2aa54b2009bb4f85cdc42d16dde18093dd832a31.tar.bz2 linux-2aa54b2009bb4f85cdc42d16dde18093dd832a31.zip |
MIPS: Netlogic: Add support for XLP 3XX cores
Add new processor ID to asm/cpu.h and kernel/cpu-probe.c.
Update to new CPU frequency detection code which works on XLP 3XX
and 8XX.
Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2971/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/netlogic/xlp/nlm_hal.c')
-rw-r--r-- | arch/mips/netlogic/xlp/nlm_hal.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c index 885f6878594a..9428e7125fed 100644 --- a/arch/mips/netlogic/xlp/nlm_hal.c +++ b/arch/mips/netlogic/xlp/nlm_hal.c @@ -86,20 +86,26 @@ int nlm_irt_to_irq(int irt) } } -unsigned int nlm_get_cpu_frequency(void) +unsigned int nlm_get_core_frequency(int core) { - unsigned int pll_divf, pll_divr, dfs_div, denom; - unsigned int val; + unsigned int pll_divf, pll_divr, dfs_div, ext_div; + unsigned int rstval, dfsval, denom; uint64_t num; - val = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG); - pll_divf = (val >> 10) & 0x7f; - pll_divr = (val >> 8) & 0x3; - dfs_div = (val >> 17) & 0x3; + rstval = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG); + dfsval = nlm_read_sys_reg(nlm_sys_base, SYS_CORE_DFS_DIV_VALUE); + pll_divf = ((rstval >> 10) & 0x7f) + 1; + pll_divr = ((rstval >> 8) & 0x3) + 1; + ext_div = ((rstval >> 30) & 0x3) + 1; + dfs_div = ((dfsval >> (core * 4)) & 0xf) + 1; - num = pll_divf + 1; - denom = 3 * (pll_divr + 1) * (1 << (dfs_div + 1)); - num = num * 800000000ULL; + num = 800000000ULL * pll_divf; + denom = 3 * pll_divr * ext_div * dfs_div; do_div(num, denom); return (unsigned int)num; } + +unsigned int nlm_get_cpu_frequency(void) +{ + return nlm_get_core_frequency(0); +} |