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
Cc: uboot-imx@nxp.com, u-boot@lists.denx.de,
	Peng Fan <peng.fan@nxp.com>, Ye Li <ye.li@nxp.com>
Subject: [PATCH V2 29/46] arm: imx8ulp: release trdc and assign lpav from RTD to APD
Date: Tue, 29 Jun 2021 10:32:23 +0800	[thread overview]
Message-ID: <20210629023240.22394-30-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20210629023240.22394-1-peng.fan@oss.nxp.com>

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

Rlease LPAV from RTD to APD
Release gpu2D/3D to APD
Set TRDC MBC2 MEM1 for iomuxc0 access
Since upower depends AP/M33 SW to configure IOMUX for its PMIC i2c
and MODE pins. we have to open iomuxc0 access for A35 core (domain 7)
in single boot.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
---
 arch/arm/mach-imx/imx8ulp/soc.c | 104 +++++++++++++++++++++++++++++++-
 1 file changed, 103 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c
index 43fe62c2fd..29f7d5be02 100644
--- a/arch/arm/mach-imx/imx8ulp/soc.c
+++ b/arch/arm/mach-imx/imx8ulp/soc.c
@@ -380,6 +380,102 @@ static int release_rdc(enum rdc_type type)
 	return ret;
 }
 
+struct mbc_mem_dom {
+	u32 mem_glbcfg[4];
+	u32 nse_blk_index;
+	u32 nse_blk_set;
+	u32 nse_blk_clr;
+	u32 nsr_blk_clr_all;
+	u32 memn_glbac[8];
+	/* The upper only existed in the beginning of each MBC */
+	u32 mem0_blk_cfg_w[64];
+	u32 mem0_blk_nse_w[16];
+	u32 mem1_blk_cfg_w[8];
+	u32 mem1_blk_nse_w[2];
+	u32 mem2_blk_cfg_w[8];
+	u32 mem2_blk_nse_w[2];
+	u32 mem3_blk_cfg_w[8];
+	u32 mem3_blk_nse_w[2];/*0x1F0, 0x1F4 */
+	u32 reserved[2];
+};
+
+struct trdc {
+	u8 res0[0x1000];
+	struct mbc_mem_dom mem_dom[4][8];
+};
+
+/* MBC[m]_[d]_MEM[s]_BLK_CFG_W[w] */
+int trdc_mbc_set_access(u32 mbc_x, u32 dom_x, u32 mem_x, u32 blk_x, u32 perm)
+{
+	struct trdc *trdc_base = (struct trdc *)0x28031000U;
+	struct mbc_mem_dom *mbc_dom;
+	u32 *cfg_w, *nse_w;
+	u32 index, offset, val;
+
+	mbc_dom = &trdc_base->mem_dom[mbc_x][dom_x];
+
+	switch (mem_x) {
+	case 0:
+		cfg_w = &mbc_dom->mem0_blk_cfg_w[blk_x / 8];
+		nse_w = &mbc_dom->mem0_blk_nse_w[blk_x / 32];
+		break;
+	case 1:
+		cfg_w = &mbc_dom->mem1_blk_cfg_w[blk_x / 8];
+		nse_w = &mbc_dom->mem1_blk_nse_w[blk_x / 32];
+		break;
+	case 2:
+		cfg_w = &mbc_dom->mem2_blk_cfg_w[blk_x / 8];
+		nse_w = &mbc_dom->mem2_blk_nse_w[blk_x / 32];
+		break;
+	case 3:
+		cfg_w = &mbc_dom->mem3_blk_cfg_w[blk_x / 8];
+		nse_w = &mbc_dom->mem3_blk_nse_w[blk_x / 32];
+		break;
+	default:
+		return -EINVAL;
+	};
+
+	index = blk_x % 8;
+	offset = index * 4;
+
+	val = readl((void __iomem *)cfg_w);
+
+	val &= ~(0xFU << offset);
+
+	if (perm == 0x7700) {
+		val |= (0x0 << offset);
+		writel(perm, (void __iomem *)cfg_w);
+	} else if (perm == 0x0077) {
+		val |= (0x8 << offset); /* nse bit set */
+		writel(val, (void __iomem *)cfg_w);
+	} else {
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+int trdc_set_access(void)
+{
+	/*
+	 * CGC0: PBridge0 slot 47
+	 * trdc_mbc_set_access(2, 7, 0, 47, 0x7700);
+	 * For secure access, default single boot already support,
+	 * For non-secure access, need add in future per usecase.
+	 */
+	 trdc_mbc_set_access(2, 7, 0, 49, 0x7700);
+	 trdc_mbc_set_access(2, 7, 0, 50, 0x7700);
+	 trdc_mbc_set_access(2, 7, 0, 51, 0x7700);
+	 trdc_mbc_set_access(2, 7, 0, 52, 0x7700);
+
+	 trdc_mbc_set_access(2, 7, 0, 47, 0x0077);
+
+	 /* iomuxc 0 */
+	 trdc_mbc_set_access(2, 7, 1, 33, 0x7700);
+
+	return 0;
+}
+
 static void xrdc_mrc_region_set_access(int mrc_index, u32 addr, u32 access)
 {
 	ulong xrdc_base = 0x292f0000, off;
@@ -428,8 +524,14 @@ int arch_cpu_init(void)
 		/* Disable wdog */
 		init_wdog();
 
-		if (get_boot_mode() == SINGLE_BOOT)
+		if (get_boot_mode() == SINGLE_BOOT) {
 			release_rdc(RDC_TRDC);
+			trdc_set_access();
+			/* LPAV to APD */
+			setbits_le32(0x2802B044, BIT(7));
+			/* GPU 2D/3D to APD */
+			setbits_le32(0x2802B04C, BIT(1) | BIT(2));
+		}
 
 		/* release xrdc, then allow A35 to write SRAM2 */
 		release_rdc(RDC_XRDC);
-- 
2.30.0


  parent reply	other threads:[~2021-06-29  2:05 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  2:31 [PATCH V2 00/46] imx: add i.MX8ULP support Peng Fan (OSS)
2021-06-29  2:31 ` [PATCH V2 01/46] arm: imx: add i.MX8ULP basic Kconfig option Peng Fan (OSS)
2021-06-29  2:31 ` [PATCH V2 02/46] arm: imx: add i.MX8ULP cpu type and helper Peng Fan (OSS)
2021-06-29  2:31 ` [PATCH V2 03/46] arm: imx: sys_proto: move boot mode define to common header Peng Fan (OSS)
2021-06-29  2:31 ` [PATCH V2 04/46] arm: imx8ulp: support print cpu info Peng Fan (OSS)
2021-06-29  2:31 ` [PATCH V2 05/46] imx: imx8ulp: add get reset cause Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 06/46] arm: imx: basic i.MX8ULP support Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 07/46] arm: imx8: Move container parser and image to mach-imx common folder Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 08/46] arm: imx8: Move container image header file to mach-imx Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 09/46] arm: imx: parse-container: guard included header files Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 10/46] arm: imx8ulp: add container support Peng Fan (OSS)
2021-07-17 12:49   ` Stefano Babic
2021-07-19  1:41     ` Peng Fan
2021-06-29  2:32 ` [PATCH V2 11/46] arm: imx: move container Kconfig under mach-imx Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 12/46] driver: misc: Add MU and S400 API to communicate with Sentinel Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 13/46] net: fec_mxc: support i.MX8ULP Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 14/46] pinctrl: Add pinctrl driver for imx8ulp Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 15/46] driver: serial: fsl_lpuart: support i.MX8ULP Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 16/46] arm: imx8ulp: add clock support Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 17/46] drivers: mmc: fsl_esdhc_imx: support i.MX8ULP Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 18/46] arm: imx8ulp: soc: Change to use CMC1 to get bootcfg Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 19/46] arm: imx8ulp: Enable full L2 cache in SPL Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 20/46] arm: imx8ulp: disable wdog3 Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 21/46] arm: imx8ulp: Update the reset vector in u-boot Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 22/46] drivers: misc: s400_api: Update S400_SUCCESS_IND to 0xd6 Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 23/46] drivers: misc: imx8ulp: Add S400 API for image authentication Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 24/46] drivers: misc: imx8ulp: Update S400 API for release RDC Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 25/46] drivers: misc: s400_api: Update API for fuse read and write Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 26/46] arm: imx8ulp: release and configure XRDC at early phase Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 27/46] arm: imx8ulp: add rdc support Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 28/46] arm: imx8ulp: add trdc release request Peng Fan (OSS)
2021-06-29  2:32 ` Peng Fan (OSS) [this message]
2021-06-29  2:32 ` [PATCH V2 30/46] imx8ulp: unify rdc functions Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 31/46] arm: imx8ulp: Probe the S400 MU device in arch init Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 32/46] arm: iMX8ULP: Add boot device relevant functions Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 33/46] arm: imx8ulp: Allocate DCNANO and MIPI_DSI to AD domain Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 34/46] arm: imx8ulp: add dummy imx_get_mac_from_fuse Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 35/46] arm: imx8ulp: add iomuxc support Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 36/46] driver: misc: imx8ulp: Add fuse driver for imx8ulp Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 37/46] imx8ulp: soc: correct reset cause Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 38/46] imx8ulp: Use DGO_GP5 to get boot config Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 39/46] imx8ulp: Add workaround for eMMC boot Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 40/46] mx7ulp: Update unlock and refresh sequences in sWDOG driver Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 41/46] mx7ulp: wdog: Wait for WDOG unlock and reconfiguration to complete Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 42/46] imx8ulp: move struct mu_type to common header Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 43/46] imx8ulp: add upower api support Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 44/46] ddr: Add DDR driver for iMX8ULP Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 45/46] arm: dts: add i.MX8ULP dtsi Peng Fan (OSS)
2021-06-29  2:32 ` [PATCH V2 46/46] arm: imx: add i.MX8ULP EVK support Peng Fan (OSS)
2021-07-15  3:29 ` [PATCH V2 00/46] imx: add i.MX8ULP support Peng Fan (OSS)
2021-07-15  8:11   ` Stefano Babic

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=20210629023240.22394-30-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 \
    --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 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.