From patchwork Tue Nov 28 10:24:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 119831 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp2916940edl; Tue, 28 Nov 2017 02:36:13 -0800 (PST) X-Google-Smtp-Source: AGs4zMbO135RGGA774IY9TB1L+ESMuCXwDTlEOy4Ut1TcvoyWHLDiTIVQ1LN+HjeJ15vLxDGyfid X-Received: by 10.80.140.176 with SMTP id q45mr2087457edq.186.1511865373354; Tue, 28 Nov 2017 02:36:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511865373; cv=none; d=google.com; s=arc-20160816; b=x3JPFTyq7vaMQt6irYIXte0cx5bAABzsOQ+I6NJxeLJa/opHTdAJm9RpDN+48jYlEZ g4lPOUtMdXvTTOD5ojYeTgVrScyGWcMJQgjzBOPyi8yxNm5C+BVTyQbhrjDsDRrnciRV JiT9DhE30mtqaWBq/E//B123Ymn5WVudRWH7qNwgxBJt1I1Y+fOt4vNO2pkEGjhYGLc1 dj+/RbEpFdv2kOLav3/VAogIYCtdcPlEW4vLp0YLRsGM1OtpVo6TDvgOJyLrUvW0D24J w2tOEn/UQAlAIQIYG07qLvEO+6n0QJc5wi1fZeEpUqfSVNI2MhDaeW10PrHb+S8U+wYd kQEQ== 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=vyfdQEZq9Tb/XyIrS1qRM86tGT2y304EPd3qbJJoE4HB9ad7wIxRX27JNMa1KgzcNr dKXZUl0JgjGNSw7Fx7Ltq2GSwhxzQ3tBWGwOkIZZJWznDAQMBexrmzni/VIADvYV5yku FOIUGwLrlQXp4Z+FfgOeh05g9mFI8Nnn619rvTjmqe144MHO0+f6h1nts/YV9/JESuIv Je0O1DFhezyFrVa/OeaCkfJ9f+1F7OdOxhpmeNZDYrOHH0xHipktYJR4uZCkhdedgMa8 YS6XckbMpLZpQGPALJgflNMUHcbOdCmjadXzJ/BshxW0UDAFykTyG7/r9oy9nglT8VOQ JIxQ== 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 n92si3817289edc.339.2017.11.28.02.36.13; Tue, 28 Nov 2017 02:36:13 -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 E9EC6C21DB2; Tue, 28 Nov 2017 10:28: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 2201AC21E63; Tue, 28 Nov 2017 10:25:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 45D6AC21E22; Tue, 28 Nov 2017 10:25:02 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 4ECCAC21DA2 for ; Tue, 28 Nov 2017 10:24:57 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 9E74D2083F; Tue, 28 Nov 2017 11:24:56 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 73C4720380; Tue, 28 Nov 2017 11:24:56 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 28 Nov 2017 11:24:48 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Thomas Petazzoni , u-boot@lists.denx.de, Andre Przywara , agraf@suse.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH 13/14] 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) {