All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: sbabic@denx.de
Cc: festevam@gmail.com, u-boot@lists.denx.de, uboot-imx@nxp.com,
	Ye Li <ye.li@nxp.com>, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH V2 08/26] imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode
Date: Wed,  6 Apr 2022 14:30:13 +0800	[thread overview]
Message-ID: <20220406063031.21960-9-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20220406063031.21960-1-peng.fan@oss.nxp.com>

From: Ye Li <ye.li@nxp.com>

When M33 is LPAV owner in dual boot, DDR, PCC5, CGC2 won't be reset
during APD reset. So no need to init DDR again after reboot, but need to
reconfigure the PLL4 PFD/PFDDIV/LPAV NIC etc, because kernel may
change or disable some of them.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/include/asm/arch-imx8ulp/cgc.h |  2 +-
 arch/arm/mach-imx/imx8ulp/cgc.c         | 20 +++++++++++---------
 arch/arm/mach-imx/imx8ulp/clock.c       |  2 +-
 board/freescale/imx8ulp_evk/spl.c       | 12 ++++++++++--
 4 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/arch/arm/include/asm/arch-imx8ulp/cgc.h b/arch/arm/include/asm/arch-imx8ulp/cgc.h
index e45f04624db..83a246b15a7 100644
--- a/arch/arm/include/asm/arch-imx8ulp/cgc.h
+++ b/arch/arm/include/asm/arch-imx8ulp/cgc.h
@@ -150,7 +150,7 @@ void cgc1_pll3_init(ulong freq);
 void cgc1_pll2_init(ulong freq);
 void cgc1_soscdiv_init(void);
 void cgc1_init_core_clk(ulong freq);
-void cgc2_pll4_init(void);
+void cgc2_pll4_init(bool pll4_reset);
 void cgc2_ddrclk_config(u32 src, u32 div);
 void cgc2_ddrclk_wait_unlock(void);
 u32 cgc1_sosc_div(enum cgc_clk clk);
diff --git a/arch/arm/mach-imx/imx8ulp/cgc.c b/arch/arm/mach-imx/imx8ulp/cgc.c
index 494ddb0f329..ccd977f1a5d 100644
--- a/arch/arm/mach-imx/imx8ulp/cgc.c
+++ b/arch/arm/mach-imx/imx8ulp/cgc.c
@@ -187,7 +187,7 @@ void cgc1_pll3_init(ulong freq)
 	}
 }
 
