From patchwork Sat Oct 10 08:28:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 1379973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=MEcsvoT+; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C7dPY48kmz9sT6 for ; Sat, 10 Oct 2020 19:28:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 41C6F8233D; Sat, 10 Oct 2020 10:28:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1602318496; bh=YMraJx7DxiTmrSHfvDpH/7CierZVvNM1QJqMRo1sFxk=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=MEcsvoT++oCh55IppsZOBRKTChU5RtSok4mnfRKlGlCJdPTOZqkQOTNtbgwb5NIJK 4+Kr/xL0Uj90irmCiwF9FJY0D7P2m8JUoogS+5dC34vNK94rpOORU6liKR2zsohB/u fQgcz0ZuQNx/pByN3oYlofVanQ5CUgWdrP7DQ9oM4BXMk3GfQKoQHOzfSJYYe9smMW TUMQnnsENpFGvR8FgybCRtb1iJURx9s366TLJsX7JW/b12TCHOZzs57GO3s21i9W5+ bXFk881Wt8ku3NUlija5lzx6bduhGV7BCu6lWQMZe2SEUq8+Zbh0nRFyIscmF7Jlta NHmqPluN43nLA== Received: by phobos.denx.de (Postfix, from userid 109) id 7DCAD82396; Sat, 10 Oct 2020 10:28:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F18A682287 for ; Sat, 10 Oct 2020 10:28:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=hs@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4C7dP74zXcz1qrgD; Sat, 10 Oct 2020 10:28:11 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4C7dP74mGRz1qvgY; Sat, 10 Oct 2020 10:28:11 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id dcczTl72yruS; Sat, 10 Oct 2020 10:28:10 +0200 (CEST) X-Auth-Info: a5wHV+0r93CBsMqUM9oXTPOtQ4cr4y9Efi2H7zuZrJo= Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 10 Oct 2020 10:28:10 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 4EDA1180827; Sat, 10 Oct 2020 10:28:09 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 31AB01BEB39; Sat, 10 Oct 2020 10:28:09 +0200 (CEST) From: Heiko Schocher To: U-Boot Mailing List , Simon Goldschmidt Cc: Heiko Schocher , Joe Hershberger , Simon Glass Subject: [PATCH v4 0/3] env: Access Environment in SPI flashes before relocation Date: Sat, 10 Oct 2020 10:28:03 +0200 Message-Id: <20201010082806.2260318-1-hs@denx.de> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the possibility to access Environment stored in SPI NOR Flash before relocation. This is used in DM/DTS rework for the aristainetos boards. There mutliple DTS are packed into a FIT image and through a variable in the Environment the correct DTS will be selected. For this we need very early access to the Environment. Also may this is good for selecting the console baudrate again through Environment which I think currently does not work for any board based on DM/DTS and with Environment in SPI NOR flash. Add this to aristainetos board, as aristainetos DM board updates are now in mainline. travis build: https://travis-ci.org/github/hsdenx/u-boot-test/builds/733559949 Changes in v4: - rebased to current master 5dcf7cc590 Changes in v3: - env_sf_init_early() always return 0 now. If we do not return 0 in this function, env_set_inited() never get called, which has the consequence that env_load/save/erase never work, because they check if the init bit is set. - add comment from Simon Glass - add missing function comments - use if(IS_ENABLED...) - drop extra brackets - let env_sf_init() decide, which function to call add comment that it is necessary to return env_sf_init() with 0. - new in v3 as aristainetos board DM changes are in mainline now Changes in v2: - patch "env: split env_import_redund into 2 functions" is new in version 2. Idea is to not duplicate too much code as Simon suggested. Heiko Schocher (3): env: split env_import_redund() into 2 functions env: Access Environment in SPI flashes before relocation imx6: enable early spi environment access on aristainetos boards configs/aristainetos2_defconfig | 1 + configs/aristainetos2b_defconfig | 1 + configs/aristainetos2bcsl_defconfig | 1 + configs/aristainetos2c_defconfig | 1 + env/Kconfig | 8 +++ env/common.c | 42 +++++++++--- env/sf.c | 100 +++++++++++++++++++++++++++- include/env.h | 18 +++++ 8 files changed, 159 insertions(+), 13 deletions(-)