Skip to contentSkip to conversation

i.MX8ULP misc update

PATCH New Peng Fan (OSS) 2 participants 39 messages Oct 29, 2021 – Feb 5, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover i.MX8ULP misc update

From: Peng Fan <[email protected]>

This is to upstream NXP downstream i.MX8ULP patches including ADC/DRAM/LPAV/FUSE/ENET update/fix

Alice Guo (3):
imx8ulp: clock: Support to enable/disable the ADC1 clock
imx8ulp: measure die temperature using PMC Temperature Sensor
imx8ulp: implement to obtain the SoC current temperature

Jacky Bai (1):
imx8ulp:ddr: saving the dram config timing data into sram

Peng Fan (1):
imx8ulp: assign PXP/HIFI4/EPDC to APD domain

Ye Li (15):
imx8ulp: soc: Check the DBD_EN fuse before setting RDC
arm: imx8ulp: Allocate LPAV resources to AP domain
imx8ulp: clock: Support LPAV clocks in cgc and pcc
imx8ulp: clock: Add MIPI DSI clock and DCNano clock
imx8ulp: rdc: allow A35 access flexspi0 mem
imx8ulp_evk: Control LPI2C0 PCA6416 and TPM0 for display
imx8ulp: Set DCNANO read QoS on NIC_LPAV to highest
imx8ulp: Fix DCNANO QoS setting
imx8ulp: Remove freescale name from CPU revision
imx8ulp: Workaround LPOSC_TRIM fuse load issue
imx8ulp: clock: Reset DDR controller before clock enable
imx8ulp: clock: Support to reset DCNano and MIPI DSI
imx8ulp: Update ethernet mac to get from fuse
imx8ulp: clock: Handle the DDRLOCKED when setting DDR clock
imx8ulp: ddr: Fix DDR frequency request issue

 arch/arm/include/asm/arch-imx8ulp/cgc.h       |  37 +-
 arch/arm/include/asm/arch-imx8ulp/clock.h     |   4 +
 arch/arm/include/asm/arch-imx8ulp/imx-regs.h  |  63 +++-
 .../include/asm/arch-imx8ulp/imx8ulp-pins.h   |   4 +
 arch/arm/include/asm/arch-imx8ulp/pcc.h       |  70 +++-
 arch/arm/include/asm/arch-imx8ulp/sys_proto.h |   2 +
 arch/arm/mach-imx/imx8ulp/cgc.c               | 325 +++++++++++++++---
 arch/arm/mach-imx/imx8ulp/clock.c             | 156 ++++++++-
 arch/arm/mach-imx/imx8ulp/pcc.c               | 158 ++++++++-
 arch/arm/mach-imx/imx8ulp/soc.c               | 117 ++++++-
 board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  56 +++
 board/freescale/imx8ulp_evk/spl.c             |   9 +
 drivers/ddr/imx/imx8ulp/Kconfig               |   7 +
 drivers/ddr/imx/imx8ulp/ddr_init.c            |  55 ++-
 drivers/thermal/Kconfig                       |   7 +
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/imx_pmc_temperature.c         | 174 ++++++++++
 17 files changed, 1148 insertions(+), 97 deletions(-)
 create mode 100644 drivers/thermal/imx_pmc_temperature.c
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/20 imx8ulp: soc: Check the DBD_EN fuse before setting RDC

From: Ye Li <[email protected]>

S400 enables RDC only when the DBD_EN is fused. Otherwise, the RDC is allowed by all masters.

Current S400 has issue if the XRDC has released to A35, then A35 reset will fail in ROM due to S400 fails to get XRDC.
So temp work around is checking the DBD_EN, if it is not fused, we don't need to call release XRDC or TRDC.

---
 arch/arm/mach-imx/imx8ulp/soc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +17 -3
index bba6323f96..b25f5f2521 100644
@@ -23,6 +23,7 @@
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
+#include <fuse.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -468,11 +469,22 @@ static int trdc_set_access(void)
 int arch_cpu_init(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
+		u32 val = 0;
+		int ret;
+		bool rdc_en = true; /* Default assume DBD_EN is set */
+
 		/* Disable wdog */
 		init_wdog();
 
+		/* Read DBD_EN fuse */
+		ret = fuse_read(8, 1, &val);
+		if (!ret)
+			rdc_en = !!(val & 0x4000);
+
 		if (get_boot_mode() == SINGLE_BOOT) {
-			release_rdc(RDC_TRDC);
+			if (rdc_en)
+				release_rdc(RDC_TRDC);
+
 			trdc_set_access();
 			/* LPAV to APD */
 			setbits_le32(0x2802B044, BIT(7));
@@ -482,8 +494,10 @@ int arch_cpu_init(void)
 			setbits_le32(0x2802B04C, BIT(1) | BIT(2) | BIT(3) | BIT(4));
 		}
 
-		/* release xrdc, then allow A35 to write SRAM2 */
-		release_rdc(RDC_XRDC);
+		/* Release xrdc, then allow A35 to write SRAM2 */
+		if (rdc_en)
+			release_rdc(RDC_XRDC);
+
 		xrdc_mrc_region_set_access(2, CONFIG_SPL_TEXT_BASE, 0xE00);
 
 		clock_init();
Signature · 1 line
2.30.0
#2 lore raw

PATCH 1/20 imx8ulp: soc: Check the DBD_EN fuse before setting RDC

Quoted 9 lines

From: Ye Li <[email protected]>
S400 enables RDC only when the DBD_EN is fused. Otherwise, the RDC is allowed by all masters.
Current S400 has issue if the XRDC has released to A35, then A35 reset will fail in ROM due to S400 fails to get XRDC.
So temp work around is checking the DBD_EN, if it is not fused, we don't need to call release XRDC or TRDC.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#3 lore raw

PATCH 2/20 arm: imx8ulp: Allocate LPAV resources to AP domain

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

When single boot, assign AP domain as the master domain of the LPAV. Allocates LPAV master and slave resources like GPU, DCNano, MIPI-DSI eDMA channel and eDMA request to APD

---
 arch/arm/mach-imx/imx8ulp/soc.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +16 -6
index b25f5f2521..7898cb0ed9 100644
@@ -466,6 +466,20 @@ static int trdc_set_access(void)
 	return 0;
 }
 