-void cgc2_pll4_init(void)
+void cgc2_pll4_init(bool pll4_reset)
 {
 	/* Disable PFD DIV and clear DIV */
 	writel(0x80808080, &cgc2_regs->pll4div_pfd0);
@@ -196,16 +196,18 @@ void cgc2_pll4_init(void)
 	/* Gate off and clear PFD  */
 	writel(0x80808080, &cgc2_regs->pll4pfdcfg);
 
-	/* Disable PLL4 */
-	writel(0x0, &cgc2_regs->pll4csr);
+	if (pll4_reset) {
+		/* Disable PLL4 */
+		writel(0x0, &cgc2_regs->pll4csr);
 
-	/* Configure PLL4 to 528Mhz and clock source from SOSC */
-	writel(22 << 16, &cgc2_regs->pll4cfg);
-	writel(0x1, &cgc2_regs->pll4csr);
+		/* Configure PLL4 to 528Mhz and clock source from SOSC */
+		writel(22 << 16, &cgc2_regs->pll4cfg);
+		writel(0x1, &cgc2_regs->pll4csr);
 
-	/* wait for PLL4 output valid */
-	while (!(readl(&cgc2_regs->pll4csr) & BIT(24)))
-		;
+		/* wait for PLL4 output valid */
+		while (!(readl(&cgc2_regs->pll4csr) & BIT(24)))
+			;
+	}
 
 	/* Enable all 4 PFDs */
 	setbits_le32(&cgc2_regs->pll4pfdcfg, 18 << 0); /* 528 */
diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c
index 46971578a91..69cccafbcef 100644
--- a/arch/arm/mach-imx/imx8ulp/clock.c
+++ b/arch/arm/mach-imx/imx8ulp/clock.c
@@ -101,7 +101,7 @@ void init_clk_ddr(void)
 	writel(0xc0000000, PCC5_LPDDR4_ADDR);
 
 	/* enable pll4 and ddrclk*/
-	cgc2_pll4_init();
+	cgc2_pll4_init(true);
 	cgc2_ddrclk_config(4, 1);
 
 	/* enable ddr pcc */
diff --git a/board/freescale/imx8ulp_evk/spl.c b/board/freescale/imx8ulp_evk/spl.c
index d3cdad2d76a..e6949b5e431 100644
--- a/board/freescale/imx8ulp_evk/spl.c
+++ b/board/freescale/imx8ulp_evk/spl.c
@@ -24,8 +24,16 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void spl_dram_init(void)
 {
-	init_clk_ddr();
-	ddr_init(&dram_timing);
+	/* Reboot in dual boot setting no need to init ddr again */
+	bool ddr_enable = pcc_clock_is_enable(5, LPDDR4_PCC5_SLOT);
+
+	if (!ddr_enable) {
+		init_clk_ddr();
+		ddr_init(&dram_timing);
+	} else {
+		/* reinit pfd/pfddiv and lpavnic except pll4*/
+		cgc2_pll4_init(false);
+	}
 }
 
 u32 spl_boot_device(void)
-- 
2.35.1


  parent reply	other threads:[~2022-04-06  5:51 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  6:30 [PATCH V2 00/26] imx: imx8ulp: misc update from downstream Peng Fan (OSS)
2022-04-06  6:30 ` [PATCH V2 01/26] imx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` [PATCH V2 02/26] imx: imx8ulp: include pcc/cgc header in clock header Peng Fan (OSS)
2022-04-12 18:46   ` sbabic
2022-04-06  6:30 ` [PATCH V2 03/26] imx: imx8ulp: Add M33 handshake functions Peng Fan (OSS)
2022-04-12 18:46   ` sbabic
2022-04-06  6:30 ` [PATCH V2 04/26] imx: imx8ulp: clock: Add clock support for i3c controller Peng Fan (OSS)
2022-04-12 18:44   ` sbabic
2022-04-06  6:30 ` [PATCH V2 05/26] imx: imx8ulp: add CAAM clock entry Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` [PATCH V2 06/26] imx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings Peng Fan (OSS)
2022-04-12 18:42   ` sbabic
2022-04-06  6:30 ` [PATCH V2 07/26] imx: imx8ulp: add ND/LD clock Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` Peng Fan (OSS) [this message]
2022-04-12 18:45   ` [PATCH V2 08/26] imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode sbabic
2022-04-06  6:30 ` [PATCH V2 09/26] imx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init Peng Fan (OSS)
2022-04-12 18:45   ` sbabic
2022-04-06  6:30 ` [PATCH V2 10/26] imx: imx8ulp: enable MU0_B clk by default Peng Fan (OSS)
2022-04-12 18:46   ` sbabic
2022-04-06  6:30 ` [PATCH V2 11/26] misc: imx8ulp: Add OEM SRK Hash fuse support Peng Fan (OSS)
2022-04-12 18:46   ` sbabic
2022-04-06  6:30 ` [PATCH V2 12/26] imx: imx8ulp: Change LPAV assignment for dual boot Peng Fan (OSS)
2022-04-12 18:42   ` sbabic
2022-04-06  6:30 ` [PATCH V2 13/26] imx: imx8ulp: Load the lposc fuse " Peng Fan (OSS)
2022-04-12 18:47   ` sbabic
2022-04-06  6:30 ` [PATCH V2 14/26] misc: S400_API: add ahab_release_caam Peng Fan (OSS)
2022-04-12 18:41   ` sbabic
2022-04-06  6:30 ` [PATCH V2 15/26] misc: S400_API: Update S400 API for buffer dump Peng Fan (OSS)
2022-04-12 18:47   ` sbabic
2022-04-06  6:30 ` [PATCH V2 16/26] imx: imx8ulp: release CAAM for the Cortex-A35 Peng Fan (OSS)
2022-04-12 18:47   ` sbabic
2022-04-06  6:30 ` [PATCH V2 17/26] imx: imx8ulp_evk: Update LPDDR4 PHY settings Peng Fan (OSS)
2022-04-12 18:42   ` sbabic
2022-04-06  6:30 ` [PATCH V2 18/26] imx: imx8ulp_evk: call the handshake with M33 Peng Fan (OSS)
2022-04-12 18:47   ` sbabic
2022-04-06  6:30 ` [PATCH V2 19/26] imx: imx8ulp_evk: Power down the domains may used in u-boot Peng Fan (OSS)
2022-04-12 17:10   ` Stefano Babic
2022-04-13  3:00     ` Peng Fan (OSS)
2022-04-13  7:45       ` Stefano Babic
2022-04-06  6:30 ` [PATCH V2 20/26] imx: dynamic setting mmcdev and mmcroot Peng Fan (OSS)
2022-04-12 18:45   ` sbabic
2022-04-25 19:58   ` Tim Harvey
2022-04-26 11:24     ` Peng Fan (OSS)
2022-04-06  6:30 ` [PATCH V2 21/26] imx: imx8ulp_evk: Enable SD/MMC port auto detect Peng Fan (OSS)
2022-04-12 18:46   ` sbabic
2022-04-06  6:30 ` [PATCH V2 22/26] imx: imx8ulp: enable wdog_ad interrupt in CMC1 Peng Fan (OSS)
2022-04-12 18:47   ` sbabic
2022-04-06  6:30 ` [PATCH V2 23/26] imx: imx8ulp: reserve tee memory Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` [PATCH V2 24/26] imx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` [PATCH V2 25/26] imx: imx8ulp_evk: Enable multiple env storage devices Peng Fan (OSS)
2022-04-12 18:43   ` sbabic
2022-04-06  6:30 ` [PATCH V2 26/26] misc: imx8ulp: Update fuse driver Peng Fan (OSS)
2022-04-12 18:46   ` sbabic

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=20220406063031.21960-9-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.