public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Frieder Schrempf <frieder@fris.de>
To: Fabio Estevam <festevam@gmail.com>, Marek Vasut <marex@denx.de>,
	Peng Fan <peng.fan@nxp.com>, Simon Glass <sjg@chromium.org>,
	Ye Li <ye.li@nxp.com>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	u-boot@lists.denx.de
Subject: [PATCH 4/6] imx8m: Restrict usable memory to space below 4G boundary
Date: Mon,  7 Jun 2021 14:05:11 +0200	[thread overview]
Message-ID: <20210607120534.183091-5-frieder@fris.de> (raw)
In-Reply-To: <20210607120534.183091-1-frieder@fris.de>

From: Frieder Schrempf <frieder.schrempf@kontron.de>

Some IPs have their accessible address space restricted by the
interconnect. Let's make sure U-Boot only ever uses the space below
the 4G address boundary (which is 3GiB big), even when the effective
available memory is bigger.

We implement board_get_usable_ram_top() for all i.MX8M SoCs, as the
whole family is affected by this.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 arch/arm/mach-imx/imx8m/soc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 0c44022a6d..f5983320c7 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -296,6 +296,20 @@ phys_size_t get_effective_memsize(void)
 #endif
 }
 
+ulong board_get_usable_ram_top(ulong total_size)
+{
+	/*
+	 * Some IPs have their accessible address space restricted by
+	 * the interconnect. Let's make sure U-Boot only ever uses the
+	 * space below the 4G address boundary (which is 3GiB big),
+	 * even when the effective available memory is bigger.
+	 */
+	if (PHYS_SDRAM + gd->ram_size > 0x80000000)
+		return 0x80000000;
+
+	return PHYS_SDRAM + gd->ram_size;
+}
+
 static u32 get_cpu_variant_type(u32 type)
 {
 	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
-- 
2.25.1


  parent reply	other threads:[~2021-06-07 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 12:05 [PATCH 0/6] Add support for Kontron i.MX6UL/ULL and i.MX8MM modules/boards Frieder Schrempf
2021-06-07 12:05 ` [PATCH 1/6] mtd: spi-nor-ids: Add support for Macronix MX25V8035F and MX25R1635F Frieder Schrempf
2021-06-07 12:05 ` [PATCH 2/6] spi: fsl_qspi: Build driver only if DM_SPI is available Frieder Schrempf
2021-06-07 12:05 ` [PATCH 3/6] clk: imx8mm: Add SPI clocks Frieder Schrempf
2021-06-08  9:33   ` Lukasz Majewski
2021-06-07 12:05 ` Frieder Schrempf [this message]
2021-06-07 12:38   ` [PATCH 4/6] imx8m: Restrict usable memory to space below 4G boundary Marek Vasut
2021-06-15  0:28     ` Peng Fan (OSS)
2021-06-15  0:41       ` Marek Vasut
2021-07-13  9:25         ` Frieder Schrempf
2021-07-13 10:31           ` Marek Vasut
2021-06-07 12:05 ` [PATCH 5/6] imx: imx6ul: Add support for Kontron Electronics SL/BL i.MX6UL/ULL boards (N63xx/N64xx) Frieder Schrempf
2021-06-10  8:40   ` Stefano Babic
2021-06-07 12:05 ` [PATCH 6/6] imx: imx8mm: Add support for Kontron Electronics SL/BL i.MX8M-Mini boards (N801x) Frieder Schrempf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210607120534.183091-5-frieder@fris.de \
    --to=frieder@fris.de \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=marex@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    --cc=ye.li@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox