From patchwork Thu Mar 8 10:33:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Gang X-Patchwork-Id: 145487 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5A54FB6F9F for ; Thu, 8 Mar 2012 21:50:40 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54E902811A; Thu, 8 Mar 2012 11:50:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PctNdZP+5Ykm; Thu, 8 Mar 2012 11:50:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D76D280B5; Thu, 8 Mar 2012 11:50:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D18E28111 for ; Thu, 8 Mar 2012 11:50:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sDJXz3hhBgzW for ; Thu, 8 Mar 2012 11:50:31 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from tx2outboundpool.messaging.microsoft.com (tx2ehsobe001.messaging.microsoft.com [65.55.88.11]) by theia.denx.de (Postfix) with ESMTPS id 4F28828071 for ; Thu, 8 Mar 2012 11:50:29 +0100 (CET) Received: from mail93-tx2-R.bigfish.com (10.9.14.251) by TX2EHSOBE003.bigfish.com (10.9.40.23) with Microsoft SMTP Server id 14.1.225.23; Thu, 8 Mar 2012 10:35:23 +0000 Received: from mail93-tx2 (localhost [127.0.0.1]) by mail93-tx2-R.bigfish.com (Postfix) with ESMTP id 18A594A0108 for ; Thu, 8 Mar 2012 10:35:23 +0000 (UTC) X-SpamScore: 10 X-BigFish: VS10(zz38a1rzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail93-tx2 (localhost.localdomain [127.0.0.1]) by mail93-tx2 (MessageSwitch) id 1331202919152345_11332; Thu, 8 Mar 2012 10:35:19 +0000 (UTC) Received: from TX2EHSMHS032.bigfish.com (unknown [10.9.14.240]) by mail93-tx2.bigfish.com (Postfix) with ESMTP id 1B99E2C0066 for ; Thu, 8 Mar 2012 10:35:19 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS032.bigfish.com (10.9.99.132) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 8 Mar 2012 10:35:15 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.1.355.3; Thu, 8 Mar 2012 04:35:09 -0600 Received: from 10.ap.freescale.net ([10.213.130.145]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q28AZ6XV020168 for ; Thu, 8 Mar 2012 03:35:07 -0700 Received: from 10.ap.freescale.net (localhost.localdomain [127.0.0.1]) by 10.ap.freescale.net (8.13.8/8.13.8) with ESMTP id q28AXaQj009039; Thu, 8 Mar 2012 18:33:36 +0800 Received: (from mylinux@localhost) by 10.ap.freescale.net (8.13.8/8.13.8/Submit) id q28AXaMR009038; Thu, 8 Mar 2012 18:33:36 +0800 From: Liu Gang To: , Date: Thu, 8 Mar 2012 18:33:19 +0800 Message-ID: <1331202801-8965-6-git-send-email-Gang.Liu@freescale.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1331202801-8965-1-git-send-email-Gang.Liu@freescale.com> References: <1331202801-8965-1-git-send-email-Gang.Liu@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Alexandre.Bounine@idt.com, r61911@freescale.com, Shaohui Xie Subject: [U-Boot] [PATCH 6/8 v4] powerpc/corenet_ds: Slave uploads ucode when boot from SRIO X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Signed-off-by: Shaohui Xie --- 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. Changes in v3: - No Changes in v4: - No 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..da21627 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 + /* + * 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); diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index 8ff1408..093c2c0 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -399,6 +399,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 /* @@ -408,6 +415,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 /* @@ -539,7 +549,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