From patchwork Sun May 17 08:37:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1292081 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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=SPq61dV1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 49PwWl3Z0Pz9sRK for ; Sun, 17 May 2020 18:37:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E8DC81783; Sun, 17 May 2020 10:37:42 +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="SPq61dV1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6CB7C8190C; Sun, 17 May 2020 10:37:40 +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 8AFB081783 for ; Sun, 17 May 2020 10:37:30 +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 x13so3298051pfn.11 for ; Sun, 17 May 2020 01:37: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=gC9lJKAMdyc/In+M7s2CfATXaMCAzXTk/su5ldxqGvI=; b=SPq61dV17wHeh9g/zDRQ+z+N+m5tJEhPj4NNF4s8uuQ5kO9deskKCV/1Zt2FcQ43MT coGjIG6pdSWWQDrv4eBkiWg3GNm0uOYGT9UgwkWgUgk0AwDXqGVEryzxUSEHMjchAwAw vpH3hCZLlebF8svJziRGUo7hY7KthuIbA42sE= 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=gC9lJKAMdyc/In+M7s2CfATXaMCAzXTk/su5ldxqGvI=; b=RgJG/Ndbf/t3KHSdjZs/1y2/ywsL0Bi/0oSellUDD4pwAs1i4L2oCLDHQMGXRPFnhj jvl5fm2pCbVBZQq89lMQ2kwrWQNScR8OmpmhX1fei/rSZ3IqshqN8wsggGuMLWQmPgYg kiSoV0/IKczj6fYa7lCYHPhFibfL+VwQdkEwJZZUcSu2A9GT6czt9r8IHl001chvI3Mo U8Sf+Ena3TbVsZLaLKLkJ+IYeuAdw2tt1AXBVJPTfAgv0HtWrwxJI44X+rTh0ONVzM+D DmbIwfh8EjJeqW5ecAUZ1ltSlxLZ32nGhKxERd8M26ElwELxTOYzTicXiAnbRmfV8vlm OTUQ== X-Gm-Message-State: AOAM5333SNdINEZo1QYWWY1rIyuvXUlWcF2zbcebyyks2pyMi6YbwBpX rcCSuNMweHQNZdHSxSGCzgKJxBvx0k7U6VBxi3quo4oR4jsiwBqpl3MCMpwHsDx+2FUOp9bV8oj lpT5ZIn9vNxvf7pNJzM0er5A2K5WTASpLz4W+7yOOqOXdxS1KlN0mLdTde9lVmVddRsiRU2qdj2 +QCuc= X-Google-Smtp-Source: ABdhPJwQYKy7Eg5RyPDwOpbS/apwctPkPwK3Zw7Dpu8AJtnIOPTTWElcyWMfzxR4L4fn5OoEJdqRTg== X-Received: by 2002:a65:4488:: with SMTP id l8mr434588pgq.327.1589704648288; Sun, 17 May 2020 01:37:28 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 01:37:27 -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 3/3] cmd: bcm: add command for chimp hand shake Date: Sun, 17 May 2020 14:07:05 +0530 Message-Id: <20200517083705.22508-4-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: Bharat Kumar Reddy Gooty Add command for chimp handshake. Signed-off-by: Bharat Kumar Reddy Gooty Signed-off-by: Rayagonda Kokatanur Reviewed-by: Simon Glass --- cmd/bcm/Makefile | 1 + cmd/bcm/chimp_handshake.c | 32 ++++++++++++++++++++++++++++++++ include/brcm/chimp.h | 6 ++++++ 3 files changed, 39 insertions(+) create mode 100644 cmd/bcm/chimp_handshake.c diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile index 671c0fbd43..49a3f38357 100644 --- a/cmd/bcm/Makefile +++ b/cmd/bcm/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o obj-y += chimp_boot.o +obj-y += chimp_handshake.o obj-y += nitro_image_load.o diff --git a/cmd/bcm/chimp_handshake.c b/cmd/bcm/chimp_handshake.c new file mode 100644 index 0000000000..7b9c766dd3 --- /dev/null +++ b/cmd/bcm/chimp_handshake.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Broadcom + */ + +#include +#include + +/* This command should be called after loading the nitro binaries */ +static int do_chimp_hs(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + int ret = CMD_RET_USAGE; + u32 hstatus; + + /* Returns 1, if handshake call is success */ + if (chimp_handshake_status_optee(0, &hstatus) == BCM_CHIMP_SUCCESS) + ret = CMD_RET_SUCCESS; + + if (hstatus == CHIMP_HANDSHAKE_SUCCESS) + printf("ChiMP Handshake successful\n"); + else + printf("ERROR: ChiMP Handshake status 0x%x\n", hstatus); + + return ret; +} + +U_BOOT_CMD + (chimp_hs, 1, 1, do_chimp_hs, + "Command to verify the Chimp hand shake", + "chimp_hs\n" +); diff --git a/include/brcm/chimp.h b/include/brcm/chimp.h index 9099a70ef5..f384603dc7 100644 --- a/include/brcm/chimp.h +++ b/include/brcm/chimp.h @@ -15,6 +15,12 @@ #define BCM_CHIMP_RUNNIG_GOOD 0x8000 +enum { + CHIMP_HANDSHAKE_SUCCESS = 0, + CHIMP_HANDSHAKE_WAIT_ERROR, + CHIMP_HANDSHAKE_WAIT_TIMEOUT, +}; + #ifdef CONFIG_CHIMP_OPTEE int chimp_fastboot_optee(void); int chimp_health_status_optee(u32 *status);