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 48ABEC61DA4 for ; Thu, 16 Feb 2023 13:29:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4241585B40; Thu, 16 Feb 2023 14:29:33 +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="gF5dIBrU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51E2D85B2A; Thu, 16 Feb 2023 14:29:25 +0100 (CET) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) (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 1ABC385B2A for ; Thu, 16 Feb 2023 14:29:21 +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 3AACE66021A9; Thu, 16 Feb 2023 13:29:20 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676554160; bh=5hZmQLSL/xTL5aCifKcVoXTgdhfEfwokqIxNBg+oKT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gF5dIBrUF8EGl+B+dIgLwWFXuiUoCQ2hnRLpWwKvZsE/Z3AUCxAEGPnCCcBCelbnq 6aU71jD7QnbSOFaQBEig+GBC+Z3fZoRXY0U43a5iox20BzWMwQm0jHJoxGy2ejqdfX T2/0y+euhOTs5FGAYiKbt87Mhlo9/DKqwGyxVRhJAH7cKMZITDLjIWsYL0EcWOBzUT jEGXd7WZaKqBNa+uEJMqcrEMhCseqqvKhLTeGBd/h4tSt7ED5ai35RSJSzdKg+QsQW 0iveWNzRlfDAikwo4+EI+Y36lTGx8kHlJz7+V9bcE1l9Z8UWf/DvTLVo1RnwaHx+eC urCaOHLZyq66Q== From: Eugen Hristev To: jagan@edgeble.ai, jonas@kwiboo.se Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, u-boot@lists.denx.de, Eugen Hristev Subject: [PATCH 2/2] board: rock5b-rk3588: add memory gaps into kernel's DTB Date: Thu, 16 Feb 2023 15:29:05 +0200 Message-Id: <20230216132905.333332-2-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216132905.333332-1-eugen.hristev@collabora.com> References: <20230216132905.333332-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