From patchwork Mon Mar 4 20:53:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1051452 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tbir5O58"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44CskZ0MVRz9s47 for ; Tue, 5 Mar 2019 07:56:06 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BFD42C21DB3; Mon, 4 Mar 2019 20:54:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7F8ECC21E2B; Mon, 4 Mar 2019 20:54:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 29828C21DFF; Mon, 4 Mar 2019 20:54:04 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id 904F7C21DB6 for ; Mon, 4 Mar 2019 20:54:00 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id d17so7074175wre.10 for ; Mon, 04 Mar 2019 12:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=heUd8NA4yYW0mS7aTGBJM29c4g47wOBaDeT99pxnLUw=; b=Tbir5O58fgdLu04UgyzOF5DJMs98AkReqDVpSwBYqBK/di81d0grXz9qRnY4aMNUZV IL/pDGk2OSOXHb/FC3eE8PGF6moQRTqSlAm5wmBCCSPwhqKERYicL+U5AjqkomhmUh9I lfj2vWv5ZGQf/Xz07x02oMX0QJSQJScZujNbWG+fkkw+BL2/MWw4SQh0cdyeVGnxW132 l5NG9ckvU+y4Rd6TPNNeKlLfNWJ74QgCXad7qeKXkyofMviXJTsj1792YAAVE58MkEOU zXdSvPIsiTuplYdPvJo7xVkTb3oBkDLGVtUU+78AIizkMNb29fGVhNSiOU3EjLSRKGBD bOXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=heUd8NA4yYW0mS7aTGBJM29c4g47wOBaDeT99pxnLUw=; b=iJw1bQpNoJlzzGcrbpS5Yv0PJHKYtYOBwtnagAZEgyphQItlIAE4QXwKi2z8ljs9U0 cxxOOGHk24x41tLsQGnJQfOHGel6W0mnI3qqDj4Sy72VN/6ePbTubey17jXSYArCtSJh nKoL5eMqymhG4jVzlH4/hrhERtVzMYVtZk96/jbzreATj24dMyuDHLS0TjftHDzHJ3l4 62X/BX7HWpuJjYWcShXEQqiMSSEsb+zRoPG1Rcz7dMoLHGZ1Qrg4janoUfo4/rXfXyek Fboh6mAQvMcYyFevjYDUc/2JK7gQtoecsFvcQqMitDkvoXnsjvWmZPMXOgdm7LhNBN4n I4Jw== X-Gm-Message-State: APjAAAVA7PBHtZC2VQ+yK6LFPlSRg1Hveof+0dvmxtJB2gDVroA/qfta B0DbolmIthJ1ql73uIddvxg= X-Google-Smtp-Source: APXvYqzeofq294Ch/fWQsXMiCUAv6J7DMGe6fytwCk+djw7/qEUCVBnI+icq45GCLjqocwG0Vnn5sA== X-Received: by 2002:adf:de0d:: with SMTP id b13mr13564491wrm.226.1551732840196; Mon, 04 Mar 2019 12:54:00 -0800 (PST) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id d206sm17071906wmc.11.2019.03.04.12.53.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 12:53:59 -0800 (PST) From: Simon Goldschmidt To: Marek Vasut , u-boot@lists.denx.de Date: Mon, 4 Mar 2019 21:53:50 +0100 Message-Id: <20190304205352.13159-4-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190304205352.13159-1-simon.k.r.goldschmidt@gmail.com> References: <20190304205352.13159-1-simon.k.r.goldschmidt@gmail.com> Cc: Tien Fong Chee , Tom Rini , Stefan Roese Subject: [U-Boot] [PATCH v2 3/5] arm: socfpga: put initial U-Boot stack into DDR X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If SPL post-reloc stage puts the stack into DDR, U-Boot should be able to do that, too. The reason to do so is that this way, U-Boot initial stack can be larger than SPL initial stack. In situations where we want to save the SPL in SRAM for next boot without reloading, this prevents overwriting the SPL DTB in SRAM if U-Boot stack usage gets too high. Signed-off-by: Simon Goldschmidt --- Changes in v2: - fix commit message: "SPL post-reloc", not "SPL pre-reloc" include/configs/socfpga_common.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index c23b34186a..7ae3db233f 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -38,12 +38,23 @@ #if ((CONFIG_SYS_BOOTCOUNT_ADDR > CONFIG_SYS_INIT_RAM_ADDR) && \ (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR + \ CONFIG_SYS_INIT_RAM_SIZE))) -#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_BOOTCOUNT_ADDR +#define CONFIG_SPL_STACK CONFIG_SYS_BOOTCOUNT_ADDR #else -#define CONFIG_SYS_INIT_SP_ADDR \ +#define CONFIG_SPL_STACK \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE) #endif +/* + * U-Boot stack setup: if SPL post-reloc uses DDR stack, use it in pre-reloc + * phase of U-Boot, too. This prevents overwriting SPL data if stack/heap usage + * in U-Boot pre-reloc is higher than in SPL. + */ +#if defined(CONFIG_SPL_STACK_R_ADDR) && CONFIG_SPL_STACK_R_ADDR +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK_R_ADDR +#else +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK +#endif + #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 /* @@ -274,11 +285,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void); #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000 #endif -/* - * Stack setup - */ -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR - /* Extra Environment */ #ifndef CONFIG_SPL_BUILD