From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3A13C00140 for ; Mon, 8 Aug 2022 17:14:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7988584109; Mon, 8 Aug 2022 19:14:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="NWitFpgC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 99E0784109; Mon, 8 Aug 2022 19:14:05 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 8FCC883F36 for ; Mon, 8 Aug 2022 19:14:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35CE3B81020; Mon, 8 Aug 2022 17:14:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADAFAC433C1; Mon, 8 Aug 2022 17:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659978840; bh=5/dEhu1zcvO9OWMUljW0khoRdP+Pp0k8SjcjnYbcxUY=; h=From:To:Cc:Subject:Date:From; b=NWitFpgCPe4eJdXTKapA36J89X+AY66WQWKlBumhmYUQev0ofXywB0ZdObu9ig/u7 vp+oCrm1N/BksIU60vv7rprQqKd+e9qb8dA/KeHpkGM0qqifN6ov8PXmiOvAItoodL V9ERHZ+soWWBgJUw5DgK2+HGu4YGylUgGFdlDgDaeWM7EMF6+929zGSxnU4+c+vGXi VfAfdiL7N438n72rSs4dmgNpMPHQgTdIP1RRGT/YaH/IlUrVBCvvaEBSjz+Rr67Hgy WWK8lFo7d4nMdsIcSG/E0WJh7a1+50PNu9SMZyV3dHZtCNv+T9t4MowasxqSm7Txsj ROLYkbN4IoBNg== Received: by pali.im (Postfix) id C9C58F13; Mon, 8 Aug 2022 19:13:57 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , =?UTF-8?q?Marek=20Beh=C3=BAn?= Cc: u-boot@lists.denx.de Subject: [PATCH] arm: mvebu: Define env_sf_get_env_addr() for all Armada boards in SPL Date: Mon, 8 Aug 2022 19:13:43 +0200 Message-Id: <20220808171343.10176-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean SPI0 CS0 Flash is mapped to address range 0xD4000000 - 0xD7FFFFFF by BootROM. Proper U-Boot removes this direct mapping. So it is available only in SPL. This applies for all 32-bit Armada BootROMs. SPL mvebu code is used only on 32-bit Armada SoCs. So move env_sf_get_env_addr() function from Turris Omnia board to common SPL mvebu code and add proper checks for SPI0 CS0. Signed-off-by: Pali Rohár --- arch/arm/mach-mvebu/spl.c | 13 +++++++++++++ board/CZ.NIC/turris_omnia/turris_omnia.c | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 13c99913c380..866e0ac62345 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -292,6 +292,19 @@ int board_return_to_bootrom(struct spl_image_info *spl_image, hang(); } +/* + * SPI0 CS0 Flash is mapped to address range 0xD4000000 - 0xD7FFFFFF by BootROM. + * Proper U-Boot removes this direct mapping. So it is available only in SPL. + */ +#if defined(CONFIG_SPL_ENV_IS_IN_SPI_FLASH) && \ + CONFIG_ENV_SPI_BUS == 0 && CONFIG_ENV_SPI_CS == 0 && \ + CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE <= 64*1024*1024 +void *env_sf_get_env_addr(void) +{ + return (void *)0xD4000000 + CONFIG_ENV_OFFSET; +} +#endif + void board_init_f(ulong dummy) { int ret; diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 5921769f1e1d..3180305f8031 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -255,16 +255,6 @@ static bool omnia_detect_wwan_usb3(const char *wwan_slot) return false; } -void *env_sf_get_env_addr(void) -{ - /* SPI Flash is mapped to address 0xD4000000 only in SPL */ -#ifdef CONFIG_SPL_BUILD - return (void *)0xD4000000 + CONFIG_ENV_OFFSET; -#else - return NULL; -#endif -} - int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { #ifdef CONFIG_SPL_ENV_SUPPORT -- 2.20.1