mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
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>
This commit is contained in:
parent
66d29985fa
commit
2aa54b2009
3 changed files with 21 additions and 12 deletions
|
@ -170,7 +170,9 @@
|
||||||
#define PRID_IMP_NETLOGIC_XLS408B 0x4e00
|
#define PRID_IMP_NETLOGIC_XLS408B 0x4e00
|
||||||
#define PRID_IMP_NETLOGIC_XLS404B 0x4f00
|
#define PRID_IMP_NETLOGIC_XLS404B 0x4f00
|
||||||
|
|
||||||
#define PRID_IMP_NETLOGIC_XLP832 0x1000
|
#define PRID_IMP_NETLOGIC_XLP8XX 0x1000
|
||||||
|
#define PRID_IMP_NETLOGIC_XLP3XX 0x1100
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definitions for 7:0 on legacy processors
|
* Definitions for 7:0 on legacy processors
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1025,7 +1025,8 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
|
||||||
MIPS_CPU_LLSC);
|
MIPS_CPU_LLSC);
|
||||||
|
|
||||||
switch (c->processor_id & 0xff00) {
|
switch (c->processor_id & 0xff00) {
|
||||||
case PRID_IMP_NETLOGIC_XLP832:
|
case PRID_IMP_NETLOGIC_XLP8XX:
|
||||||
|
case PRID_IMP_NETLOGIC_XLP3XX:
|
||||||
c->cputype = CPU_XLP;
|
c->cputype = CPU_XLP;
|
||||||
__cpu_name[cpu] = "Netlogic XLP";
|
__cpu_name[cpu] = "Netlogic XLP";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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 pll_divf, pll_divr, dfs_div, ext_div;
|
||||||
unsigned int val;
|
unsigned int rstval, dfsval, denom;
|
||||||
uint64_t num;
|
uint64_t num;
|
||||||
|
|
||||||
val = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG);
|
rstval = nlm_read_sys_reg(nlm_sys_base, SYS_POWER_ON_RESET_CFG);
|
||||||
pll_divf = (val >> 10) & 0x7f;
|
dfsval = nlm_read_sys_reg(nlm_sys_base, SYS_CORE_DFS_DIV_VALUE);
|
||||||
pll_divr = (val >> 8) & 0x3;
|
pll_divf = ((rstval >> 10) & 0x7f) + 1;
|
||||||
dfs_div = (val >> 17) & 0x3;
|
pll_divr = ((rstval >> 8) & 0x3) + 1;
|
||||||
|
ext_div = ((rstval >> 30) & 0x3) + 1;
|
||||||
|
dfs_div = ((dfsval >> (core * 4)) & 0xf) + 1;
|
||||||
|
|
||||||
num = pll_divf + 1;
|
num = 800000000ULL * pll_divf;
|
||||||
denom = 3 * (pll_divr + 1) * (1 << (dfs_div + 1));
|
denom = 3 * pll_divr * ext_div * dfs_div;
|
||||||
num = num * 800000000ULL;
|
|
||||||
do_div(num, denom);
|
do_div(num, denom);
|
||||||
return (unsigned int)num;
|
return (unsigned int)num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int nlm_get_cpu_frequency(void)
|
||||||
|
{
|
||||||
|
return nlm_get_core_frequency(0);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue