From patchwork Fri May 10 16:19:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1098189 X-Patchwork-Delegate: patrice.chotard@st.com 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=st.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="Wer5ptFD"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 450wWp70lpz9sB8 for ; Sat, 11 May 2019 02:24:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9F4AEC21EAE; Fri, 10 May 2019 16:21:11 +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=T_DKIM_INVALID 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 168ADC21E63; Fri, 10 May 2019 16:20:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D9C6C21DE8; Fri, 10 May 2019 16:20:20 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lists.denx.de (Postfix) with ESMTPS id 1ECECC21E3E for ; Fri, 10 May 2019 16:20:16 +0000 (UTC) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4AG6TdE025384; Fri, 10 May 2019 18:20:15 +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=aD9IXD2emMRPepXHcZFzEEle8/CxqiP1CgCo/dwyOx0=; b=Wer5ptFD86cnxbA4Ab2NjSAtAcIZ+z6iUgr9o3M5Zcj5Oc5mR1pLQj67Ds3EK+muRXbd /K8McWHn6ZNYnzHKnmQJdvZHVriH7JQGmyq8a4WN65KMpxn8BmfnHEzerldUFB8hofAy QT60l/Mwq7N3l+EI383pdwidOXZ3qB8syGSP3dpS1BuWkQZPJxwhshdtSalpIaALnyX6 /GcNZ+9MEFIKEtvrEeeHr4OisrcGDTb4I9kv2uu9cj6QMlixcdCTWLsPMijgF8nUWfE5 2WfTdYq/TpQ6+GAlWHEUqAxQuFXlE2ZuwlRdkdD4bQltTuR01SWjf4ho/EwkzgNh0U8V jw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2sc9s4kftu-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 10 May 2019 18:20:15 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2F1A638; Fri, 10 May 2019 16:20:15 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 56F12115C; Fri, 10 May 2019 16:20:14 +0000 (GMT) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 10 May 2019 18:20:13 +0200 From: Patrice Chotard To: Date: Fri, 10 May 2019 18:19:05 +0200 Message-ID: <1557505154-3856-5-git-send-email-patrice.chotard@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557505154-3856-1-git-send-email-patrice.chotard@st.com> References: <1557505154-3856-1-git-send-email-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG7NODE2.st.com (10.75.127.20) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-09_02:, , signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH 04/13] board: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf() 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" This allows to : - select the current device to save the environment file - select the correct EXT4 boot device instance and partition to save the environment file. For EXT4, device is mmc, device instance is 0 for sdcard or 1 for eMMC. The partition is set to "auto" to select the first partition with bootable flag. Signed-off-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 360b0df..316cd48 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -505,6 +506,29 @@ void board_quiesce_devices(void) setup_led(LEDST_OFF); } +#if defined(CONFIG_ENV_IS_IN_EXT4) +const char *env_ext4_get_intf(void) +{ + u32 bootmode = get_bootmode(); + + switch (bootmode & TAMP_BOOT_DEVICE_MASK) { + case BOOT_FLASH_SD: + case BOOT_FLASH_EMMC: + return "mmc"; + default: + return ""; + } +} + +const char *env_ext4_get_dev_part(void) +{ + static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"}; + u32 bootmode = get_bootmode(); + + return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1]; +} +#endif + #ifdef CONFIG_SYS_MTDPARTS_RUNTIME #define MTDPARTS_LEN 256