From patchwork Tue Apr 9 19:11:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1082664 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=de.adit-jv.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44dxk41CVrz9sNt for ; Wed, 10 Apr 2019 05:12:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BEBC6C21D8A; Tue, 9 Apr 2019 19:12:04 +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 EBBFCC21D8A; Tue, 9 Apr 2019 19:12:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B03E1C21D8A; Tue, 9 Apr 2019 19:12:01 +0000 (UTC) Received: from smtp1.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lists.denx.de (Postfix) with ESMTPS id 37032C21C29 for ; Tue, 9 Apr 2019 19:12:01 +0000 (UTC) Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 7E6223C00DD; Tue, 9 Apr 2019 21:11:57 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tfQAZzAaDK_K; Tue, 9 Apr 2019 21:11:49 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id D549B3C00C6; Tue, 9 Apr 2019 21:11:49 +0200 (CEST) Received: from vmlxhi-102.adit-jv.com (10.72.93.184) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 9 Apr 2019 21:11:49 +0200 From: Eugeniu Rosca To: Alex Kiernan , Marek Vasut , Simon Glass , Joe Hershberger , Jocelyn Bohr , Alex Deymo , Jassi Brar , Date: Tue, 9 Apr 2019 21:11:40 +0200 Message-ID: <20190409191140.19483-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Originating-IP: [10.72.93.184] Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH] fastboot: add support for 'getvar platform' 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Our R-Car3 Android userspace relies on the output of 'fastboot getvar platform' and U-Boot currently is not able to handle it: host $> fastboot getvar platform getvar:platform FAILED (remote: Variable not implemented) finished. total time: 0.001s We either have the option of adding 'fastboot.platform' variable to the default/saved environment as a workaround or add proper 'fastboot getvar platform' support in U-Boot via this patch. In the latter case, other platforms can benefit from it too. Note that R-Car3 already exports 'platform' environment variable via v2019.01 commit 00e4b57e9e71c3 ("ARM: rmobile: Set environment variable containing CPU type"). Signed-off-by: Eugeniu Rosca --- drivers/fastboot/fb_getvar.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index 4d264c985d7e..bc2481b57d73 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -17,6 +17,7 @@ static void getvar_downloadsize(char *var_parameter, char *response); static void getvar_serialno(char *var_parameter, char *response); static void getvar_version_baseband(char *var_parameter, char *response); static void getvar_product(char *var_parameter, char *response); +static void getvar_platform(char *var_parameter, char *response); static void getvar_current_slot(char *var_parameter, char *response); static void getvar_slot_suffixes(char *var_parameter, char *response); static void getvar_has_slot(char *var_parameter, char *response); @@ -55,6 +56,9 @@ static const struct { }, { .variable = "product", .dispatch = getvar_product + }, { + .variable = "platform", + .dispatch = getvar_platform }, { .variable = "current-slot", .dispatch = getvar_current_slot @@ -117,6 +121,16 @@ static void getvar_product(char *var_parameter, char *response) fastboot_fail("Board not set", response); } +static void getvar_platform(char *var_parameter, char *response) +{ + const char *p = env_get("platform"); + + if (p) + fastboot_okay(p, response); + else + fastboot_fail("platform not set", response); +} + static void getvar_current_slot(char *var_parameter, char *response) { /* A/B not implemented, for now always return _a */