From: "Jayachandran C" <jchandra@broadcom.com>
To: linux-mips@linux-mips.org
Cc: "Jayachandran C" <jchandra@broadcom.com>, ralf@linux-mips.org
Subject: [PATCH 11/18 UPDATED] MIPS: Netlogic: SYS block updates of XLP9XX
Date: Tue, 22 Oct 2013 16:52:09 +0530 [thread overview]
Message-ID: <1382440929-10941-1-git-send-email-jchandra@broadcom.com> (raw)
In-Reply-To: <1381756874-22616-16-git-send-email-jchandra@broadcom.com>
Add the SYS block registers for XLP9XX, most of them have changed.
The wakeup sequence has been updated to set the coherent mode from
the main thread rather than the woken up thread.
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
Updated to apply cleanly after change to 06/18 in this patchset
arch/mips/include/asm/netlogic/xlp-hal/sys.h | 18 ++++++-
arch/mips/netlogic/common/reset.S | 8 +++
arch/mips/netlogic/xlp/nlm_hal.c | 5 +-
arch/mips/netlogic/xlp/setup.c | 5 +-
arch/mips/netlogic/xlp/wakeup.c | 74 ++++++++++++++++++--------
5 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/sys.h b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
index fcf2833..d9b107f 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/sys.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
@@ -147,13 +147,29 @@
#define SYS_SYS_PLL_MEM_REQ 0x2a3
#define SYS_PLL_MEM_STAT 0x2a4
+/* Registers changed on 9XX */
+#define SYS_9XX_POWER_ON_RESET_CFG 0x00
+#define SYS_9XX_CHIP_RESET 0x01
+#define SYS_9XX_CPU_RESET 0x02
+#define SYS_9XX_CPU_NONCOHERENT_MODE 0x03
+
+/* XLP 9XX fuse block registers */
+#define FUSE_9XX_DEVCFG6 0xc6
+
#ifndef __ASSEMBLY__
#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r)
#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v)
-#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(XLP_IO_SYS_OFFSET(node))
+#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
+ XLP9XX_IO_SYS_OFFSET(node) : XLP_IO_SYS_OFFSET(node))
#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ)
+/* XLP9XX fuse block */
+#define nlm_get_fuse_pcibase(node) \
+ nlm_pcicfg_base(XLP9XX_IO_FUSE_OFFSET(node))
+#define nlm_get_fuse_regbase(node) \
+ (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ)
+
unsigned int nlm_get_pic_frequency(int node);
#endif
#endif
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S
index 57eb7a1..dfbf94d 100644
--- a/arch/mips/netlogic/common/reset.S
+++ b/arch/mips/netlogic/common/reset.S
@@ -159,6 +159,13 @@ FEXPORT(nlm_reset_entry)
nop
1: /* Entry point on core wakeup */
+ mfc0 t0, CP0_EBASE, 0 /* processor ID */
+ andi t0, 0xff00
+ li t1, 0x1500 /* XLP 9xx */
+ beq t0, t1, 2f /* does not need to set coherent */
+ nop
+
+ /* set bit in SYS coherent register for the core */
mfc0 t0, CP0_EBASE, 1
mfc0 t1, CP0_EBASE, 1
srl t1, 5
@@ -180,6 +187,7 @@ FEXPORT(nlm_reset_entry)
lw t1, 0(t2)
sync
+2:
/* Configure LSU on Non-0 Cores. */
xlp_config_lsu
/* FALL THROUGH */
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 2d31cf1..61f325d 100644
--- a/arch/mips/netlogic/xlp/nlm_hal.c
+++ b/arch/mips/netlogic/xlp/nlm_hal.c
@@ -174,7 +174,10 @@ unsigned int nlm_get_core_frequency(int node, int core)
uint64_t num, sysbase;
sysbase = nlm_get_node(node)->sysbase;
- rstval = nlm_read_sys_reg(sysbase, SYS_POWER_ON_RESET_CFG);
+ if (cpu_is_xlp9xx())
+ rstval = nlm_read_sys_reg(sysbase, SYS_9XX_POWER_ON_RESET_CFG);
+ else
+ rstval = nlm_read_sys_reg(sysbase, SYS_POWER_ON_RESET_CFG);
if (cpu_is_xlpii()) {
num = 1000000ULL * (400 * 3 + 100 * (rstval >> 26));
denom = 3;
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index fb4dd71..a3c1a95 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -56,7 +56,10 @@ static void nlm_linux_exit(void)
{
uint64_t sysbase = nlm_get_node(0)->sysbase;
- nlm_write_sys_reg(sysbase, SYS_CHIP_RESET, 1);
+ if (cpu_is_xlp9xx())
+ nlm_write_sys_reg(sysbase, SYS_9XX_CHIP_RESET, 1);
+ else
+ nlm_write_sys_reg(sysbase, SYS_CHIP_RESET, 1);
for ( ; ; )
cpu_wait();
}
diff --git a/arch/mips/netlogic/xlp/wakeup.c b/arch/mips/netlogic/xlp/wakeup.c
index 598b4c3..7e3c5b9 100644
--- a/arch/mips/netlogic/xlp/wakeup.c
+++ b/arch/mips/netlogic/xlp/wakeup.c
@@ -54,7 +54,7 @@
static int xlp_wakeup_core(uint64_t sysbase, int node, int core)
{
uint32_t coremask, value;
- int count;
+ int count, resetreg;
coremask = (1 << core);
@@ -65,12 +65,24 @@ static int xlp_wakeup_core(uint64_t sysbase, int node, int core)
nlm_write_sys_reg(sysbase, SYS_CORE_DFS_DIS_CTRL, value);
}
+ /* On 9XX, mark coherent first */
+ if (cpu_is_xlp9xx()) {
+ value = nlm_read_sys_reg(sysbase, SYS_9XX_CPU_NONCOHERENT_MODE);
+ value &= ~coremask;
+ nlm_write_sys_reg(sysbase, SYS_9XX_CPU_NONCOHERENT_MODE, value);
+ }
+
/* Remove CPU Reset */
- value = nlm_read_sys_reg(sysbase, SYS_CPU_RESET);
+ resetreg = cpu_is_xlp9xx() ? SYS_9XX_CPU_RESET : SYS_CPU_RESET;
+ value = nlm_read_sys_reg(sysbase, resetreg);
value &= ~coremask;
- nlm_write_sys_reg(sysbase, SYS_CPU_RESET, value);
+ nlm_write_sys_reg(sysbase, resetreg, value);
+
+ /* We are done on 9XX */
+ if (cpu_is_xlp9xx())
+ return 1;
- /* Poll for CPU to mark itself coherent */
+ /* Poll for CPU to mark itself coherent on other type of XLP */
count = 100000;
do {
value = nlm_read_sys_reg(sysbase, SYS_CPU_NONCOHERENT_MODE);
@@ -98,33 +110,48 @@ static int wait_for_cpus(int cpu, int bootcpu)
static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
{
struct nlm_soc_info *nodep;
- uint64_t syspcibase;
+ uint64_t syspcibase, fusebase;
uint32_t syscoremask, mask, fusemask;
int core, n, cpu;
for (n = 0; n < NLM_NR_NODES; n++) {
- syspcibase = nlm_get_sys_pcibase(n);
- if (nlm_read_reg(syspcibase, 0) == 0xffffffff)
- break;
+ if (n != 0) {
+ /* check if node exists and is online */
+ if (cpu_is_xlp9xx()) {
+ int b = xlp9xx_get_socbus(n);
+ pr_info("Node %d SoC PCI bus %d.\n", n, b);
+ if (b == 0)
+ break;
+ } else {
+ syspcibase = nlm_get_sys_pcibase(n);
+ if (nlm_read_reg(syspcibase, 0) == 0xffffffff)
+ break;
+ }
+ nlm_node_init(n);
+ }
/* read cores in reset from SYS */
- if (n != 0)
- nlm_node_init(n);
nodep = nlm_get_node(n);
- fusemask = nlm_read_sys_reg(nodep->sysbase,
- SYS_EFUSE_DEVICE_CFG_STATUS0);
- switch (read_c0_prid() & 0xff00) {
- case PRID_IMP_NETLOGIC_XLP3XX:
- mask = 0xf;
- break;
- case PRID_IMP_NETLOGIC_XLP2XX:
- mask = 0x3;
- break;
- case PRID_IMP_NETLOGIC_XLP8XX:
- default:
- mask = 0xff;
- break;
+ if (cpu_is_xlp9xx()) {
+ fusebase = nlm_get_fuse_regbase(n);
+ fusemask = nlm_read_reg(fusebase, FUSE_9XX_DEVCFG6);
+ mask = 0xfffff;
+ } else {
+ fusemask = nlm_read_sys_reg(nodep->sysbase,
+ SYS_EFUSE_DEVICE_CFG_STATUS0);
+ switch (read_c0_prid() & 0xff00) {
+ case PRID_IMP_NETLOGIC_XLP3XX:
+ mask = 0xf;
+ break;
+ case PRID_IMP_NETLOGIC_XLP2XX:
+ mask = 0x3;
+ break;
+ case PRID_IMP_NETLOGIC_XLP8XX:
+ default:
+ mask = 0xff;
+ break;
+ }
}
/*
@@ -137,6 +164,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
if (n == 0)
nodep->coremask = 1;
+ pr_info("Node %d - SYS/FUSE coremask %x\n", n, syscoremask);
for (core = 0; core < NLM_CORES_PER_NODE; core++) {
/* we will be on node 0 core 0 */
if (n == 0 && core == 0)
--
1.7.9.5
next prev parent reply other threads:[~2013-10-22 11:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 13:20 [PATCH 00/18] Broadcom XLP Updates Jayachandran C
2013-10-14 13:20 ` [PATCH 01/18] MIPS: Netlogic: Add MSI support for XLP Jayachandran C
2013-10-14 13:20 ` [PATCH 02/18] MIPS: Netlogic: Add topology.h for XLP family Jayachandran C
2013-10-14 13:20 ` [PATCH 03/18] MIPS: Netlogic: Some cleanups for assembly code Jayachandran C
2013-10-14 13:21 ` [PATCH 04/18] MIPS: Netlogic: L1D cacheflush before thread enable on XLPII Jayachandran C
2013-10-14 13:21 ` [PATCH 05/18] MIPS: Netlogic: Add macro for node present Jayachandran C
2013-10-14 13:21 ` [PATCH 06/18] MIPS: Netlogic: Get coremask from FUSE register Jayachandran C
2013-10-15 12:09 ` Sergei Shtylyov
2013-10-22 11:19 ` [PATCH 06/18 UPDATED] " Jayachandran C
2013-10-14 13:21 ` [PATCH 07/18] MIPS: Netlogic: Core wakeup improvements Jayachandran C
2013-10-14 13:21 ` [PATCH 08/18] MIPS: Netlogic: Identify XLP 9XX chip Jayachandran C
2013-10-14 13:21 ` [PATCH 09/18] MIPS: Netlogic: update iomap.h for XLP9XX Jayachandran C
2013-10-14 13:21 ` [PATCH 10/18] MIPS: Netlogic: XLP9XX PIC updates Jayachandran C
2013-10-14 13:21 ` [PATCH 11/18] MIPS: Netlogic: SYS block updates of XLP9XX Jayachandran C
2013-10-22 11:20 ` [PATCH 11/18 UPDATED] " Jayachandran C
2013-10-14 13:21 ` [PATCH 12/18] MIPS: Netlogic: XLP9XX UART offset Jayachandran C
2013-10-14 13:21 ` [PATCH 13/18] MIPS: Netlogic: XLP9XX bridge and DRAM code Jayachandran C
2013-10-14 13:21 ` [PATCH 14/18] MIPS: Netlogic: Add cpu to node mapping for XLP9XX Jayachandran C
2013-10-14 13:21 ` [PATCH 15/18] MIPS: PCI: Netlogic XLP9XX support Jayachandran C
2013-10-22 11:22 ` Jayachandran C [this message]
2013-10-22 11:26 ` [PATCH 15/18 UPDATED] " Jayachandran C
2013-10-14 13:21 ` [PATCH 16/18] MIPS: Netlogic: XLP9XX USB support Jayachandran C
2013-10-14 13:21 ` [PATCH 17/18] MIPS: Netlogic: XLP9XX PIC OF support Jayachandran C
2013-10-15 12:28 ` Sergei Shtylyov
2013-10-22 11:23 ` Jayachandran C
2013-10-14 13:21 ` [PATCH 18/18] MIPS: Netlogic: Add default DTB for XLP9XX SoC Jayachandran C
2013-10-25 8:52 ` [PATCH 18/18 UPDATED] " Jayachandran C
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=1382440929-10941-1-git-send-email-jchandra@broadcom.com \
--to=jchandra@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.