From patchwork Wed Oct 25 12:25:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117110 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp786136qgn; Wed, 25 Oct 2017 05:27:04 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SbarBN48vqzI2tdGuA7bwc/rvFy4gdkrCZ4fUL8gkD/KlQmitl8tegx+w8AwpYeQKJSpVR X-Received: by 10.80.222.76 with SMTP id a12mr24139863edl.214.1508934424775; Wed, 25 Oct 2017 05:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934424; cv=none; d=google.com; s=arc-20160816; b=UibBL/yHPshAIXwpRjAYu6NBoVL9AdJVIYlGQtjQ9Ar/cQHeR7ZGxvAr6JWxqj5/5M KcEoyxbjpNrxhMVpUO/4Fu0b3nT8PMRhTHpmAWJnBI9k5Z/4CYbuwi6Me1FG9DZ/bfu7 3iRTzr+6Wd/ZCG0FpAbQj5jvovaHb0trGZgS+ed5fSXGNW/oLc1zZaq5TXc6TjD9R/JG ZMPVHpsefHA7GJjvRJH+I5mmz27vABOhXtc1zAODM+Tsy9F6qyoWLiWdiod8icwGImBC 6uFa/5wxSIhw9Ng0FbLKXZuTY7KtCAeM72lYTKS8NT/alaw/DH9GiIIBKfulcKmovHf0 kHxg== 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:message-id :date:to:from:arc-authentication-results; bh=3uqeVYV9lEzvPHlVc8AqlHLNXZaisvyf9IrPloiGX/A=; b=RlYC463eHrYcFp5oYs0VEH0E8WSB79w1Hd0fRCNwNBNq99wS6oY7EcmkFLPozv9TUe xWpH9NyAHz2ppHQnHqAQHJJ4D/sQ1bXxLbdEiqUG2U32SK90k4O0ZwEY/1Tg4FKv5RQB etBJIdZijaSLiMyNBf+f8iM5tZKimhRAJTHIqWfZ+fAwLbNXQfXSLjOcPPw1bgxfHuOs y3HY2qzzCVYnC0KA+gT2K6P9cBPf3WCX5wdXnyG26e0+IwsviseuMXV85Ls+jo2j4Chw lbAGP0ufxPX7+V+NP95xxXTAcIVSQmU2geukU9iPntqtCkDLEJ1pXcfyZBdfCGXV9A7n wirg== 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 p61si1733085edd.543.2017.10.25.05.27.04; Wed, 25 Oct 2017 05:27:04 -0700 (PDT) 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 53767C21DB9; Wed, 25 Oct 2017 12:26:25 +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 98128C21D92; Wed, 25 Oct 2017 12:26:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1CECEC21DE4; Wed, 25 Oct 2017 12:26:12 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id B6D23C21DC4 for ; Wed, 25 Oct 2017 12:26:08 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 16EE02084E; Wed, 25 Oct 2017 14:26:07 +0200 (CEST) Received: from localhost (unknown [185.94.189.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6143F206D8; Wed, 25 Oct 2017 14:26:06 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Wed, 25 Oct 2017 14:25:58 +0200 Message-Id: <20171025122601.28224-2-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025122601.28224-1-maxime.ripard@free-electrons.com> References: <20171025122601.28224-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC 1/4] env: Rework mmc environment ifdef 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" We want the MMC environment code to be compilable so that it can be used by other environment methods, even if it's not the primary one. Rework slightly the ifdef to do that. Signed-off-by: Maxime Ripard --- env/mmc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/env/mmc.c b/env/mmc.c index 3f3092d97560..ffbd1f7c0e59 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -143,7 +143,10 @@ static inline int write_env(struct mmc *mmc, unsigned long size, return (n == blk_cnt) ? 0 : -1; } -static int env_mmc_save(void) +#ifdef CONFIG_ENV_IS_IN_MMC +static +#endif +int env_mmc_save(void) { ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1); int dev = mmc_get_env_dev(); @@ -206,10 +209,13 @@ static inline int read_env(struct mmc *mmc, unsigned long size, return (n == blk_cnt) ? 0 : -1; } -#ifdef CONFIG_ENV_OFFSET_REDUND -static int env_mmc_load(void) +#ifdef CONFIG_ENV_IS_IN_MMC +static +#endif +int env_mmc_load(void) { #if !defined(ENV_IS_EMBEDDED) +#ifdef CONFIG_ENV_OFFSET_REDUND struct mmc *mmc; u32 offset1, offset2; int read1_fail = 0, read2_fail = 0; @@ -265,13 +271,7 @@ err: if (ret) set_default_env(errmsg); -#endif - return ret; -} #else /* ! CONFIG_ENV_OFFSET_REDUND */ -static int env_mmc_load(void) -{ -#if !defined(ENV_IS_EMBEDDED) ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct mmc *mmc; u32 offset; @@ -306,11 +306,12 @@ fini: err: if (ret) set_default_env(errmsg); -#endif +#endif /* CONFIG_ENV_OFFSET_REDUND */ +#endif /* ENV_IS_EMBEDDED */ return ret; } -#endif /* CONFIG_ENV_OFFSET_REDUND */ +#ifdef CONFIG_ENV_IS_IN_MMC U_BOOT_ENV_LOCATION(mmc) = { .location = ENVL_MMC, ENV_NAME("MMC") @@ -319,3 +320,4 @@ U_BOOT_ENV_LOCATION(mmc) = { .save = env_save_ptr(env_mmc_save), #endif }; +#endif /* CONFIG_ENV_IS_IN_MMC */ From patchwork Wed Oct 25 12:25:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117112 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp787320qgn; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RP7FkJVnvL1Sz9wm2HKTbEXV+fEkd25tQK/v/vCoMtL7yQORx/qQ1a2POVzobOf6M+rfYh X-Received: by 10.80.135.157 with SMTP id a29mr23434078eda.79.1508934502630; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934502; cv=none; d=google.com; s=arc-20160816; b=h38VpzA3l4I2Zr9lbpgmT3T+8gBPOz/eC0aJhYEzJOWj6f7KUM79UV0uyUgI2mh89v 1mKXr2rFR/MKD16lXUUnH/Uzybc5RLmGpZLqK2D2D3vGySmRrXTAcVOknvLx0j99ZVMj /B29ZoGXxdMTeK5585KGKuVznnsE9LWeraLPcuzOVSTF6LGrtcv9dvbwHU/e2Pxd464R ZKO39E9BivMy1x1v/6nVYQ5tzbtiS3FYNgQK9BTSUeV5SWE+17MtQLS45VKSHN5Vqpg9 TOpC/zTyIxeDp30KfsQObeom+u5ESLA2eMwiJscTyDRPHkzquhK+3O8M8EecND5lQE6R OCdg== 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:message-id :date:to:from:arc-authentication-results; bh=HZMbgzAdA5Dg+9jgt1juBUWhMKXFEINt24/hn6wzVKY=; b=tdgtUskLF3jMR7PCwOBAw3CkxK5MrEqUnozmv05Iu8Qnw1fBY6ob7Pfe+b8GbfnxSb MvaM+/zdDu7GSWnNV4ZSAhIohHfqNA5t2Aup+No/kYcQsASUo8yReJvt7Pa6Z33cOV6b jo15MQIYHdaKNLjpXyKKETEbl+nw/szcKgCb+5YDMr/Kksc23cbKRm9eyNBKSYR+McOI yuNk0jAvI79N1NsMecZRIr8JuwhX4AIvOn3I7/2yexgF2B/lAPyqde+fnyWFx19AJN44 DpQevyvGEXGks/3sjPjsPAprvqps3C7+7YDMtLG6TmjtWB3C+9vnoKlMBF+EGW0WxQA+ vayw== 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 m13si1545522edi.490.2017.10.25.05.28.22; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) 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 2DC44C21DF4; Wed, 25 Oct 2017 12:27:00 +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 E30BCC21DC1; Wed, 25 Oct 2017 12:26:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A177C21D99; Wed, 25 Oct 2017 12:26:15 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 1D971C21DD9 for ; Wed, 25 Oct 2017 12:26:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7296F20848; Wed, 25 Oct 2017 14:26:10 +0200 (CEST) Received: from localhost (unknown [185.94.189.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id BF3F0206D8; Wed, 25 Oct 2017 14:26:09 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Wed, 25 Oct 2017 14:25:59 +0200 Message-Id: <20171025122601.28224-3-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025122601.28224-1-maxime.ripard@free-electrons.com> References: <20171025122601.28224-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC 2/4] env; fat: Allow the fat environment to be embedded by another one 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 fat environment is currently only buildable as the primary environment, but other environment methods might need to use it as a secondary environment (for example to implement fallback mechanisms). Make sure the environment can be compiled and that the functions are not static when the configuration option is not enabled, and that we will register it only when it is our primary environment method. Signed-off-by: Maxime Ripard --- env/fat.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/env/fat.c b/env/fat.c index ec49c3905369..acdea664dd2c 100644 --- a/env/fat.c +++ b/env/fat.c @@ -34,7 +34,10 @@ DECLARE_GLOBAL_DATA_PTR; #ifdef CMD_SAVEENV -static int env_fat_save(void) +#ifdef CONFIG_ENV_IS_IN_FAT +static +#endif +int env_fat_save(void) { env_t env_new; struct blk_desc *dev_desc = NULL; @@ -74,7 +77,10 @@ static int env_fat_save(void) #endif /* CMD_SAVEENV */ #ifdef LOADENV -static int env_fat_load(void) +#ifdef CONFIG_ENV_IS_IN_FAT +static +#endif +int env_fat_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct blk_desc *dev_desc = NULL; @@ -112,6 +118,7 @@ err_env_relocate: } #endif /* LOADENV */ +#ifdef CONFIG_ENV_IS_IN_FAT U_BOOT_ENV_LOCATION(fat) = { .location = ENVL_FAT, ENV_NAME("FAT") @@ -122,3 +129,4 @@ U_BOOT_ENV_LOCATION(fat) = { .save = env_save_ptr(env_fat_save), #endif }; +#endif From patchwork Wed Oct 25 12:26:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117113 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp787541qgn; Wed, 25 Oct 2017 05:28:38 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Sf+z7n5BvwVoVWX6ulJnkM+NJXw5hqhyRQcS1iRlHWGzUMbZ5baCvsa7wyNqbhOR5urz3h X-Received: by 10.80.163.136 with SMTP id s8mr23451634edb.302.1508934518136; Wed, 25 Oct 2017 05:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934518; cv=none; d=google.com; s=arc-20160816; b=LIMsU1x1J7FsyKsk2kV7zZEwyDgzKPOxVS0VxnmbGDWgidCsCWXQA4CzQeYpJvYVm4 OQPVGp/P281Mc9OkinBHHh3wWiFpme5gI6gpGlFY27ZzYjhs1ZQbZtxNPiEDfNUnsYBu GMi4XGSCL+5I7Bx9t7k1eh+hR0fK3h1UYltx/uNySgMIPOXiHYa4GxTsRLdPOD1x9VWC 9h6ChJ6H72oC3/Rg8XBP2HHFqgwrA6pbJ19qh1VXeuu53n+L1r/1ud+Z4Ya0XnI5yymr J/3JCD8+QK1+gfAVFpca4tQv/AswYxCOLOixuXI2udQ5mMHYJfw2SEA9S5Adfh0gzag2 tezA== 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:message-id :date:to:from:arc-authentication-results; bh=TW/xbyd61HT/Uqs9uvbHO/bMB8jFXGsYB8D04TzDUX0=; b=cGNqCA2AqkdkKxDcNE19/uLVkZXuPmxxl1/mw6WLOErbda99WMlFjk/b5RGY050i3a Q3AsYTNiZ6XAnUvOSQb8mhvRmK59grANsIXTpeIi32bVlzea0TN2kPU0Mh5aRkAqHyRB 6L71g+kT0C8BGSrbD08SapFHQl8AcPl9fPqwENxF3XPwUETj8tBu/lONi98G944MH6yc Y6C2DEAl8gET37XTXJHYATM+19S456cVtPj84Q8+yH0iHJMouBro7WdTHERQlJEYdrG4 YwjEqrxGkI5ec1j/YsRplFZJL/pW4Ypmu6HcEm9Hn3OEfECkWGrWWMSDPwDZopBU+ugX MY1Q== 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 b92si1874908edf.338.2017.10.25.05.28.37; Wed, 25 Oct 2017 05:28:38 -0700 (PDT) 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 A06BDC21D92; Wed, 25 Oct 2017 12:27:16 +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 E01A9C21DF1; Wed, 25 Oct 2017 12:26:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 45D7AC21DC6; Wed, 25 Oct 2017 12:26: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 67914C21DB5 for ; Wed, 25 Oct 2017 12:26:15 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id BA91320848; Wed, 25 Oct 2017 14:26:13 +0200 (CEST) Received: from localhost (unknown [185.94.189.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0D212206D8; Wed, 25 Oct 2017 14:26:12 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Wed, 25 Oct 2017 14:26:00 +0200 Message-Id: <20171025122601.28224-4-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025122601.28224-1-maxime.ripard@free-electrons.com> References: <20171025122601.28224-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC 3/4] env: Create an environment transition method 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. Introduce an environment method from storing the environment raw in the MMC to a file in a FAT partition. 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. Signed-off-by: Maxime Ripard --- cmd/nvedit.c | 1 + env/Kconfig | 12 ++++++--- env/Makefile | 1 + env/sunxi-transition.c | 59 ++++++++++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 2 +- include/environment.h | 1 + 6 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 env/sunxi-transition.c diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4e79d03856fe..7b89ee428859 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -52,6 +52,7 @@ DECLARE_GLOBAL_DATA_PTR; !defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \ !defined(CONFIG_ENV_IS_IN_REMOTE) && \ !defined(CONFIG_ENV_IS_IN_UBI) && \ + !defined(CONFIG_ENV_IS_SUNXI_TRANSITION) && \ !defined(CONFIG_ENV_IS_NOWHERE) # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE diff --git a/env/Kconfig b/env/Kconfig index 02cb7cbb751d..fdd68fdfbdb6 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -30,6 +30,9 @@ choice partition on the device) or a filesystem (where the environment information is written to a file). +config ENV_IS_SUNXI_TRANSITION + bool "Environment transition for Allwinner SoCs" + config ENV_IS_NOWHERE bool "Environment is not stored" help @@ -369,17 +372,20 @@ config ENV_AES config ENV_FAT_INTERFACE string "Name of the block device for the environment" - depends on ENV_IS_IN_FAT + depends on ENV_IS_IN_FAT || ENV_IS_SUNXI_TRANSITION default "mmc" if TI_COMMON_CMD_OPTIONS || ARCH_ZYNQMP || ARCH_AT91 + default "mmc" if ARCH_SUNXI help Define this to a string that is the name of the block device. config ENV_FAT_DEVICE_AND_PART string "Device and partition for where to store the environemt in FAT" - depends on ENV_IS_IN_FAT + depends on ENV_IS_IN_FAT || ENV_IS_SUNXI_TRANSITION default "0:1" if TI_COMMON_CMD_OPTIONS default "0:auto" if ARCH_ZYNQMP default "0" if ARCH_AT91 + default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 + default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 help Define this to a string to specify the partition of the device. It can be as following: @@ -397,7 +403,7 @@ config ENV_FAT_DEVICE_AND_PART config ENV_FAT_FILE string "Name of the FAT file to use for the environemnt" - depends on ENV_IS_IN_FAT + depends on ENV_IS_IN_FAT || ENV_IS_SUNXI_TRANSITION default "uboot.env" help It's a string of the FAT file name. This file use to store the diff --git a/env/Makefile b/env/Makefile index 7ce8231d9a70..09ad342e6161 100644 --- a/env/Makefile +++ b/env/Makefile @@ -28,6 +28,7 @@ obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += sf.o obj-$(CONFIG_ENV_IS_IN_REMOTE) += remote.o obj-$(CONFIG_ENV_IS_IN_UBI) += ubi.o obj-$(CONFIG_ENV_IS_NOWHERE) += nowhere.o +obj-$(CONFIG_ENV_IS_SUNXI_TRANSITION) += fat.o mmc.o sunxi-transition.o endif ifdef CONFIG_SPL_BUILD diff --git a/env/sunxi-transition.c b/env/sunxi-transition.c new file mode 100644 index 000000000000..fae0603a897a --- /dev/null +++ b/env/sunxi-transition.c @@ -0,0 +1,59 @@ +/* + * (C) Copyright 2017 Maxime Ripard + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/* #define DEBUG */ + +#include +#include + +int env_fat_load(void); +int env_fat_save(void); + +int env_mmc_load(void); +int env_mmc_save(void); + +static int env_sunxi_save(void) +{ + int ret; + + ret = env_fat_save(); + if (!ret) { + debug("Wrote env in FAT file\n"); + return 0; + } + + ret = env_mmc_save(); + if (!ret) + printf("The env is raw, this will be broken in the future, please upgrade to file-based env\n"); + + return ret; +} + +static int env_sunxi_load(void) +{ + int ret; + + ret = env_fat_load(); + if (!ret) { + debug("Found env in FAT partition, bailing out\n"); + return 0; + } + + ret = env_mmc_load(); + if (!ret) + printf("The env is raw, this will be broken in the future, please upgrade to file-based env\n"); + + return ret; +} + +U_BOOT_ENV_LOCATION(sunxi) = { + .location = ENVL_SUNXI_TRANSITION, + ENV_NAME("SUNXI") + .load = env_sunxi_load, +#ifndef CONFIG_SPL_BUILD + .save = env_save_ptr(env_sunxi_save), +#endif +}; diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 91751171ec2b..c894131576e2 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -147,7 +147,7 @@ #define CONFIG_MMC_SUNXI_SLOT 0 #endif -#if defined(CONFIG_ENV_IS_IN_MMC) +#if defined(CONFIG_ENV_IS_IN_MMC) || defined (CONFIG_ENV_IS_SUNXI_TRANSITION) #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 /* If we have two devices (most likely eMMC + MMC), favour the eMMC */ #define CONFIG_SYS_MMC_ENV_DEV 1 diff --git a/include/environment.h b/include/environment.h index 7b9821638960..20c9cd13f11c 100644 --- a/include/environment.h +++ b/include/environment.h @@ -208,6 +208,7 @@ enum env_location { ENVL_ONENAND, ENVL_REMOTE, ENVL_SPI_FLASH, + ENVL_SUNXI_TRANSITION, ENVL_UBI, ENVL_NOWHERE, From patchwork Wed Oct 25 12:26:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117111 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp786661qgn; Wed, 25 Oct 2017 05:27:39 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QmOk9WwL/u4gzkGjLCfCQJXg/E9ZBbIqRxO73x2plocHNnduQYocT4gqsxGrf80vg+LAF+ X-Received: by 10.80.148.37 with SMTP id p34mr24083829eda.254.1508934459763; Wed, 25 Oct 2017 05:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934459; cv=none; d=google.com; s=arc-20160816; b=iGvsPFs+5ETy7Eg+X6Bea8uMXPtKVQf6dlWbhN/xVl6AVDFzN2ol5RkljLQACFQHiG xdnTNebhPkF0jJMUu2/HdtNistTszcMQf33xiCOiRvugyzr751LKxFrqg9ZbwebNb0Bq XYLD95mttjCX0c3+4eNYmDVmmEDBHduMvHYaSD92vXbptjUWhzP2LQUmMG9Sk5Hy92/Q kEdXYp+oS9y2eBtkxXOJHDLjqKzsAOri4uXdQysfdCHy82YCAHq7W23QrGEhgoNWCCah v+r4wvlCY0dvd5JQEu+3w3fhGHQGcGfUx1OP093DnK5WO3hYHfEZnWgCWo6zLVbCVjlt MI3A== 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:message-id :date:to:from:arc-authentication-results; bh=1prXOd+pc6kA20wIzknNcFzHkDM9qaYmvAMJN9frUsQ=; b=tLc2l1U5Itgy6Rw/fV+4WwLR/aK42CtZrCTGRBwIkJ3au1cr8yqaemeXuOQUvHapnq tGXR1H2bRnpxChagfVTvhAdmAbXDj2Tc7hNx+QjagU97F/NjH0j9o+bvjQ3ZldLP7SLO wlCVBqRSb9V19pKIC1ze9LLMu8v6XbasnhDMxpzh4qfTRzIeJ7TXHisVtb0srhCgkGa2 Q3k0Lgwzea419AqVTDDENdmPRopyDStnJ0N7WTPRrz660u9QNjPH6WXh22fyrkSdst97 svbuFgJtFUv5TCN7hsVDSUqdwZHqa3Xovoo5VoTmQSvHc2upX/YHQu+mktrB2UQ5VzEb BShg== 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 l35si1785941ede.237.2017.10.25.05.27.39; Wed, 25 Oct 2017 05:27:39 -0700 (PDT) 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 63074C21DA2; Wed, 25 Oct 2017 12:26:43 +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 8A327C21DC3; Wed, 25 Oct 2017 12:26:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B4ABAC21DA2; Wed, 25 Oct 2017 12:26:22 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 1A976C21D99 for ; Wed, 25 Oct 2017 12:26:19 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 6F89C20848; Wed, 25 Oct 2017 14:26:17 +0200 (CEST) Received: from localhost (unknown [185.94.189.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id CC1F8206D8; Wed, 25 Oct 2017 14:26:16 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Wed, 25 Oct 2017 14:26:01 +0200 Message-Id: <20171025122601.28224-5-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025122601.28224-1-maxime.ripard@free-electrons.com> References: <20171025122601.28224-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC 4/4] env: sunxi: Switch by default to the transition environment code 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 some code to smoothly transition from a raw environment to a file, make that the default. Signed-off-by: Maxime Ripard --- env/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/Kconfig b/env/Kconfig index fdd68fdfbdb6..95ab988552bb 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -2,7 +2,7 @@ menu "Environment" choice prompt "Select the location of the environment" - default ENV_IS_IN_MMC if ARCH_SUNXI + default ENV_IS_SUNXI_TRANSITION 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