From patchwork Tue Mar 30 10:09:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1459980 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=n9T/Zl4V; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F8lZV5pjpz9sVt for ; Tue, 30 Mar 2021 21:10:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1ECE58291A; Tue, 30 Mar 2021 12:10:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="n9T/Zl4V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E3C8F8290A; Tue, 30 Mar 2021 12:10:15 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 37E50828E1 for ; Tue, 30 Mar 2021 12:10:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62f.google.com with SMTP id l4so23938614ejc.10 for ; Tue, 30 Mar 2021 03:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pz7s4JfNNdbID1xxgB2sy0Dhqv7H+hd1wgG0m5mSA7U=; b=n9T/Zl4VT17WIoFLS9J7taYNUi5E/bl+XHkUUm0XBiSz7+GloT1/gR5FKm0MLn80oq mQULnCY2G2pcHDDceKFWzHVKykQXF5gH0ouGLiDjOaTIJIry1R/MuIgUQAkn9OPnnHGI 5/50xhx2nSnHKIPoRSvlxBk7RQq0xtfO5bPNGus6aHCTfOfmAMXM7RneziPwftnQJbLx GI3IHYHig6n/gDw6d2UlN57NhMoLckexzSxMlHYkaCPQ7ejx4VJ3DloImvLf/9E357OI J6egPTZAJxWGjg+ZdX6jDi0MC/WdfchukT3q8ArJV1VuGiTmJVbj4F5m/x9NOrRU0vfr AHyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Pz7s4JfNNdbID1xxgB2sy0Dhqv7H+hd1wgG0m5mSA7U=; b=Wifxeb7Bwp7RqV0DfET2w75Yxf7hbfrWHBOesOoo2WGqubi1dob5An4Ge2H3ZTfLuD 8e5PofiMAHXpVDqHPplSJ7oGOF2AwOlOGf3w89Akv28gsY8Z6H0t8uiKa723HqOJQTqZ OFZhhBzXfq0l2j+o1jKjsm9iCsIhgozvu6Ck+g+OJ0MC6hcZHwJ6bE5xXyUo2QzO7ern PnflWlhDyJ3cmlPx0jhcWOodkgcaSuA2xfS08w58THzEnGzMQJCJgE4/EEIH9pBHtYj2 be2HXcKEosyk5rIkzlnLM2miLvTKbCF8vKuJOsuE8IaBYFyAdDcIZjU3nCMSXG51ti6F HHuA== X-Gm-Message-State: AOAM533l1O1j6kVLIJCuxwlQHMKs2xjH08WIx+bAoh2WKY7YB2La59Y4 FEJPXMhRGh6wc98+iQbyqBVvrY+8QU5ejLCy X-Google-Smtp-Source: ABdhPJyljSgx0+z7PV4F1gV0uKiikdPu1HGrMWX4FJKuPj8JkPrJtArluy7ng09kEXMs8yI8wnYs/Q== X-Received: by 2002:a17:907:1749:: with SMTP id lf9mr20900458ejc.174.1617099009643; Tue, 30 Mar 2021 03:10:09 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::45a]) by smtp.gmail.com with ESMTPSA id c12sm11408833edx.54.2021.03.30.03.10.09 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Mar 2021 03:10:09 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Ashok Reddy Soma , Joe Hershberger , Wolfgang Denk Subject: [PATCH 3/4] xilinx: versal: Add support for saving env based on bootmode Date: Tue, 30 Mar 2021 12:09:59 +0200 Message-Id: <9d1c895f235cad0a93911084fc0a9259d9aae5fe.1617098995.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.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.4 at phobos.denx.de X-Virus-Status: Clean From: Ashok Reddy Soma Enable saving variables to MMC(FAT) and SPI based on primary bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE). Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well. Signed-off-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- board/xilinx/versal/board.c | 30 ++++++++++++++++++++++++++++ configs/xilinx_versal_virt_defconfig | 3 +++ env/Kconfig | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index c644fe8dc068..042f3ec4f3a0 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -245,3 +246,32 @@ int dram_init(void) void reset_cpu(ulong addr) { } + +enum env_location env_get_location(enum env_operation op, int prio) +{ + u32 bootmode = versal_get_bootmode(); + + if (prio) + return ENVL_UNKNOWN; + + switch (bootmode) { + case EMMC_MODE: + case SD_MODE: + case SD1_LSHFT_MODE: + case SD_MODE1: + if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) + return ENVL_FAT; + if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)) + return ENVL_EXT4; + return ENVL_UNKNOWN; + case OSPI_MODE: + case QSPI_MODE_24BIT: + case QSPI_MODE_32BIT: + if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) + return ENVL_SPI_FLASH; + return ENVL_UNKNOWN; + case JTAG_MODE: + default: + return ENVL_NOWHERE; + } +} diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig index 2d639a1026a8..fe108d3475c3 100644 --- a/configs/xilinx_versal_virt_defconfig +++ b/configs/xilinx_versal_virt_defconfig @@ -39,6 +39,9 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_OF_BOARD=y +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y diff --git a/env/Kconfig b/env/Kconfig index bc4f7d8f4ee4..0cee6a8e310f 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -431,7 +431,7 @@ config ENV_FAT_DEVICE_AND_PART string "Device and partition for where to store the environemt in FAT" depends on ENV_IS_IN_FAT default "0:1" if TI_COMMON_CMD_OPTIONS - default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP + default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 default "0" if ARCH_AT91