From patchwork Sun May 17 08:37:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1292079 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=V4EwvFTu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49PwWM1X4fz9sRK for ; Sun, 17 May 2020 18:37:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F0CF8190C; Sun, 17 May 2020 10:37:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.b="V4EwvFTu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3278C8190C; Sun, 17 May 2020 10:37:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ECE2B81783 for ; Sun, 17 May 2020 10:37:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rayagonda.kokatanur@broadcom.com Received: by mail-pf1-x441.google.com with SMTP id n18so3320573pfa.2 for ; Sun, 17 May 2020 01:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zVoQFyIrxGpipzVhNvvWwJfu1WQ4uLPO8USTcr7UxOQ=; b=V4EwvFTuMoGMfQQ57Gz6srGGAGTtzqg5o6GSU6Vxih5fv7EwDf0CKUeDBsUOxj6A9d Ar+okPL/QthAuT8+roqL0k7b06dheWlYGRUxwGsBP0iYJzoNeGZThrN4vekhh4I0tq2f TJYQGZAJow94Q2trWBlwav2Qst8z1Kq1Gpyv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zVoQFyIrxGpipzVhNvvWwJfu1WQ4uLPO8USTcr7UxOQ=; b=P8oPT9KcDAnAF5dEZ6F7/HdOReHPI50UZSkBjwiazBREm/Qfqm9UjegnvqnxHtBBBR uRn6NtG693fMldqiCf6yNqvXsBPMIo0uQ0WpPjBG9nnOfmrv+GgsjuCHB5FE6nzs8dzi 8PKqMvU2VwR47WMi3XfxzuK/LFXo0oxhjDIjwGTjTVJUCNEUaJbqdkZACmXN92CXjRDu EskpxsTO17RRmTGqYiPkKautU/2qvx2M6sBVIWwhlm2a+OYzauP8cVJbknqQXh68xFpo beBKF0UzP+O7ZBRExhPT2KoreQN/1k1BWtiwAUN7TWNRlHaLbINMmxXbPXlSr7jQ98If jB/w== X-Gm-Message-State: AOAM5320LIZVRZyVh27wAC2EfOyMFOYI4SFNlgiTHELfaQxbyLQsQXBS U0BlMwmCXFjBNVxBlaiOik/oBcv16LdgthAvWrrK/KQIwtHJj/jdoWO5dwg63G+AlTYxKyuNsc7 o+HH8X8QhNMooQ8xruQqsyq5BinksIAOR9CdNuYbD990apso/8HDX4VIN12560W1Er7ikinafdb 4b3KI= X-Google-Smtp-Source: ABdhPJx4TTh4HdKwKra/TLVEqBCveF7Scb4jhULArD6wXeVDf7wthj9+BV9mF8PNyfodHFCLUADWJw== X-Received: by 2002:a63:1854:: with SMTP id 20mr10466566pgy.257.1589704639841; Sun, 17 May 2020 01:37:19 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d195sm5870361pfd.52.2020.05.17.01.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 01:37:19 -0700 (PDT) From: Rayagonda Kokatanur To: u-boot@lists.denx.de, Simon Glass , Bharat Gooty , Vladimir Olovyannikov , Vikas Gupta , Trac Hoang Cc: Rayagonda Kokatanur Subject: [PATCH v1 1/3] cmd: bcm: add nitro boot command Date: Sun, 17 May 2020 14:07:03 +0530 Message-Id: <20200517083705.22508-2-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200517083705.22508-1-rayagonda.kokatanur@broadcom.com> References: <20200517083705.22508-1-rayagonda.kokatanur@broadcom.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean From: Trac Hoang Add command to boot nitro. Signed-off-by: Trac Hoang Signed-off-by: Rayagonda Kokatanur --- cmd/bcm/Makefile | 1 + cmd/bcm/chimp_boot.c | 36 ++++++++++++++++++++++++++++++++++++ include/brcm/chimp.h | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 cmd/bcm/chimp_boot.c diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile index 96dc8f7ad7..dc274f6b96 100644 --- a/cmd/bcm/Makefile +++ b/cmd/bcm/Makefile @@ -2,3 +2,4 @@ # Copyright 2020 Broadcom obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o +obj-y += chimp_boot.o diff --git a/cmd/bcm/chimp_boot.c b/cmd/bcm/chimp_boot.c new file mode 100644 index 0000000000..dcab9a5bcb --- /dev/null +++ b/cmd/bcm/chimp_boot.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Broadcom + */ + +#include +#include +#include + +static int do_chimp_fastboot_secure(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + u32 health = 0; + + if (chimp_health_status_optee(&health) != BCM_CHIMP_SUCCESS) { + pr_err("Chimp health command fail\n"); + return CMD_RET_FAILURE; + } + + if (health == BCM_CHIMP_RUNNIG_GOOD) { + printf("skip fastboot...\n"); + return CMD_RET_SUCCESS; + } + + if (chimp_fastboot_optee() != BCM_CHIMP_SUCCESS) { + pr_err("Failed to load secure ChiMP image\n"); + return CMD_RET_FAILURE; + } + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD + (chimp_ld_secure, 1, 0, do_chimp_fastboot_secure, + "Invoke chimp fw load via optee", + "chimp_ld_secure\n" +); diff --git a/include/brcm/chimp.h b/include/brcm/chimp.h index c3d4594c4b..9099a70ef5 100644 --- a/include/brcm/chimp.h +++ b/include/brcm/chimp.h @@ -13,6 +13,8 @@ #define BCM_CHIMP_SUCCESS 0 #define BCM_CHIMP_FAILURE (!BCM_CHIMP_SUCCESS) +#define BCM_CHIMP_RUNNIG_GOOD 0x8000 + #ifdef CONFIG_CHIMP_OPTEE int chimp_fastboot_optee(void); int chimp_health_status_optee(u32 *status);