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 6C789C433EF for ; Fri, 20 May 2022 04:39:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E6F983E3C; Fri, 20 May 2022 06:39:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="qqSdFnto"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84A6683DEB; Fri, 20 May 2022 06:39:38 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9E9F483E3C for ; Fri, 20 May 2022 06:39:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=judge.packham@gmail.com Received: by mail-pj1-x1031.google.com with SMTP id n10so7014671pjh.5 for ; Thu, 19 May 2022 21:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Uin1CP/UHjq40TqOIoi/rG4iN1p0wmv+lNCOMLBeG9k=; b=qqSdFntovPvNOD7sIt9rmoITdqDzI953yuOGoGdUtChZs5UOMqscoHfW6AyTC7o/uW bqpPoFE1XZycQFo8BTjlCe/Yjgr11HZBA8G4jECF84piaUMia0X1Etm0a0ouze8B4LWZ /PVCaW3vm1nONYPqYInjpJqrNKmwsJYK7s17t915oDI0+/5j7gsawqQj8P5KASPgElSs Uw/W77ZlVqmPODy7Z7Xf1qj+Lj33qjCqfVoyyWbeiu4fdQfK0UgNZ0UY61sejDoAW7G4 7kiYJZd6g5zw/PkTBhz1HDazFtXa4BSmL8AGDwlYRfEUt0dN0PKI/LhbyZEmPvy5z1YE L/Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Uin1CP/UHjq40TqOIoi/rG4iN1p0wmv+lNCOMLBeG9k=; b=O4g6Llj/bWvaYwE/e9p+T94aVXZuMlActWWbRYcdG6UJZsPbXzT7KxSc48MpuufS+8 dEWKzKhRT0CIzzbHoTBAQ3fklIr2rQFeur04C4CkBO4kHyuz7/snAAPCMK8fa0zUB4B0 L+tbI3JsOmHq96S6IuWevk9knnNbtSNQLWKB0H1/5/aSuJ5cOuBNj7v/2BSpEijxPUSM smZQAjBsKIOljeYZPO3yy1l4XWh/ExEjU9shhq9kALH72ECRduHpiWqG2HCaJ1nJF50R rIyMFAy3L+EkW1mFX1f2E7lQXURessVcz3zVNKayfYpGb/UI8ExYTYZ8bdJOKViuRIvn Towg== X-Gm-Message-State: AOAM532rZ+d5NajkV6SqQrnUmPuw5i78yqxS6FvdJPwdDSUphOZTrRK5 R0lxGcrKGWA0XNJiFOExdaX/ljip0ik= X-Google-Smtp-Source: ABdhPJyeRyFKF/uqtu3wjyC4WmfKCNEhinOioafvpXtmsMTiIl6XUOn+8k7PESxLe6B+rKdtca4tfw== X-Received: by 2002:a17:902:8501:b0:15f:173:40e1 with SMTP id bj1-20020a170902850100b0015f017340e1mr8017287plb.74.1653021573570; Thu, 19 May 2022 21:39:33 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:6447:5d44:ac16:8dad]) by smtp.gmail.com with ESMTPSA id w198-20020a6282cf000000b005184c9c46dbsm583237pfd.81.2022.05.19.21.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 21:39:33 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Cc: Chris Packham , Stefan Roese , Tom Rini Subject: [PATCH] arm64: mvebu: handle non-zero base address for RAM Date: Fri, 20 May 2022 16:39:22 +1200 Message-Id: <20220520043922.1502554-1-judge.packham@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 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 board_get_usable_ram_top() conflated the RAM size with the top address of RAM. On systems where RAM starts at address 0 these numbers are the same so it went unnoticed. Update board_get_usable_ram_top() to take CONFIG_SYS_SDRAM_BASE into account when determining the top address. Signed-off-by: Chris Packham --- I've got a 64-bit mvebu SoC/board that I plan on submitting in a few weeks. One of the gotchas with this board is that the physical address of the RAM starts at 0x2_00000000 (there's some seemingly unmovable I/O occupying the lower addresses). This was one of the earlier issues I hit with porting. I figured it was independent enough that I could send it out while I'm still working on the rest of the series. arch/arm/mach-mvebu/arm64-common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c index 5357aa554db4..238edbe6ba56 100644 --- a/arch/arm/mach-mvebu/arm64-common.c +++ b/arch/arm/mach-mvebu/arm64-common.c @@ -28,14 +28,13 @@ DECLARE_GLOBAL_DATA_PTR; * Currently only 2GiB are mapped for system memory. This is what * we pass to the U-Boot subsystem here. */ -#define USABLE_RAM_SIZE 0x80000000 +#define USABLE_RAM_SIZE 0x80000000ULL ulong board_get_usable_ram_top(ulong total_size) { - if (gd->ram_size > USABLE_RAM_SIZE) - return USABLE_RAM_SIZE; + unsigned long top = CONFIG_SYS_SDRAM_BASE + min(gd->ram_size, USABLE_RAM_SIZE); - return gd->ram_size; + return (gd->ram_top > top) ? top : gd->ram_top; } /* -- 2.36.1