From patchwork Mon Jan 4 18:40:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravik Hasija X-Patchwork-Id: 1422221 X-Patchwork-Delegate: van.freenix@gmail.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=none dis=none) header.from=linux.microsoft.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=bqhVbrhy; 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 4D8kwv36Hmz9s24 for ; Tue, 5 Jan 2021 05:41:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9CA9382462; Mon, 4 Jan 2021 19:41:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.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=linux.microsoft.com header.i=@linux.microsoft.com header.b="bqhVbrhy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B583482644; Mon, 4 Jan 2021 19:41:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by phobos.denx.de (Postfix) with ESMTP id 8ECB98000F for ; Mon, 4 Jan 2021 19:41:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rahasij@linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1062) id 8E63720B7192; Mon, 4 Jan 2021 10:41:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8E63720B7192 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1609785670; bh=VJKLQFm10xxos8O3dDIOkMnDafV/Zz8TrP1AG//2A+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqhVbrhylz3BdSdhupjQVy4np0T54FK2A4PujQYjiDswZRriTHB2cHuFYJZ/t8xCt HZ1+JxuY3Jk4OqhUemf3/APdDlZ2foaK0/v3k0P3Ze6leYrpBV3BeEJmSu6+UTF+WV QunGF63+Zoy1Ix5vXmKBGscdO3SPJST4t6Qy8UeM= From: Ravik Hasija To: u-boot@lists.denx.de Cc: sjg@chromium.org, marex@denx.de, jh80.chung@samsung.com, Ravik Hasija , Dhananjay Phadke Subject: [PATCH v2] cmd: mmc: add mmcboot command Date: Mon, 4 Jan 2021 10:40:56 -0800 Message-Id: <1609785656-6472-1-git-send-email-rahasij@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1608753437-5004-1-git-send-email-rahasij@linux.microsoft.com> References: <1608753437-5004-1-git-send-email-rahasij@linux.microsoft.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 Similar to usbboot, add command line to boot from raw mmc partition using common_diskboot(), which supports legacy or FIT images. Usage: mmcboot [loadAaddr] [dev:part] Where [loadAddr] defaults to CONFIG_SYS_LOAD_ADDR, and [dev:part] defaults to ${bootdevice}. Also fixing config macro usage for CONFIG_SUPPORT_EMMC_BOOT (suggested by checkpatch.pl). Signed-off-by: Ravik Hasija Signed-off-by: Dhananjay Phadke Reviewed-by: Jaehoon Chung Reviewed-by: Simon Glass --- v2: * Fixed build failure. * Updated syntax of mmcboot cmd. --- cmd/Makefile | 2 +- cmd/mmc.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cmd/Makefile b/cmd/Makefile index dd86675bf2..573e4776f5 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -97,7 +97,7 @@ obj-$(CONFIG_CMD_MII) += mii.o obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MDIO) += mdio.o obj-$(CONFIG_CMD_SLEEP) += sleep.o -obj-$(CONFIG_CMD_MMC) += mmc.o +obj-$(CONFIG_CMD_MMC) += mmc.o disk.o obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o obj-$(CONFIG_MP) += mp.o obj-$(CONFIG_CMD_MTD) += mtd.o diff --git a/cmd/mmc.c b/cmd/mmc.c index 1529a3e05d..0c3ed6c108 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -711,7 +711,7 @@ static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag, } #endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT) static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -950,7 +950,7 @@ static struct cmd_tbl cmd_mmc[] = { #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""), #endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT) U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""), U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""), U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""), @@ -992,6 +992,14 @@ static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc, return cp->cmd(cmdtp, flag, argc, argv); } +#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT) +static int do_mmcboot(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + return common_diskboot(cmdtp, "mmc", argc, argv); +} +#endif + U_BOOT_CMD( mmc, 29, 1, do_mmcops, "MMC sub system", @@ -1016,7 +1024,7 @@ U_BOOT_CMD( " WARNING: Partitioning is a write-once setting once it is set to complete.\n" " Power cycling is required to initialize partitions after set to complete.\n" #endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT +#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT) "mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n" " - Set the BOOT_BUS_WIDTH field of the specified device\n" "mmc bootpart-resize \n" @@ -1046,3 +1054,11 @@ U_BOOT_CMD( "display MMC info", "- display info of the current MMC device" ); + +#if CONFIG_IS_ENABLED(SUPPORT_EMMC_BOOT) +U_BOOT_CMD( + mmcboot, 3, 1, do_mmcboot, + "boot from eMMC", + "[loadAddr] [dev:part]" +); +#endif