From patchwork Tue Jan 16 09: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: 124641 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948551lje; Tue, 16 Jan 2018 01:24:59 -0800 (PST) X-Google-Smtp-Source: ACJfBotXJA6GTpj9xV19RCZF6T/9Om9nTjVyY1hxMWvBuyRTagxRuXw1qzGBUeLhWn+8LJLCeryp X-Received: by 10.80.173.45 with SMTP id y42mr23183513edc.247.1516094699669; Tue, 16 Jan 2018 01:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094699; cv=none; d=google.com; s=arc-20160816; b=gLxYcmM5R9EBRFwYwfID3lh25wc7y0kpp+4C0gXdGsKsG4Qg5l0D78u9fnwcGgMStC BiWFnJGF9azehOk2eWZTuR3xyKbWiXqems3giqb2x2n+K0BtNygW4MzHbo94UEzUQF+Y 1yM7kS+/8/XMJJFmwkQJ4vuF+hoMGTh+1Lf8WWEhcQ/Iq/CgjtIq8xI25YQsUM6Niixb U/NIAtW0n+Q00731YY7+HpZqq1nMCra+1JDW/d40Ig7flfhUpUpTodzfi6hddK6x7409 kCZwa+rppAf5Ie4IPTzfOsvWLEKWCS+k7C9bWROiszIsP4E72UKIDnBbdayw4GW9Um5T QI9A== 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=Po4gmL3Yw8K5X7U3ZpZZ3Z5bFC7sKPqRBLYr96ClmLs/+GJjSEP9auX5S6JUciOiGl 2vbchXJ/IsHRiOuZSazahb/0v/bKe+tjN2KSCWfQfhIGxcrNWIkjWlUO2pOdjuvTl9fd 3uw3W2eyexb9fYtLzDuflRW+YwKzvkYKrurnecSltm7eTmzP+c40IOyB360pxnKJrWTY XMET5ncs0GETKC5W5FJ9IfNxvkQ5HpJOY1WiQFjaqFP8jGRQeACAg4FHSI/qEFxyoDtK dyADedAxP6Jce5QULoo+B3teWFpc7287+JKxxFjq8bz0THDOvvmM2Z6S/K/ipEWHEHTU GnZg== 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 35si1024862edl.30.2018.01.16.01.24.59; Tue, 16 Jan 2018 01:24:59 -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 300EAC21E0A; Tue, 16 Jan 2018 09:21:32 +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 9CB6AC21E99; Tue, 16 Jan 2018 09:17:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0327CC21E26; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 769A5C21E31 for ; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 51384208BB; Tue, 16 Jan 2018 10:16:58 +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 231C720725; Tue, 16 Jan 2018 10:16:58 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:50 +0100 Message-Id: <679e3edb8433e93229fbbce13b563b2ad440d612.1516094113.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 v2 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) {