From patchwork Wed Sep 9 13:22:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1360629 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=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=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=tGvuxhCM; 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 4BmjQ724KVz9sTN for ; Wed, 9 Sep 2020 23:23:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 41485822CE; Wed, 9 Sep 2020 15:22:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="tGvuxhCM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26D31822E8; Wed, 9 Sep 2020 15:22:55 +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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C20C08221F for ; Wed, 9 Sep 2020 15:22:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 089DMkmS030160; Wed, 9 Sep 2020 15:22:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=8eOxfyGghGynX2p3XiqLVRbUe2MNsVQY5tNBDm4MKT0=; b=tGvuxhCMODqe6zhGTQwJSU0Eb3WcHPzdkOf+CnUkw22mt6wK0AQnU5Ufr+VUJV81CjoL mrDTdRrqg7/XlRGP+psdC5IZcR0P4Be3IJaiKStF1d9BbvIVsYPloebKxQ581q16SLUa NB35dCUXpqFu/NHm4t5pPGXr39jL0XgJYneOM7grqI4dbvs1y74Tmz+qaz0amFYj8h/I WFNvhpyvxJMrrnj+G4vhoZnshWWvfGRTULuS/1iisIo7huQmEK1wsLBP+D5N5jOQovrP 7tfZZr4wiucON5vRtzBhPbt/BjxLEQrQBG/Be1JU8MG5tqLewzAUFJkTuxPz2qNfSy7N 0A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 33c051dc3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Sep 2020 15:22:46 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D009B100034; Wed, 9 Sep 2020 15:22:45 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C409B2AD9E9; Wed, 9 Sep 2020 15:22:45 +0200 (CEST) Received: from localhost (10.75.127.50) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 9 Sep 2020 15:22:45 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Boris Brezillon , Jagan Teki , Kever Yang , Lokesh Vutla , Miquel Raynal , Sam Protsenko , Simon Glass , mingming lee , U-Boot STM32 Subject: [PATCH 4/4] fastboot: add command to select the eMMC boot configuration Date: Wed, 9 Sep 2020 15:22:39 +0200 Message-ID: <20200909152228.4.I3e4476ed5db1d186ce48088d1d1e8140510f08ca@changeid> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200909152228.1.I4ae7c1ab59fed4861cde9322a8d12167c9d0187a@changeid> References: <20200909152228.1.I4ae7c1ab59fed4861cde9322a8d12167c9d0187a@changeid> MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-09_07:2020-09-09, 2020-09-09 signatures=0 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 Add command oem bootbus which executes the command ``mmc bootbus `` on the current fastboot mmc device ( = CONFIG_FASTBOOT_FLASH_MMC_DEV) to set the eMMC boot configuration on first update, with = boot_bus_width reset_boot_bus_width boot_mode $> fastboot oem bootbus: Signed-off-by: Patrick Delaunay --- doc/android/fastboot.rst | 1 + drivers/fastboot/Kconfig | 7 +++++++ drivers/fastboot/fb_command.c | 36 +++++++++++++++++++++++++++++++++++ include/fastboot.h | 3 +++ 4 files changed, 47 insertions(+) diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst index 7d69372753..6aa725fcd8 100644 --- a/doc/android/fastboot.rst +++ b/doc/android/fastboot.rst @@ -25,6 +25,7 @@ The following OEM commands are supported (if enabled): - ``oem format`` - this executes ``gpt write mmc %x $partitions`` - ``oem partconf`` - this executes ``mmc partconf %x 0`` to configure eMMC with = boot_ack boot_partition +- ``oem bootbus`` - this executes ``mmc bootbus %x %s`` to configure eMMC Support for both eMMC and NAND devices is included. diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 1bcc8d4ab9..a17e488714 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -196,6 +196,13 @@ config FASTBOOT_CMD_OEM_PARTCONF Add support for the "oem partconf" command from a client. This set the mmc boot-partition for the selecting eMMC device. +config FASTBOOT_CMD_OEM_BOOTBUS + bool "Enable the 'oem bootbus' command" + depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT + help + Add support for the "oem bootbus" command from a client. This set + the mmc boot configuration for the selecting eMMC device. + endif # FASTBOOT endmenu diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index e42c018348..00efd477db 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -43,6 +43,9 @@ static void oem_format(char *, char *); #if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF) static void oem_partconf(char *, char *); #endif +#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS) +static void oem_bootbus(char *, char *); +#endif static const struct { const char *command; @@ -98,6 +101,12 @@ static const struct { .dispatch = oem_partconf, }, #endif +#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS) + [FASTBOOT_COMMAND_OEM_BOOTBUS] = { + .command = "oem bootbus", + .dispatch = oem_bootbus, + }, +#endif }; /** @@ -372,3 +381,30 @@ static void oem_partconf(char *cmd_parameter, char *response) fastboot_okay(NULL, response); } #endif + +#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS) +/** + * oem_bootbus() - Execute the OEM bootbus command + * + * @cmd_parameter: Pointer to command parameter + * @response: Pointer to fastboot response buffer + */ +static void oem_bootbus(char *cmd_parameter, char *response) +{ + char cmdbuf[32]; + + if (!cmd_parameter) { + fastboot_fail("Expected command parameter", response); + return; + } + + /* execute 'mmc bootbus' command with cmd_parameter arguments*/ + snprintf(cmdbuf, sizeof(cmdbuf), "mmc bootbus %x %s", + CONFIG_FASTBOOT_FLASH_MMC_DEV, cmd_parameter); + printf("Execute: %s\n", cmdbuf); + if (run_command(cmdbuf, 0)) + fastboot_fail("Cannot set oem bootbus", response); + else + fastboot_okay(NULL, response); +} +#endif diff --git a/include/fastboot.h b/include/fastboot.h index 3e68852e9a..966ffc6d94 100644 --- a/include/fastboot.h +++ b/include/fastboot.h @@ -39,6 +39,9 @@ enum { #if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF) FASTBOOT_COMMAND_OEM_PARTCONF, #endif +#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS) + FASTBOOT_COMMAND_OEM_BOOTBUS, +#endif FASTBOOT_COMMAND_COUNT };