+void lpav_configure(void)
+{
+	/* LPAV to APD */
+	setbits_le32(SIM_SEC_BASE_ADDR + 0x44, BIT(7));
+
+	/* GPU 2D/3D/DCNANO/MIPI_DSI to APD */
+	setbits_le32(SIM_SEC_BASE_ADDR + 0x4c, BIT(1) | BIT(2) | BIT(3) | BIT(4));
+
+	/* LPAV slave/dma2 ch allocation and request allocation to APD */
+	writel(0x1f, SIM_SEC_BASE_ADDR + 0x50);
+	writel(0xffffffff, SIM_SEC_BASE_ADDR + 0x54);
+	writel(0x003fffff, SIM_SEC_BASE_ADDR + 0x58);
+}
+
 int arch_cpu_init(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
@@ -486,12 +500,8 @@ int arch_cpu_init(void)
 				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));
-			/* DCNANO and MIPI_DSI to APD */
-			setbits_le32(0x2802B04C, BIT(1) | BIT(2) | BIT(3) | BIT(4));
+
+			lpav_configure();
 		}
 
 		/* Release xrdc, then allow A35 to write SRAM2 */
Signature · 1 line
2.30.0
#4 lore raw

PATCH 2/20 arm: imx8ulp: Allocate LPAV resources to AP domain

Quoted 6 lines

From: Ye Li <[email protected]>
When single boot, assign AP domain as the master domain of the LPAV. Allocates LPAV master and slave resources like GPU, DCNano, MIPI-DSI eDMA channel and eDMA request to APD

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#5 lore raw

PATCH 3/20 imx8ulp: assign PXP/HIFI4/EPDC to APD domain

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Assign the PXP/HIFI4/EPDC to APD domain, otherwise APD not able to receive interrupts from the modules.

---
 arch/arm/mach-imx/imx8ulp/soc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +2 -2
index 7898cb0ed9..e0574112cd 100644
@@ -471,8 +471,8 @@ void lpav_configure(void)
 	/* LPAV to APD */
 	setbits_le32(SIM_SEC_BASE_ADDR + 0x44, BIT(7));
 
-	/* GPU 2D/3D/DCNANO/MIPI_DSI to APD */
-	setbits_le32(SIM_SEC_BASE_ADDR + 0x4c, BIT(1) | BIT(2) | BIT(3) | BIT(4));
+	/* PXP/GPU 2D/3D/DCNANO/MIPI_DSI/EPDC/HIFI4 to APD */
+	setbits_le32(SIM_SEC_BASE_ADDR + 0x4c, 0x7F);
 
 	/* LPAV slave/dma2 ch allocation and request allocation to APD */
 	writel(0x1f, SIM_SEC_BASE_ADDR + 0x50);
Signature · 1 line
2.30.0
#6 lore raw

PATCH 3/20 imx8ulp: assign PXP/HIFI4/EPDC to APD domain

Quoted 5 lines

From: Peng Fan <[email protected]>
Assign the PXP/HIFI4/EPDC to APD domain, otherwise APD not able to receive interrupts from the modules.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#7 lore raw

PATCH 4/20 imx8ulp: clock: Support LPAV clocks in cgc and pcc

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Add the PCC5 clocks support and more LPAV clocks and PLL4 PFD in CGC.

---
 arch/arm/include/asm/arch-imx8ulp/cgc.h |  32 ++-
 arch/arm/include/asm/arch-imx8ulp/pcc.h |  66 ++++-
 arch/arm/mach-imx/imx8ulp/cgc.c         | 314 ++++++++++++++++++++----
 arch/arm/mach-imx/imx8ulp/clock.c       |  48 +++-
 arch/arm/mach-imx/imx8ulp/pcc.c         | 130 ++++++++--
 5 files changed, 508 insertions(+), 82 deletions(-)
arch/arm/include/asm/arch-imx8ulp/cgc.h +29 -3
index 34a15fb59c..745fd7f5e8 100644
@@ -6,11 +6,15 @@
 #ifndef _ASM_ARCH_CGC_H
 #define _ASM_ARCH_CGC_H
 
