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 AD894C433F5 for ; Mon, 14 Feb 2022 23:29:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B860083076; Tue, 15 Feb 2022 00:29:08 +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="DhPIGNnJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7036A839EF; Tue, 15 Feb 2022 00:29:04 +0100 (CET) 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 4347F839E2 for ; Tue, 15 Feb 2022 00:28:51 +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 ams.source.kernel.org (Postfix) with ESMTPS id DEC67B80DCF; Mon, 14 Feb 2022 23:28:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F263C340F2; Mon, 14 Feb 2022 23:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644881329; bh=8yJIorZsm9jbhaODf9swTB2DTSRWbPo+2p9Ihk1v9lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DhPIGNnJOyk+EyZ1nRLZacPtv1LmHobFiE6G0Xi8vdoSuwQE6P5RBKpliF4YR+fp6 93JQTbzokYCfPgqasXytMJ4jC5hiNbgGe0iuj09wE9MgdOyc+1Y+qQ2j8qcFvLd9mG VI9WDIWyZyS0ClY14b3eQtp6PpGpYqI2JhaouXyzP+tlJ+wHuCs7FGp8qBnApBSNWD wWly6Kb5oTbUXv0Xrr7ZZfUay8IWYwn8JSKs5GU8p3dY+Q3aJWer0pDxBrP9aVENFi 3hjCFxYQN2a42gFSebGTdVD5f2pmZ9wmMa+EJWpcsXK8dwgy7SZHlutxWFxO8wtSD1 Xl646nRYHdGlw== Received: by pali.im (Postfix) id F09E4153C; Tue, 15 Feb 2022 00:28:46 +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 1/3] arm: mvebu: a37xx: Fix calling build_mem_map() Date: Tue, 15 Feb 2022 00:28:33 +0100 Message-Id: <20220214232835.12924-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220214232835.12924-1-pali@kernel.org> References: <20220214232835.12924-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 --- 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 bdf8dc377528..9da0d08f947c 100644 --- a/arch/arm/mach-mvebu/armada3700/cpu.c +++ b/arch/arm/mach-mvebu/armada3700/cpu.c @@ -136,8 +136,6 @@ static void build_mem_map(void) void enable_caches(void) { - build_mem_map(); - icache_enable(); dcache_enable(); } @@ -146,6 +144,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