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) {