-enum cgc1_clk {
+enum cgc_clk {
 	DUMMY0_CLK,
 	DUMMY1_CLK,
 	LPOSC,
+	NIC_APCLK,
+	NIC_PERCLK,
+	XBAR_APCLK,
 	XBAR_BUSCLK,
+	AD_SLOWCLK,
 	SOSC,
 	SOSC_DIV1,
 	SOSC_DIV2,
@@ -34,6 +38,24 @@ enum cgc1_clk {
 	PLL3_PFD2_DIV2,
 	PLL3_PFD3_DIV1,
 	PLL3_PFD3_DIV2,
+	LVDS,
+	LPAV_AXICLK,
+	LPAV_AHBCLK,
+	LPAV_BUSCLK,
+	PLL4,
+	PLL4_VCODIV,
+	PLL4_PFD0,
+	PLL4_PFD1,
+	PLL4_PFD2,
+	PLL4_PFD3,
+	PLL4_PFD0_DIV1,
+	PLL4_PFD0_DIV2,
+	PLL4_PFD1_DIV1,
+	PLL4_PFD1_DIV2,
+	PLL4_PFD2_DIV1,
+	PLL4_PFD2_DIV2,
+	PLL4_PFD3_DIV1,
+	PLL4_PFD3_DIV2,
 };
 
 struct cgc1_regs {
@@ -119,12 +141,16 @@ struct cgc2_regs {
 	u32 lvdscfg;
 };
 
-u32 cgc1_clk_get_rate(enum cgc1_clk clk);
+u32 cgc_clk_get_rate(enum cgc_clk clk);
 void cgc1_pll3_init(void);
 void cgc1_pll2_init(void);
 void cgc1_soscdiv_init(void);
 void cgc1_init_core_clk(void);
 void cgc2_pll4_init(void);
 void cgc2_ddrclk_config(u32 src, u32 div);
-u32 cgc1_sosc_div(enum cgc1_clk clk);
+u32 cgc1_sosc_div(enum cgc_clk clk);
+void cgc1_enet_stamp_sel(u32 clk_src);
+void cgc2_pll4_pfd_config(enum cgc_clk pllpfd, u32 pfd);
+void cgc2_pll4_pfddiv_config(enum cgc_clk pllpfddiv, u32 div);
+void cgc2_lpav_init(enum cgc_clk clk);
 #endif
arch/arm/include/asm/arch-imx8ulp/pcc.h +64 -2

80 lines not on this page · raw message

arch/arm/mach-imx/imx8ulp/cgc.c +267 -47

438 lines not on this page · raw message

arch/arm/mach-imx/imx8ulp/clock.c +36 -12

66 lines not on this page · raw message

arch/arm/mach-imx/imx8ulp/pcc.c +112 -18

215 lines not on this page · raw message

Signature · 1 line
2.30.0
#8 lore raw

PATCH 4/20 imx8ulp: clock: Support LPAV clocks in cgc and pcc

Quoted 4 lines

From: Ye Li <[email protected]>
Add the PCC5 clocks support and more LPAV clocks and PLL4 PFD in CGC.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#9 lore raw

PATCH 5/20 imx8ulp: clock: Add MIPI DSI clock and DCNano clock

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Add the DSI clock enable and disable with PCC reset used. Add the LCD pixel clock calculation and configuration for DCNano

---
 arch/arm/include/asm/arch-imx8ulp/clock.h |  2 +
 arch/arm/mach-imx/imx8ulp/clock.c         | 73 +++++++++++++++++++++++
 2 files changed, 75 insertions(+)
arch/arm/include/asm/arch-imx8ulp/clock.h +2 -0
index 58e3356e32..24322f3ab2 100644
@@ -38,4 +38,6 @@ void init_clk_ddr(void);
 int set_ddr_clk(u32 phy_freq_mhz);
 void clock_init(void);
 void cgc1_enet_stamp_sel(u32 clk_src);
+void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz);
+void enable_mipi_dsi_clk(unsigned char enable);
 #endif
arch/arm/mach-imx/imx8ulp/clock.c +73 -0

79 lines not on this page · raw message

Signature · 1 line
2.30.0
#10 lore raw

PATCH 5/20 imx8ulp: clock: Add MIPI DSI clock and DCNano clock

Quoted 5 lines

From: Ye Li <[email protected]>
Add the DSI clock enable and disable with PCC reset used. Add the LCD pixel clock calculation and configuration for DCNano

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#11 lore raw

PATCH 6/20 imx8ulp: rdc: allow A35 access flexspi0 mem

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

For singel boot, set flexspi0 mem to be accessed by A35

---
 arch/arm/mach-imx/imx8ulp/soc.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +2 -0
index e0574112cd..f64a8fb9fc 100644
@@ -463,6 +463,8 @@ static int trdc_set_access(void)
 	/* Iomuxc0: : PBridge1 slot 33 */
 	trdc_mbc_set_access(2, 7, 1, 33, false);
 
+	/* flexspi0 */
+	trdc_mrc_region_set_access(0, 7, 0x04000000, 0x0c000000, false);
 	return 0;
 }
 
Signature · 1 line
2.30.0
#12 lore raw

PATCH 6/20 imx8ulp: rdc: allow A35 access flexspi0 mem

Quoted 4 lines

From: Ye Li <[email protected]>
For singel boot, set flexspi0 mem to be accessed by A35

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#13 lore raw

PATCH 7/20 imx8ulp_evk: Control LPI2C0 PCA6416 and TPM0 for display

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

The board use IO9 of PCA6416 on LPI2C0 and TPM0 for MIPI DSI MUX and backlight. However the LPI2C0 and TPM0 are M33 resources, in this patch we simply access them, but this is a temporary solution. We will modify it when M33 FW changes to set MIPI DSI panel as default path and enable backlight after reset.

---
 .../include/asm/arch-imx8ulp/imx8ulp-pins.h   |  4 ++
 arch/arm/mach-imx/imx8ulp/clock.c             |  6 ++
 arch/arm/mach-imx/imx8ulp/soc.c               |  5 ++
 board/freescale/imx8ulp_evk/imx8ulp_evk.c     | 56 +++++++++++++++++++
 4 files changed, 71 insertions(+)
arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h +4 -0
index d7c07f41b3..d0eefcbc92 100644
@@ -9,6 +9,10 @@
 #include <asm/arch/iomux.h>
 
 enum {
+	IMX8ULP_PAD_PTA3__TPM0_CH2                         = IOMUX_PAD(0x000c, 0x000c, IOMUX_CONFIG_MPORTS | 0x6, 0x0948, 0x1, 0),
+	IMX8ULP_PAD_PTA8__LPI2C0_SCL                       = IOMUX_PAD(0x0020, 0x0020, IOMUX_CONFIG_MPORTS | 0x5, 0x097c, 0x2, 0),
+	IMX8ULP_PAD_PTA9__LPI2C0_SDA                       = IOMUX_PAD(0x0024, 0x0024, IOMUX_CONFIG_MPORTS | 0x5, 0x0980, 0x2, 0),
+
 	IMX8ULP_PAD_PTB7__PMIC0_MODE2                       = IOMUX_PAD(0x009C, 0x009C, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0),
 	IMX8ULP_PAD_PTB8__PMIC0_MODE1                       = IOMUX_PAD(0x00A0, 0x00A0, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0),
 	IMX8ULP_PAD_PTB9__PMIC0_MODE0                       = IOMUX_PAD(0x00A4, 0x00A4, IOMUX_CONFIG_MPORTS | 0xA, 0x0000, 0x0, 0),
arch/arm/mach-imx/imx8ulp/clock.c +6 -0
index 02e90f7856..e599e6c4c6 100644
@@ -186,6 +186,9 @@ int enable_i2c_clk(unsigned char enable, u32 i2c_num)
 		LPI2C7_PCC4_SLOT << 8 | 4,
 	};
 
+	if (i2c_num == 0)
+		return 0;
+
 	if (i2c_num < 4 || i2c_num > 7)
 		return -EINVAL;
 
@@ -214,6 +217,9 @@ u32 imx_get_i2cclk(u32 i2c_num)
 		LPI2C7_PCC4_SLOT << 8 | 4,
 	};
 
