All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: sbabic@denx.de, festevam@gmail.com,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: u-boot@lists.denx.de, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH V2 33/49] imx: imx9: Add M33 release prepare function
Date: Mon, 27 Jun 2022 11:24:39 +0800	[thread overview]
Message-ID: <20220627032455.28280-34-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20220627032455.28280-1-peng.fan@oss.nxp.com>

From: Peng Fan <peng.fan@nxp.com>

To support on-demand booting M33 image from A core. SPL needs
to follow M33 kick up sequence to release M33 firstly,
then set M33 CPUWAIT signal. ATF will clear CPUWAIT to kick
M33 to run.

The prepare function also works around the M33 TCM ECC issue by
clean the TCM. Also enable sentinel handshake and WDOG1 clock
for M33 stop and reset.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/include/asm/arch-imx9/sys_proto.h |  2 +
 arch/arm/mach-imx/imx9/soc.c               | 51 ++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx9/sys_proto.h b/arch/arm/include/asm/arch-imx9/sys_proto.h
index 5ae7a043398..ba97f92f5ae 100644
--- a/arch/arm/include/asm/arch-imx9/sys_proto.h
+++ b/arch/arm/include/asm/arch-imx9/sys_proto.h
@@ -9,4 +9,6 @@
 #include <asm/mach-imx/sys_proto.h>
 
 void soc_power_init(void);
+bool m33_is_rom_kicked(void);
+int m33_prepare(void);
 #endif
diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index 68f3ddd4287..2a29454d1eb 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -13,6 +13,7 @@
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/ccm_regs.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/trdc.h>
 #include <asm/mach-imx/boot_mode.h>
@@ -378,3 +379,53 @@ void soc_power_init(void)
 
 	disable_isolation();
 }
+
+static bool m33_is_rom_kicked(void)
+{
+	struct blk_ctrl_s_aonmix_regs *s_regs =
+			(struct blk_ctrl_s_aonmix_regs *)BLK_CTRL_S_ANOMIX_BASE_ADDR;
+
+	if (!(readl(&s_regs->m33_cfg) & BIT(2)))
+		return true;
+
+	return false;
+}
+
+int m33_prepare(void)
+{
+	struct src_mix_slice_regs *mix_regs =
+		(struct src_mix_slice_regs *)(ulong)(SRC_IPS_BASE_ADDR + 0x400 * (SRC_MIX_CM33 + 1));
+	struct src_general_regs *global_regs =
+		(struct src_general_regs *)(ulong)SRC_GLOBAL_RBASE;
+	struct blk_ctrl_s_aonmix_regs *s_regs =
+			(struct blk_ctrl_s_aonmix_regs *)BLK_CTRL_S_ANOMIX_BASE_ADDR;
+	u32 val;
+
+	if (m33_is_rom_kicked())
+		return -EPERM;
+
+	/* Release reset of M33 */
+	setbits_le32(&global_regs->scr, BIT(0));
+
+	/* Check the reset released in M33 MIX func stat */
+	val = readl(&mix_regs->func_stat);
+	while (!(val & SRC_MIX_SLICE_FUNC_STAT_RST_STAT))
+		val = readl(&mix_regs->func_stat);
+
+	/* Release Sentinel TROUT */
+	ahab_release_m33_trout();
+
+	/* Mask WDOG1 IRQ from A55, we use it for M33 reset */
+	setbits_le32(&s_regs->ca55_irq_mask[1], BIT(6));
+
+	/* Turn on WDOG1 clock */
+	ccm_lpcg_on(CCGR_WDG1, 1);
+
+	/* Set sentinel LP handshake for M33 reset */
+	setbits_le32(&s_regs->lp_handshake[0], BIT(6));
+
+	/* Clear M33 TCM for ECC */
+	memset((void *)(ulong)0x201e0000, 0, 0x40000);
+
+	return 0;
+}
-- 
2.36.0


  parent reply	other threads:[~2022-06-27  2:47 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  3:24 [PATCH V2 00/49] imx: support i.MX93 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 01/49] spl: imx8mm: enlarge SPL_MAX_SIZE Peng Fan (OSS)
