]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
powerpc/corenet_ds: Slave uploads ucode when boot from SRIO
authorLiu Gang <Gang.Liu@freescale.com>
Thu, 8 Mar 2012 00:33:19 +0000 (00:33 +0000)
committerAndy Fleming <afleming@freescale.com>
Wed, 25 Apr 2012 04:58:33 +0000 (23:58 -0500)
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>
arch/powerpc/cpu/mpc8xxx/srio.c
board/freescale/common/p_corenet/law.c
board/freescale/common/p_corenet/tlb.c
include/configs/corenet_ds.h

index 77fa32f69768a89ae9231c93a17ce0ced71b7312..e593f22b1069b4464c76f0c3d0ed76dfaab168ab 100644 (file)
@@ -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 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 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
index 1fbab4d9684894551971b8387ff8ac5a9ad03fb7..c4566ddd4f75c2b11c633f9f65f8e687e2327061 100644 (file)
@@ -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
 };
index a8c8b3c3a869465060a0747d1a326a72bbde1ecf..da2162728fdbe1a274573f5cd683610fa7b0ffbe 100644 (file)
@@ -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
+       /*
+        * 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_G,
+               0, 17, BOOKE_PAGESZ_1M, 1),
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
index 8ff1408c6078456920837651c97711db9b813819..093c2c04b120b263c352b4622601085b00ee3d9a 100644 (file)
 #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
 
 /*
 /* 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
 
 /*
  * 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