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 17C08C61DA4 for ; Wed, 22 Feb 2023 09:05:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 413F4858D6; Wed, 22 Feb 2023 10:05:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com header.b="kM526yIK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A110080BAA; Wed, 22 Feb 2023 10:05:23 +0100 (CET) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2674E8572F for ; Wed, 22 Feb 2023 10:05:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from eugen-station.. (unknown [82.76.24.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2E16466021A4; Wed, 22 Feb 2023 09:05:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1677056719; bh=5hZmQLSL/xTL5aCifKcVoXTgdhfEfwokqIxNBg+oKT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kM526yIKdEVxMWyJKXhL7tlWuSpnBMypN01OzKgWPi/jQgw6OsWWwlaeHfNVZ72wo NOn1woGq+65iRhF+5WXlScVr9VF1/M+x67iCqc43Ev9BXAtFXFBEYQflZzbGcLalNA uCHBTA8vEa5VvvCNNjMgOizYrGRQMNmrpy7onKCRtvcCdDZqzv6B/Fv3tReTAmktuv zADMNeq9vE9h7lKLiPYyLVn57YpFsLK+2BMGohNOIvAqLJL7CKE0zxxdmYste1ddbR 2duyY6gzNqQ26LUcvVPDyTPaYIz1UGrBiA4TM9gWZjwSugJ6xiJf7m2C48uYqLv4af DqdoAHDYCo1KQ== From: Eugen Hristev To: kever.yang@rock-chips.com, jagan@edgeble.ai, jonas@kwiboo.se Cc: u-boot@lists.denx.de, sjg@chromium.org, philipp.tomsich@vrull.eu, Eugen Hristev Subject: [PATCH v2 2/2] board: rock5b-rk3588: add memory gaps into kernel's DTB Date: Wed, 22 Feb 2023 11:05:13 +0200 Message-Id: <20230222090513.146446-2-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230222090513.146446-1-eugen.hristev@collabora.com> References: <20230222090513.146446-1-eugen.hristev@collabora.com> 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.6 at phobos.denx.de X-Virus-Status: Clean RK3588 has two memory gaps when using 16 GiB DRAM size: [0x3fc000000 , 0x3fc500000] and [0x3fff00000 , 0x3ffffffff] If the kernel is agnostic to these gaps, accessing the area causes a SError panic. Hence, add reserved memory areas in kernel's DTB before booting. Signed-off-by: Eugen Hristev --- Hi, These memory gaps are required because the kernel crashes with a SError if accessing that area. It appears the ATAGs provide DDR banks that do not include those specific two regions. To be able to boot the kernel, those areas have to be reserved. Maybe someone from Rockchip could have an explanation to this behavior? Otherwise we have to block them at this level. If those memory ranges are reserved for a dedicated purpose we can come up with a better solution, w.r.t. the purpose of the regions. Thanks ! Eugen board/radxa/rock5b-rk3588/rock5b-rk3588.c | 35 +++++++++++++++++++++++ configs/rock5b-rk3588_defconfig | 1 + 2 files changed, 36 insertions(+) diff --git a/board/radxa/rock5b-rk3588/rock5b-rk3588.c b/board/radxa/rock5b-rk3588/rock5b-rk3588.c index b5d74798f3b9..5c3b52b94898 100644 --- a/board/radxa/rock5b-rk3588/rock5b-rk3588.c +++ b/board/radxa/rock5b-rk3588/rock5b-rk3588.c @@ -2,3 +2,38 @@ /* * Copyright (c) 2023 Collabora Ltd. */ + +#include +#include + +#ifdef CONFIG_OF_BOARD_SETUP +int rock5b_add_reserved_memory_fdt_nodes(void *new_blob) +{ + struct fdt_memory gap1 = { + .start = 0x3fc000000, + .end = 0x3fc4fffff, + }; + struct fdt_memory gap2 = { + .start = 0x3fff00000, + .end = 0x3ffffffff, + }; + unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP; + unsigned int ret; + + /* + * Inject the reserved-memory nodes into the DTS + */ + ret = fdtdec_add_reserved_memory(new_blob, "gap1", &gap1, NULL, 0, + NULL, flags); + if (ret) + return ret; + + return fdtdec_add_reserved_memory(new_blob, "gap2", &gap2, NULL, 0, + NULL, flags); +} + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + return rock5b_add_reserved_memory_fdt_nodes(blob); +} +#endif diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig index 9b7db7de64be..f3026c7ea166 100644 --- a/configs/rock5b-rk3588_defconfig +++ b/configs/rock5b-rk3588_defconfig @@ -26,6 +26,7 @@ CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y CONFIG_SPL_LOAD_FIT=y +CONFIG_OF_BOARD_SETUP=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -- 2.34.1