MIPS: Netlogic: Add support for XLP 3XX cores
authorJayachandran C <jayachandranc@netlogicmicro.com>
Wed, 16 Nov 2011 00:21:29 +0000 (00:21 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 7 Dec 2011 22:04:56 +0000 (22:04 +0000)
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>
arch/mips/include/asm/cpu.h
arch/mips/kernel/cpu-probe.c
arch/mips/netlogic/xlp/nlm_hal.c

index 6e94c7e2c164674fdd35b401cb952b31d3705b7b..a71c25b62580c31873e2a9624aa5e9420383fc6f 100644 (file)
 #define PRID_IMP_NETLOGIC_XLS408B      0x4e00
 #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
  */
index 92fae7f459cf3ab6b4ea2c5fb429ad4e0bd48c85..40c9c51c80e379c9377edb9f05c21a8c371929bc 100644 (file)
@@ -1025,7 +1025,8 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
                        MIPS_CPU_LLSC);
 
        switch (c->processor_id & 0xff00) {
-       case PRID_IMP_NETLOGIC_XLP832:
+       case PRID_IMP_NETLOGIC_XLP8XX:
+       case PRID_IMP_NETLOGIC_XLP3XX:
                c->cputype = CPU_XLP;
                __cpu_name[cpu] = "Netlogic XLP";
                break;
index 885f6878594a4d06e9f3ca40e13eb415748fd420..9428e7125fed5d08f8f7161479187e51f8c288c3 100644 (file)
@@ -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);
+}
This page took 0.031542 seconds and 5 git commands to generate.