From patchwork Tue Jan 23 20:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125571 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1981751ljf; Tue, 23 Jan 2018 12:18:17 -0800 (PST) X-Google-Smtp-Source: AH8x226FygLlGySgG194h0xoSLhvRqcoP4u9Vv46kmAA3MXrPO9tG1FymoB6fCq+mHCx1eGYnjR0 X-Received: by 10.80.162.39 with SMTP id 36mr20849979edl.96.1516738697168; Tue, 23 Jan 2018 12:18:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738697; cv=none; d=google.com; s=arc-20160816; b=lCSGSelQngb/VQ5EXTe1+bgBKAN/HPptYODKsPT9SZzb46r/wSlIkbyX3tKgFzFwkH 5+S4vEhRsOEPZcArMXaWI15KfRM4jNpXmAbFA479TRX6fQa0MGNKwzDmEk048+oIMbG5 kMbbshfcyhwis3YiLtGO8GgNKl/MuFOORzkKl9kDRg0MIYnZRq3Yrgtbd4UxD97RInON b9VAmd+wRJ3i9Mrg8feW8gmV0Kv5mrcgZsJDP1AecW9ZMZuTbQyH27lJmFLe34RU2eVo WPOmM6TIUfzSfi49cK7ytad15YzfSVvAor6kAroOisDYGZigevmF1+er9cIt5SrTXxFH GQGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=olmVkPtQUpCd6/0LgGcBiBRXX+R7DJmzVP+YOZETsko=; b=Ccm13unWFFWcYElGXKcOKWD+ndTScUtrAJgNeXDVXfIsPh/qO6CvVbPnp6vBlq0/M0 BcmRTUOvyGa0JIi1Mfqgu3i+k1/YBBW2/9/VJy7OklE7GUlw/HrZelHqjPiFyEoXsy6l oaIlkVKb2eUixt1DGMgLBo1wm7ZvUJQcBYnQKpCDfNt1bXFEL8/qmrgcibvnlQTJdIvq FYSUoz1x1Iv13bUyQCkBx1M7o8I6iPNWD9tUpQ+JPS2GwZ9kR2VYgx2SKbe8S4Et6Ri7 mAf8BLdSdZOZLiTCv3ougK36UYFNR6lOJ1j1lP1Gmb26T6TbL58N7orQegMpiYqWOmb1 ztUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k91si1545095edc.122.2018.01.23.12.18.16; Tue, 23 Jan 2018 12:18:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id A9A37C21C3F; Tue, 23 Jan 2018 20:17:33 +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 E20EFC21E92; Tue, 23 Jan 2018 20:17:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6B73FC21DA6; Tue, 23 Jan 2018 20:17:08 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id F080CC21C3F for ; Tue, 23 Jan 2018 20:17:07 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id CA46320C12; Tue, 23 Jan 2018 21:17:07 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 953B9207A8; Tue, 23 Jan 2018 21:17:07 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:50 +0100 Message-Id: <8c0b36130b265e429f5ad0887c339776e4d47912.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 01/15] cmd: nvedit: Get rid of the env lookup 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The nvedit command is the only user of env_driver_lookup_default outside of the environment code itself, and it uses it only to print the environment it's about to save to during env save. As we're about to rework the environment to be able to handle multiple environment sources, we might not have an idea of what environment backend is going to be used before trying (and possibly failing for some). Therefore, it makes sense to remove that message and move it to the env_save function itself. As a side effect, we also can get rid of the call to env_driver_lookup_default that is also about to get refactored. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- cmd/nvedit.c | 4 ---- env/env.c | 4 +++- include/environment.h | 7 ------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4e79d03856fe..a690d743cd46 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -708,10 +708,6 @@ ulong env_get_ulong(const char *name, int base, ulong default_val) static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - struct env_driver *env = env_driver_lookup_default(); - - printf("Saving Environment to %s...\n", env->name); - return env_save() ? 1 : 0; } diff --git a/env/env.c b/env/env.c index 76a5608628fc..094538ff5b62 100644 --- a/env/env.c +++ b/env/env.c @@ -52,7 +52,7 @@ static enum env_location env_get_default_location(void) return ENVL_UNKNOWN; } -struct env_driver *env_driver_lookup_default(void) +static struct env_driver *env_driver_lookup_default(void) { enum env_location loc = env_get_default_location(); struct env_driver *drv; @@ -115,6 +115,8 @@ int env_save(void) return -ENODEV; if (!drv->save) return -ENOSYS; + + printf("Saving Environment to %s...\n", drv->name); ret = drv->save(); if (ret) { debug("%s: Environment failed to save (err=%d)\n", __func__, diff --git a/include/environment.h b/include/environment.h index d29f82cb5d6f..a2015c299aa9 100644 --- a/include/environment.h +++ b/include/environment.h @@ -293,13 +293,6 @@ int env_import_redund(const char *buf1, const char *buf2); #endif /** - * env_driver_lookup_default() - Look up the default environment driver - * - * @return pointer to driver, or NULL if none (which should not happen) - */ -struct env_driver *env_driver_lookup_default(void); - -/** * env_get_char() - Get a character from the early environment * * This reads from the pre-relocation environemnt From patchwork Tue Jan 23 20:16:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125574 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1982913ljf; Tue, 23 Jan 2018 12:20:53 -0800 (PST) X-Google-Smtp-Source: AH8x227/MPKwjDFvNJj9mz4BSBJ5jVtKsacTuiZNmyLwNc8ew+ADO8Y0eF6J4vmgomf21pvhH5hi X-Received: by 10.80.153.143 with SMTP id m15mr20931191edb.145.1516738853907; Tue, 23 Jan 2018 12:20:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738853; cv=none; d=google.com; s=arc-20160816; b=HLsSaSJOY14Rnv5/vhf/4QLxWoLOdqZKaKJfBoRJzHEwjqzwNvNHGaNQKCqiW13q7K do0a/qbzaNgtv/g0Prd12fodIzv8vQ99qK9xaLfRxZPPpgO0YYsfwlboHHG2DMB71IWd cGzgoNJNP626/br9iT7DXzEo3WTh2ZJN0XaDDATBMOJ2LmY0X/l23K2VO9aDkNtDRZHy GMSdGAHaL7ahqKEfIyBF1o2d/0cWHNlruRI+ChsTnIlsriVwoO5BT5jSyLOQ0gC6+elN RICjzo8v3R1LC9380VRpP3jaKvGF+GBsPyt6nXg7O5QKi3FkgaDcGHBWrguS/lEXCJ6l UP1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=vlMiHPcoPAC+98M2hyduRHT+hzVYtAfDocwS/Q1vIWI=; b=M6bRm28HZSfb7+OMzgHhg4LURV1P5br6jeSHEkZ4TnqTG3O4MM6OaKmlmkdTWLkfWN qT2jebjaxpFkD6EVYncNNOejDH5cosRmE1BU1bFMH46TTYVFaF5f1SG5jQJwiclUNQFL Kxts4g20zpruZlMYdkvpFY2gwrI1kvbvU/lQyuoBSMIJ+9o46JtsgQkzvqDmm+ylFSd4 64y6mEe0MJwLkm3i8VCEc9Fd3zw0sRtYSbe7xww6dIntMjywMN/skp66Odr+iGhUG55o UEJlazoXeB/7dQPodUCVX1ioBT1DGNQ5XoH6zL+UD/VIp7PfD5gCBbq0lsDoIHAa5GG+ Bxzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id i2si480510edf.508.2018.01.23.12.20.53; Tue, 23 Jan 2018 12:20:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 790F0C21EF2; Tue, 23 Jan 2018 20:17:53 +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 0A3AAC21F0C; Tue, 23 Jan 2018 20:17:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A908BC21C3F; Tue, 23 Jan 2018 20:17:08 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 56EB7C21C51 for ; Tue, 23 Jan 2018 20:17:08 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 319CF20C1B; Tue, 23 Jan 2018 21:17:08 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id F02BD207A8; Tue, 23 Jan 2018 21:17:07 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:51 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 02/15] env: Rename env_driver_lookup_default and env_get_default_location 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The env_driver_lookup_default and env_get_default_location functions are about to get refactored to support loading from multiple environment. The name is therefore not really well suited anymore. Drop the default part to be a bit more relevant. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/env/env.c b/env/env.c index 094538ff5b62..97ada5b5a6fd 100644 --- a/env/env.c +++ b/env/env.c @@ -10,7 +10,7 @@ DECLARE_GLOBAL_DATA_PTR; -static struct env_driver *env_driver_lookup(enum env_location loc) +static struct env_driver *_env_driver_lookup(enum env_location loc) { struct env_driver *drv; const int n_ents = ll_entry_count(struct env_driver, env_driver); @@ -26,7 +26,7 @@ static struct env_driver *env_driver_lookup(enum env_location loc) return NULL; } -static enum env_location env_get_default_location(void) +static enum env_location env_get_location(void) { if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) return ENVL_EEPROM; @@ -52,12 +52,12 @@ static enum env_location env_get_default_location(void) return ENVL_UNKNOWN; } -static struct env_driver *env_driver_lookup_default(void) +static struct env_driver *env_driver_lookup(void) { - enum env_location loc = env_get_default_location(); + enum env_location loc = env_get_location(); struct env_driver *drv; - drv = env_driver_lookup(loc); + drv = _env_driver_lookup(loc); if (!drv) { debug("%s: No environment driver for location %d\n", __func__, loc); @@ -69,7 +69,7 @@ static struct env_driver *env_driver_lookup_default(void) int env_get_char(int index) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret; if (gd->env_valid == ENV_INVALID) @@ -89,7 +89,7 @@ int env_get_char(int index) int env_load(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret = 0; if (!drv) @@ -108,7 +108,7 @@ int env_load(void) int env_save(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret; if (!drv) @@ -129,7 +129,7 @@ int env_save(void) int env_init(void) { - struct env_driver *drv = env_driver_lookup_default(); + struct env_driver *drv = env_driver_lookup(); int ret = -ENOENT; if (!drv) From patchwork Tue Jan 23 20:16:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125573 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1982689ljf; Tue, 23 Jan 2018 12:20:21 -0800 (PST) X-Google-Smtp-Source: AH8x224e/MQ6zfamkgRZsKj+1kTzrV5JzBveJ9g0WjgEeR63nwfFeo3zbFofJgHxCWeWGrIOihXl X-Received: by 10.80.146.182 with SMTP id k51mr21581484eda.110.1516738821507; Tue, 23 Jan 2018 12:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738821; cv=none; d=google.com; s=arc-20160816; b=xNC5UJZgPPQT0+ANbUoEgLxm0wgrFop0RAxRpAiiC+NHja0NQR1VM3n46xBx6lTk9E eYCWy17DQJ1j8srmBr8nuLX8ir4qakWsPy6KX0JfoHV6uamwJnjGeL4PYa5yYP6Xvkoy UTXDPyaOziLq/3WqKhhmL17qM+NQlnShNySTBbtVF9ZD7ecXJhI9GmTrNufKekGtTglz vW6JgYbqgbaXGXWkXzD3Gk4/icFVSb8BTJyt6TDugb50PdHuM9zDNVU2UndeJCIgW3V4 mG5x/PVrfYrxK8e1avDk9BGkr3L73+huwvVUtHA0Cc+iyx/Tux2FNqPC0Yl5fkA1nT/+ r9aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=C6qaS0tO5k7RWRcSfgL+NKBklDRTkGhHChZQOIupgf4=; b=rn5Lu6YQJh6PbPIIVWYSSSn8YYl8JYuyFLk6muoHngri6nbxG0/8aluUZvE69ZzCei 7T7TMLednE0OZcLX9jJt71/hZddWn06Jup0KhgSnU3k6aKpHk0db6NKyxdXBsiZZRFXb BKpqnMD4aiE+3cYKo2lDuBHdtG9CS+ACczea3F1qljdohTrcK9BCm8tPNdOtrYTGxKX+ XaEJQr/nc2bzGMSS4b2UOP/toa110QBJ3OO8RPq1+wgQd2RdzP30KyF+JrN5jRH/es4R z4CbxmxnZmgaPS3O8kMTfGeyuLHs3figHn4DbReb2FThvxjbd57xuNKnfxF6DDXP/k1M MRNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u61si704800edc.131.2018.01.23.12.20.21; Tue, 23 Jan 2018 12:20:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 1A67AC21EF1; Tue, 23 Jan 2018 20:18:10 +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 ED069C21DB5; Tue, 23 Jan 2018 20:17:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 15229C21C3F; Tue, 23 Jan 2018 20:17:09 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id BF46DC21C51 for ; Tue, 23 Jan 2018 20:17:08 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 96F4B20C29; Tue, 23 Jan 2018 21:17:08 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 61C72207A8; Tue, 23 Jan 2018 21:17:08 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:52 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 03/15] env: Pass additional parameters to the env lookup function 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In preparation for the multiple environment support, let's introduce two new parameters to the environment driver lookup function: the priority and operation. The operation parameter is meant to identify, obviously, the operation you might want to perform on the environment. The priority is a number passed to identify the environment priority you want to retrieve. The lowest priority parameter (0) will be the primary source. Combining the two parameters allow you to support multiple environments through different priorities, and to change those priorities between read and writes operations. This is especially useful to implement migration mechanisms where you want to always use the same environment first, be it to read or write, while the common case is more likely to use the same environment it has read from to write it to. Signed-off-by: Maxime Ripard --- env/env.c | 157 +++++++++++++++++++++++++++++-------------- include/environment.h | 8 ++- 2 files changed, 116 insertions(+), 49 deletions(-) diff --git a/env/env.c b/env/env.c index 97ada5b5a6fd..73da149fd8ca 100644 --- a/env/env.c +++ b/env/env.c @@ -26,8 +26,33 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) return NULL; } -static enum env_location env_get_location(void) +/** + * env_get_location() - Returns the best env location for a board + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will return the preferred environment for the given priority. + * + * All implementations are free to use the operation, the priority and + * any other data relevant to their choice, but must take into account + * the fact that the lowest prority (0) is the most important location + * in the system. The following locations should be returned by order + * of descending priorities, from the highest to the lowest priority. + * + * Returns: + * an enum env_location value on success, a negative error code otherwise + */ +static enum env_location env_get_location(enum env_operation op, int prio) { + /* + * We support a single environment, so any environment asked + * with a priority that is not zero is out of our supported + * bounds. + */ + if (prio >= 1) + return ENVL_UNKNOWN; + if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) return ENVL_EEPROM; else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) @@ -52,11 +77,27 @@ static enum env_location env_get_location(void) return ENVL_UNKNOWN; } -static struct env_driver *env_driver_lookup(void) + +/** + * env_driver_lookup() - Finds the most suited environment location + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will try to find the available environment with the highest + * priority in the system. + * + * Returns: + * NULL on error, a pointer to a struct env_driver otherwise + */ +static struct env_driver *env_driver_lookup(enum env_operation op, int prio) { - enum env_location loc = env_get_location(); + enum env_location loc = env_get_location(op, prio); struct env_driver *drv; + if (loc == ENVL_UNKNOWN) + return NULL; + drv = _env_driver_lookup(loc); if (!drv) { debug("%s: No environment driver for location %d\n", __func__, @@ -69,83 +110,101 @@ static struct env_driver *env_driver_lookup(void) int env_get_char(int index) { - struct env_driver *drv = env_driver_lookup(); - int ret; + struct env_driver *drv; + int prio; if (gd->env_valid == ENV_INVALID) return default_environment[index]; - if (!drv) - return -ENODEV; - if (!drv->get_char) - return *(uchar *)(gd->env_addr + index); - ret = drv->get_char(index); - if (ret < 0) { - debug("%s: Environment failed to load (err=%d)\n", - __func__, ret); + + for (prio = 0; (drv = env_driver_lookup(ENVOP_GET_CHAR, prio)); prio++) { + int ret; + + if (!drv->get_char) + continue; + + ret = drv->get_char(index); + if (!ret) + return 0; + + debug("%s: Environment %s failed to load (err=%d)\n", __func__, + drv->name, ret); } - return ret; + return -ENODEV; } int env_load(void) { - struct env_driver *drv = env_driver_lookup(); - int ret = 0; + struct env_driver *drv; + int prio; - if (!drv) - return -ENODEV; - if (!drv->load) - return 0; - ret = drv->load(); - if (ret) { - debug("%s: Environment failed to load (err=%d)\n", __func__, - ret); - return ret; + for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) { + int ret; + + if (!drv->load) + continue; + + ret = drv->load(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to load (err=%d)\n", __func__, + drv->name, ret); } - return 0; + return -ENODEV; } int env_save(void) { - struct env_driver *drv = env_driver_lookup(); - int ret; + struct env_driver *drv; + int prio; - if (!drv) - return -ENODEV; - if (!drv->save) - return -ENOSYS; - - printf("Saving Environment to %s...\n", drv->name); - ret = drv->save(); - if (ret) { - debug("%s: Environment failed to save (err=%d)\n", __func__, - ret); - return ret; + for (prio = 0; (drv = env_driver_lookup(ENVOP_SAVE, prio)); prio++) { + int ret; + + if (!drv->save) + continue; + + printf("Saving Environment to %s...\n", drv->name); + ret = drv->save(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to save (err=%d)\n", __func__, + drv->name, ret); } - return 0; + return -ENODEV; } int env_init(void) { - struct env_driver *drv = env_driver_lookup(); + struct env_driver *drv; int ret = -ENOENT; + int prio; + + for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { + if (!drv->init) + continue; - if (!drv) - return -ENODEV; - if (drv->init) ret = drv->init(); + if (!ret) + return 0; + + debug("%s: Environment %s failed to init (err=%d)\n", __func__, + drv->name, ret); + } + + if (!prio) + return -ENODEV; + if (ret == -ENOENT) { gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = ENV_VALID; return 0; - } else if (ret) { - debug("%s: Environment failed to init (err=%d)\n", __func__, - ret); - return ret; } - return 0; + return ret; } diff --git a/include/environment.h b/include/environment.h index a2015c299aa9..a4060506fabb 100644 --- a/include/environment.h +++ b/include/environment.h @@ -205,6 +205,14 @@ enum env_location { ENVL_UNKNOWN, }; +/* value for the various operations we want to perform on the env */ +enum env_operation { + ENVOP_GET_CHAR, /* we want to call the get_char function */ + ENVOP_INIT, /* we want to call the init function */ + ENVOP_LOAD, /* we want to call the load function */ + ENVOP_SAVE, /* we want to call the save function */ +}; + struct env_driver { const char *name; enum env_location location; From patchwork Tue Jan 23 20:16:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125572 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1982467ljf; Tue, 23 Jan 2018 12:19:51 -0800 (PST) X-Google-Smtp-Source: AH8x225s03aCFTLkJ8SVSBFw2OGOK/wENZg7FlPea4/wr47ipNOUQ5IVy6NrDHVS9/r1ZSmYcm4H X-Received: by 10.80.187.73 with SMTP id y67mr20754920ede.172.1516738791334; Tue, 23 Jan 2018 12:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738791; cv=none; d=google.com; s=arc-20160816; b=a0wlKKMiV86uxcPCL8bmwtwBJ6AhZ752oQ9cxslTs4MsLEE0/lXPmB18kEtx1WGWu/ asoJBPytGQ4BymIynFxs+R3R3TUpFNWxXpZwout6yZUnKQFg4+aXi29ILfN4bcQ7yIz5 8PdNAo8Ivwg4d37NA7YfmVnuMWBzLExevkzwgRc9WkbeViPH+E4q2bnKni1L9ShcM4U0 uSHaC/pWD4br0EPiSFPaZCy/XWMhXTLAbNwvG9yZsvS94qYL/CGl2SaNFAGWQPCAEB1r j0j4GK9IgmmNTgTR7b1HdxXDPbIp94nDPJJ7bmOfHO1r7K2FqchIEtlPM9n2i0qojg1u zERg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=kXcr5n1LiW9AvT3hRujCxexv7sN1a/pKsvVqfZ88TQQ=; b=M2hqTumelegGx7SFJZMBql67/dwo3yjLprDmcZRqu0em8ziMKVy9xTy8ixtjWlK+tk 5P+42B8bwtmunY0qop1ctgazgGp9UDMVw1okdGzKNBcK0BS0wm5s6U3FFn6Ld8rME8T5 M1lJv+gWsnVtxV+YWixYd6A4RqnyaNwfVwa8m1wsq7pnEJVfrN51EZFTzpi0y1NiHQTT HTngBqP6+ROP/0c1ZlwwqlghZ5P0zzsJsdRCOj2GN5GAoX7gCM/5Tmj59RNmCZvCpUkt a3CzCBMttywWBATCuZK5+jxq/gBi6kuA3HDb3idYkiXcsMBOhQu+wifIzAhhqZZopZ7/ GZWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 34si4316902edj.250.2018.01.23.12.19.50; Tue, 23 Jan 2018 12:19:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id AAA6FC220DC; Tue, 23 Jan 2018 20:18:31 +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 EAFB0C220DC; Tue, 23 Jan 2018 20:17:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DE36FC21EDE; Tue, 23 Jan 2018 20:17:09 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 36A59C21DA6 for ; Tue, 23 Jan 2018 20:17:09 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 142C520C53; Tue, 23 Jan 2018 21:17:09 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id CB850207A8; Tue, 23 Jan 2018 21:17:08 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:53 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 04/15] env: Make the env save message a bit more explicit 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we'll soon have support for multiple environments, the environment saving message might end up being printed multiple times if the higher priority environment cannot be used. That might confuse the user, so let's make it explicit if the operation failed or not. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 73da149fd8ca..11667a3cbc71 100644 --- a/env/env.c +++ b/env/env.c @@ -166,8 +166,9 @@ int env_save(void) if (!drv->save) continue; - printf("Saving Environment to %s...\n", drv->name); + printf("Saving Environment to %s... ", drv->name); ret = drv->save(); + printf("%s\n", ret ? "Failed" : "OK"); if (!ret) return 0; From patchwork Tue Jan 23 20:16:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125581 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984841ljf; Tue, 23 Jan 2018 12:25:16 -0800 (PST) X-Google-Smtp-Source: AH8x224ZwPgwxRCohPpLX6Etn7uFyLcZI/kIu9dAZTtPbGEAtsWjJ9b0j7S2/yAHnLErsG7rbsAt X-Received: by 10.80.207.206 with SMTP id i14mr20696164edk.133.1516739115958; Tue, 23 Jan 2018 12:25:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739115; cv=none; d=google.com; s=arc-20160816; b=jYsvTHT+6UUJY+q6ls2H9Xi3nzNNhp4YUNKhQ75Fy/CaAfUoK4Z3jhjq1lQRP2Rr3S +d21ACBJfzzPN06dNI5yVEeTpDfAkDZnM6ZWKbKu9rK/HqYdb4PcTZRaPPUPoJgKNkQ1 QMjxTSxBFYhWCPTs+L8RLqkQSCCQf73Ttg5y7fxiWjeFIlgo/7eAtWK5JuEbG42yDYkT QqU7SMh7yfpSRoS/h190KNrmWaSl0wbXld8ZoMZJDdDZyjyamUVl5X84LDgIUL6zp0R/ OWSP6nasIR00aYT+i9JYiw6Cy2sXUXjWslo1dWooj7xdKhdOnP8gSlPbdMwwtllgQ4Vi +mIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=+smlgpxBVVwNR1TBgYVnZyvWQ0ZV5bDSZUeqOPCNvls=; b=Z+ewj3MjqrUNVvY2GfyBs6wsFg7b5U+VHn7E8Mr0YtZ4oyL37lm5B50bNB5kXsmxMr xFtOAAfe3Peka/0AVZnWTmZQK91mxMTGExICjioyHdkJtE7ZP/u7trQ7ybEXmw/UGQEE ZimrwOpDRiAcK6X7fw8NX2Y9ucs5MgQ0V9gPkClwG35lRmYrxtfnf6FPI5VAvxHsG3SP o7IVLm8INHzZqCr6U9sUaFtRH8DZrQ+Z3dxWvk9lh5JQ6JNdWCD4jlQoW2YdjJaaElk6 xS6YSpsDoNAgXyEamRmUAMHWU6BwXWZc7ap5tccH2i5UHQwBiNHlN9n2hC2aQhdDfTCu W+9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id f6si2408972eda.157.2018.01.23.12.25.15; Tue, 23 Jan 2018 12:25:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 84829C22169; Tue, 23 Jan 2018 20:20:36 +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 DB3A1C22168; Tue, 23 Jan 2018 20:17:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5C4AAC21EBB; Tue, 23 Jan 2018 20:17:17 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 494BEC21F0A for ; Tue, 23 Jan 2018 20:17:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 2710420D86; Tue, 23 Jan 2018 21:17:12 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id EA846207A8; Tue, 23 Jan 2018 21:17:11 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:54 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 05/15] env: Make it explicit where we're loading our environment from 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we can have multiple environments now, it's better to provide a decent indication on what environments were tried and which were the one to fail and succeed. Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/env/env.c b/env/env.c index 11667a3cbc71..906f28ee50a1 100644 --- a/env/env.c +++ b/env/env.c @@ -144,12 +144,15 @@ int env_load(void) if (!drv->load) continue; + printf("Loading Environment from %s... ", drv->name); ret = drv->load(); + if (ret) + printf("Failed (%d)\n", ret); + else + printf("OK\n"); + if (!ret) return 0; - - debug("%s: Environment %s failed to load (err=%d)\n", __func__, - drv->name, ret); } return -ENODEV; @@ -168,12 +171,13 @@ int env_save(void) printf("Saving Environment to %s... ", drv->name); ret = drv->save(); - printf("%s\n", ret ? "Failed" : "OK"); + if (ret) + printf("Failed (%d)\n", ret); + else + printf("OK\n"); + if (!ret) return 0; - - debug("%s: Environment %s failed to save (err=%d)\n", __func__, - drv->name, ret); } return -ENODEV; From patchwork Tue Jan 23 20:16:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125576 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1983829ljf; Tue, 23 Jan 2018 12:23:04 -0800 (PST) X-Google-Smtp-Source: AH8x227iJTp90S8iCq1gFSwsO34iH0N6qdi7tw5qCeXvkYECIWZTn9lUC2B5CjqLA1s4ZRnM5Jry X-Received: by 10.80.202.193 with SMTP id f1mr21422755edi.30.1516738984006; Tue, 23 Jan 2018 12:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738983; cv=none; d=google.com; s=arc-20160816; b=d933nw6rKq+t86WlYYS4gH0VszLU9pjuX4fyT5CI2DLb4DCoW+RAeIEKof2+Ys8x8l bz+b+VtEArLVUq+MsJY4YQRQtSuWdtnvnrzRdu9c2HTReBoRbVhWU/KOo5EiluE3dPH7 ERoWL3I81WAtFZxXw8AkzbEHdchJZIkbiUcgl+rsGwbL9/LHErV7CckQSIabbRUVTJcA 0MrdLcWfYAozBaEfB5vgAg9pwe/LxMfAP/oEF86qEMSL4sqsuaYURXCEYwytz5MBSWGL g37EYDbsoHCskrVPTCfqnbEAf9+COKrHuTe34O2cRSuTwRKoAZDS6uxhX4ghdWJOsRWe IO1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=iRCC2lxkddvXGqNWN69MabOKcurl6zpX6gwtVm67A+4=; b=pUB8vquHl3GyRUtObXXPyXhu5qZHpcuOb7U6zY3SeBitvgCUD+V1g1T1J3X4I7OTdc gKvCbhOXe0HKkllI6M3imMFRp7K9+aXGpGNmfWSmj3DCpt3S4zQH6fThyEPpnHFq0B0k a3cjCuRZsuYcgeeQWZkXOKs8sJvnbJi4/LUWY84Ey5HEXLPV2YZ7gmlrDO4wmXWGiUGw MUdROCnW/rANrrHbIXkvSJh+waVdroezuVyGf+BVNdww0Qu4iZYIb1WHLaL3+VOKZ0PI JyeJZ5k/4L22X5ZCnhsrbraKRfwcEKwSIOcto181HW5W7xWmBeEJTKw1OCtB2wbdR2uR YERA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id f18si1445328edb.350.2018.01.23.12.23.03; Tue, 23 Jan 2018 12:23:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 8E514C2212D; Tue, 23 Jan 2018 20:18:48 +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 DD2D9C21DA6; Tue, 23 Jan 2018 20:17:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 21A7AC22132; Tue, 23 Jan 2018 20:17:13 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 9C17EC21E73 for ; Tue, 23 Jan 2018 20:17:09 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7809520C56; Tue, 23 Jan 2018 21:17:09 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4B564207A8; Tue, 23 Jan 2018 21:17:09 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:55 +0100 Message-Id: <2be71a7b8fdf51572b9264358733235936f5aebd.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 06/15] env: fat: Make the debug messages play a little nicer 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make FAT play a little nicer by removing all the extra \n and formatting that is redundant with the global output. Reviewed-by: Andre Przywara Signed-off-by: Maxime Ripard --- env/fat.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/env/fat.c b/env/fat.c index ec49c3905369..158a9a34357b 100644 --- a/env/fat.c +++ b/env/fat.c @@ -55,7 +55,11 @@ static int env_fat_save(void) dev = dev_desc->devnum; if (fat_set_blk_dev(dev_desc, &info) != 0) { - printf("\n** Unable to use %s %d:%d for saveenv **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to use %s %d:%d... ", CONFIG_ENV_FAT_INTERFACE, dev, part); return 1; } @@ -63,12 +67,15 @@ static int env_fat_save(void) err = file_fat_write(CONFIG_ENV_FAT_FILE, (void *)&env_new, 0, sizeof(env_t), &size); if (err == -1) { - printf("\n** Unable to write \"%s\" from %s%d:%d **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to write \"%s\" from %s%d:%d... ", CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part); return 1; } - puts("done\n"); return 0; } #endif /* CMD_SAVEENV */ @@ -90,14 +97,22 @@ static int env_fat_load(void) dev = dev_desc->devnum; if (fat_set_blk_dev(dev_desc, &info) != 0) { - printf("\n** Unable to use %s %d:%d for loading the env **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to use %s %d:%d... ", CONFIG_ENV_FAT_INTERFACE, dev, part); goto err_env_relocate; } err = file_fat_read(CONFIG_ENV_FAT_FILE, buf, CONFIG_ENV_SIZE); if (err == -1) { - printf("\n** Unable to read \"%s\" from %s%d:%d **\n", + /* + * This printf is embedded in the messages from env_save that + * will calling it. The missing \n is intentional. + */ + printf("Unable to read \"%s\" from %s%d:%d... ", CONFIG_ENV_FAT_FILE, CONFIG_ENV_FAT_INTERFACE, dev, part); goto err_env_relocate; } From patchwork Tue Jan 23 20:16:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125583 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984980ljf; Tue, 23 Jan 2018 12:25:35 -0800 (PST) X-Google-Smtp-Source: AH8x226PS8zVdiqqwiaeoqj90BmKpfUDoU92VpVBPx5EEgm67VwShq12TsyLWHgd8lzaFZlKMqZU X-Received: by 10.80.183.170 with SMTP id h39mr20910416ede.124.1516739135137; Tue, 23 Jan 2018 12:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739135; cv=none; d=google.com; s=arc-20160816; b=QQnRKaFF4GvOPQAXiw3tPwOMhsk6AUJWJReum6el7WEOYncLN8GDafaX4W7hfcp68f y7AuWY9DorENvIUemzp6jeAuwTueYwEOFVFO3DEoFOs40+ljzKfaIGPKNrA9HNvMD0Qk jbv+5LPjs+zzW69B/LtVw2jvLGsVxPoRe/RBvFf4hYCKmvTSjgW0rgVZy+wfiNUQGnrN Uo4m43P23T5crzwnSOq/fr3g2LfVXyP4//2TP9qbK3NMfI/xoZFaLRnipbnp6uCrvQuN a6/F4c3ZntKPiBfSSyTYc444lbz44hG74psV8Ewys+rOs5Pr61ois+BupwAjyowCV/Wj /vIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=oPJQ6/8C0fDWNRs1OrgtoQdhD2XhdqvqYq79WQh9Awg=; b=fyFgq8apUQ36seaQMuXs7mf9rDBHm7BmveMW1kGIQifMl0FZA+jHULh4xQPKWhCeax IKL876Q/F+PaVyqQS8moulQwJooSoAloIZ1rA0yrJMco9pcPhIHktbXck650SybTDKnh HpB17tc2PJIAdJmyjqxQjtHtqVbv1xR8cyzo5rKKyQQe+XU9l6vNsGneU0GIVVYBcKNE rtTctYXCgkeRzv7Tj3EWmxXtye1P+3HWSi/Oe6iZ4KujgnpUfd7BopahzFdYt4elwPsd rtTzmPMabqCJdpug0xmUCcYt0tnL4gK1qMjEr4KO8Ha91bO1kWz+l1WxdpqjHeU1YkEX Bx8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 93si11608334edk.128.2018.01.23.12.25.34; Tue, 23 Jan 2018 12:25:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id B6974C21E65; Tue, 23 Jan 2018 20:19:44 +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 578F1C21DD7; Tue, 23 Jan 2018 20:17:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4FA9DC21E68; Tue, 23 Jan 2018 20:17:14 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 1BACCC21E88 for ; Tue, 23 Jan 2018 20:17:10 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E7DB820C89; Tue, 23 Jan 2018 21:17:09 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id B605E207A8; Tue, 23 Jan 2018 21:17:09 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:56 +0100 Message-Id: <00797679b40073c7480a156a83d3b0a1be72cf5f.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 07/15] env: mmc: Make the debug messages play a little nicer 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make MMC play a little nicer by removing all the extra \n and formatting that is redundant with the global output. Reviewed-by: Andre Przywara Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard Reviewed-by: Jaehoon Chung --- env/mmc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/env/mmc.c b/env/mmc.c index ed7bcf16ae0e..528fbf978162 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -233,7 +233,6 @@ static int env_mmc_save(void) goto fini; } - puts("done\n"); ret = 0; #ifdef CONFIG_ENV_OFFSET_REDUND From patchwork Tue Jan 23 20:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125577 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984445ljf; Tue, 23 Jan 2018 12:24:23 -0800 (PST) X-Google-Smtp-Source: AH8x227OjKKhJq8oqWD7oon/MtBsTnOKwHsVGwhPhQR755j5rmlCLQcBBc7UCy8nCA2n0j7Iu3MF X-Received: by 10.80.189.139 with SMTP id y11mr9616427edh.122.1516739063405; Tue, 23 Jan 2018 12:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739063; cv=none; d=google.com; s=arc-20160816; b=qese2YJWTwTdtXRNv6WnVoHFJ0fksKxX60kT4OfP9liXNYzMRkYEov8Eak9Ql+tKAG UDnbaD04dgaG5pO242dMRJ+jZDyty5dFiu9hjQQVGNcnR/8vlAvDbzkIr5Pl4wsW6nP0 AuPM/0mSgPUu/W4n4K3XQLfboxDhPxoHgWsG71Ubiuh6NZA/EnpZAges9CXo9rZ89jVK GrEpK/zXePag83tjeLr9R5XWW5e8uTKJ97JUdcWmsd8TYrbEhKI9nWg5aQ+C7k1eW4EP 6Q0Ah+o6epIV9KlhbYoaubQrByL/qoJazwX/Rs9pPrs6aIRBgZutGaeC4wFVJ1WX6SUB ohEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=5qRcAdtvKa5l9j6gakknoGARKjG7dR2lqm+qPHLpiKw=; b=vH2SKpryC9HyXvWDj1TYgLRgOuapn3v3m2HQ/HUeYq1BVMMW9UfEr7r5NQY0Jk7mTI cjJA2LPjhABkrmTooOzHQOSFAuh0WJ0foo0UBOlfRFZHGY+F2Y6j1iapgWK1u1NmA3uI Ye4M0M/5KtskghSKFfNDGdVjceXcLyQzUQGFVt5XXhmenFYNv4Dopg4eUdU9t72zn+T3 Gsbt7FzsMcWJoal67poiDLKRrzjabOJ7G027Jzx1g1V+fYonDqfrsynApO8kn6qw2hUc f6CVsPgggfaJ7CutP7NuwTs6DVDM3rv716wpxztSNRq/M75nj6ipIKYnpSwGi54hRJz1 hTyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id w28si5568439edl.405.2018.01.23.12.24.23; Tue, 23 Jan 2018 12:24:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 03BEDC21E85; Tue, 23 Jan 2018 20:19:05 +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 D1B0BC2213B; Tue, 23 Jan 2018 20:17:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 78907C21EF1; Tue, 23 Jan 2018 20:17:14 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 827BBC21E76 for ; Tue, 23 Jan 2018 20:17:10 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 5D9BC20C92; Tue, 23 Jan 2018 21:17:10 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2E473207A8; Tue, 23 Jan 2018 21:17:10 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:57 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 08/15] env: common: Make the debug messages play a little nicer 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we have global messages to indicate what's going on, the custom messages in the environment drivers only make the output less readable. Make the common code play a little nicer by removing all the extra output in the standard case. Reviewed-by: Andre Przywara Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/common.c b/env/common.c index 8167ea299264..c633502d68bb 100644 --- a/env/common.c +++ b/env/common.c @@ -78,7 +78,7 @@ void set_default_env(const char *s) puts(s); } } else { - puts("Using default environment\n\n"); + debug("Using default environment\n"); } if (himport_r(&env_htab, (char *)default_environment, From patchwork Tue Jan 23 20:16:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125582 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984930ljf; Tue, 23 Jan 2018 12:25:29 -0800 (PST) X-Google-Smtp-Source: AH8x226mWW+6dQ6+pOz2da8z9SxcnKsPTSKL/u7OuuNXf70HRzMit1GFjXHiiPl3ytMAouVriqia X-Received: by 10.80.169.53 with SMTP id l50mr21334679edc.128.1516739129222; Tue, 23 Jan 2018 12:25:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739129; cv=none; d=google.com; s=arc-20160816; b=YwRMBVKixNgUgWCPisEf0y5cRDhjdTMgIA1tfYntyYqpoTRqaAmGkAtWFDExxfAASW e/j/HJllj+/7nB4IUzr+JyudWEAJtTGMSWdtbFueAW8tLVK8W8UJ78ZnGh1PAmFnND61 YIpD/EksmJkdhIHaEeyU99BZDeakKAl78qIq8gOxZ5sB+oYNndz9yMz5xn+25O0oaWCH G6Aepxxlp/ZviYlrh0W6zMzPDRpT3macL0q9DZB2+tBi9AG7q2/ZL4pGpsLxir51aUj7 j0mJTMpinnxc2HI5w9Fn3b9b9synihAL1KHm+QIq8y4eY9nH6k0fyv/k68b4yv0O4DpK 1kjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=hTJcIdMeiekbnUwfFrEqjw+PeHU0yIag0gNj1Hb5nhk=; b=f4xsMWTsOlI76Q690v5B5/Ft3MsXAD2BW9qI+beiGi9ozgSRPlWMJw1XOMFHZjrBSz 5msodZilbdNz3hW0iKWFbgehfAQvfHdV/dC3FxljpyoZDd7egwbKgSFLqIHDKafAq3Kk 9mFdN1KHntGmNFBVmYcoRzcMPFR2nikk4WHRWoNsVqwuWU2DpGLY3lMihCA+upXL199I WnpTJc5ls9SJsguSjzfo15pIV22X3aDVuIMKqRewDoG3UfwzqbGurHAE+oBwmtZdRBEx t3DMMS9QBDDATIz377kv07l19iIpOLuHyenVW4YhvOdWGOnPieVEaBYIYe1GJZJfgijt tfng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id e34si1206297eda.52.2018.01.23.12.25.28; Tue, 23 Jan 2018 12:25:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id D37F6C21DB5; Tue, 23 Jan 2018 20:20:18 +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 D262DC22153; Tue, 23 Jan 2018 20:17:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CF8C3C21F03; Tue, 23 Jan 2018 20:17:16 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id EDF3AC21EE3 for ; Tue, 23 Jan 2018 20:17:10 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id CD3BC20D84; Tue, 23 Jan 2018 21:17:10 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 98D30207A8; Tue, 23 Jan 2018 21:17:10 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:58 +0100 Message-Id: <844212451999302a41d87526d6616b1af7c781d1.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 09/15] env: Support multiple environments 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place to support multiple environment, let's make sure the current code can use it. The priority used between the various environment is the same one that was used in the code previously. At read / init times, the highest priority environment is going to be detected, and we'll use the same one without lookup during writes. This should implement the same behaviour than we currently have. Reviewed-by: Andre Przywara Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 80 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/env/env.c b/env/env.c index 906f28ee50a1..1182fdb545db 100644 --- a/env/env.c +++ b/env/env.c @@ -26,6 +26,41 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) return NULL; } +static enum env_location env_locations[] = { +#ifdef CONFIG_ENV_IS_IN_EEPROM + ENVL_EEPROM, +#endif +#ifdef CONFIG_ENV_IS_IN_FAT + ENVL_FAT, +#endif +#ifdef CONFIG_ENV_IS_IN_FLASH + ENVL_FLASH, +#endif +#ifdef CONFIG_ENV_IS_IN_MMC + ENVL_MMC, +#endif +#ifdef CONFIG_ENV_IS_IN_NAND + ENVL_NAND, +#endif +#ifdef CONFIG_ENV_IS_IN_NVRAM + ENVL_NVRAM, +#endif +#ifdef CONFIG_ENV_IS_IN_REMOTE + ENVL_REMOTE, +#endif +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH + ENVL_SPI_FLASH, +#endif +#ifdef CONFIG_ENV_IS_IN_UBI + ENVL_UBI, +#endif +#ifdef CONFIG_ENV_IS_NOWHERE + ENVL_NOWHERE, +#endif +}; + +static enum env_location env_load_location = ENVL_UNKNOWN; + /** * env_get_location() - Returns the best env location for a board * @op: operations performed on the environment @@ -45,36 +80,21 @@ static struct env_driver *_env_driver_lookup(enum env_location loc) */ static enum env_location env_get_location(enum env_operation op, int prio) { - /* - * We support a single environment, so any environment asked - * with a priority that is not zero is out of our supported - * bounds. - */ - if (prio >= 1) - return ENVL_UNKNOWN; - - if IS_ENABLED(CONFIG_ENV_IS_IN_EEPROM) - return ENVL_EEPROM; - else if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) - return ENVL_FAT; - else if IS_ENABLED(CONFIG_ENV_IS_IN_FLASH) - return ENVL_FLASH; - else if IS_ENABLED(CONFIG_ENV_IS_IN_MMC) - return ENVL_MMC; - else if IS_ENABLED(CONFIG_ENV_IS_IN_NAND) - return ENVL_NAND; - else if IS_ENABLED(CONFIG_ENV_IS_IN_NVRAM) - return ENVL_NVRAM; - else if IS_ENABLED(CONFIG_ENV_IS_IN_REMOTE) - return ENVL_REMOTE; - else if IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) - return ENVL_SPI_FLASH; - else if IS_ENABLED(CONFIG_ENV_IS_IN_UBI) - return ENVL_UBI; - else if IS_ENABLED(CONFIG_ENV_IS_NOWHERE) - return ENVL_NOWHERE; - else - return ENVL_UNKNOWN; + switch (op) { + case ENVOP_GET_CHAR: + case ENVOP_INIT: + case ENVOP_LOAD: + if (prio >= ARRAY_SIZE(env_locations)) + return ENVL_UNKNOWN; + + env_load_location = env_locations[prio]; + return env_load_location; + + case ENVOP_SAVE: + return env_load_location; + } + + return ENVL_UNKNOWN; } From patchwork Tue Jan 23 20:16:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125584 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1985615ljf; Tue, 23 Jan 2018 12:26:59 -0800 (PST) X-Google-Smtp-Source: AH8x226XGQEQkAVfRtcLjRURx5jGUlnbv+2acWH/6b82UnGTAC5G2rEbk58jL1bYL5IttvSQ9nyN X-Received: by 10.80.194.146 with SMTP id o18mr14506502edf.67.1516739218970; Tue, 23 Jan 2018 12:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739218; cv=none; d=google.com; s=arc-20160816; b=CfVse63axR0/sls5bP0P9nwCaU/FRTqc+Z7+ZQxLHNmFz3PwkkmkOmG5wVcH480AGJ kxT05R+EVf1rKsCEgf+aX0wnVVVgj+qEYKwUi6kXsCHMqQzJqZZF+ZrpDI9G6rT5H1PU gNmfRKZFk5ZOU+rEclXXxhvdpz4/Be6HtQPBZYfjqev1qls3emycUqUdCQMdcqWG9J6/ fXDex2L5g/wCm9xdE7Z11dAhnf0+TZiaEhyvKHPQn/OuHmoXRZ74XrJA3SjlsACDeLsc YEHtK3da3VjMFAOic8cix4sDGdLDgHHqOWRDRoQX2O6xwtD87ioRHAC5py6opUuCGd/f LoQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=WT9VQCqrW40Y9zcPvlNY3hRZuiFe3Nk8DeTMx4DOcnE=; b=VkDG8wi4NhKYK3JFkc/yQHBalTsYmSh3xmAyQHm9dUyC8W63laO/uWgCdASXTIXfSt qhBQzq0W1oTe7CS18vmWNha5hd5xa0gyXBvNpAxuwb55iwDBadwt2Pbr77h4sP1Ee7p7 Bu5lKrZlQFF5Ptbw8k4kDG7G8b9lIoVs0rVBrCQO/kromMDLM/LvDgobXCygZy0R2Uj5 Qoka8oDD3KgWQ8mV5suFojun/WdZ8kiwb4v7I8lUGN/gqKo/4kLYIsup75PNhVCJ5Lh2 XZngRDEkQd+77XFq2dsktKRDAGUo1uOlt9vEYUiRBrDAcU8V/lgoOfH1t5lcE1mphhUx dBDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 6si2738313edf.460.2018.01.23.12.26.58; Tue, 23 Jan 2018 12:26:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 7391FC2216F; Tue, 23 Jan 2018 20:21:44 +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 11159C22169; Tue, 23 Jan 2018 20:17:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4BBA0C22140; Tue, 23 Jan 2018 20:17:16 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 62FADC21EE8 for ; Tue, 23 Jan 2018 20:17:11 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 4118D20C1B; Tue, 23 Jan 2018 21:17:11 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0FD02207A8; Tue, 23 Jan 2018 21:17:11 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:16:59 +0100 Message-Id: <62912996953986988c425da917d9aae0cc49fcf2.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 10/15] env: Initialise all the environments 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we want to have multiple environments, we will need to initialise all the environments since we don't know at init time what drivers might fail when calling load. Let's init all of them, and only consider for further operations the ones that have not reported any errors at init time. Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 36 +++++++++++++++++++++++++------- include/asm-generic/global_data.h | 1 +- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/env/env.c b/env/env.c index 1182fdb545db..2ea581cbedd6 100644 --- a/env/env.c +++ b/env/env.c @@ -61,6 +61,23 @@ static enum env_location env_locations[] = { static enum env_location env_load_location = ENVL_UNKNOWN; +static bool env_has_inited(enum env_location location) +{ + return gd->env_has_init & BIT(location); +} + +static void env_set_inited(enum env_location location) +{ + /* + * We're using a 32-bits bitmask stored in gd (env_has_init) + * using the above enum value as the bit index. We need to + * make sure that we're not overflowing it. + */ + BUILD_BUG_ON(ARRAY_SIZE(env_locations) > BITS_PER_LONG); + + gd->env_has_init |= BIT(location); +} + /** * env_get_location() - Returns the best env location for a board * @op: operations performed on the environment @@ -142,6 +159,9 @@ int env_get_char(int index) if (!drv->get_char) continue; + if (!env_has_inited(drv->location)) + continue; + ret = drv->get_char(index); if (!ret) return 0; @@ -164,6 +184,9 @@ int env_load(void) if (!drv->load) continue; + if (!env_has_inited(drv->location)) + continue; + printf("Loading Environment from %s... ", drv->name); ret = drv->load(); if (ret) @@ -189,6 +212,9 @@ int env_save(void) if (!drv->save) continue; + if (!env_has_inited(drv->location)) + continue; + printf("Saving Environment to %s... ", drv->name); ret = drv->save(); if (ret) @@ -210,14 +236,10 @@ int env_init(void) int prio; for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { - if (!drv->init) - continue; - - ret = drv->init(); - if (!ret) - return 0; + if (!drv->init || !(ret = drv->init())) + env_set_inited(drv->location); - debug("%s: Environment %s failed to init (err=%d)\n", __func__, + debug("%s: Environment %s init done (ret=%d)\n", __func__, drv->name, ret); } diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 73e036d6fd4a..fd8cd45b050e 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -50,6 +50,7 @@ typedef struct global_data { #endif unsigned long env_addr; /* Address of Environment struct */ unsigned long env_valid; /* Environment valid? enum env_valid */ + unsigned long env_has_init; /* Bitmask of boolean of struct env_location offsets */ unsigned long ram_top; /* Top address of RAM used by U-Boot */ unsigned long relocaddr; /* Start address of U-Boot in RAM */ From patchwork Tue Jan 23 20:17:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125579 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984740ljf; Tue, 23 Jan 2018 12:25:03 -0800 (PST) X-Google-Smtp-Source: AH8x224P4r39rvHuzpVA86ETxaQrYwY4w/m5AK8ZL73QDGeAZdw0MMK2cKHdjFD28RpIlD6VT/yi X-Received: by 10.80.137.225 with SMTP id h30mr20732783edh.304.1516739103630; Tue, 23 Jan 2018 12:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739103; cv=none; d=google.com; s=arc-20160816; b=D5xufaJl9pybX4EhyAxLmLc8YzlHwm/hmwdPyhjO1RcNGCrba5CcQkLTSvL5McjjIV iiKx4aQxtGyhrty3HAmD8MHHV0vjRdeUst/9KXmKbXQXXXgFZ3LQO7NAu0X7ko0Wgk22 duiGcGO/tuwR5Nq6E31MOceQGGSQSt2yDE0J1TLLHG5HI+iVhNhUEHovuDqu1hO4wHts ZYgdxqVOhZroKkx6/PuuShkCHH9OdLdkqJC1fw6Bl9D6zdJK9ddsbaFD4vV3RdoIsza3 6s7sm5TR9vdlUMHBRJogeYlwh99k7FL/EedULOWUWB7vt+4Ri6U5+eBKZvgKrBjweYTS jBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=zD1jWzJSeEYXEI0cjAg+1gHe+xFH85N4iHx7RezFAcw=; b=Uu4f00LAHpXgrYo3zqC3MAFaoCetArZ0a6cbsBFXyzaxLVTuSrDpn0WCv7IygJEUzl 4VTBM5pML/4rGqjrBhBg8G4zrqvoDPSxY913/fCfcrgFbZsof+PqzQhyfymgEjJeOCVV UiMO26Tbo1zB1MwNspdcIvDPW8kRTeruI9sZM6kdUd33/i55Uqjm38VsjHQ6Vz9TM+JH O9rs+ZWkWdvDaFi7z1u7tVBe+YswG3CRppvI7/8i2Gn9PNzvYlBknCJmJw2oQ3fCyvAk 2gxC8dvnMl1ZdNRpASjVzPixsMs1ivPI/pnfNvMHuuWOLPhi40kHplY++3Zju7OP9l5m /dXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o91si750623eda.277.2018.01.23.12.25.03; Tue, 23 Jan 2018 12:25:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 3F709C2213E; Tue, 23 Jan 2018 20:21:26 +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 B63EDC21EE8; Tue, 23 Jan 2018 20:17:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EC6F5C21E76; Tue, 23 Jan 2018 20:17:16 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id CC3B2C21EFC for ; Tue, 23 Jan 2018 20:17:11 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id A763820C12; Tue, 23 Jan 2018 21:17:11 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 77D11207A8; Tue, 23 Jan 2018 21:17:11 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:17:00 +0100 Message-Id: <2700368ef3020748126407597a416a3943eae6ba.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 11/15] env: mmc: depends on the MMC framework 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The raw MMC environment directly calls into the MMC framework. Make sure it's enabled before we can select it. Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard Reviewed-by: Jaehoon Chung --- env/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/env/Kconfig b/env/Kconfig index bef6e89bfc3c..ad5ccc253762 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -156,6 +156,7 @@ config ENV_IS_IN_FLASH config ENV_IS_IN_MMC bool "Environment in an MMC device" depends on !CHAIN_OF_TRUST + depends on MMC help Define this if you have an MMC device which you want to use for the environment. From patchwork Tue Jan 23 20:17:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125578 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984494ljf; Tue, 23 Jan 2018 12:24:30 -0800 (PST) X-Google-Smtp-Source: AH8x224NsPPLRtRtY9S8jaINi6w6sJcQH+SBNLOjE+eLYuwNUq21AF2aM5vI3ggdn99S29r3jXWk X-Received: by 10.80.162.133 with SMTP id 5mr20744388edm.174.1516739070278; Tue, 23 Jan 2018 12:24:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739070; cv=none; d=google.com; s=arc-20160816; b=H9CgjqFhJDTJh52ms76u/0IBQgafX/7jOBHlltu+IEhpGzJzGTxzjTXNviUFgww/Cm BwautRtV7rE5zBPaVk92k+DpW06dfMvE/B9c+pWzp8FMLdem2E8w0PXycm4rAgl/Xlql CbPDRnAp5wwLsdGJKfC/pfBjU7JJ94Z1og5q3nsgB2thBNBjmCFhHgdd/5sXeGAa8bGG Oa/Z3ff67J4YvlT9vtZI7+dleWJuocFY8B60wMYn2wH88ps4Xgq/hsMQRZa0esUN0W4G lKh/PklqOGyNMT+vLmWCPoKolvD1XtC+YRpn0JFoEamBwe4YUo19wZ1m4t54Iff09XdD +tbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=JJD2lQnTgL1Qbokil7nNSg5A6zPsmoZCMqN4fd5oQRQ=; b=Fr9UvrfnZQbTOIIfIgAe1E1mZlPKZ1/qqUc0TXvYGcz5e2cx1jcPTsXU/W1zjpAxhZ Zk0mlpDGejG0hYwBOJAlB1oB3lzJR5xAfI9Xz7NqdoB/60fqxwMKomDoX5DVIw0F6DTA rsJXmRdPnAwc6NaVepOXyavWqKSxL68P3CAzcRNf2WULDUEzLXszDk9gi0rCb8GGFQdJ Q5F2OgHftIjGG/JhfC4SndSmsMmlD/XOfV9TYQ1mEs2sMl8Uj2PdisgHXhZARIkCO6wr B8bibUymt659zlPKACpbU3j3Py1B67W5gxAN1AaxTRMsuJ8WvKSTjRUobojWcFFBHEae rbEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id g60si7161869edd.352.2018.01.23.12.24.30; Tue, 23 Jan 2018 12:24:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id E0A08C22139; Tue, 23 Jan 2018 20:19:23 +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 261B3C2214B; Tue, 23 Jan 2018 20:17:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A50FC22139; Tue, 23 Jan 2018 20:17:18 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 401F0C21EBB for ; Tue, 23 Jan 2018 20:17:13 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 1DE4720C56; Tue, 23 Jan 2018 21:17:13 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id D5C79207A8; Tue, 23 Jan 2018 21:17:12 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:17:01 +0100 Message-Id: <30ac99c8d9f378683fd436cf56a738561c870c29.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 12/15] env: Allow to build multiple environments in Kconfig 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place in the code, let's allow to build multiple environments backend through Kconfig. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- configs/MPC8313ERDB_NAND_33_defconfig | 1 +- configs/MPC8313ERDB_NAND_66_defconfig | 1 +- configs/cl-som-imx7_defconfig | 1 +- configs/microblaze-generic_defconfig | 1 +- env/Kconfig | 65 +++++++++++++--------------- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/configs/MPC8313ERDB_NAND_33_defconfig b/configs/MPC8313ERDB_NAND_33_defconfig index 823001583447..b761516d126a 100644 --- a/configs/MPC8313ERDB_NAND_33_defconfig +++ b/configs/MPC8313ERDB_NAND_33_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_DATE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=e2800000.flash" CONFIG_MTDPARTS_DEFAULT="mtdparts=e2800000.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" +# CONFIG_ENV_IS_IN_FLASH is not set CONFIG_ENV_IS_IN_NAND=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y diff --git a/configs/MPC8313ERDB_NAND_66_defconfig b/configs/MPC8313ERDB_NAND_66_defconfig index 2639926ab814..0f2a675ae2cf 100644 --- a/configs/MPC8313ERDB_NAND_66_defconfig +++ b/configs/MPC8313ERDB_NAND_66_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_DATE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=e2800000.flash" CONFIG_MTDPARTS_DEFAULT="mtdparts=e2800000.flash:512k(uboot),128k(env),6m@1m(kernel),-(fs)" +# CONFIG_ENV_IS_IN_FLASH is not set CONFIG_ENV_IS_IN_NAND=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index d37c82cafac1..0c93159032e5 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -41,6 +41,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +# CONFIG_ENV_IS_IN_MMC is not set CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig index 5254c0da790a..cc80e8a027c8 100644 --- a/configs/microblaze-generic_defconfig +++ b/configs/microblaze-generic_defconfig @@ -40,7 +40,6 @@ CONFIG_CMD_UBI=y # CONFIG_CMD_UBIFS is not set CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y -CONFIG_ENV_IS_IN_FLASH=y CONFIG_NETCONSOLE=y CONFIG_SPL_DM=y CONFIG_MTD_NOR_FLASH=y diff --git a/env/Kconfig b/env/Kconfig index ad5ccc253762..6e2fbf416c12 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -1,38 +1,18 @@ menu "Environment" -choice - prompt "Select the location of the environment" - default ENV_IS_IN_MMC if ARCH_SUNXI - default ENV_IS_IN_MMC if ARCH_EXYNOS4 - default ENV_IS_IN_MMC if MX6SX || MX7D - default ENV_IS_IN_MMC if TEGRA30 || TEGRA124 - default ENV_IS_IN_MMC if TEGRA_ARMV8_COMMON - default ENV_IS_IN_FLASH if ARCH_CINTEGRATOR - default ENV_IS_IN_FLASH if ARCH_INTEGRATOR_CP - default ENV_IS_IN_FLASH if M548x || M547x || M5282 || MCF547x_8x - default ENV_IS_IN_FLASH if MCF532x || MCF52x2 - default ENV_IS_IN_FLASH if MPC86xx || MPC83xx - default ENV_IS_IN_FLASH if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641 - default ENV_IS_IN_FLASH if SH && !CPU_SH4 - default ENV_IS_IN_SPI_FLASH if ARMADA_XP - default ENV_IS_IN_SPI_FLASH if INTEL_BAYTRAIL - default ENV_IS_IN_SPI_FLASH if INTEL_BRASWELL - default ENV_IS_IN_SPI_FLASH if INTEL_BROADWELL - default ENV_IS_IN_SPI_FLASH if NORTHBRIDGE_INTEL_IVYBRIDGE - default ENV_IS_IN_SPI_FLASH if INTEL_QUARK - default ENV_IS_IN_SPI_FLASH if INTEL_QUEENSBAY - default ENV_IS_IN_FAT if ARCH_BCM283X - default ENV_IS_IN_FAT if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS - default ENV_IS_NOWHERE - help - At present the environment can be stored in only one place. Use this - option to select the location. This is either a device (where the - environemnt information is simply written to a fixed location or - partition on the device) or a filesystem (where the environment - information is written to a file). - config ENV_IS_NOWHERE bool "Environment is not stored" + depends on !ENV_IS_IN_EEPROM + depends on !ENV_IS_IN_FAT + depends on !ENV_IS_IN_FLASH + depends on !ENV_IS_IN_MMC + depends on !ENV_IS_IN_NAND + depends on !ENV_IS_IN_NVRAM + depends on !ENV_IS_IN_ONENAND + depends on !ENV_IS_IN_REMOTE + depends on !ENV_IS_IN_SPI_FLASH + depends on !ENV_IS_IN_UBI + default y help Define this if you don't want to or can't have an environment stored on a storage medium. In this case the environemnt will still exist @@ -74,6 +54,8 @@ config ENV_IS_IN_EEPROM config ENV_IS_IN_FAT bool "Environment is in a FAT filesystem" depends on !CHAIN_OF_TRUST + default y if ARCH_BCM283X + default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS select FAT_WRITE help Define this if you want to use the FAT file system for the environment. @@ -84,6 +66,13 @@ config ENV_IS_IN_FAT config ENV_IS_IN_FLASH bool "Environment in flash memory" depends on !CHAIN_OF_TRUST + default y if ARCH_CINTEGRATOR + default y if ARCH_INTEGRATOR_CP + default y if M548x || M547x || M5282 || MCF547x_8x + default y if MCF532x || MCF52x2 + default y if MPC86xx || MPC83xx + default y if ARCH_MPC8572 || ARCH_MPC8548 || ARCH_MPC8641 + default y if SH && !CPU_SH4 help Define this if you have a flash device which you want to use for the environment. @@ -157,6 +146,11 @@ config ENV_IS_IN_MMC bool "Environment in an MMC device" depends on !CHAIN_OF_TRUST depends on MMC + default y if ARCH_SUNXI + default y if ARCH_EXYNOS4 + default y if MX6SX || MX7D + default y if TEGRA30 || TEGRA124 + default y if TEGRA_ARMV8_COMMON help Define this if you have an MMC device which you want to use for the environment. @@ -294,6 +288,13 @@ config ENV_IS_IN_REMOTE config ENV_IS_IN_SPI_FLASH bool "Environment is in SPI flash" depends on !CHAIN_OF_TRUST + default y if ARMADA_XP + default y if INTEL_BAYTRAIL + default y if INTEL_BRASWELL + default y if INTEL_BROADWELL + default y if NORTHBRIDGE_INTEL_IVYBRIDGE + default y if INTEL_QUARK + default y if INTEL_QUEENSBAY help Define this if you have a SPI Flash memory device which you want to use for the environment. @@ -359,8 +360,6 @@ config ENV_IS_IN_UBI You will probably want to define these to avoid a really noisy system when storing the env in UBI. -endchoice - config ENV_FAT_INTERFACE string "Name of the block device for the environment" depends on ENV_IS_IN_FAT From patchwork Tue Jan 23 20:17:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125575 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1983193ljf; Tue, 23 Jan 2018 12:21:31 -0800 (PST) X-Google-Smtp-Source: AH8x2256OzMUmTbO8V50owH6fIPbvq4V8SP1k6YTwuaI+tI/GooXPs6+TpWGXaA6eDg3aO7owEmy X-Received: by 10.80.224.5 with SMTP id e5mr21296588edl.218.1516738891045; Tue, 23 Jan 2018 12:21:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516738891; cv=none; d=google.com; s=arc-20160816; b=guBUt/ow0zWjK3muC5JqjIjqnNBSZJhxaPiBkWapVEfYPjoFHvm2H/P1MYYg3zkFso sdYOx9CoxK8ryyejFgOs7evc1kcXJCZy2d4VpUXd3/KrPL0ogk0tdLy2VCa9YuOsATtN fIWub5aE06wyQ2tQX1q+MLMj8b75nH4m+A81wki4lJRq5IzueNXrLpxAh8xs5T4b6ZnB vPcEIX1OfHvr1RuQ3qXB4W5iaFxCPzPJmtNRwMxyr05Avt97obtfE030EVlskc4hJHYz WJCGgxosJRSx15p5PkBrt3MeCo1dDAReqtzKrlO7ztdJK0wiLhc7ljAu87Xm7QxtG/So FVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=EA9Y54WHJLs6l250WpetDWn6kwPY3p4tSfQZfVhVS3o=; b=F8AWMnq5jpso/QQ486EvKYwsIwU4oDsuQRjQkWw68/mPvHydnWzNVFbRvGrJlNG2ek fFIC61+PalMAaK9y/qII6hGlzYWL0jPYWh54GAx22mvwK/0d+YLDGBTZ2i7vjFCe7+Hg D9n1aFpJCelOa/BqO2JEipX4rcBH1WTIwUUvTFfyA31ATp6naYsZe3AiOmoWj1DI4wfS pCPIIBt85PqkAuFo7TjM9jZKYp4gRpaqGcoQajdy9yQ01OTmTIZ8ZfWzly9EtEux+j1R RDBu+qdnSiPSsBdYZaXORN1lwWwnsVFvqdpmAUSLcsD9OZ/1zLltbQwEquu19sdZoSns G8sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id a4si1083311ede.313.2018.01.23.12.21.30; Tue, 23 Jan 2018 12:21:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 96C22C220DC; Tue, 23 Jan 2018 20:20:01 +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 77A3EC2214F; Tue, 23 Jan 2018 20:17:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AABAFC2214C; Tue, 23 Jan 2018 20:17:18 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id A089EC21E65 for ; Tue, 23 Jan 2018 20:17:13 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7E62920D96; Tue, 23 Jan 2018 21:17:13 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4BD5920C29; Tue, 23 Jan 2018 21:17:13 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:17:02 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 13/15] env: Mark env_get_location as weak 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Allow boards and architectures to override the default environment lookup code by overriding env_get_location. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- env/env.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 2ea581cbedd6..9564522e76a5 100644 --- a/env/env.c +++ b/env/env.c @@ -85,6 +85,7 @@ static void env_set_inited(enum env_location location) * highest priority * * This will return the preferred environment for the given priority. + * This is overridable by boards if they need to. * * All implementations are free to use the operation, the priority and * any other data relevant to their choice, but must take into account @@ -95,7 +96,7 @@ static void env_set_inited(enum env_location location) * Returns: * an enum env_location value on success, a negative error code otherwise */ -static enum env_location env_get_location(enum env_operation op, int prio) +__weak enum env_location env_get_location(enum env_operation op, int prio) { switch (op) { case ENVOP_GET_CHAR: From patchwork Tue Jan 23 20:17:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125585 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1985697ljf; Tue, 23 Jan 2018 12:27:09 -0800 (PST) X-Google-Smtp-Source: AH8x225n+qP8UtvTPj6woZQCD7NoMWx85s9rGQX9Plpkpv2RiM/WSa+G9E5u63d5VZVuJMQs78yr X-Received: by 10.80.144.102 with SMTP id z35mr20287031edz.235.1516739229166; Tue, 23 Jan 2018 12:27:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739229; cv=none; d=google.com; s=arc-20160816; b=efipFVc/m2RaQenMNH+e/xGS7gtFLIs74sNn/+BeQxbpLUV9pPJyFIPWAsj2cS+Ea9 v3Hg8/QXteYJ5ywCFaCC10UytnbwOjEmVlz5JjXjRkq6yBqE6la9MS7HyoaFJX29lSqi BOpPtrCdbOI4Epv1+kFlH+Ae/LCfOCN2JmrtAvTujY4Jq90gJsg8l8AySnymarE05fKs Mm18VBXjgHWV0TUqK5X7wD1JiDdYHxT7NvEcORx3/Q5Jc0/njAh8DRlzSNvj7HL72ODP AhlskseSr/qPU4CMxOx2jKEJXuyWaKxdySDcAvNnfujhIBAHCD8S09pLUoh6mOUf5KQX 3Jbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=qJ/06Su1fCfvNMjpHEPcY1JIrzz+FtNAjhQ0cjKxU1Y=; b=pg/u34/FiSkld2VWVkvlYGGT051z6uH1kvR0+Ob5x+iUKL7XtWQ6zVInBfvdl8VMf6 gw1jGH/0sgwfGxDANUqNjexzKP34Kdanv/MmQ2FEbSJd6DTCZ0A4KygmajH1VWrKh9C+ jc6toCUPxUXAJi9ANaxLYzRbapu+fC91nwaJbfgE90AtP1UUrBRsFbUa+9yMqCYbsVr5 cTCUOEkOlarqxGHEMZzG2rhc6GxFbKNJkTT52W7j0l7hQKpnQjdYiqGzglQnKcU3Imwl 72TrExztnwCYK4bTa+wIVQSxFOFWsk8ZJx9l75iPDI0vHw9njdCClwqxkm24Z42AsExm tEcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 35si4825405edk.490.2018.01.23.12.27.08; Tue, 23 Jan 2018 12:27:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id ACA2AC21F10; Tue, 23 Jan 2018 20:20:53 +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 A9C34C21E77; Tue, 23 Jan 2018 20:17:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 30607C2212D; Tue, 23 Jan 2018 20:17:18 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 12C40C21F10 for ; Tue, 23 Jan 2018 20:17:14 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E6AAF20C12; Tue, 23 Jan 2018 21:17:13 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id B646320C29; Tue, 23 Jan 2018 21:17:13 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:17:03 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 14/15] sunxi: Transition from the MMC to a FAT-based environment 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The current environment has been hardcoded to an offset that starts to be an issue given the current size of our main U-Boot binary. By implementing a custom environment location routine, we can always favor the FAT-based environment, and fallback to the MMC if we don't find something in the FAT partition. We also implement the same order when saving the environment, so that hopefully we can slowly migrate the users over to FAT-based environment and away from the raw MMC one. Eventually, and hopefully before we reach that limit again, we will have most of our users using that setup, and we'll be able to retire the raw environment, and gain more room for the U-Boot binary. Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard --- board/sunxi/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index dcacdf3e626d..8891961dcc6b 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -173,6 +173,22 @@ void i2c_init_board(void) #endif } +#if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT) +enum env_location env_get_location(enum env_operation op, int prio) +{ + switch (prio) { + case 0: + return ENVL_FAT; + + case 1: + return ENVL_MMC; + + default: + return ENVL_UNKNOWN; + } +} +#endif + /* add board specific code here */ int board_init(void) { From patchwork Tue Jan 23 20:17:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125580 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1984759ljf; Tue, 23 Jan 2018 12:25:06 -0800 (PST) X-Google-Smtp-Source: AH8x226l6yx5Jlf/Nh0IyJdV2g75vZOvNSTga+Ig8W/HvJuY4KH5r7NhbtmnUmkvJawbgVHRYfmF X-Received: by 10.80.149.216 with SMTP id x24mr21182995eda.74.1516739106537; Tue, 23 Jan 2018 12:25:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516739106; cv=none; d=google.com; s=arc-20160816; b=VN6sBe2YazcVV9NDf/qfCaJrEcXCWyuDgJ/ztUUceeOAOP5l4xfQwOovD83sNh/xXd GAuTGPXPIktxYK0NpeFAcVa3NSww4ONlanJ/A2mD7grwIy++9EinaVaAe+f2qLpoKytz gFNV+QGiWeM90zJy03cM5YXBJuvlkPYwhhKA/e9kD/3TuLiZLBlIFSeqRrfMckVW2mJH u0PECDF6/cyfWdd+b5WE8W2Gkftq6RutVO4IeOk41HxRl8T9eiKwRmV8HQxp4Di7/adp YtKTD3zDaba4tKv03xD7Q2U2dZBfk1LAwiymcnntDqxpkR5PXd1kJlkJt+Pv/1Brx3A8 ZbuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=slCPTX+MOUChmi/qMMX6PfbnM4bmc5ROJAH/7G7G1Bw=; b=XAA2pTvRAyKJehg2LI/4tzXX8hRzkGZ2USPhp4UqhIX681ND2QZBCe+fHsDJG0V9Bo fxjQY1gI0afyyeHCrBxldG5DZ/N8xI272GDgKUU/0EwaYZiZPB3CneTK5Bqcis4RHI7p b0GoHEsIHvf/WPaLFj/mUjfcnP//TPX18FYZue7wlYTqMN0bQ9djPwcPyuPF2enU3ivZ igf1eJtSE1bSt7qwE7N+ePAh1VakyJUocf7UGvkIDA+nBbb6UEmwErdJlp+aWsjD0/mj pz75eMQO6g3NtUa9Rlum4xcAtThNlvPaOFoCF8buCUYV796BuG2rsGQfb3RNUrqV7PYb xfjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u34si15624512edc.179.2018.01.23.12.25.06; Tue, 23 Jan 2018 12:25:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 24A15C22139; Tue, 23 Jan 2018 20:21:09 +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 B149CC22171; Tue, 23 Jan 2018 20:17:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C7D2CC22167; Tue, 23 Jan 2018 20:17:17 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id BF485C21C51 for ; Tue, 23 Jan 2018 20:17:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 9F70920C53; Tue, 23 Jan 2018 21:17:12 +0100 (CET) Received: from localhost (LFbn-1-2035-97.w90-76.abo.wanadoo.fr [90.76.104.97]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6BD36207A8; Tue, 23 Jan 2018 21:17:12 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 23 Jan 2018 21:17:04 +0100 Message-Id: <23bad85f3664281aeced4aaf8c445f63fbd63f1e.1516723179.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v3 15/15] env: sunxi: Enable FAT-based environment support by default 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Now that we have everything in place to implement the transition scheme, let's enable it by default. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard --- env/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/env/Kconfig b/env/Kconfig index 6e2fbf416c12..d1bf75ab41ca 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -55,6 +55,7 @@ config ENV_IS_IN_FAT bool "Environment is in a FAT filesystem" depends on !CHAIN_OF_TRUST default y if ARCH_BCM283X + default y if ARCH_SUNXI && MMC default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS select FAT_WRITE help @@ -363,6 +364,7 @@ config ENV_IS_IN_UBI config ENV_FAT_INTERFACE string "Name of the block device for the environment" depends on ENV_IS_IN_FAT + default "mmc" if ARCH_SUNXI default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91 help Define this to a string that is the name of the block device. @@ -372,6 +374,8 @@ config ENV_FAT_DEVICE_AND_PART depends on ENV_IS_IN_FAT default "0:1" if TI_COMMON_CMD_OPTIONS default "0:auto" if ARCH_ZYNQMP + 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 help Define this to a string to specify the partition of the device. It can