From patchwork Thu Aug 20 15:11:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1348437 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=WWUMAT8G; 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 4BXSmL4k6Mz9sTd for ; Fri, 21 Aug 2020 01:11:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F57082375; Thu, 20 Aug 2020 17:11:34 +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="WWUMAT8G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 381628236C; Thu, 20 Aug 2020 17:11:33 +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-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 5E6A882369 for ; Thu, 20 Aug 2020 17:11:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=rayagonda.kokatanur@broadcom.com Received: by mail-pg1-x544.google.com with SMTP id 128so1277675pgd.5 for ; Thu, 20 Aug 2020 08:11:30 -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=pAqTGpX0lyt5B+jZT8XT396pgIW7DTiIreNZrHBSAm8=; b=WWUMAT8GaZeswDPoSOIKawG+M7yxfOpLs3rzBh2mJc1SIL0Rlf/DNcWqObK4f9VtUh V/lQmwbRriCXC8Mca8nvQMTtv39iRRo6EZg0gptHGFz2p1tCFZa5lp1MGili94LHNAh5 322zOAI6sAyUGF9PNgfJsD+BRgUycFMDilIg8= 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=pAqTGpX0lyt5B+jZT8XT396pgIW7DTiIreNZrHBSAm8=; b=LXh0xj7/gxHZRS4KNPSyLPuXwpcCJmU+goGcqZVbYh3i7U628uiI7mt+vxCgHpivKu 6MQ4wPDLzKmFoMbARBZGBhTWmw9AwKAs+txorKh7n3BmC7xV+CTJnmvkFi8JwYLZEKNg ZwlPFVewgYA0qhBsXCnog0SY/ND49Za/cSv37SbddTv7GTsYb8Q61GxEkDWLtGjM5Xv9 a4vVz+T41Kg/qhom8iz7evRtG/mLRdKkLmriyBNKe2JdZ+Pg3CNDEqsJoc84nnWYz84Q uzBV04Ptb57DJTQTyvlGOXFnIe+uX9m3XmH5Km/07YqEZsgZbE3fPbtmr1v5KQExwfTK abng== X-Gm-Message-State: AOAM530S96jEOObx6C/Sr78sloJIDVU/sZ52JsOV0PZMIQlrGySG6Z8H eP2NqUTmw4521o8y7UW31QB/XbsHGfNa0Hldi4UQxdlCqUUEmYxbcZaSblVegJu/KKRf/mC0Z1Q Wad1JBrKlOt3+dqo4Mba4+SA9wQQMTxYSgj/5r26aadWBbIYR2+tDJWxkBMnvLepF3AQa+atADL 57tOkA0rD5 X-Google-Smtp-Source: ABdhPJwakT73Y8VrNxj/ipUnX8DzvsQDqO0D6sxGayaElklUkbE4PnYIh1b6qcjv/89bfylCrA4bow== X-Received: by 2002:a62:d149:: with SMTP id t9mr2565440pfl.59.1597936288166; Thu, 20 Aug 2020 08:11:28 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id e23sm2861014pgb.79.2020.08.20.08.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 08:11:27 -0700 (PDT) From: Rayagonda Kokatanur To: u-boot@lists.denx.de, Simon Glass , Tom Rini , Bharat Gooty , Vladimir Olovyannikov Cc: Trac Hoang , Rayagonda Kokatanur Subject: [PATCH v2 1/5] cmd: broadcom: add bnxt boot command Date: Thu, 20 Aug 2020 20:41:04 +0530 Message-Id: <20200820151108.5503-2-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200820151108.5503-1-rayagonda.kokatanur@broadcom.com> References: <20200820151108.5503-1-rayagonda.kokatanur@broadcom.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean From: Trac Hoang Chimp is a core in Broadcom netxtream controller (bnxt). Add command to load binary to chimp and boot bnxt. Signed-off-by: Trac Hoang Signed-off-by: Rayagonda Kokatanur Reviewed-by: Simon Glass --- Changes from V1: -Address review comments from Simon, Update commit message. Rearrange header files. Add comments to macros. cmd/broadcom/Makefile | 4 ++++ cmd/broadcom/chimp_boot.c | 37 +++++++++++++++++++++++++++++++++++++ include/broadcom/chimp.h | 6 ++++++ 3 files changed, 47 insertions(+) create mode 100644 cmd/broadcom/Makefile create mode 100644 cmd/broadcom/chimp_boot.c diff --git a/cmd/broadcom/Makefile b/cmd/broadcom/Makefile new file mode 100644 index 0000000000..22ccf2f334 --- /dev/null +++ b/cmd/broadcom/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright 2020 Broadcom + +obj-y += chimp_boot.o diff --git a/cmd/broadcom/chimp_boot.c b/cmd/broadcom/chimp_boot.c new file mode 100644 index 0000000000..16f2b612c4 --- /dev/null +++ b/cmd/broadcom/chimp_boot.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Broadcom + */ + +#include +#include +#include + +static int do_chimp_fastboot_secure(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + u32 health = 0; + + if (chimp_health_status_optee(&health)) { + 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()) { + 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/broadcom/chimp.h b/include/broadcom/chimp.h index 7f64152913..73bb1c21e9 100644 --- a/include/broadcom/chimp.h +++ b/include/broadcom/chimp.h @@ -9,6 +9,12 @@ #include +/* + * Chimp binary has health status like initialization complete, + * crash or running fine + */ +#define BCM_CHIMP_RUNNIG_GOOD 0x8000 + /** * chimp_fastboot_optee() - api to load bnxt firmware *