From patchwork Thu Nov 16 09:22:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 119035 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5362156qgn; Thu, 16 Nov 2017 01:30:05 -0800 (PST) X-Google-Smtp-Source: AGs4zMakhyovDkf9hjFnYQLOIzebHkQsODEDkmvlPz2ixtLccuaC/CcjXGyk4LgEDtJSRGSKltrw X-Received: by 10.80.175.66 with SMTP id g60mr1857837edd.283.1510824604992; Thu, 16 Nov 2017 01:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510824604; cv=none; d=google.com; s=arc-20160816; b=iOhrLjYH7OP5+/hCjTACy7xceSKIAV9G4pFFDe755lSEEsPoXM+ZLngrVffNvSZIl4 Z43DnTvuwxmzhmWjCuMz4103zo+hqOufDjXU0CQ24aByXIOJtwvsqPs46ttxmX13qZcw hsPSfWa2AYBUNhYwyx/2odPJuCXpvP5f3dH9aZjYUl3de559szp4pi4Y3VcTrR2NFLAq X+Qd46TDqKj9exh8z3/HkByYjMYSh3WbqBzGzrTKDSk+aZkCzzsf/oqENtzJDJ5hETkw 78JUC/TFVIw6IH+QVAuPW7ubCSmhIvbEYRR+58d/5+pm7Ft4eigEZcrl3EvAeVX6SLk0 85Jw== 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=EIY6UXHb7P0716r9C1bVqnldv/BufKTmWozplDUmXnQ=; b=y4RZ51OYXpF3M+rkCgN6ROexx3BLB4C9jYK2nt6NPPIbCKUhK2X1MClrGueHKOLhPY jmMWir7gRgUgK6VCwBrKIZqTS9+Tz93dIFPypyzcvFBLviCDqkXI0kd6DDocX3S4wZ/4 sm9hxasPPyPYNtuigMYIIe1rDYiNenCQ/peoDTmKsFFwOZae0dwaAO01oXRvkXk40vXS sV09JMip6dt37bjkhGQy9zkBWkGPWS0i9xDwVwdtI49XQu6p3dWeOzVl1sCg2IEbwD/B tIdVTZsQfJtpVyQIl+6pdrVC8tfjjnfjYxbCUNk92D9LVL2b1k2Lwj2yLBQz/qoDzgFs ytDg== 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 y8si866144edk.42.2017.11.16.01.30.04; Thu, 16 Nov 2017 01:30:04 -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 88018C21DDE; Thu, 16 Nov 2017 09:24:54 +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 BFEFCC21DA1; Thu, 16 Nov 2017 09:24:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AE10AC21DA1; Thu, 16 Nov 2017 09:23:01 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 89D3DC21DC6 for ; Thu, 16 Nov 2017 09:22:58 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7D51B20DD6; Thu, 16 Nov 2017 10:22:57 +0100 (CET) Received: from localhost (unknown [185.94.189.187]) by mail.free-electrons.com (Postfix) with ESMTPSA id B206D213DE; Thu, 16 Nov 2017 10:22:43 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Thu, 16 Nov 2017 10:22:30 +0100 Message-Id: <20171116092231.27740-10-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171116092231.27740-1-maxime.ripard@free-electrons.com> References: <20171116092231.27740-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 PATCH 09/10] 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. Signed-off-by: Maxime Ripard Reviewed-by: Lukasz Majewski --- 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) {