From: Jayachandran C <jayachandranc@netlogicmicro.com>
To: <ralf@linux-mips.org>, <linux-mips@linux-mips.org>
Subject: [PATCH 11/12] MIPS: Netlogic: Add support for XLP 3XX cores
Date: Sun, 23 Oct 2011 19:12:52 +0530 [thread overview]
Message-ID: <20111023134246.GA29137@jayachandranc.netlogicmicro.com> (raw)
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>
---
arch/mips/include/asm/cpu.h | 4 +++-
arch/mips/kernel/cpu-probe.c | 3 ++-
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 4bcb668b..4617e5d 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -167,7 +167,9 @@
#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
*/
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 501d302..757a3c4 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1021,7 +1021,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;
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 885f687..9428e71 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);
+}
--
1.7.4.1
WARNING: multiple messages have this Message-ID (diff)
From: Jayachandran C <jayachandranc@netlogicmicro.com>
To: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: [PATCH 11/12] MIPS: Netlogic: Add support for XLP 3XX cores
Date: Sun, 23 Oct 2011 19:12:52 +0530 [thread overview]
Message-ID: <20111023134246.GA29137@jayachandranc.netlogicmicro.com> (raw)
Message-ID: <20111023134252.9SWKBec2Ug3vwG8bIPJblf-5IkPR0GvahBWFAdQzLF4@z> (raw)
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>
---
arch/mips/include/asm/cpu.h | 4 +++-
arch/mips/kernel/cpu-probe.c | 3 ++-
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 4bcb668b..4617e5d 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -167,7 +167,9 @@
#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
*/
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 501d302..757a3c4 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1021,7 +1021,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;
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 885f687..9428e71 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);
+}
--
1.7.4.1
next reply other threads:[~2011-10-23 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-23 13:42 Jayachandran C [this message]
2011-10-23 13:42 ` [PATCH 11/12] MIPS: Netlogic: Add support for XLP 3XX cores Jayachandran C
-- strict thread matches above, loose matches on Subject: below --
2011-11-11 11:37 [PATCH 00/12] MIPS: Support for Netlogic XLP processors Jayachandran C
2011-11-11 11:40 ` [PATCH 11/12] MIPS: Netlogic: Add support for XLP 3XX cores Jayachandran C
2011-11-11 11:40 ` Jayachandran C
2011-11-16 0:48 ` Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111023134246.GA29137@jayachandranc.netlogicmicro.com \
--to=jayachandranc@netlogicmicro.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox