public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] ppc/p4080: CoreNet platfrom style secondary core release
Date: Fri, 18 Sep 2009 15:59:52 -0500	[thread overview]
Message-ID: <1253307595-28655-5-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1253307595-28655-4-git-send-email-galak@kernel.crashing.org>

The CoreNet platform style of bringing secondary cores out of reset is
a bit different that the PQ3 style.  Mostly the registers that we use
to setup boot translation, enable time bases, and boot release the cores
have moved around.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 cpu/mpc85xx/mp.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
index fa65bed..b474218 100644
--- a/cpu/mpc85xx/mp.c
+++ b/cpu/mpc85xx/mp.c
@@ -26,6 +26,7 @@
 #include <lmb.h>
 #include <asm/io.h>
 #include <asm/mmu.h>
+#include <asm/fsl_law.h>
 #include "mp.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -135,6 +136,66 @@ ulong get_spin_addr(void)
 	return addr;
 }
 
+#ifdef CONFIG_FSL_CORENET
+static void corenet_mp_up(unsigned long bootpg)
+{
+	u32 up, cpu_up_mask, whoami;
+	u32 *table = (u32 *)get_spin_addr();
+	volatile ccsr_gur_t *gur;
+	volatile ccsr_local_t *ccm;
+	volatile ccsr_rcpm_t *rcpm;
+	volatile ccsr_pic_t *pic;
+	int timeout = 10;
+	u32 nr_cpus;
+	struct law_entry e;
+
+	gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+	ccm = (void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
+	rcpm = (void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR);
+	pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+
+	nr_cpus = ((in_be32(&pic->frr) >> 8) & 0xff) + 1;
+
+	whoami = in_be32(&pic->whoami);
+	cpu_up_mask = 1 << whoami;
+	out_be32(&ccm->bstrl, bootpg);
+
+	e = find_law(bootpg);
+	out_be32(&ccm->bstrar, LAWAR_EN | e.trgt_id << 20 | LAWAR_SIZE_4K);
+
+	/* disable time base@the platform */
+	out_be32(&rcpm->ctbenrl, cpu_up_mask);
+
+	/* release the hounds */
+	up = ((1 << nr_cpus) - 1);
+	out_be32(&gur->brrl, up);
+
+	/* wait for everyone */
+	while (timeout) {
+		int i;
+		for (i = 0; i < nr_cpus; i++) {
+			if (table[i * NUM_BOOT_ENTRY + BOOT_ENTRY_ADDR_LOWER])
+				cpu_up_mask |= (1 << i);
+		};
+
+		if ((cpu_up_mask & up) == up)
+			break;
+
+		udelay(100);
+		timeout--;
+	}
+
+	if (timeout == 0)
+		printf("CPU up timeout. CPU up mask is %x should be %x\n",
+			cpu_up_mask, up);
+
+	/* enable time base@the platform */
+	out_be32(&rcpm->ctbenrl, 0);
+	mtspr(SPRN_TBWU, 0);
+	mtspr(SPRN_TBWL, 0);
+	out_be32(&rcpm->ctbenrl, (1 << nr_cpus) - 1);
+}
+#else
 static void pq3_mp_up(unsigned long bootpg)
 {
 	u32 up, cpu_up_mask, whoami;
@@ -196,6 +257,7 @@ static void pq3_mp_up(unsigned long bootpg)
 	devdisr &= ~(MPC85xx_DEVDISR_TB0 | MPC85xx_DEVDISR_TB1);
 	out_be32(&gur->devdisr, devdisr);
 }
+#endif
 
 void cpu_mp_lmb_reserve(struct lmb *lmb)
 {
@@ -217,7 +279,7 @@ void setup_mp(void)
 	if (i != -1) {
 		/* map reset page to bootpg so we can copy code there */
 		disable_tlb(i);
-	
+
 		set_tlb(1, 0xfffff000, bootpg, /* tlb, epn, rpn */
 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, /* perms, wimge */
 			0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
@@ -234,7 +296,11 @@ void setup_mp(void)
 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I, /* perms, wimge */
 			0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
 
+#ifdef CONFIG_FSL_CORENET
+		corenet_mp_up(bootpg);
+#else
 		pq3_mp_up(bootpg);
+#endif
 	} else {
 		puts("WARNING: No reset page TLB. "
 			"Skipping secondary core setup\n");
-- 
1.6.0.6

  reply	other threads:[~2009-09-18 20:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 20:59 [U-Boot] [PATCH 0/7] ppc/p4080: infrastructure patches Kumar Gala
2009-09-18 20:59 ` [U-Boot] [PATCH 1/7] ppc/p4080: Add p4080 platform immap definitions Kumar Gala
2009-09-18 20:59   ` [U-Boot] [PATCH 2/7] ppc/p4080: Add support for CoreNet style platform LAWs Kumar Gala
2009-09-18 20:59     ` [U-Boot] [PATCH 3/7] ppc/p4080: CoreNet platfrom style CCSRBAR setting Kumar Gala
2009-09-18 20:59       ` Kumar Gala [this message]
2009-09-18 20:59         ` [U-Boot] [PATCH 5/7] ppc/p4080: Add various p4080 related defines (and p4040) Kumar Gala
2009-09-18 20:59           ` [U-Boot] [PATCH 6/7] ppc/p4080: Handle timebase enabling and frequency reporting Kumar Gala
2009-09-18 20:59             ` [U-Boot] [PATCH 7/7] ppc/p4080: Determine various chip frequencies on CoreNet platforms Kumar Gala
2009-09-18 22:09             ` [U-Boot] [PATCH 6/7] ppc/p4080: Handle timebase enabling and frequency reporting Scott Wood
2009-09-22 22:09             ` Wolfgang Denk
2009-09-22 22:07         ` [U-Boot] [PATCH 4/7] ppc/p4080: CoreNet platfrom style secondary core release Wolfgang Denk
2009-09-23 17:03           ` Kumar Gala
2009-09-18 21:55     ` [U-Boot] [PATCH 2/7] ppc/p4080: Add support for CoreNet style platform LAWs Scott Wood
2009-09-18 21:56       ` Scott Wood
2009-09-18 21:58         ` Ben Warren
2009-09-18 22:48       ` Kumar Gala
2009-09-22 22:05     ` Wolfgang Denk
2009-09-23 16:07       ` Kumar Gala
2009-09-18 21:20   ` [U-Boot] [PATCH 1/7] ppc/p4080: Add p4080 platform immap definitions Scott Wood
2009-09-18 21:33     ` Kumar Gala

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=1253307595-28655-5-git-send-email-galak@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=u-boot@lists.denx.de \
    /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