+	if (i2c_num == 0)
+		return 24000000;
+
 	if (i2c_num < 4 || i2c_num > 7)
 		return 0;
 
arch/arm/mach-imx/imx8ulp/soc.c +5 -0
index f64a8fb9fc..427b5e4117 100644
@@ -465,6 +465,11 @@ static int trdc_set_access(void)
 
 	/* flexspi0 */
 	trdc_mrc_region_set_access(0, 7, 0x04000000, 0x0c000000, false);
+
+	/* tpm0: PBridge1 slot 21 */
+	trdc_mbc_set_access(2, 7, 1, 21, false);
+	/* lpi2c0: PBridge1 slot 24 */
+	trdc_mbc_set_access(2, 7, 1, 24, false);
 	return 0;
 }
 
board/freescale/imx8ulp_evk/imx8ulp_evk.c +56 -0

73 lines not on this page · raw message

Signature · 1 line
2.30.0
#14 lore raw

PATCH 7/20 imx8ulp_evk: Control LPI2C0 PCA6416 and TPM0 for display

Quoted 8 lines

From: Ye Li <[email protected]>
The board use IO9 of PCA6416 on LPI2C0 and TPM0 for MIPI DSI MUX and backlight. However the LPI2C0 and TPM0 are M33 resources, in this patch we simply access them, but this is a temporary solution. We will modify it when M33 FW changes to set MIPI DSI panel as default path and enable backlight after reset.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#15 lore raw

PATCH 8/20 imx8ulp: Set DCNANO read QoS on NIC_LPAV to highest

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

To avoid DCNANO underrun issue on high loading test, set its read Qos on NIC_LPAV to highest

---
 arch/arm/mach-imx/imx8ulp/soc.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +3 -0
index 427b5e4117..0cf4765bd6 100644
@@ -485,6 +485,9 @@ void lpav_configure(void)
 	writel(0x1f, SIM_SEC_BASE_ADDR + 0x50);
 	writel(0xffffffff, SIM_SEC_BASE_ADDR + 0x54);
 	writel(0x003fffff, SIM_SEC_BASE_ADDR + 0x58);
+
+	/* Set read QoS of dcnano on LPAV NIC */
+	writel(0xf, 0x2e447100);
 }
 
 int arch_cpu_init(void)
Signature · 1 line
2.30.0
#16 lore raw

PATCH 8/20 imx8ulp: Set DCNANO read QoS on NIC_LPAV to highest

Quoted 6 lines

From: Ye Li <[email protected]>
To avoid DCNANO underrun issue on high loading test, set its read Qos on NIC_LPAV to highest

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#17 lore raw

PATCH 9/20 imx8ulp: Fix DCNANO QoS setting

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

The setting does not have effect because we should set it after power on the PS16 for NIC AV.

So move it after upower_init which has powered on all PS

---
 arch/arm/include/asm/arch-imx8ulp/sys_proto.h | 1 +
 arch/arm/mach-imx/imx8ulp/soc.c               | 3 +++
 board/freescale/imx8ulp_evk/spl.c             | 3 +++
 3 files changed, 7 insertions(+)
arch/arm/include/asm/arch-imx8ulp/sys_proto.h +1 -0
index 1a142dce72..8e2c6ed0ce 100644
@@ -16,4 +16,5 @@ enum bt_mode get_boot_mode(void);
 int xrdc_config_pdac(u32 bridge, u32 index, u32 dom, u32 perm);
 int xrdc_config_pdac_openacc(u32 bridge, u32 index);
 enum boot_device get_boot_device(void);
+void set_lpav_qos(void);
 #endif
arch/arm/mach-imx/imx8ulp/soc.c +3 -0
index 0cf4765bd6..2348132bf7 100644
@@ -485,7 +485,10 @@ void lpav_configure(void)
 	writel(0x1f, SIM_SEC_BASE_ADDR + 0x50);
 	writel(0xffffffff, SIM_SEC_BASE_ADDR + 0x54);
 	writel(0x003fffff, SIM_SEC_BASE_ADDR + 0x58);
+}
 
+void set_lpav_qos(void)
+{
 	/* Set read QoS of dcnano on LPAV NIC */
 	writel(0xf, 0x2e447100);
 }
board/freescale/imx8ulp_evk/spl.c +3 -0
index faece336ef..42f8e262b6 100644
@@ -90,6 +90,9 @@ void spl_board_init(void)
 
 	/* Init XRDC MRC for VIDEO, DSP domains */
 	xrdc_init_mrc();
+
+	/* Call it after PS16 power up */
+	set_lpav_qos();
 }
 
 void board_init_f(ulong dummy)
Signature · 1 line
2.30.0
#18 lore raw

PATCH 9/20 imx8ulp: Fix DCNANO QoS setting

Quoted 7 lines

From: Ye Li <[email protected]>
The setting does not have effect because we should set it after power on the PS16 for NIC AV.
So move it after upower_init which has powered on all PS

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#19 lore raw

PATCH 10/20 imx8ulp: Remove freescale name from CPU revision

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Remove the freescale vendor name from CPU revision print to align with other i.MX platforms

---
 arch/arm/mach-imx/imx8ulp/soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/imx8ulp/soc.c +1 -1
index 2348132bf7..d9dca21e8c 100644
@@ -211,7 +211,7 @@ int print_cpuinfo(void)
 
 	cpurev = get_cpu_rev();
 
