mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] ARM: layerscape: ppa: Fix starting PPA
Date: Mon, 20 Nov 2023 15:44:53 +0100	[thread overview]
Message-ID: <20231120144453.1075740-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20231120144453.1075740-1-s.hauer@pengutronix.de>

With dba1c26f70 we replaced request_sdram_region() for the PPA with
reserve_sdram_region(). The effect is that the region is marked as
reserved and mapped non executable. While this is desired for EL2, it
also has the effect that we can't start the PPA anymore from EL3.

Map the region cached/executable to start the PPA, then map it
uncached/non executable once we are in EL2.

Fixes: dba1c26f70 ("arm: layerscape: ppa: reserve SDRAM region for PPA")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-layerscape/ppa.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index 521e6b89da..43145a7ece 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -4,6 +4,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <mmu.h>
 #include <firmware.h>
 #include <memory.h>
 #include <linux/sizes.h>
@@ -54,17 +55,11 @@ static int ppa_init(void *ppa, size_t ppa_size, void *sec_firmware_addr)
 	int ret;
 	u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
 	struct ccsr_scfg __iomem *scfg = (void *)(LSCH2_SCFG_ADDR);
-	int el = current_el();
 	struct fit_handle *fit;
 	void *conf;
 	const void *buf;
 	unsigned long firmware_size;
 
-	if (el < 3) {
-		printf("EL%d, skip ppa init\n", el);
-		return 0;
-	}
-
 	boot_loc_ptr_l = &scfg->scratchrw[1];
 	boot_loc_ptr_h = &scfg->scratchrw[0];
 
@@ -115,6 +110,7 @@ int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size)
 	struct resource *res;
 	void *ppa_fw;
 	size_t ppa_fw_size;
+	int el = current_el();
 	int ret;
 
 	res = reserve_sdram_region("ppa", ppa_start, ppa_size);
@@ -126,9 +122,13 @@ int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size)
 
 	get_builtin_firmware(ppa_ls1046a_bin, &ppa_fw, &ppa_fw_size);
 
-	ret = ppa_init(ppa_fw, ppa_fw_size, (void *)ppa_start);
-	if (ret)
-		return ret;
+	if (el == 3) {
+		remap_range((void *)ppa_start, ppa_size, MAP_CACHED);
+		ret = ppa_init(ppa_fw, ppa_fw_size, (void *)ppa_start);
+		remap_range((void *)ppa_start, ppa_size, MAP_UNCACHED);
+		if (ret)
+			return ret;
+	}
 
 	of_register_fixup(of_fixup_reserved_memory, res);
 
-- 
2.39.2




  reply	other threads:[~2023-11-20 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 14:44 [PATCH 1/2] ARM: mmu64: setup ttb for EL2 as well Sascha Hauer
2023-11-20 14:44 ` Sascha Hauer [this message]
2023-11-20 14:54   ` [PATCH 2/2] ARM: layerscape: ppa: Fix starting PPA Ahmad Fatoum
2023-11-20 15:12     ` Sascha Hauer
2023-11-21 13:42       ` Ahmad Fatoum

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=20231120144453.1075740-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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