All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Gang <Gang.Liu@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8 v2] powerpc/corenet_ds: Slave uploads ucode when boot from SRIO
Date: Tue, 17 Jan 2012 17:09:07 +0800	[thread overview]
Message-ID: <1326791349-20458-6-git-send-email-Gang.Liu@freescale.com> (raw)
In-Reply-To: <1326791349-20458-1-git-send-email-Gang.Liu@freescale.com>

When boot from SRIO, slave's ucode can be stored in master's memory space,
then slave can fetch the ucode image through SRIO interface. For the
corenet platform, ucode is for Fman.

Master needs to:
	1. Put the slave's ucode image into it's own memory space.
	2. Set an inbound SRIO window covered slave's ucode stored in master's
	   memory space.
Slave needs to:
	1. Set a specific TLB entry in order to fetch ucode from master.
	2. Set a LAW entry with the TargetID SRIO1 or SRIO2 for ucode.

Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
Changes in v2:
 - Subject changed to "powerpc/corenet_ds".
 - Use "(void *)" instead of "(u32)" when calling "out_be32()".
 - Use "NOR flash" instead of "Nor flash".
 - Get rid of the base address + offset notation. Use C structs
   instead.
 - Get rid of hard coded magic numbers. Use macro instead.
 - Use "debug()" instead of "printf()".
 - Correct some comment style errors.

 arch/powerpc/cpu/mpc8xxx/srio.c        |   25 +++++++++++++++++++++----
 board/freescale/common/p_corenet/law.c |    4 ++++
 board/freescale/common/p_corenet/tlb.c |   10 ++++++++++
 include/configs/corenet_ds.h           |   12 +++++++++++-
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xxx/srio.c b/arch/powerpc/cpu/mpc8xxx/srio.c
index 77fa32f..e593f22 100644
--- a/arch/powerpc/cpu/mpc8xxx/srio.c
+++ b/arch/powerpc/cpu/mpc8xxx/srio.c
@@ -100,8 +100,8 @@ void srio_boot_master(void)
 
 	debug("SRIOBOOT - MASTER: Master port [ %d ] for srio boot.\n",
 			CONFIG_SRIOBOOT_MASTER_PORT);
-	/* configure inbound window5 for slave's u-boot image */
-	debug("SRIOBOOT - MASTER: Inbound window 5 for slave's image; "
+	/* configure inbound window for slave's u-boot image */
+	debug("SRIOBOOT - MASTER: Inbound window for slave's image; "
 			"Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n",
 			(u64)CONFIG_SRIOBOOT_SLAVE_IMAGE_LAW_PHYS1,
 			(u64)CONFIG_SRIOBOOT_SLAVE_IMAGE_SRIO_PHYS1,
@@ -117,8 +117,8 @@ void srio_boot_master(void)
 			SRIO_IB_ATMU_AR
 			| atmu_size_mask(CONFIG_SRIOBOOT_SLAVE_IMAGE_SIZE));
 
-	/* configure inbound window4 for slave's u-boot image */
-	debug("SRIOBOOT - MASTER: Inbound window 4 for slave's image; "
+	/* configure inbound window for slave's u-boot image */
+	debug("SRIOBOOT - MASTER: Inbound window for slave's image; "
 			"Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n",
 			(u64)CONFIG_SRIOBOOT_SLAVE_IMAGE_LAW_PHYS2,
 			(u64)CONFIG_SRIOBOOT_SLAVE_IMAGE_SRIO_PHYS2,
@@ -133,5 +133,22 @@ void srio_boot_master(void)
 			.port[CONFIG_SRIOBOOT_MASTER_PORT].inbw[1].riwar,
 			SRIO_IB_ATMU_AR
 			| atmu_size_mask(CONFIG_SRIOBOOT_SLAVE_IMAGE_SIZE));
+
+	/* configure inbound window for slave's ucode */
+	debug("SRIOBOOT - MASTER: Inbound window for slave's ucode; "
+			"Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n",
+			(u64)CONFIG_SRIOBOOT_SLAVE_UCODE_LAW_PHYS,
+			(u64)CONFIG_SRIOBOOT_SLAVE_UCODE_SRIO_PHYS,
+			CONFIG_SRIOBOOT_SLAVE_UCODE_SIZE);
+	out_be32((void *)&srio->atmu
+			.port[CONFIG_SRIOBOOT_MASTER_PORT].inbw[2].riwtar,
+			CONFIG_SRIOBOOT_SLAVE_UCODE_LAW_PHYS >> 12);
+	out_be32((void *)&srio->atmu
+			.port[CONFIG_SRIOBOOT_MASTER_PORT].inbw[2].riwbar,
+			CONFIG_SRIOBOOT_SLAVE_UCODE_SRIO_PHYS >> 12);
+	out_be32((void *)&srio->atmu
+			.port[CONFIG_SRIOBOOT_MASTER_PORT].inbw[2].riwar,
+			SRIO_IB_ATMU_AR
+			| atmu_size_mask(CONFIG_SRIOBOOT_SLAVE_UCODE_SIZE));
 }
 #endif
diff --git a/board/freescale/common/p_corenet/law.c b/board/freescale/common/p_corenet/law.c
index 1fbab4d..c4566dd 100644
--- a/board/freescale/common/p_corenet/law.c
+++ b/board/freescale/common/p_corenet/law.c
@@ -52,9 +52,13 @@ struct law_entry law_table[] = {
 #if defined(CONFIG_SRIOBOOT_SLAVE_PORT0)
 	SET_LAW(CONFIG_SYS_SRIOBOOT_SLAVE_ADDR_PHYS,
 				LAW_SIZE_1M, LAW_TRGT_IF_RIO_1),
+	SET_LAW(CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR_PHYS,
+				LAW_SIZE_1M, LAW_TRGT_IF_RIO_1),
 #elif defined(CONFIG_SRIOBOOT_SLAVE_PORT1)
 	SET_LAW(CONFIG_SYS_SRIOBOOT_SLAVE_ADDR_PHYS,
 				LAW_SIZE_1M, LAW_TRGT_IF_RIO_2),
+	SET_LAW(CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR_PHYS,
+				LAW_SIZE_1M, LAW_TRGT_IF_RIO_2),
 #endif
 #endif
 };
diff --git a/board/freescale/common/p_corenet/tlb.c b/board/freescale/common/p_corenet/tlb.c
index a8c8b3c..6bb4c3f 100644
--- a/board/freescale/common/p_corenet/tlb.c
+++ b/board/freescale/common/p_corenet/tlb.c
@@ -147,6 +147,16 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 16, BOOKE_PAGESZ_1M, 1),
 #endif