-	printf("CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n",
+	printf("CPU:   i.MX%s rev%d.%d at %d MHz\n",
 	       get_imx_type((cpurev & 0xFF000) >> 12),
 	       (cpurev & 0x000F0) >> 4, (cpurev & 0x0000F) >> 0,
 	       mxc_get_clock(MXC_ARM_CLK) / 1000000);
Signature · 1 line
2.30.0
#20 lore raw

PATCH 10/20 imx8ulp: Remove freescale name from CPU revision

Quoted 6 lines

From: Ye Li <[email protected]>
Remove the freescale vendor name from CPU revision print to align with other i.MX platforms

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#21 lore raw

PATCH 11/20 imx8ulp: Workaround LPOSC_TRIM fuse load issue

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

8ULP ROM should read the LPOSC trim BIAS fuse to fill the CGC0 LPOSCCTRL[7:0], but it writes a fixed value on A0.1 revision.

A0.2 will fix the issue in ROM. But A0.1 we have to workaround it in SPL by setting LPOSCCTRL BIASCURRENT again.

---
 arch/arm/include/asm/arch-imx8ulp/sys_proto.h |  1 +
 arch/arm/mach-imx/imx8ulp/soc.c               | 20 +++++++++++++++++++
 board/freescale/imx8ulp_evk/spl.c             |  6 ++++++
 3 files changed, 27 insertions(+)
arch/arm/include/asm/arch-imx8ulp/sys_proto.h +1 -0
index 8e2c6ed0ce..284ccafc98 100644
@@ -17,4 +17,5 @@ int xrdc_config_pdac(u32 bridge, u32 index, u32 dom, u32 perm);
 int xrdc_config_pdac_openacc(u32 bridge, u32 index);
 enum boot_device get_boot_device(void);
 void set_lpav_qos(void);
+void load_lposc_fuse(void);
 #endif
arch/arm/mach-imx/imx8ulp/soc.c +20 -0
index d9dca21e8c..e12e28d9e7 100644
@@ -487,6 +487,26 @@ void lpav_configure(void)
 	writel(0x003fffff, SIM_SEC_BASE_ADDR + 0x58);
 }
 
