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 4A27FC54EBE for ; Mon, 16 Jan 2023 16:15:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1AC498556A; Mon, 16 Jan 2023 17:15:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se 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=kwiboo.se header.i=@kwiboo.se header.b="RQkJnFCE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7769282FE7; Mon, 16 Jan 2023 17:15:10 +0100 (CET) Received: from wrqvnvpf.outbound-mail.sendgrid.net (wrqvnvpf.outbound-mail.sendgrid.net [149.72.40.63]) (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 EF2F584FD1 for ; Mon, 16 Jan 2023 17:15:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=iucyt77LBdB90wm585vJQYdA4gcTQhh9Eo2dmDKDt9I=; b=RQkJnFCEgjNhHPSem7WQshz/5XLRxg6o4QPTCcMpzdVacmf68B7hb3JDvfrV65qZ9aG3 s5X6Ao8X3o8Kp9HyMVv8r57GTPcLAN5pmOMVQiX2bLXldrEdzaqNH5txxxAK1FmI8H2S1h 172CJTvzV6L/cycxiCwaalOSUSxwVfIZNTmjwSnO1gY1oSLqRxTjdo8obdWKsUkH+98+cr 03ENsC39w6ZeO13xphtZT+lz1Pg5uPAUi0YluXpave/ex86qvrDMxZDQptMjcHAjm6Rele W8PY8hh2guT6FGH+12uLNhTo0cajQjwMBs9QS2rx37tQp7z2ZNJJJNg8FIHyguYQ== Received: by filterdrecv-6c4ccfbdd8-vlc7h with SMTP id filterdrecv-6c4ccfbdd8-vlc7h-1-63C57809-18 2023-01-16 16:15:05.37850437 +0000 UTC m=+5159369.477016367 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5-2 (SG) with ESMTP id 36YvQ-92R6C4s9iMzrNgqw Mon, 16 Jan 2023 16:15:05.083 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/2] rockchip: sdram: add dram bank with usable memory beyond 4GB Date: Mon, 16 Jan 2023 16:15:05 +0000 (UTC) Message-Id: <20230116161459.1307591-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116161459.1307591-1-jonas@kwiboo.se> References: <20230116161459.1307591-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0hymJpVumoV3uibCDC?= =?us-ascii?Q?vcXKjSvvrS5NaH3n7mkPNibabTcJwkfiLlTWvF2?= =?us-ascii?Q?lFCgnoneOikLyYKGa6CVJKjxXWsZY+=2FJhG7FOLY?= =?us-ascii?Q?N10+PgS0LPjUXFghXyYWuM4fMP8qclvapC=2Fm4t1?= =?us-ascii?Q?XvZlf+OOvTPL8YLxgVN9YhiLDeERwKc2rw6WMd?= To: Simon Glass , Philipp Tomsich , Kever Yang Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 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.6 at phobos.denx.de X-Virus-Status: Clean Add a second dram bank of usable memory beyond the blob of space for peripheral near 4GB. Any memory that exists beyond the 4GB mark is added to the second bank. Signed-off-by: Jonas Karlman --- arch/arm/mach-rockchip/sdram.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c index 7c12112799..2007064f0a 100644 --- a/arch/arm/mach-rockchip/sdram.c +++ b/arch/arm/mach-rockchip/sdram.c @@ -37,13 +37,19 @@ struct tos_parameter_t { int dram_init_banksize(void) { - size_t top = min((unsigned long)(gd->ram_size + CONFIG_SYS_SDRAM_BASE), - (unsigned long)(gd->ram_top)); + size_t ram_top = (unsigned long)(gd->ram_size + CONFIG_SYS_SDRAM_BASE); + size_t top = min((unsigned long)ram_top, (unsigned long)(gd->ram_top)); #ifdef CONFIG_ARM64 /* Reserve 0x200000 for ATF bl31 */ gd->bd->bi_dram[0].start = 0x200000; gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start; + + /* Add usable memory beyond the blob of space for peripheral near 4GB */ + if (ram_top > SZ_4G && top < SZ_4G) { + gd->bd->bi_dram[1].start = SZ_4G; + gd->bd->bi_dram[1].size = ram_top - gd->bd->bi_dram[1].start; + } #else #ifdef CONFIG_SPL_OPTEE_IMAGE struct tos_parameter_t *tos_parameter; @@ -181,7 +187,7 @@ size_t rockchip_sdram_size(phys_addr_t reg) * 2. update board_get_usable_ram_top() and dram_init_banksize() * to reserve memory for peripheral space after previous update. */ - if (size_mb > (SDRAM_MAX_SIZE >> 20)) + if (!IS_ENABLED(CONFIG_ARM64) && size_mb > (SDRAM_MAX_SIZE >> 20)) size_mb = (SDRAM_MAX_SIZE >> 20); return (size_t)size_mb << 20; -- 2.39.0