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 80053C433F5 for ; Wed, 2 Mar 2022 11:50:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E940583C8E; Wed, 2 Mar 2022 12:49:49 +0100 (CET) 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="J0308jnH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B376583CBE; Wed, 2 Mar 2022 12:49:43 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 0CAE183C8E for ; Wed, 2 Mar 2022 12:49:37 +0100 (CET) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 973586188D; Wed, 2 Mar 2022 11:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2786BC004E1; Wed, 2 Mar 2022 11:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646221774; bh=/DRrIOBZELYTIPnGA3IKYQedhMdH40kop7N35Zr9Qho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J0308jnH14/vI1j8gRrGwJXkK/lpSpAjx6EKLwoEtBoOIOSomFES4Sy25tx7tZKwW kOmzw385Z8AQmZT5zWIQLeHtfAoJL0p3RsmU79OU/3V3X2uoWq6nKzuTGQkX6v1EV+ zg6T/bB6bBstz5Ab+4DKAnmzV8AKUREe3CDkDOFkZUmozRyG+WfF2imkf2dJSW4H9/ CnTx6425OuE2Qo7oxzIOtG6vT1IGAXX07/Cb3s+G1suV23vRnWi94uRTBaqug0+CA6 xdtXc8R7qsX8cNnW528Hco8laejklJpY4rvsQUj0Eq6t+3kKgOcp/9Szevqu/4K6ra P1vnXoDUb7UsQ== Received: by pali.im (Postfix) id AB56396D; Wed, 2 Mar 2022 12:49:31 +0100 (CET) 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 u-boot-marvell 2/8] arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function Date: Wed, 2 Mar 2022 12:47:52 +0100 Message-Id: <20220302114758.21787-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220302114758.21787-1-pali@kernel.org> References: <20220302114758.21787-1-pali@kernel.org> 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.5 at phobos.denx.de X-Virus-Status: Clean BootROM maps SPI Flash to fixed address 0xD4000000 and this mapping is active also when BootROM is executing binary kwbimage headers, which includes also U-Boot SPL. Therefore no initialization code is required to access SPI Flags from U-Boot SPL. In proper U-Boot it is remapped to other location. So in mvebu implementation of env_sf_get_env_addr() function returns 0xD4000000 when running in SPL and NULL when in proper U-Boot. This change would allow to use U-Boot ENV in U-Boot SPL. Normally it is not possible to read ENV because it is too big and U-Boot SPL does not have such big malloc() pool to real all ENV variables. Signed-off-by: Pali Rohár --- board/CZ.NIC/turris_omnia/turris_omnia.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 33cec6587e19..a93af6c5b877 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -243,6 +243,16 @@ static bool omnia_detect_sata(void) return stsword & MSATA_IND_STSBIT ? true : 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) { if (omnia_detect_sata()) { -- 2.20.1