+#ifdef CONFIG_SRIOBOOT_SLAVE
+	/*
+	 * *I*G - SRIOBOOT-SLAVE. 1M space from 0xffe00000 for fetching ucode
+	 * and ENV from master
+	 */
+	SET_TLB_ENTRY(1, CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR,
+		CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR_PHYS,
+		MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+		0, 17, BOOKE_PAGESZ_1M, 1),
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index cc65ce5..6bc1276 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -398,6 +398,13 @@
 #define CONFIG_SRIOBOOT_SLAVE_IMAGE_SIZE 0x80000	/* 512K */
 #define CONFIG_SRIOBOOT_SLAVE_IMAGE_LAW_PHYS2 0xfef080000ull
 #define CONFIG_SRIOBOOT_SLAVE_IMAGE_SRIO_PHYS2 0x3fff80000ull
+/*
+ * for slave UCODE instored in master memory space,
+ * PHYS must be aligned based on the SIZE
+ */
+#define CONFIG_SRIOBOOT_SLAVE_UCODE_LAW_PHYS 0xfef020000ull
+#define CONFIG_SRIOBOOT_SLAVE_UCODE_SRIO_PHYS 0x3ffe00000ull
+#define CONFIG_SRIOBOOT_SLAVE_UCODE_SIZE 0x10000	/* 64K */
 #endif
 
 /*
@@ -407,6 +414,9 @@
 /* slave port for srioboot */
 #define CONFIG_SRIOBOOT_SLAVE_PORT0
 /* #define CONFIG_SRIOBOOT_SLAVE_PORT1 */
+#define CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR 0xFFE00000
+#define CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR_PHYS \
+		(0x300000000ull | CONFIG_SYS_SRIOBOOT_UCODE_ENV_ADDR)
 #endif
 
 /*
@@ -538,7 +548,7 @@
  * the ucode address in master's NOR flash.
  */
 #define CONFIG_SYS_QE_FMAN_FW_IN_REMOTE
-#define CONFIG_SYS_QE_FMAN_FW_ADDR	NULL
+#define CONFIG_SYS_QE_FMAN_FW_ADDR	0xFFE00000
 #else
 #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
 #define CONFIG_SYS_QE_FMAN_FW_ADDR		0xEF000000
-- 
1.7.3.1

  parent reply	other threads:[~2012-01-17  9:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17  9:09 [U-Boot] [PATCH 1/8 v2] powerpc/srio: Rewrite the struct ccsr_rio Liu Gang
2012-01-17  9:09 ` [U-Boot] [PATCH 2/8 v2] powerpc/corenet_ds: Correct the compilation errors about ENV Liu Gang
2012-01-17  9:09 ` [U-Boot] [PATCH 3/8 v2] powerpc/corenet_ds: Document for the boot from SRIO Liu Gang
2012-01-17  9:09 ` [U-Boot] [PATCH 4/8 v2] powerpc/corenet_ds: Master module for " Liu Gang
2012-01-17  9:09 ` [U-Boot] [PATCH 5/8 v2] powerpc/corenet_ds: Slave " Liu Gang
2012-01-17  9:09 ` Liu Gang [this message]
2012-01-17  9:09 ` [U-Boot] [PATCH 7/8 v2] powerpc/corenet_ds: Slave reads ENV from master when " Liu Gang
2012-01-17  9:09 ` [U-Boot] [PATCH 8/8 v2] powerpc/corenet_ds: Slave core in holdoff " Liu Gang

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=1326791349-20458-6-git-send-email-Gang.Liu@freescale.com \
    --to=gang.liu@freescale.com \
    --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 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.