2022-06-29 10:09   ` Frieder Schrempf
2022-07-05  1:35     ` Peng Fan
2022-07-05  2:08       ` Peng Fan
2022-07-05  6:40         ` Frieder Schrempf
2022-06-27  3:24 ` [PATCH V2 02/49] arm: makefile: cleanup mach-imx usage Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 03/49] imx: Change USB boot device type Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 04/49] imx: spl: Allow iMX7/8/8M to overwrite spl_board_boot_device Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 05/49] imx: simplify dependency with SPL_BOOTROM_SUPPORT Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 06/49] imx: move get_boot_device to common header Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 07/49] imx: move get_boot_device to common file Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 08/49] imx: add USB2_BOOT type Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 09/49] imx: add basic i.MX9 support Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 10/49] fsl_lpuart: add " Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 11/49] gpio: pca953x: support pcal6524 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 12/49] imx: pinctrl: add pinctrl and pinfunc file for i.MX93 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 13/49] imx: imx9: Add CCM and clock API support Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 14/49] mmc: fsl_esdhc_imx: Support i.MX9 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 15/49] spl: Use SPL_FIT_IMAGE_TINY for iMX9 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 16/49] imx: imx9: Add function to initialize timer Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 17/49] imx: imx9: disable watchdog Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 18/49] imx: imx9: support romapi Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 19/49] misc: imx: S400_API: Move S400 MU and API to a common place Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 20/49] misc: s4mu: Support iMX93 with Sentinel MU Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 21/49] misc: S400_API: Update release RDC API Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 22/49] misc: S400_API: New API for FW status and chip info Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 23/49] misc: s400_api: introduce ahab_release_m33_trout Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 24/49] imx: imx9: Add TRDC driver for TRDC init Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 25/49] imx: imx9: Add AHAB boot support Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 26/49] imx: imx9: Get the chip revision through S400 API Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 27/49] misc: S400_API: Rename imx8ulp_s400_msg to sentinel_msg Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 28/49] misc: imx8ulp: move fuse.c from imx8ulp to sentinel Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 29/49] misc: fuse: support to access fuse on i.MX93 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 30/49] misc: fuse: update the code for accessing fuse of i.MX93 Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 31/49] imx: imx9: Add gpio registers structure Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 32/49] imx: imx9: Add MIX power init Peng Fan (OSS)
2022-06-27  3:24 ` Peng Fan (OSS) [this message]
2022-06-27  3:24 ` [PATCH V2 34/49] imx: imx9: Support booting m33 from Acore Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 35/49] imx: imx9: Support multiple env storages at runtime Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 36/49] imx: imx9: clock: Add DDR clock support Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 37/49] ddr: imx: Add i.MX9 DDR controller driver Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 38/49] ddr: imx9: enable Performance monitor counter Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 39/49] arm: dts: Add i.MX93 SoC DTSi file Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 40/49] imx: imx93_evk: Add basic board support Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 41/49] imx: imx93_evk: Set ARM clock to 1.7Ghz Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 42/49] net: fec_mxc: support i.MX93 Peng Fan (OSS)
2022-07-03 19:13   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 43/49] net: dwc_eth_qos: fix build break when CLK not enabled Peng Fan (OSS)
2022-07-03 19:21   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 44/49] net: dwc_eth_qos: public some functions Peng Fan (OSS)
2022-07-03 19:14   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 45/49] net: dwc_eth_qos: move i.MX code out Peng Fan (OSS)
2022-07-03 19:15   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 46/49] net: eqos: add function to get phy node and address Peng Fan (OSS)
2022-07-03 19:17   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 47/49] net: dwc_eth_qos: intrdouce eqos hook eqos_get_enetaddr Peng Fan (OSS)
2022-07-03 19:19   ` Ramon Fried
2022-06-27  3:24 ` [PATCH V2 48/49] board: freescale: imx93_evk: support ethernet Peng Fan (OSS)
2022-06-27  3:24 ` [PATCH V2 49/49] tools: image: support i.MX93 Peng Fan (OSS)
2022-06-27  6:45 ` [PATCH V2 00/49] imx: " Peng Fan

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=20220627032455.28280-34-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=festevam@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.