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 495DEC636D3 for ; Tue, 7 Feb 2023 17:27:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 667A085D69; Tue, 7 Feb 2023 18:27:22 +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="KzqWybYJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C84EA85787; Tue, 7 Feb 2023 18:27:16 +0100 (CET) Received: from xvfrqvdb.outbound-mail.sendgrid.net (xvfrqvdb.outbound-mail.sendgrid.net [168.245.72.219]) (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 58D2085866 for ; Tue, 7 Feb 2023 18:27:12 +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=CC4ahJaBrRaY9Ab7ZtRVagDZtxc7bPsCJrVfmxy7xcE=; b=KzqWybYJN5FPgefPCBtGrp72cJoiGGy2UcT1+AtVkzHITWVM2ZKUrqSNrUu0Ds1u+cZy v6jjpAiqrqE9RVqkQZlxg/QV3VOakHxEl47pMD96RcFZ3psSx1AXg37vXmdcWde1A1GiaA w0HFkoJNRI7gfsiOGM4/214iRLIFrJRP7tLxcdQFZxAnqXmYqzk6sqaqonJ0XEj95jiOvZ PJqrQsl3EpPIpZjcxc7awc4fJ0cBRd3sDqMSp11UT3BS7+qMyEjRy4WnN/74ZbTFbxKn/N PpR/pbGbsZ/WRJuoj0dLYMIdt4EIls6mZlu+Wf65+kjZHGI3vdO+4aGqFvtt/yAA== Received: by filterdrecv-69c5db5cf4-gdm76 with SMTP id filterdrecv-69c5db5cf4-gdm76-1-63E289EE-4A 2023-02-07 17:27:10.965975941 +0000 UTC m=+7064346.112826482 Received: from bionic.localdomain (unknown) by geopod-ismtpd-4-0 (SG) with ESMTP id W8P_ZEYKTVWFmF3hXSy6Cg Tue, 07 Feb 2023 17:27:10.741 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 2/2] rockchip: sdram: add dram bank with usable memory beyond 4GB Date: Tue, 07 Feb 2023 17:27:11 +0000 (UTC) Message-Id: <20230207172707.4094859-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207172707.4094859-1-jonas@kwiboo.se> References: <20230116161459.1307591-1-jonas@kwiboo.se> <20230207172707.4094859-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h4q4BDE1CTs=2FHXX9R?= =?us-ascii?Q?+wKV0fk1kRHJhsKKfXyJJdCWcn=2FRbTYZOukNubs?= =?us-ascii?Q?W5+mQMrPVwP15TYOaVKp6n1Sw9A9mlDi7HcQOIP?= =?us-ascii?Q?7tjmS4UvlJlxD22DgHxBegESJdoANk9b=2FwV+2bk?= =?us-ascii?Q?5Qu96Qoa0CD4CLraBGPZXBfK3f7OtDsBQfpOBL?= To: Simon Glass , Philipp Tomsich , Kever Yang Cc: u-boot@lists.denx.de, Eugen Hristev , Jagan Teki , 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 --- v2: - Change CONFIG_SYS_SDRAM_BASE to CFG_SYS_SDRAM_BASE 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 91951e4b8ccf..1d17a740ade9 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 + CFG_SYS_SDRAM_BASE), - (unsigned long)(gd->ram_top)); + size_t ram_top = (unsigned long)(gd->ram_size + CFG_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.1