+void load_lposc_fuse(void)
+{
+	int ret;
+	u32 val = 0, val2 = 0, reg;
+
+	ret = fuse_read(25, 0, &val);
+	if (ret)
+		return; /* failed */
+
+	ret = fuse_read(25, 1, &val2);
+	if (ret)
+		return; /* failed */
+
+	/* LPOSCCTRL */
+	reg = readl(0x2802f304);
+	reg &= ~0xff;
+	reg |= (val & 0xff);
+	writel(reg, 0x2802f304);
+}
+
 void set_lpav_qos(void)
 {
 	/* Set read QoS of dcnano on LPAV NIC */
board/freescale/imx8ulp_evk/spl.c +6 -0
index 42f8e262b6..c17d5eff7d 100644
@@ -77,6 +77,12 @@ void spl_board_init(void)
 
 	/* After AP set iomuxc0, the i2c can't work, Need M33 to set it now */
 
+	/* Load the lposc fuse for single boot to work around ROM issue,
+	 *  The fuse depends on S400 to read.
+	 */
+	if (is_soc_rev(CHIP_REV_1_0) && get_boot_mode() == SINGLE_BOOT)
+		load_lposc_fuse();
+
 	upower_init();
 
 	power_init_board();
Signature · 1 line
2.30.0
#22 lore raw

PATCH 11/20 imx8ulp: Workaround LPOSC_TRIM fuse load issue

Quoted 8 lines

From: Ye Li <[email protected]>
8ULP ROM should read the LPOSC trim BIAS fuse to fill the CGC0 LPOSCCTRL[7:0], but it writes a fixed value on A0.1 revision. A0.2 will fix the issue in ROM. But A0.1 we have to workaround it in SPL by setting LPOSCCTRL BIASCURRENT again.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#23 lore raw

PATCH 12/20 imx8ulp: clock: Reset DDR controller before clock enable

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

The LPAV is not allocated to APD when dual boot, so LPAV won't reset when APD is reset. We have to explicitly reset the DDR, otherwise its initialization will fail.

---
 arch/arm/mach-imx/imx8ulp/clock.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-imx/imx8ulp/clock.c +3 -0
index e599e6c4c6..f54fc25763 100644
@@ -97,6 +97,9 @@ void ddrphy_pll_lock(void)
 
 void init_clk_ddr(void)
 {
+	/* disable the ddr pcc */
+	writel(0xc0000000, PCC5_LPDDR4_ADDR);
+
 	/* enable pll4 and ddrclk*/
 	cgc2_pll4_init();
 	cgc2_ddrclk_config(1, 1);
Signature · 1 line
2.30.0
#24 lore raw

PATCH 12/20 imx8ulp: clock: Reset DDR controller before clock enable

Quoted 7 lines

From: Ye Li <[email protected]>
The LPAV is not allocated to APD when dual boot, so LPAV won't reset when APD is reset. We have to explicitly reset the DDR, otherwise its initialization will fail.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#25 lore raw

PATCH 13/20 imx8ulp: clock: Support to reset DCNano and MIPI DSI

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

When LPAV is allocated to RTD, the LPAV won't be reset. So we have to reset DCNano and MIPI DSI in u-boot before enabling the drivers

---
 arch/arm/include/asm/arch-imx8ulp/clock.h | 1 +
 arch/arm/mach-imx/imx8ulp/clock.c         | 8 ++++++++
 2 files changed, 9 insertions(+)
arch/arm/include/asm/arch-imx8ulp/clock.h +1 -0
index 24322f3ab2..cc70284f55 100644
@@ -39,5 +39,6 @@ int set_ddr_clk(u32 phy_freq_mhz);
 void clock_init(void);
 void cgc1_enet_stamp_sel(u32 clk_src);
 void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz);
+void reset_lcdclk(void);
 void enable_mipi_dsi_clk(unsigned char enable);
 #endif
arch/arm/mach-imx/imx8ulp/clock.c +8 -0
index f54fc25763..d03269ac04 100644
@@ -330,6 +330,7 @@ void enable_mipi_dsi_clk(unsigned char enable)
 {
 	if (enable) {
 		pcc_clock_enable(5, DSI_PCC5_SLOT, false);
+		pcc_reset_peripheral(5, DSI_PCC5_SLOT, true);
 		pcc_clock_sel(5, DSI_PCC5_SLOT, PLL4_PFD3_DIV2);
 		pcc_clock_div_config(5, DSI_PCC5_SLOT, 0, 6);
 		pcc_clock_enable(5, DSI_PCC5_SLOT, true);
@@ -340,6 +341,13 @@ void enable_mipi_dsi_clk(unsigned char enable)
 	}
 }
 
+void reset_lcdclk(void)
+{
+	/* Disable clock and reset dcnano*/
+	pcc_clock_enable(5, DCNANO_PCC5_SLOT, false);
+	pcc_reset_peripheral(5, DCNANO_PCC5_SLOT, true);
+}
+
 void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz)
 {
 	u8 pcd, best_pcd = 0;
Signature · 1 line
2.30.0
#26 lore raw

PATCH 13/20 imx8ulp: clock: Support to reset DCNano and MIPI DSI

Quoted 6 lines

From: Ye Li <[email protected]>
When LPAV is allocated to RTD, the LPAV won't be reset. So we have to reset DCNano and MIPI DSI in u-boot before enabling the drivers

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#27 lore raw

PATCH 14/20 imx8ulp: Update ethernet mac to get from fuse

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

Get the MAC address from fuse bank5 word 3 and 4. It has MSB first at lowest address, so have a reverse order with other iMX used in mac.c

---
 arch/arm/mach-imx/imx8ulp/soc.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +23 -0
index e12e28d9e7..943ea7fb7e 100644
@@ -588,7 +588,30 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 
 void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 {
+	u32 val[2] = {};
+	int ret;
+
+	ret = fuse_read(5, 3, &val[0]);
+	if (ret)
+		goto err;
+
+	ret = fuse_read(5, 4, &val[1]);
+	if (ret)
+		goto err;
+
+	mac[0] = val[0];
+	mac[1] = val[0] >> 8;
+	mac[2] = val[0] >> 16;
+	mac[3] = val[0] >> 24;
+	mac[4] = val[1];
+	mac[5] = val[1] >> 8;
+
+	debug("%s: MAC%d: %02x.%02x.%02x.%02x.%02x.%02x\n",
+	      __func__, dev_id, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+	return;
+err:
 	memset(mac, 0, 6);
+	printf("%s: fuse read err: %d\n", __func__, ret);
 }
 
 int (*card_emmc_is_boot_part_en)(void) = (void *)0x67cc;
Signature · 1 line
2.30.0
#28 lore raw

PATCH 14/20 imx8ulp: Update ethernet mac to get from fuse

Quoted 7 lines

From: Ye Li <[email protected]>
Get the MAC address from fuse bank5 word 3 and 4. It has MSB first at lowest address, so have a reverse order with other iMX used in mac.c

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#29 lore raw

PATCH 15/20 imx8ulp: clock: Support to enable/disable the ADC1 clock

In reply to Peng Fan (OSS)

From: Alice Guo <[email protected]>

This patch implements enable_adc1_clk() to enable or disable the ADC1 clock on i.MX8ULP.

---
 arch/arm/include/asm/arch-imx8ulp/cgc.h      |  4 +++
 arch/arm/include/asm/arch-imx8ulp/clock.h    |  1 +
 arch/arm/include/asm/arch-imx8ulp/imx-regs.h |  1 +
 arch/arm/include/asm/arch-imx8ulp/pcc.h      |  4 +++
 arch/arm/mach-imx/imx8ulp/clock.c            | 12 +++++++++
 arch/arm/mach-imx/imx8ulp/pcc.c              | 28 +++++++++++++++++++-
 6 files changed, 49 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-imx8ulp/cgc.h +4 -0
index 745fd7f5e8..e15ef1d6c1 100644
@@ -56,6 +56,10 @@ enum cgc_clk {
 	PLL4_PFD2_DIV2,
 	PLL4_PFD3_DIV1,
 	PLL4_PFD3_DIV2,
+	CM33_BUSCLK,
+	PLL1_VCO_DIV,
+	PLL0_PFD2_DIV,
+	PLL0_PFD1_DIV,
 };
 
 struct cgc1_regs {
arch/arm/include/asm/arch-imx8ulp/clock.h +1 -0
index cc70284f55..c0f32cc087 100644
@@ -41,4 +41,5 @@ void cgc1_enet_stamp_sel(u32 clk_src);
 void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz);
 void reset_lcdclk(void);
 void enable_mipi_dsi_clk(unsigned char enable);
+void enable_adc1_clk(bool enable);
 #endif
arch/arm/include/asm/arch-imx8ulp/imx-regs.h +1 -0
index af6845cbff..91adc85525 100644
@@ -30,6 +30,7 @@
 
 #define PCC_XRDC_MGR_ADDR	0x292d00bc
 
+#define PCC1_RBASE		0x28091000
 #define PCC3_RBASE		0x292d0000
 #define PCC4_RBASE		0x29800000
 #define PCC5_RBASE		0x2da70000
arch/arm/include/asm/arch-imx8ulp/pcc.h +4 -0
index 468015482b..46386f1aba 100644
@@ -8,6 +8,10 @@
 
 #include <asm/arch/cgc.h>
 
+enum pcc1_entry {
+	ADC1_PCC1_SLOT = 34,
+};
+
 enum pcc3_entry {
 	DMA1_MP_PCC3_SLOT = 1,
 	DMA1_CH0_PCC3_SLOT = 2,
arch/arm/mach-imx/imx8ulp/clock.c +12 -0
index d03269ac04..961702310c 100644
@@ -341,6 +341,18 @@ void enable_mipi_dsi_clk(unsigned char enable)
 	}
 }
 
+void enable_adc1_clk(bool enable)
+{
+	if (enable) {
+		pcc_clock_enable(1, ADC1_PCC1_SLOT, false);
+		pcc_clock_sel(1, ADC1_PCC1_SLOT, CM33_BUSCLK);
+		pcc_clock_enable(1, ADC1_PCC1_SLOT, true);
+		pcc_reset_peripheral(1, ADC1_PCC1_SLOT, false);
+	} else {
+		pcc_clock_enable(1, ADC1_PCC1_SLOT, false);
+	}
+}
+
 void reset_lcdclk(void)
 {
 	/* Disable clock and reset dcnano*/
arch/arm/mach-imx/imx8ulp/pcc.c +27 -1
index 6145b3ea6a..7909d770af 100644
@@ -15,6 +15,21 @@
 #define cgc_clk_TYPES 2
 #define cgc_clk_NUM 8
 
+static enum cgc_clk pcc1_clksrc[][8] = {
+	{
+	},
+	{
+		DUMMY0_CLK,
+		LPOSC,
+		SOSC_DIV2,
+		FRO_DIV2,
+		CM33_BUSCLK,
+		PLL1_VCO_DIV,
+		PLL0_PFD2_DIV,
+		PLL0_PFD1_DIV,
+	}
+};
+
 static enum cgc_clk pcc3_clksrc[][8] = {
 	{
 	},
@@ -75,6 +90,11 @@ static enum cgc_clk pcc5_clksrc[][8] = {
 	}
 };
 
+static struct pcc_entry pcc1_arrays[] = {
+	{PCC1_RBASE, ADC1_PCC1_SLOT, CLKSRC_PER_BUS, PCC_NO_DIV, PCC_HAS_RST_B},
+	{}
+};
+
 static struct pcc_entry pcc3_arrays[] = {
 	{PCC3_RBASE, DMA1_MP_PCC3_SLOT,		CLKSRC_NO_PCS, PCC_NO_DIV, PCC_NO_RST_B},
 	{PCC3_RBASE, DMA1_CH0_PCC3_SLOT,	CLKSRC_NO_PCS, PCC_NO_DIV, PCC_NO_RST_B},
@@ -228,6 +248,10 @@ static int find_pcc_entry(int pcc_controller, int pcc_clk_slot, struct pcc_entry
 	int index = 0;
 
 	switch (pcc_controller) {
+	case 1:
+		pcc_array = pcc1_arrays;
+		*out = &pcc1_arrays[0];
+		break;
 	case 3:
 		pcc_array = pcc3_arrays;
 		*out = &pcc3_arrays[0];
@@ -310,7 +334,9 @@ int pcc_clock_sel(int pcc_controller, int pcc_clk_slot, enum cgc_clk src)
 		return -EPERM;
 	}
 
-	if (pcc_controller == 3)
+	if (pcc_controller == 1)
+		cgc_clk_array = pcc1_clksrc[clksrc_type];
+	else if (pcc_controller == 3)
 		cgc_clk_array = pcc3_clksrc[clksrc_type];
 	else if (pcc_controller == 4)
 		cgc_clk_array = pcc4_clksrc[clksrc_type];
Signature · 1 line
2.30.0
#30 lore raw

PATCH 15/20 imx8ulp: clock: Support to enable/disable the ADC1 clock

Quoted 6 lines

From: Alice Guo <[email protected]>
This patch implements enable_adc1_clk() to enable or disable the ADC1 clock on i.MX8ULP.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#31 lore raw

PATCH 16/20 imx8ulp: clock: Handle the DDRLOCKED when setting DDR clock

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

The DDRLOCKED bit in CGC2 DDRCLK will auto lock up and down by HW according to DDR DIV updating or DDR CLK halt status change. So DDR PCC disable/enable will trigger the lock up/down flow. We need wait until unlock to ensure clock is ready.

And before configuring the DDRCLK DIV, we need polling the DDRLOCKED until it is unlocked. Otherwise writing ti DIV bits will not set.

---
 arch/arm/include/asm/arch-imx8ulp/cgc.h |  1 +
 arch/arm/mach-imx/imx8ulp/cgc.c         | 11 +++++++++++
 arch/arm/mach-imx/imx8ulp/clock.c       |  6 ++++++
 3 files changed, 18 insertions(+)
arch/arm/include/asm/arch-imx8ulp/cgc.h +1 -0
index e15ef1d6c1..ad3edc85ad 100644
@@ -152,6 +152,7 @@ void cgc1_soscdiv_init(void);
 void cgc1_init_core_clk(void);
 void cgc2_pll4_init(void);
 void cgc2_ddrclk_config(u32 src, u32 div);
+void cgc2_ddrclk_wait_unlock(void);
 u32 cgc1_sosc_div(enum cgc_clk clk);
 void cgc1_enet_stamp_sel(u32 clk_src);
 void cgc2_pll4_pfd_config(enum cgc_clk pllpfd, u32 pfd);
arch/arm/mach-imx/imx8ulp/cgc.c +11 -0
index fc84f3f293..38bcbb91e6 100644
@@ -269,12 +269,23 @@ void cgc2_pll4_pfddiv_config(enum cgc_clk pllpfddiv, u32 div)
 
 void cgc2_ddrclk_config(u32 src, u32 div)
 {
+	/* If reg lock is set, wait until unlock by HW */
+	/* This lock is triggered by div updating and ddrclk halt status change, */
+	while ((readl(&cgc2_regs->ddrclk) & BIT(31)))
+		;
+
 	writel((src << 28) | (div << 21), &cgc2_regs->ddrclk);
 	/* wait for DDRCLK switching done */
 	while (!(readl(&cgc2_regs->ddrclk) & BIT(27)))
 		;
 }
 
+void cgc2_ddrclk_wait_unlock(void)
+{
+	while ((readl(&cgc2_regs->ddrclk) & BIT(31)))
+		;
+}
+
 void cgc2_lpav_init(enum cgc_clk clk)
 {
 	u32 i, scs, reg;
arch/arm/mach-imx/imx8ulp/clock.c +6 -0
index 961702310c..91580b2c29 100644
@@ -107,6 +107,9 @@ void init_clk_ddr(void)
 	/* enable ddr pcc */
 	writel(0xd0000000, PCC5_LPDDR4_ADDR);
 
+	/* Wait until ddrclk reg lock bit is cleared, so that the div update is finished */
+	cgc2_ddrclk_wait_unlock();
+
 	/* for debug */
 	/* setclkout_ddr(); */
 }
@@ -144,6 +147,9 @@ int set_ddr_clk(u32 phy_freq_mhz)
 		return -EINVAL;
 	}
 
+	/* Wait until ddrclk reg lock bit is cleared, so that the div update is finished */
+	cgc2_ddrclk_wait_unlock();
+
 	return 0;
 }
 
Signature · 1 line
2.30.0
#32 lore raw

PATCH 16/20 imx8ulp: clock: Handle the DDRLOCKED when setting DDR clock

Quoted 10 lines

From: Ye Li <[email protected]>
The DDRLOCKED bit in CGC2 DDRCLK will auto lock up and down by HW according to DDR DIV updating or DDR CLK halt status change. So DDR PCC disable/enable will trigger the lock up/down flow. We need wait until unlock to ensure clock is ready.
And before configuring the DDRCLK DIV, we need polling the DDRLOCKED until it is unlocked. Otherwise writing ti DIV bits will not set.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#33 lore raw

PATCH 18/20 imx8ulp: implement to obtain the SoC current temperature

In reply to Peng Fan (OSS)

From: Alice Guo <[email protected]>

Obatin the SoC current temperature in print_cpuinfo().

---
 arch/arm/mach-imx/imx8ulp/soc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +17 -0
index 943ea7fb7e..934b0ef038 100644
@@ -24,6 +24,7 @@
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
 #include <fuse.h>
+#include <thermal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -216,6 +217,22 @@ int print_cpuinfo(void)
 	       (cpurev & 0x000F0) >> 4, (cpurev & 0x0000F) >> 0,
 	       mxc_get_clock(MXC_ARM_CLK) / 1000000);
 
+#if defined(CONFIG_IMX_PMC_TEMPERATURE)
+	struct udevice *udev;
+	int ret, temp;
+
+	ret = uclass_get_device(UCLASS_THERMAL, 0, &udev);
+	if (!ret) {
+		ret = thermal_get_temp(udev, &temp);
+		if (!ret)
+			printf("CPU current temperature: %d\n", temp);
+		else
+			debug(" - failed to get CPU current temperature\n");
+	} else {
+		debug(" - failed to get CPU current temperature\n");
+	}
+#endif
+
 	printf("Reset cause: %s\n", get_reset_cause(cause));
 
 	printf("Boot mode: ");
Signature · 1 line
2.30.0
#34 lore raw

PATCH 18/20 imx8ulp: implement to obtain the SoC current temperature

Quoted 5 lines

From: Alice Guo <[email protected]>
Obatin the SoC current temperature in print_cpuinfo().

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#35 lore raw

PATCH 19/20 imx8ulp:ddr: saving the dram config timing data into sram

In reply to Peng Fan (OSS)

From: Jacky Bai <[email protected]>

On i.MX8ULP, The dram config timing need to be saved into sram for ddr retention when APD enter PD mode, so add this support on i.MX8ULP.

---
 drivers/ddr/imx/imx8ulp/Kconfig    |  7 +++++
 drivers/ddr/imx/imx8ulp/ddr_init.c | 45 ++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
drivers/ddr/imx/imx8ulp/Kconfig +7 -0
index e56062a1d0..42848863aa 100644
@@ -8,4 +8,11 @@ config IMX8ULP_DRAM_PHY_PLL_BYPASS
 	bool "Enable the DDR PHY PLL bypass mode, so PHY clock is from DDR_CLK "
 	depends on IMX8ULP_DRAM
 
+config SAVED_DRAM_TIMING_BASE
+	hex "Define the base address for saved dram timing"
+	help
+	  The DRAM config timing data need to be saved into sram
+	  for low power use.
+	default 0x2006c000
+
 endmenu
drivers/ddr/imx/imx8ulp/ddr_init.c +45 -0

57 lines not on this page · raw message

Signature · 1 line
2.30.0
#36 lore raw

PATCH 19/20 imx8ulp:ddr: saving the dram config timing data into sram

Quoted 6 lines

From: Jacky Bai <[email protected]>
On i.MX8ULP, The dram config timing need to be saved into sram for ddr retention when APD enter PD mode, so add this support on i.MX8ULP.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#37 lore raw

PATCH 20/20 imx8ulp: ddr: Fix DDR frequency request issue

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

After acking the requested frequency, should wait the ack bit clear by DDR controller and check the DFS interrupt for next request polling. Otherwise, the next polling of request bit will get previous value that DDR controller have not cleared it, so a wrong request frequency is used.

---
 drivers/ddr/imx/imx8ulp/ddr_init.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/ddr/imx/imx8ulp/ddr_init.c +7 -3
index 9730dd6450..a5a9fd8d7c 100644
@@ -129,8 +129,8 @@ int ddr_calibration(unsigned int fsp_table[3])
 		 * Polling SIM LPDDR_CTRL2 Bit phy_freq_chg_req until be 1'b1
 		 */
 		reg_val = readl(AVD_SIM_LPDDR_CTRL2);
-		phy_freq_req = (reg_val >> 7) & 0x1;
-
+		/* DFS interrupt is set */
+		phy_freq_req = ((reg_val >> 7) & 0x1) && ((reg_val >> 15) & 0x1);
 		if (phy_freq_req) {
 			phy_freq_type = reg_val & 0x1F;
 			if (phy_freq_type == 0x00) {
@@ -159,7 +159,11 @@ int ddr_calibration(unsigned int fsp_table[3])
 				if (freq_chg_pt == 2)
 					freq_chg_cnt--;
 			}
-			reg_val = readl(AVD_SIM_LPDDR_CTRL2);
+
+			/* Hardware clear the ack on falling edge of LPDDR_CTRL2:phy_freq_chg_reg */
+			/* Ensure the ack is clear before starting to poll request again */
+			while ((readl(AVD_SIM_LPDDR_CTRL2) & BIT(6)))
+				;
 		}
 	} while (1);
 
Signature · 1 line
2.30.0
#38 lore raw

PATCH 20/20 imx8ulp: ddr: Fix DDR frequency request issue

Quoted 9 lines

From: Ye Li <[email protected]>
After acking the requested frequency, should wait the ack bit clear by DDR controller and check the DFS interrupt for next request polling. Otherwise, the next polling of request bit will get previous value that DDR controller have not cleared it, so a wrong request frequency is used.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================