aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/netlogic
diff options
context:
space:
mode:
authorJayachandran C <jayachandranc@netlogicmicro.com>2011-11-15 19:21:29 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:04:56 -0500
commit2aa54b2009bb4f85cdc42d16dde18093dd832a31 (patch)
tree0e9adc109b4c8bc8e2cfe983bef40380b72c12bf /arch/mips/netlogic
parent66d29985fab8207b1b2c03ac34a2c294c5b47a30 (diff)
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')
-rw-r--r--arch/mips/netlogic/xlp/nlm_hal.c26
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)
86 } 86 }
87} 87}
88 88
89unsigned int nlm_get_cpu_frequency(void) 89unsigned int nlm_get_core_frequency(int core)
90{ 90{
91 unsigned int pll_divf, pll_divr, dfs_div, denom; 91 unsigned int pll_divf, pll_divr, dfs_div, ext_div;
92 unsigned int val; 92 unsigned int rstval, dfsval, denom;
93 uint64_t num; 93 uint64_t num;
94 94
95 val = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG); 95 rstval = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG);
96 pll_divf = (val >> 10) & 0x7f; 96 dfsval = nlm_read_sys_reg(nlm_sys_base, SYS_CORE_DFS_DIV_VALUE);
97 pll_divr = (val >> 8) & 0x3; 97 pll_divf = ((rstval >> 10) & 0x7f) + 1;
98 dfs_div = (val >> 17) & 0x3; 98 pll_divr = ((rstval >> 8) & 0x3) + 1;
99 ext_div = ((rstval >> 30) & 0x3) + 1;
100 dfs_div = ((dfsval >> (core * 4)) & 0xf) + 1;
99 101
100 num = pll_divf + 1; 102 num = 800000000ULL * pll_divf;
101 denom = 3 * (pll_divr + 1) * (1 << (dfs_div + 1)); 103 denom = 3 * pll_divr * ext_div * dfs_div;
102 num = num * 800000000ULL;
103 do_div(num, denom); 104 do_div(num, denom);
104 return (unsigned int)num; 105 return (unsigned int)num;
105} 106}
107
108unsigned int nlm_get_cpu_frequency(void)
109{
110 return nlm_get_core_frequency(0);
111}