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 74E63C433EF for ; Wed, 16 Feb 2022 10:19:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 46DA583A2B; Wed, 16 Feb 2022 11:19:22 +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="s4cSf8RH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4CBDD83003; Wed, 16 Feb 2022 11:19:11 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::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 3524283A2B for ; Wed, 16 Feb 2022 11:19:04 +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 BF83D6191D; Wed, 16 Feb 2022 10:19:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 110D9C340E8; Wed, 16 Feb 2022 10:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645006742; bh=BqYmwRtPJDzjFU9fT6aAhgRpbvTv22SuXrpMhoXaYKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s4cSf8RHPCl2z019HLFat4Ziew/+QRrPfQRNOFhUu+4exc+hkQRuaZlrnwdaQpa63 e0eUjSD2mYwxPI8S1VKkLn6mX9BssyzvgHYPgOtiIqfysOtYN+yVDRxnaHz6lB33gJ KOw+Ktidj1h77UTOvmYIKKUaQiPBxT5M1l50b7bLBkNQvGTiQ8pjYD15yPKv2dh1h/ cHmJe2namruW5/ikFVImmvkuOTC1FO7D9VVpYdKrLj21fHLWTrm1I8BAS1jkXZAWBE S09PIwi2R7js4BergRdGGpX6P/TuDfLuLwajGMWj5jcr6t/7iZvG9PSNQopXexE+fh f2qMHqPmbgIbg== Received: by pali.im (Postfix) id 005662B39; Wed, 16 Feb 2022 11:18:59 +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-mvebu v2 1/3] arm: mvebu: a37xx: Fix calling build_mem_map() Date: Wed, 16 Feb 2022 11:18:43 +0100 Message-Id: <20220216101845.18638-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220216101845.18638-1-pali@kernel.org> References: <20220214232835.12924-1-pali@kernel.org> <20220216101845.18638-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 Function build_mem_map() modifies global variable mem_map. This variable is used by the get_page_table_size() function which is called by function arm_reserve_mmu() (as aliased macro PGTABLE_SIZE). Function arm_reserve_mmu() is called earlier than enable_caches() which calls build_mem_map(). So arm_reserve_mmu() does not calculate reserved memory correctly. Fix this issue by calling build_mem_map() from a3700_dram_init() which is called before arm_reserve_mmu(). Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/armada3700/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-mvebu/armada3700/cpu.c index 7702028ba19b..57a811b36ac6 100644 --- a/arch/arm/mach-mvebu/armada3700/cpu.c +++ b/arch/arm/mach-mvebu/armada3700/cpu.c @@ -142,8 +142,6 @@ static void build_mem_map(void) void enable_caches(void) { - build_mem_map(); - icache_enable(); dcache_enable(); } @@ -152,6 +150,8 @@ int a3700_dram_init(void) { int win; + build_mem_map(); + gd->ram_size = 0; for (win = 0; win < MVEBU_CPU_DEC_WINS; ++win) { u32 base, tgt, size; -- 2.20.1