From patchwork Mon Oct 21 15:58:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1180713 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xhCC4K25z9sPL for ; Tue, 22 Oct 2019 02:59:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3CEE0C21D74; Mon, 21 Oct 2019 15:58:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 25F87C21D74; Mon, 21 Oct 2019 15:58:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8B492C21D74; Mon, 21 Oct 2019 15:58:53 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by lists.denx.de (Postfix) with ESMTPS id 2B6B9C21C50 for ; Mon, 21 Oct 2019 15:58:53 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46xhC0701xz1qql4; Mon, 21 Oct 2019 17:58:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46xhC06Y4Dz1qqkC; Mon, 21 Oct 2019 17:58:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Vovi_oz5wak5; Mon, 21 Oct 2019 17:58:51 +0200 (CEST) X-Auth-Info: jZbwj5yCyCsO23hfZagZ2dF5IOguBiZvF3JiptqjcUg= Received: from crub.agik.hopto.org (p54833695.dip0.t-ipconnect.de [84.131.54.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 21 Oct 2019 17:58:51 +0200 (CEST) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Mon, 21 Oct 2019 17:58:49 +0200 Message-Id: <20191021155851.16483-1-agust@denx.de> X-Mailer: git-send-email 2.17.1 Cc: uboot-imx@nxp.com Subject: [U-Boot] [PATCH 1/3] mach-imx: Adding new argument for SIP call interface X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Ye Li Need to pass total 5 arguments for SIP HAB call on i.MX8MQ, so update the interface to add new argument. Signed-off-by: Ye Li Reviewed-by: Patrick Wildt --- arch/arm/include/asm/mach-imx/sys_proto.h | 3 ++- arch/arm/mach-imx/imx_bootaux.c | 4 ++-- arch/arm/mach-imx/sip.c | 4 +++- drivers/misc/imx8/fuse.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h index aa66fdc88f..139a7638c1 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -143,7 +143,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout); int mxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout); unsigned long call_imx_sip(unsigned long id, unsigned long reg0, - unsigned long reg1, unsigned long reg2); + unsigned long reg1, unsigned long reg2, + unsigned long reg3); unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0, unsigned long *reg1, unsigned long reg2, unsigned long reg3); diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c index 18d7e6819c..3d9422d5a2 100644 --- a/arch/arm/mach-imx/imx_bootaux.c +++ b/arch/arm/mach-imx/imx_bootaux.c @@ -26,7 +26,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data) /* Enable M4 */ #ifdef CONFIG_IMX8M - call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0); + call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0, 0); #else clrsetbits_le32(SRC_BASE_ADDR + SRC_M4_REG_OFFSET, SRC_M4C_NON_SCLR_RST_MASK, SRC_M4_ENABLE_MASK); @@ -38,7 +38,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data) int arch_auxiliary_core_check_up(u32 core_id) { #ifdef CONFIG_IMX8M - return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0); + return call_imx_sip(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0, 0); #else unsigned int val; diff --git a/arch/arm/mach-imx/sip.c b/arch/arm/mach-imx/sip.c index 968e7cf309..fca520c671 100644 --- a/arch/arm/mach-imx/sip.c +++ b/arch/arm/mach-imx/sip.c @@ -7,7 +7,8 @@ #include unsigned long call_imx_sip(unsigned long id, unsigned long reg0, - unsigned long reg1, unsigned long reg2) + unsigned long reg1, unsigned long reg2, + unsigned long reg3) { struct pt_regs regs; @@ -15,6 +16,7 @@ unsigned long call_imx_sip(unsigned long id, unsigned long reg0, regs.regs[1] = reg0; regs.regs[2] = reg1; regs.regs[3] = reg2; + regs.regs[4] = reg3; smc_call(®s); diff --git a/drivers/misc/imx8/fuse.c b/drivers/misc/imx8/fuse.c index 2f2fad2c17..1309215d4d 100644 --- a/drivers/misc/imx8/fuse.c +++ b/drivers/misc/imx8/fuse.c @@ -74,7 +74,7 @@ int fuse_prog(u32 bank, u32 word, u32 val) } return call_imx_sip(FSL_SIP_OTP_WRITE, (unsigned long)word, - (unsigned long)val, 0); + (unsigned long)val, 0, 0); } int fuse_override(u32 bank, u32 word, u32 val) From patchwork Mon Oct 21 15:58:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1180714 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xhCy5HDRz9sP3 for ; Tue, 22 Oct 2019 02:59:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 66272C21EA8; Mon, 21 Oct 2019 15:59:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A4590C21C50; Mon, 21 Oct 2019 15:58:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7A7FEC21D74; Mon, 21 Oct 2019 15:58:54 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 2A09EC21C50 for ; Mon, 21 Oct 2019 15:58:54 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46xhC16yccz1rGSH; Mon, 21 Oct 2019 17:58:53 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46xhC16Tzxz1qqkC; Mon, 21 Oct 2019 17:58:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id rsRBOlB89axs; Mon, 21 Oct 2019 17:58:53 +0200 (CEST) X-Auth-Info: M6mmgSFjvNsWmu7m9CRuAaS5t7gRio68JXNX6GBg4UQ= Received: from crub.agik.hopto.org (p54833695.dip0.t-ipconnect.de [84.131.54.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 21 Oct 2019 17:58:53 +0200 (CEST) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Mon, 21 Oct 2019 17:58:50 +0200 Message-Id: <20191021155851.16483-2-agust@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191021155851.16483-1-agust@denx.de> References: <20191021155851.16483-1-agust@denx.de> Cc: uboot-imx@nxp.com Subject: [U-Boot] [PATCH 2/3] imx8: add sc_misc_seco_build_info() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add function for reading SECO-FW commit id. Signed-off-by: Anatolij Gustschin --- arch/arm/include/asm/arch-imx8/sci/sci.h | 1 + drivers/misc/imx8/scu_api.c | 27 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/arch/arm/include/asm/arch-imx8/sci/sci.h index 14ee6f999b..df5c60d4ce 100644 --- a/arch/arm/include/asm/arch-imx8/sci/sci.h +++ b/arch/arm/include/asm/arch-imx8/sci/sci.h @@ -81,6 +81,7 @@ int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev); void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status); void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit); +void sc_misc_seco_build_info(sc_ipc_t ipc, u32 *version, u32 *commit); int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val); int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp, s16 *celsius, s8 *tenths); diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index b2fdeef13a..44d0165c3f 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -349,6 +349,33 @@ void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit) *commit = RPC_U32(&msg, 4); } +void sc_misc_seco_build_info(sc_ipc_t ipc, u32 *version, u32 *commit) +{ + struct udevice *dev = gd->arch.scu_dev; + int size = sizeof(struct sc_rpc_msg_s); + struct sc_rpc_msg_s msg; + int ret; + + if (!dev) + hang(); + + RPC_VER(&msg) = SC_RPC_VERSION; + RPC_SVC(&msg) = SC_RPC_SVC_MISC; + RPC_FUNC(&msg) = MISC_FUNC_SECO_BUILD_INFO; + RPC_SIZE(&msg) = 1; + + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); + if (ret < 0) { + printf("%s: err: %d\n", __func__, ret); + return; + } + + if (version) + *version = RPC_U32(&msg, 0); + if (commit) + *commit = RPC_U32(&msg, 4); +} + int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val) { struct udevice *dev = gd->arch.scu_dev; From patchwork Mon Oct 21 15:58:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1180715 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xhDF70bjz9sPL for ; Tue, 22 Oct 2019 02:59:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 86F5FC21D8A; Mon, 21 Oct 2019 15:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3DC68C21DF9; Mon, 21 Oct 2019 15:59:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D762CC21D74; Mon, 21 Oct 2019 15:58:59 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 495DDC21E1E for ; Mon, 21 Oct 2019 15:58:56 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46xhC40pvzz1rGSM; Mon, 21 Oct 2019 17:58:56 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46xhC40HnLz1qqkC; Mon, 21 Oct 2019 17:58:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id IWQn4OZqyPmT; Mon, 21 Oct 2019 17:58:54 +0200 (CEST) X-Auth-Info: +tAU7aOoZGdZ4VogWiIGIGo60g35KR7HttZ96aR1g1U= Received: from crub.agik.hopto.org (p54833695.dip0.t-ipconnect.de [84.131.54.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 21 Oct 2019 17:58:54 +0200 (CEST) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Mon, 21 Oct 2019 17:58:51 +0200 Message-Id: <20191021155851.16483-3-agust@denx.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191021155851.16483-1-agust@denx.de> References: <20191021155851.16483-1-agust@denx.de> Cc: uboot-imx@nxp.com Subject: [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617) and add the commit IDs to the environment. Signed-off-by: Anatolij Gustschin --- arch/arm/mach-imx/imx8/misc.c | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c index fe73e29eee..b0693358e7 100644 --- a/arch/arm/mach-imx/imx8/misc.c +++ b/arch/arm/mach-imx/imx8/misc.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate) { @@ -25,9 +28,28 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate) return 0; } +#define FSL_SIP_BUILDINFO 0xC2000003 +#define FSL_SIP_BUILDINFO_GET_COMMITHASH 0x00 +extern uint32_t _end_ofs; + +static void set_buildinfo_to_env(uint32_t scfw, uint32_t secofw, + char *mkimage, char *atf) +{ + if (!mkimage || !atf) + return; + + env_set("commit_mkimage", mkimage); + env_set("commit_atf", atf); + env_set_hex("commit_scfw", (ulong)scfw); + env_set_hex("commit_secofw", (ulong)secofw); +} + void build_info(void) { + u32 seco_build = 0, seco_commit = 0; u32 sc_build = 0, sc_commit = 0; + ulong atf_commit = 0; + char *mkimage_commit, *temp; /* Get SCFW build and commit id */ sc_misc_build_info(-1, &sc_build, &sc_commit); @@ -35,5 +57,42 @@ void build_info(void) printf("SCFW does not support build info\n"); sc_commit = 0; /* Display 0 if build info not supported */ } - printf("Build: SCFW %x\n", sc_commit); + + /* Get SECO FW build and commit id */ + sc_misc_seco_build_info(-1, &seco_build, &seco_commit); + if (!seco_build) { + debug("SECO FW does not support build info\n"); + /* Display 0 when the build info is not supported */ + seco_commit = 0; + } + + /* + * Get imx-mkimage commit id. + * The imx-mkimage puts the commit hash behind the end of u-boot.bin + */ + mkimage_commit = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs + + fdt_totalsize(gd->fdt_blob)); + temp = mkimage_commit + 8; + *temp = '\0'; + + if (strlen(mkimage_commit) == 0) { + debug("IMX-MKIMAGE does not support build info\n"); + mkimage_commit = "0"; /* Display 0 */ + } + + /* Get ARM Trusted Firmware commit id */ + atf_commit = call_imx_sip(FSL_SIP_BUILDINFO, + FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0); + if (atf_commit == 0xffffffff) { + debug("ATF does not support build info\n"); + atf_commit = 0x30; /* Display 0 */ + } + + printf("Build: SCFW %08x, SECO-FW %08x\n" + " IMX-MKIMAGE %s, ATF %s\n", + sc_commit, seco_commit, mkimage_commit, (char *)&atf_commit); + + /* Set all to env */ + set_buildinfo_to_env(sc_commit, seco_commit, mkimage_commit, + (char *)&atf_commit); }