diff options
-rw-r--r-- | arch/mips/include/asm/cpu.h | 4 | ||||
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 3 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/nlm_hal.c | 26 |
3 files changed, 21 insertions, 12 deletions
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 6e94c7e2c164..a71c25b62580 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -170,7 +170,9 @@ | |||
170 | #define PRID_IMP_NETLOGIC_XLS408B 0x4e00 | 170 | #define PRID_IMP_NETLOGIC_XLS408B 0x4e00 |
171 | #define PRID_IMP_NETLOGIC_XLS404B 0x4f00 | 171 | #define PRID_IMP_NETLOGIC_XLS404B 0x4f00 |
172 | 172 | ||
173 | #define PRID_IMP_NETLOGIC_XLP832 0x1000 | 173 | #define PRID_IMP_NETLOGIC_XLP8XX 0x1000 |
174 | #define PRID_IMP_NETLOGIC_XLP3XX 0x1100 | ||
175 | |||
174 | /* | 176 | /* |
175 | * Definitions for 7:0 on legacy processors | 177 | * Definitions for 7:0 on legacy processors |
176 | */ | 178 | */ |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 92fae7f459cf..40c9c51c80e3 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -1025,7 +1025,8 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu) | |||
1025 | MIPS_CPU_LLSC); | 1025 | MIPS_CPU_LLSC); |
1026 | 1026 | ||
1027 | switch (c->processor_id & 0xff00) { | 1027 | switch (c->processor_id & 0xff00) { |
1028 | case PRID_IMP_NETLOGIC_XLP832: | 1028 | case PRID_IMP_NETLOGIC_XLP8XX: |
1029 | case PRID_IMP_NETLOGIC_XLP3XX: | ||
1029 | c->cputype = CPU_XLP; | 1030 | c->cputype = CPU_XLP; |
1030 | __cpu_name[cpu] = "Netlogic XLP"; | 1031 | __cpu_name[cpu] = "Netlogic XLP"; |
1031 | break; | 1032 | break; |
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 | ||
89 | unsigned int nlm_get_cpu_frequency(void) | 89 | unsigned 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 | |||
108 | unsigned int nlm_get_cpu_frequency(void) | ||
109 | { | ||
110 | return nlm_get_core_frequency(0); | ||
111 | } | ||