imx: imx8ulp: misc update from downstream
v2 cover imx: imx8ulp: misc update from downstream
From: Peng Fan <[email protected]>
V2:
Update commit log
Drop patch 26 in V1
Minor update
This patchset is to upstream NXP downstream i.MX8ULP patches
- Support Nominal/Low Drive clock settings
- Update mem map for TEE
- Release CAAM
- Support Dual boot
- Enable handshake with M33
- Update DDR and PHY settings
- Misc clock update
Clark Wang (1):
imx: imx8ulp: clock: Add clock support for i3c controller
Clement Faure (2):
misc: S400_API: add ahab_release_caam
imx: imx8ulp: release CAAM for the Cortex-A35
Ji Luo (1):
imx: imx8ulp: reserve tee memory
Peng Fan (9):
imx: imx8ulp: include pcc/cgc header in clock header
imx: imx8ulp: add CAAM clock entry
imx: imx8ulp: add ND/LD clock
imx: imx8ulp: enable MU0_B clk by default
imx: dynamic setting mmcdev and mmcroot
imx: imx8ulp_evk: Enable SD/MMC port auto detect
imx: imx8ulp: enable wdog_ad interrupt in CMC1
imx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS
misc: imx8ulp: Update fuse driver
Ye Li (13):
imx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz
imx: imx8ulp: Add M33 handshake functions
imx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings
imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode
imx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init
misc: imx8ulp: Add OEM SRK Hash fuse support
imx: imx8ulp: Change LPAV assignment for dual boot
imx: imx8ulp: Load the lposc fuse for dual boot
misc: S400_API: Update S400 API for buffer dump
imx: imx8ulp_evk: Update LPDDR4 PHY settings
imx: imx8ulp_evk: call the handshake with M33
imx: imx8ulp_evk: Power down the domains may used in u-boot
imx: imx8ulp_evk: Enable multiple env storage devices
arch/arm/include/asm/arch-imx8ulp/cgc.h | 8 +- arch/arm/include/asm/arch-imx8ulp/clock.h | 8 +- arch/arm/include/asm/arch-imx8ulp/imx-regs.h | 1 + arch/arm/include/asm/arch-imx8ulp/pcc.h | 1 + arch/arm/include/asm/arch-imx8ulp/s400_api.h | 5 +- arch/arm/include/asm/arch-imx8ulp/sys_proto.h | 2 + arch/arm/include/asm/mach-imx/sys_proto.h | 2 + arch/arm/mach-imx/imx8ulp/Kconfig | 6 + arch/arm/mach-imx/imx8ulp/cgc.c | 106 +- arch/arm/mach-imx/imx8ulp/clock.c | 95 +- arch/arm/mach-imx/imx8ulp/pcc.c | 1 + arch/arm/mach-imx/imx8ulp/soc.c | 197 ++- board/freescale/common/Makefile | 3 + board/freescale/common/mmc.c | 49 + board/freescale/imx8ulp_evk/Makefile | 7 +- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 43 +- board/freescale/imx8ulp_evk/lpddr4_timing.c | 32 +- .../freescale/imx8ulp_evk/lpddr4_timing_266.c | 1109 +++++++++++++++++ board/freescale/imx8ulp_evk/spl.c | 59 +- configs/imx8ulp_evk_defconfig | 2 +- drivers/misc/imx8ulp/fuse.c | 4 +- drivers/misc/imx8ulp/s400_api.c | 63 + include/configs/imx8ulp_evk.h | 2 + 23 files changed, 1696 insertions(+), 109 deletions(-) create mode 100644 board/freescale/common/mmc.c create mode 100644 board/freescale/imx8ulp_evk/lpddr4_timing_266.c
Signature · 1 line
2.35.1
PATCH v2 1/26 imx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz
From: Ye Li <[email protected]>
The COUNTER_FREQUENCY is missed in 8ulp configs, it will cause SPL and u-boot not set the cntfrq_el0. For u-boot, this is ok, because ATF has set it. But for SPL, it will lead delay and get_timer not working.
--- include/configs/imx8ulp_evk.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/imx8ulp_evk.h +2 -0
@@ -27,6 +27,8 @@#endif +#define COUNTER_FREQUENCY 1000000/* 1MHz */ +/* ENET Config */ #if defined(CONFIG_FEC_MXC )#define PHY_ANEG_TIMEOUT 20000
Signature · 1 line
2.35.1
PATCH v2 1/26 imx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz
Quoted 8 lines
From: Ye Li <[email protected]>
TheCOUNTER_FREQUENCYis missed in 8ulp configs, it will cause SPL and u-boot not set thecntfrq_el0. For u-boot, this is ok, because ATF has set it. But for SPL, it will lead delay andget_timernot working.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 2/26 imx: imx8ulp: include pcc/cgc header in clock header
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
With this change, we no need to include pcc/cgc header files both.
--- arch/arm/include/asm/arch-imx8ulp/clock.h | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/include/asm/arch-imx8ulp/clock.h +3 -0
@@ -6,6 +6,9 @@#ifndef _ASM_ARCH_IMX8ULP_CLOCK_H#define _ASM_ARCH_IMX8ULP_CLOCK_H +#include <asm/arch/pcc.h> +#include <asm/arch/cgc.h> +/* Mainly for compatible to imx common code. */ enum mxc_clock { MXC_ARM_CLK = 0,
Signature · 1 line
2.35.1
PATCH v2 2/26 imx: imx8ulp: include pcc/cgc header in clock header
Quoted 3 lines
From: Peng Fan <[email protected]>
With this change, we no need to include pcc/cgc header files both.Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 3/26 imx: imx8ulp: Add M33 handshake functions
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Add functions to check if M33 image is booted and handshake with M33 image via MU. A core notifies M33 to start init by FCR F0, then wait M33 init done signal by checking FSR F0.
--- arch/arm/include/asm/arch-imx8ulp/imx-regs.h | 1 + arch/arm/include/asm/arch-imx8ulp/sys_proto.h | 2 ++ arch/arm/mach-imx/imx8ulp/soc.c | 36 +++++++++++++++++++ 3 files changed, 39 insertions(+)
arch/arm/include/asm/arch-imx8ulp/imx-regs.h +1 -0
@@ -14,6 +14,7 @@#define CMC0_RBASE 0x28025000 +#define MU0_B_BASE_ADDR 0x29220000#define CMC1_BASE_ADDR 0x29240000#define SIM1_BASE_ADDR 0x29290000
arch/arm/include/asm/arch-imx8ulp/sys_proto.h +2 -0
@@ -18,4 +18,6 @@ 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 ); +bool m33_image_booted (void ); +int m33_image_handshake (ulong timeout_ms);#endif
arch/arm/mach-imx/imx8ulp/soc.c +36 -0
@@ -26,6 +26,7 @@#include <dm/uclass-internal.h> #include <fuse.h> #include <thermal.h> +#include <linux/iopoll.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -137,6 +138,41 @@ enum bt_mode get_boot_mode(void)return LOW_POWER_BOOT ; } +bool m33_image_booted (void ) +{ +u32 gp6; + +/* DGO_GP6 */ + gp6 =readl (SIM_SEC_BASE_ADDR +0x28 ); +if (gp6 &BIT (5 )) +return true; + +return false; +} + +int m33_image_handshake (ulong timeout_ms) +{ +u32 fsr; +int ret; +ulong timeout_us = timeout_ms *1000 ; + +/* enable MU0_MUB clock before access the register of MU0_MUB */ +pcc_clock_enable (3 ,MU0_B_PCC3_SLOT , true); + +/* Notify m33 that it's ready to do init srtm(enable mu receive interrupt and so on) */ +setbits_le32 (MU0_B_BASE_ADDR +0x100 ,BIT (0 ));/* set FCR F0 flag of MU0_MUB */ + +/* +* Wait m33 to set FCR F0 flag of MU0_MUA +* Clear FCR F0 flag of MU0_MUB after m33 has set FCR F0 flag of MU0_MUA +*/ + ret =readl_poll_sleep_timeout (MU0_B_BASE_ADDR +0x104 , fsr, fsr &BIT (0 ),10 , timeout_us); +if (!ret) +clrbits_le32 (MU0_B_BASE_ADDR +0x100 ,BIT (0 )); + +return ret; +} +#define CMC_SRS_TAMPER BIT(31)#define CMC_SRS_SECURITY BIT(30)#define CMC_SRS_TZWDG BIT(29)
Signature · 1 line
2.35.1
PATCH v2 3/26 imx: imx8ulp: Add M33 handshake functions
Quoted 8 lines
From: Ye Li <[email protected]>
Add functions to check if M33 image is booted and handshake with M33 image via MU. A core notifies M33 to start init by FCR F0, then wait M33 init done signal by checking FSR F0.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Biwen Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 4/26 imx: imx8ulp: clock: Add clock support for i3c controller
In reply to Peng Fan (OSS)From: Clark Wang <[email protected]>
Add i3c controller clock enable/disable function for imx8ulp.
--- arch/arm/mach-imx/imx8ulp/clock.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm/mach-imx/imx8ulp/clock.c +20 -0
@@ -237,6 +237,26 @@ u32 imx_get_i2cclk(u32 i2c_num) }#endif +#if IS_ENABLED (CONFIG_SYS_I2C_IMX_I3C ) +int enable_i3c_clk (unsigned char enable,u32 i3c_num) +{ +if (enable) { +pcc_clock_enable (3 ,I3C2_PCC3_SLOT , false); +pcc_clock_sel (3 ,I3C2_PCC3_SLOT ,SOSC_DIV2 ); +pcc_clock_enable (3 ,I3C2_PCC3_SLOT , true); +pcc_reset_peripheral (3 ,I3C2_PCC3_SLOT , false); + }else { +pcc_clock_enable (3 ,I3C2_PCC3_SLOT , false); + } +return 0 ; +} + +u32 imx_get_i3cclk (u32 i3c_num) +{ +return pcc_clock_get_rate (3 ,I3C2_PCC3_SLOT ); +} +#endif +void enable_usboh3_clk (unsigned char enable) {if (enable) {
Signature · 1 line
2.35.1
PATCH v2 4/26 imx: imx8ulp: clock: Add clock support for i3c controller
Quoted 5 lines
From: Clark Wang <[email protected]>
Add i3c controller clock enable/disable function for imx8ulp.Reviewed-by Ye Li <[email protected]>Signed-off-by Clark Wang <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 5/26 imx: imx8ulp: add CAAM clock entry
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add CAAM clock entry in PCC3
--- arch/arm/include/asm/arch-imx8ulp/pcc.h | 1 + arch/arm/mach-imx/imx8ulp/pcc.c | 1 + 2 files changed, 2 insertions(+)
arch/arm/include/asm/arch-imx8ulp/pcc.h +1 -0
@@ -52,6 +52,7 @@ enum pcc3_entry {UPOWER_PCC3_SLOT =40 ,WDOG3_PCC3_SLOT =42 ,WDOG4_PCC3_SLOT =43 , +CAAM_PCC3_SLOT =46 ,XRDC_MGR_PCC3_SLOT =47 ,SEMA42_1_PCC3_SLOT =48 , ROMCP1_PCC3_SLOT = 49,
arch/arm/mach-imx/imx8ulp/pcc.c +1 -0
@@ -135,6 +135,7 @@ static struct pcc_entry pcc3_arrays[] = { {PCC3_RBASE, UPOWER_PCC3_SLOT, CLKSRC_NO_PCS, PCC_NO_DIV, PCC_NO_RST_B}, {PCC3_RBASE, WDOG3_PCC3_SLOT, CLKSRC_PER_BUS, PCC_HAS_DIV, PCC_HAS_RST_B}, {PCC3_RBASE, WDOG4_PCC3_SLOT, CLKSRC_PER_BUS, PCC_HAS_DIV, PCC_HAS_RST_B}, + {PCC3_RBASE, CAAM_PCC3_SLOT, CLKSRC_NO_PCS, PCC_NO_DIV, PCC_HAS_RST_B}, {PCC3_RBASE, XRDC_MGR_PCC3_SLOT, CLKSRC_NO_PCS, PCC_NO_DIV, PCC_NO_RST_B}, {PCC3_RBASE, SEMA42_1_PCC3_SLOT, CLKSRC_PER_BUS, PCC_NO_DIV, PCC_NO_RST_B}, {PCC3_RBASE, ROMCP1_PCC3_SLOT, CLKSRC_NO_PCS, PCC_NO_DIV, PCC_NO_RST_B},
Signature · 1 line
2.35.1
PATCH v2 5/26 imx: imx8ulp: add CAAM clock entry
Quoted 3 lines
From: Peng Fan <[email protected]>
Add CAAM clock entry in PCC3Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 6/26 imx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
This workaround is not needed on i.MX8ULP proto-1B EVK as board has fixed the problem. Because we don't support proto-1A any longer, remove the PMIC settings.
--- board/freescale/imx8ulp_evk/spl.c | 18 ------------------ 1 file changed, 18 deletions(-)
board/freescale/imx8ulp_evk/spl.c +0 -18
@@ -35,24 +35,6 @@ u32 spl_boot_device(void)int power_init_board (void ) { -u32 pmic_reg; - -/* PMIC set bucks1-4 to PWM mode */ -upower_pmic_i2c_read (0x10 , &pmic_reg); -upower_pmic_i2c_read (0x14 , &pmic_reg); -upower_pmic_i2c_read (0x21 , &pmic_reg); -upower_pmic_i2c_read (0x2e , &pmic_reg); - -upower_pmic_i2c_write (0x10 ,0x3d ); -upower_pmic_i2c_write (0x14 ,0x7d ); -upower_pmic_i2c_write (0x21 ,0x7d ); -upower_pmic_i2c_write (0x2e ,0x3d ); - -upower_pmic_i2c_read (0x10 , &pmic_reg); -upower_pmic_i2c_read (0x14 , &pmic_reg); -upower_pmic_i2c_read (0x21 , &pmic_reg); -upower_pmic_i2c_read (0x2e , &pmic_reg); -/* Set buck3 to 1.1v OD */ upower_pmic_i2c_write (0x22 ,0x28 );return 0 ;
Signature · 1 line
2.35.1
PATCH v2 6/26 imx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings
Quoted 7 lines
From: Ye Li <[email protected]>
This workaround is not needed on i.MX8ULP proto-1B EVK as board has fixed the problem. Because we don't support proto-1A any longer, remove the PMIC settings.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 7/26 imx: imx8ulp: add ND/LD clock
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add a new ddr script, defconfig for ND
Configure the clock for ND mode
changing A35 to 960MHz for OD mode
Update NIC CLK for the various modes
Introduce clock_init_early/late, late is used after pmic voltage setting, early is used in the very early stage for upower mu, lpuart and etc.
Note: NIC runs at 324MHz, 442MHz has some random kernel hang issue with cpuidle enabled now.
--- arch/arm/include/asm/arch-imx8ulp/cgc.h | 6 +- arch/arm/include/asm/arch-imx8ulp/clock.h | 5 +- arch/arm/mach-imx/imx8ulp/Kconfig | 6 + arch/arm/mach-imx/imx8ulp/cgc.c | 78 +- arch/arm/mach-imx/imx8ulp/clock.c | 70 +- arch/arm/mach-imx/imx8ulp/soc.c | 2 +- board/freescale/imx8ulp_evk/Makefile | 7 +- .../freescale/imx8ulp_evk/lpddr4_timing_266.c | 1109 +++++++++++++++++ board/freescale/imx8ulp_evk/spl.c | 15 +- 9 files changed, 1251 insertions(+), 47 deletions(-) create mode 100644 board/freescale/imx8ulp_evk/lpddr4_timing_266.c
arch/arm/include/asm/arch-imx8ulp/cgc.h +3 -3
@@ -146,10 +146,10 @@ struct cgc2_regs { };u32 cgc_clk_get_rate (enum cgc_clk clk); -void cgc1_pll3_init (void ); -void cgc1_pll2_init (void ); +void cgc1_pll3_init (ulong freq); +void cgc1_pll2_init (ulong freq);void cgc1_soscdiv_init (void ); -void cgc1_init_core_clk (void ); +void cgc1_init_core_clk (ulong freq);void cgc2_pll4_init (void );void cgc2_ddrclk_config (u32 src,u32 div);void cgc2_ddrclk_wait_unlock (void );
arch/arm/include/asm/arch-imx8ulp/clock.h +4 -1
@@ -9,6 +9,8 @@#include <asm/arch/pcc.h> #include <asm/arch/cgc.h> +#define MHZ (X ) ((X) * 1000000UL) +/* Mainly for compatible to imx common code. */ enum mxc_clock {MXC_ARM_CLK =0 ,
@@ -39,7 +41,8 @@ void init_clk_usdhc(u32 index);void init_clk_fspi (int index);void init_clk_ddr (void );int set_ddr_clk (u32 phy_freq_mhz); -void clock_init (void ); +void clock_init_early (void ); +void clock_init_late (void );void cgc1_enet_stamp_sel (u32 clk_src);void mxs_set_lcdclk (u32 base_addr,u32 freq_in_khz);void reset_lcdclk (void );
arch/arm/mach-imx/imx8ulp/Kconfig +6 -0
@@ -7,6 +7,12 @@ config IMX8ULP config SYS_SOC default "imx8ulp" +config IMX8ULP_LD_MODE + bool + +config IMX8ULP_ND_MODE + bool "i.MX8ULP Low Driver Mode" + choice prompt "i.MX8ULP board select" optional
arch/arm/mach-imx/imx8ulp/cgc.c +56 -22
158 lines not on this page · raw message
arch/arm/mach-imx/imx8ulp/clock.c +53 -17
90 lines not on this page · raw message
arch/arm/mach-imx/imx8ulp/soc.c +1 -1
@@ -597,7 +597,7 @@ int arch_cpu_init(void)xrdc_mrc_region_set_access (2 ,CONFIG_SPL_TEXT_BASE ,0xE00 ); -clock_init (); +clock_init_early (); }else {/* reconfigure core0 reset vector to ROM */ set_core0_reset_vector (0x1000 );
board/freescale/imx8ulp_evk/Makefile +6 -1
@@ -3,5 +3,10 @@ obj-y += imx8ulp_evk.o ifdef CONFIG_SPL_BUILD -obj-y += spl.o ddr_init.o lpddr4_timing.o +obj-y += spl.o ddr_init.o +ifdef CONFIG_IMX8ULP_ND_MODE +obj-y += lpddr4_timing_264.o +else +obj-y += lpddr4_timing.o +endif endif
board/freescale/imx8ulp_evk/lpddr4_timing_266.c new file +1109 -0
1,109 lines not on this page · raw message
board/freescale/imx8ulp_evk/spl.c +13 -2
@@ -35,8 +35,17 @@ u32 spl_boot_device(void)int power_init_board (void ) { -/* Set buck3 to 1.1v OD */ -upower_pmic_i2c_write (0x22 ,0x28 ); +if (IS_ENABLED (CONFIG_IMX8ULP_LD_MODE )) { +/* Set buck3 to 0.9v LD */ +upower_pmic_i2c_write (0x22 ,0x18 ); + }else if (IS_ENABLED (CONFIG_IMX8ULP_ND_MODE )) { +/* Set buck3 to 1.0v ND */ +upower_pmic_i2c_write (0x22 ,0x20 ); + }else { +/* Set buck3 to 1.1v OD */ +upower_pmic_i2c_write (0x22 ,0x28 ); + } +return 0 ; }
@@ -69,6 +78,8 @@ void spl_board_init(void)power_init_board (); +clock_init_late (); +/* DDR initialization */ spl_dram_init ();
Signature · 1 line
2.35.1
PATCH v2 7/26 imx: imx8ulp: add ND/LD clock
Quoted 10 lines
From: Peng Fan <[email protected]>
Add a new ddr script, defconfig for ND
Configure the clock for ND mode
changing A35 to 960MHz for OD mode
Update NIC CLK for the various modes
Introduce clock_init_early/late, late is used after pmic voltage setting, early is used in the very early stage for upower mu, lpuart and etc.
Note: NIC runs at 324MHz, 442MHz has some random kernel hang issue with cpuidle enabled now.
Quoted 2 lines
Reviewed-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 8/26 imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
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.
--- 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(-)
arch/arm/include/asm/arch-imx8ulp/cgc.h +1 -1
@@ -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);
arch/arm/mach-imx/imx8ulp/cgc.c +11 -9
@@ -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 */
arch/arm/mach-imx/imx8ulp/clock.c +1 -1
@@ -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 */
board/freescale/imx8ulp_evk/spl.c +10 -2
@@ -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 )
Signature · 1 line
2.35.1
PATCH v2 8/26 imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode
Quoted 8 lines
From: Ye Li <[email protected]>
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 <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 9/26 imx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
When reset with dual boot mode, the LPAV domain won't power down due to its master is not assigned to APD. So the NICLPAV keeps the last setting to use PLL4PFD1. So before SPL initialize the PLL4, we need to switch NICLPAV to FRO192, otherwise system will hang.
--- arch/arm/mach-imx/imx8ulp/cgc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/mach-imx/imx8ulp/cgc.c +8 -0
@@ -189,6 +189,14 @@ void cgc1_pll3_init(ulong freq)void cgc2_pll4_init (bool pll4_reset) { +/* Check the NICLPAV first to ensure not from PLL4 PFD1 clock */ +if ((readl (&cgc2_regs->niclpavclk) &GENMASK (29 ,28 )) ==BIT (28 )) { +/* switch to FRO 192 first */ +clrbits_le32 (&cgc2_regs->niclpavclk,GENMASK (29 ,28 )); +while (!(readl (&cgc2_regs->niclpavclk) &BIT (27 ))) + ; + } +/* Disable PFD DIV and clear DIV */ writel (0x80808080 , &cgc2_regs->pll4div_pfd0);writel (0x80808080 , &cgc2_regs->pll4div_pfd1);
Signature · 1 line
2.35.1
PATCH v2 9/26 imx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init
Quoted 8 lines
From: Ye Li <[email protected]>
When reset with dual boot mode, the LPAV domain won't power down due to its master is not assigned to APD. So the NICLPAV keeps the last setting to use PLL4PFD1. So before SPL initialize the PLL4, we need to switch NICLPAV to FRO192, otherwise system will hang.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 10/26 imx: imx8ulp: enable MU0_B clk by default
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Enable MU0_B clk by default. When M33 image is loaded by Jlink, the previous method not enable MU0_B clk and not able to communicate with M33, so let's enable it by default.
And we not put it under kernel dts, because it conflicts with i.MX8QM suspend/resume logic which requires large change.
--- arch/arm/mach-imx/imx8ulp/clock.c | 3 +++ arch/arm/mach-imx/imx8ulp/soc.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx8ulp/clock.c +3 -0
@@ -214,6 +214,9 @@ void clock_init_late(void)pcc_reset_peripheral (4 ,SDHC2_PCC4_SLOT , false); } +/* enable MU0_MUB clock before access the register of MU0_MUB */ +pcc_clock_enable (3 ,MU0_B_PCC3_SLOT , true); +/* * Enable clock division * TODO: may not needed after ROM ready.
arch/arm/mach-imx/imx8ulp/soc.c +0 -3
@@ -156,9 +156,6 @@ int m33_image_handshake(ulong timeout_ms)int ret;ulong timeout_us = timeout_ms *1000 ; -/* enable MU0_MUB clock before access the register of MU0_MUB */ -pcc_clock_enable (3 ,MU0_B_PCC3_SLOT , true); -/* Notify m33 that it's ready to do init srtm(enable mu receive interrupt and so on) */ setbits_le32 (MU0_B_BASE_ADDR +0x100 ,BIT (0 ));/* set FCR F0 flag of MU0_MUB */
Signature · 1 line
2.35.1
PATCH v2 10/26 imx: imx8ulp: enable MU0_B clk by default
Quoted 9 lines
From: Peng Fan <[email protected]>
EnableMU0_Bclk by default. When M33 image is loaded by Jlink, the previous method not enableMU0_Bclk and not able to communicate with M33, so let's enable it by default.
And we not put it under kernel dts, because it conflicts with i.MX8QM suspend/resume logic which requires large change.Reviewed-by Ye Li <[email protected]>Reviewed-by Jacky Bai <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 11/26 misc: imx8ulp: Add OEM SRK Hash fuse support
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Since latest S400 firmware has supported to read OEM SRK Hash, add it to the driver's table
--- drivers/misc/imx8ulp/fuse.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/imx8ulp/fuse.c +1 -0
@@ -61,6 +61,7 @@ struct s400_map_entry s400_api_mapping_table[] = { { 1, 8 }, /* LOCK */ { 2, 8 }, /* ECID */ { 7, 4, 0, 1 }, /* OTP_UNIQ_ID */ + { 15, 8 }, /* OEM SRK HASH */ { 23, 1, 4, 2 }, /* OTFAD */ };
Signature · 1 line
2.35.1
PATCH v2 11/26 misc: imx8ulp: Add OEM SRK Hash fuse support
Quoted 6 lines
From: Ye Li <[email protected]>
Since latest S400 firmware has supported to read OEM SRK Hash, add it to the driver's tableReviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 12/26 imx: imx8ulp: Change LPAV assignment for dual boot
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Assign the LPAV owner to RTD, and assign LPAV masters and peripherals to APD. So except the masters and peripherals, other resources (like DDR, cgc2, pcc5) in LPAV won't be reset during reboot and suspend.
No needs to initialize DDR again after reboot.
--- arch/arm/mach-imx/imx8ulp/soc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +6 -5
@@ -524,10 +524,10 @@ static int trdc_set_access(void)return 0 ; } -void lpav_configure (void ) +void lpav_configure (bool lpav_to_m33) { -/* LPAV to APD */ -setbits_le32 (SIM_SEC_BASE_ADDR +0x44 ,BIT (7 )); +if (!lpav_to_m33) +setbits_le32 (SIM_SEC_BASE_ADDR +0x44 ,BIT (7 ));/* LPAV to APD */ /* PXP/GPU 2D/3D/DCNANO/MIPI_DSI/EPDC/HIFI4 to APD */ setbits_le32 (SIM_SEC_BASE_ADDR +0x4c ,0x7F );
@@ -584,8 +584,9 @@ int arch_cpu_init(void)release_rdc (RDC_TRDC );trdc_set_access (); - -lpav_configure (); +lpav_configure (false); + }else { +lpav_configure (true); }/* Release xrdc, then allow A35 to write SRAM2 */
Signature · 1 line
2.35.1
PATCH v2 12/26 imx: imx8ulp: Change LPAV assignment for dual boot
Quoted 8 lines
From: Ye Li <[email protected]>
Assign the LPAV owner to RTD, and assign LPAV masters and peripherals to APD. So except the masters and peripherals, other resources (like DDR, cgc2, pcc5) in LPAV won't be reset during reboot and suspend. No needs to initialize DDR again after reboot.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 13/26 imx: imx8ulp: Load the lposc fuse for dual boot
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Found the lposc fuse loading having impact to cpu idle in kernel. Without the loading in dual boot mode, kernel will hang after idle for a while.
--- board/freescale/imx8ulp_evk/spl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
board/freescale/imx8ulp_evk/spl.c +2 -4
@@ -76,10 +76,8 @@ 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 the lposc fuse to work around ROM issue. The fuse depends on S400 to read. */ +if (is_soc_rev (CHIP_REV_1_0 ))load_lposc_fuse ();upower_init ();
Signature · 1 line
2.35.1
PATCH v2 13/26 imx: imx8ulp: Load the lposc fuse for dual boot
Quoted 7 lines
From: Ye Li <[email protected]>
Found the lposc fuse loading having impact to cpu idle in kernel. Without the loading in dual boot mode, kernel will hang after idle for a while.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 14/26 misc: S400_API: add ahab_release_caam
In reply to Peng Fan (OSS)From: Clement Faure <[email protected]>
Add ahab_release_caam() function to the S400 API.
--- arch/arm/include/asm/arch-imx8ulp/s400_api.h | 2 ++ drivers/misc/imx8ulp/s400_api.c | 29 ++++++++++++++++++++ 2 files changed, 31 insertions(+)
arch/arm/include/asm/arch-imx8ulp/s400_api.h +2 -0
@@ -19,6 +19,7 @@#define AHAB_READ_FUSE_REQ_CID 0x97#define AHAB_RELEASE_RDC_REQ_CID 0xC4#define AHAB_WRITE_FUSE_REQ_CID 0xD6 +#define AHAB_CAAM_RELEASE_CID 0xD7#define S400_MAX_MSG 8U
@@ -37,5 +38,6 @@ int ahab_verify_image(u32 img_id, u32 *response);int ahab_forward_lifecycle (u16 life_cycle,u32 *response);int ahab_write_fuse (u16 fuse_id,u32 fuse_val,bool lock,u32 *response);int ahab_read_common_fuse (u16 fuse_id,u32 *fuse_words,u32 fuse_num,u32 *response); +int ahab_release_caam (u32 core_did,u32 *response);#endif
drivers/misc/imx8ulp/s400_api.c +29 -0
@@ -242,3 +242,32 @@ int ahab_write_fuse(u16 fuse_id, u32 fuse_val, bool lock, u32 *response)return ret; } + +int ahab_release_caam (u32 core_did,u32 *response) +{ +struct udevice *dev = gd->arch.s400_dev; +int size =sizeof (struct imx8ulp_s400_msg ); +struct imx8ulp_s400_msg msg; +int ret; + +if (!dev) { +printf ("s400 dev is not initialized\n" ); +return -ENODEV ; + } + + msg.version =AHAB_VERSION ; + msg.tag =AHAB_CMD_TAG ; + msg.size =2 ; + msg.command =AHAB_CAAM_RELEASE_CID ; + msg.data[0 ] = core_did; + + ret =misc_call (dev, false, &msg, size, &msg, size); +if (ret) +printf ("Error: %s: ret %d, response 0x%x\n" , + __func__, ret, msg.data[0 ]); + +if (response) + *response = msg.data[0 ]; + +return ret; +}
Signature · 1 line
2.35.1
PATCH v2 14/26 misc: S400_API: add ahab_release_caam
Quoted 4 lines
From: Clement Faure <[email protected]> Add
ahab_release_caam()function to the S400 API.Signed-off-by Clement Faure <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 15/26 misc: S400_API: Update S400 API for buffer dump
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Add ahab_dump_buffer API to dump AHAB buffer for debug purpose
--- arch/arm/include/asm/arch-imx8ulp/s400_api.h | 3 +- drivers/misc/imx8ulp/s400_api.c | 34 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-imx8ulp/s400_api.h +2 -1
@@ -21,7 +21,7 @@#define AHAB_WRITE_FUSE_REQ_CID 0xD6#define AHAB_CAAM_RELEASE_CID 0xD7 -#define S400_MAX_MSG 8U +#define S400_MAX_MSG 255Ustruct imx8ulp_s400_msg {u8 version;
@@ -39,5 +39,6 @@ int ahab_forward_lifecycle(u16 life_cycle, u32 *response);int ahab_write_fuse (u16 fuse_id,u32 fuse_val,bool lock,u32 *response);int ahab_read_common_fuse (u16 fuse_id,u32 *fuse_words,u32 fuse_num,u32 *response);int ahab_release_caam (u32 core_did,u32 *response); +int ahab_dump_buffer (u32 *buffer,u32 buffer_length);#endif
drivers/misc/imx8ulp/s400_api.c +34 -0
@@ -271,3 +271,37 @@ int ahab_release_caam(u32 core_did, u32 *response)return ret; } + +int ahab_dump_buffer (u32 *buffer,u32 buffer_length) +{ +struct udevice *dev = gd->arch.s400_dev; +int size =sizeof (struct imx8ulp_s400_msg ); +struct imx8ulp_s400_msg msg; +int ret, i =0 ; + +if (!dev) { +printf ("s400 dev is not initialized\n" ); +return -ENODEV ; + } + + msg.version =AHAB_VERSION ; + msg.tag =AHAB_CMD_TAG ; + msg.size =1 ; + msg.command =AHAB_LOG_CID ; + + ret =misc_call (dev, false, &msg, size, &msg, size); +if (ret) { +printf ("Error: %s: ret %d, response 0x%x\n" , + __func__, ret, msg.data[0 ]); + +return ret; + } + +if (buffer) { + buffer[i++] = *(u32 *)&msg;/* Need dump the response header */ +for (; i < buffer_length && i < msg.size; i++) + buffer[i] = msg.data[i -1 ]; + } + +return i; +}
Signature · 1 line
2.35.1
PATCH v2 15/26 misc: S400_API: Update S400 API for buffer dump
Quoted 4 lines
From: Ye Li <[email protected]>
Addahab_dump_bufferAPI to dump AHAB buffer for debug purposeSigned-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 16/26 imx: imx8ulp: release CAAM for the Cortex-A35
In reply to Peng Fan (OSS)From: Clement Faure <[email protected]>
Release the CAAM for the A35 from the SPL.
--- board/freescale/imx8ulp_evk/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
board/freescale/imx8ulp_evk/spl.c +8 -0
@@ -19,6 +19,7 @@#include <asm/arch/ddr.h> #include <asm/arch/rdc.h> #include <asm/arch/upower.h> +#include <asm/arch/s400_api.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -60,6 +61,8 @@ int power_init_board(void)void spl_board_init (void ) {struct udevice *dev; +u32 res; +int ret;uclass_find_first_device (UCLASS_MISC , &dev);
@@ -98,6 +101,11 @@ void spl_board_init(void)/* Call it after PS16 power up */ set_lpav_qos (); + +/* Enable A35 access to the CAAM */ + ret =ahab_release_caam (0x7 , &res); +if (ret) +printf ("ahab release caam failed %d, 0x%x\n" , ret, res); }void board_init_f (ulong dummy)
Signature · 1 line
2.35.1
PATCH v2 16/26 imx: imx8ulp: release CAAM for the Cortex-A35
Quoted 4 lines
From: Clement Faure <[email protected]> Release the CAAM for the A35 from the SPL.
Signed-off-by Clement Faure <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 17/26 imx: imx8ulp_evk: Update LPDDR4 PHY settings
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Update DDR PHY settings to support LPDDR4 mode only by adjusting DQ VREF ctrl, ODT and pads drive strength.
--- board/freescale/imx8ulp_evk/lpddr4_timing.c | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-)
board/freescale/imx8ulp_evk/lpddr4_timing.c +16 -16
@@ -701,7 +701,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e064154, 0x2000000 }, /* 85 */ { 0x2e064158, 0x51515042 }, /* 86 */ { 0x2e06415c, 0x31c06000 }, /* 87 */ - { 0x2e064160, 0x9bf000a }, /* 88 */ + { 0x2e064160, 0x6bf000a }, /* 88 */ { 0x2e064164, 0xc0c000 }, /* 89 */ { 0x2e064168, 0x1000000 }, /* 90 */ { 0x2e06416c, 0x10001000 }, /* 91 */
@@ -777,7 +777,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e064554, 0x2000000 }, /* 341 */ { 0x2e064558, 0x51515042 }, /* 342 */ { 0x2e06455c, 0x31c06000 }, /* 343 */ - { 0x2e064560, 0x9bf000a }, /* 344 */ + { 0x2e064560, 0x6bf000a }, /* 344 */ { 0x2e064564, 0xc0c000 }, /* 345 */ { 0x2e064568, 0x1000000 }, /* 346 */ { 0x2e06456c, 0x10001000 }, /* 347 */
@@ -854,7 +854,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e064954, 0x2000000 }, /* 597 */ { 0x2e064958, 0x51515042 }, /* 598 */ { 0x2e06495c, 0x31c06000 }, /* 599 */ - { 0x2e064960, 0x9bf000a }, /* 600 */ + { 0x2e064960, 0x6bf000a }, /* 600 */ { 0x2e064964, 0xc0c000 }, /* 601 */ { 0x2e064968, 0x1000000 }, /* 602 */ { 0x2e06496c, 0x10001000 }, /* 603 */
@@ -930,7 +930,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e064d54, 0x2000000 }, /* 853 */ { 0x2e064d58, 0x51515042 }, /* 854 */ { 0x2e064d5c, 0x31c06000 }, /* 855 */ - { 0x2e064d60, 0x9bf000a }, /* 856 */ + { 0x2e064d60, 0x6bf000a }, /* 856 */ { 0x2e064d64, 0xc0c000 }, /* 857 */ { 0x2e064d68, 0x1000000 }, /* 858 */ { 0x2e064d6c, 0x10001000 }, /* 859 */
@@ -1032,7 +1032,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e065860, 0x8040201 }, /* 1560 */ { 0x2e065864, 0x2010201 }, /* 1561 */ { 0x2e065868, 0xf0f0f }, /* 1562 */ - { 0x2e06586c, 0x241b42 }, /* 1563 */ + { 0x2e06586c, 0x241342 }, /* 1563 */ { 0x2e065874, 0x1020000 }, /* 1565 */ { 0x2e065878, 0x701 }, /* 1566 */ { 0x2e06587c, 0x54 }, /* 1567 */
@@ -1047,7 +1047,7 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e0658a0, 0x4410 }, /* 1576 */ { 0x2e0658a4, 0x4410 }, /* 1577 */ { 0x2e0658b0, 0x60000 }, /* 1580 */ - { 0x2e0658b8, 0x96 }, /* 1582 */ + { 0x2e0658b8, 0x66 }, /* 1582 */ { 0x2e0658bc, 0x10000 }, /* 1583 */ { 0x2e0658c0, 0x8 }, /* 1584 */ { 0x2e0658d8, 0x3000000 }, /* 1590 */
@@ -1074,20 +1074,20 @@ struct dram_cfg_param ddr_phy_f1_cfg[] = { { 0x2e065980, 0x300 }, /* 1632 */ { 0x2e065984, 0x300 }, /* 1633 */ { 0x2e065988, 0x300 }, /* 1634 */ - { 0x2e06598c, 0x4bf77 }, /* 1635 */ - { 0x2e065990, 0x77 }, /* 1636 */ - { 0x2e065994, 0x27f }, /* 1637 */ - { 0x2e06599c, 0x27f }, /* 1639 */ - { 0x2e0659a4, 0x27f00 }, /* 1641 */ + { 0x2e06598c, 0x337cc }, /* 1635 */ + { 0x2e065990, 0x8 }, /* 1636 */ + { 0x2e065994, 0x1b7 }, /* 1637 */ + { 0x2e06599c, 0x1b7 }, /* 1639 */ + { 0x2e0659a4, 0x1b700 }, /* 1641 */ { 0x2e0659a8, 0x1980000 }, /* 1642 */ - { 0x2e0659ac, 0x27fcc }, /* 1643 */ - { 0x2e0659b4, 0x27f00 }, /* 1645 */ + { 0x2e0659ac, 0x1b7cc }, /* 1643 */ + { 0x2e0659b4, 0x1b700 }, /* 1645 */ { 0x2e0659b8, 0x1980000 }, /* 1646 */ - { 0x2e0659bc, 0x27f00 }, /* 1647 */ + { 0x2e0659bc, 0x1b700 }, /* 1647 */ { 0x2e0659c0, 0x1980000 }, /* 1648 */ - { 0x2e0659c4, 0x27f00 }, /* 1649 */ + { 0x2e0659c4, 0x1b700 }, /* 1649 */ { 0x2e0659c8, 0x1980000 }, /* 1650 */ - { 0x2e0659cc, 0x27f00 }, /* 1651 */ + { 0x2e0659cc, 0x1b700 }, /* 1651 */ { 0x2e0659d0, 0x1980000 }, /* 1652 */ { 0x2e0659d4, 0x20040003 }, /* 1653 */ };
Signature · 1 line
2.35.1
PATCH v2 17/26 imx: imx8ulp_evk: Update LPDDR4 PHY settings
Quoted 6 lines
From: Ye Li <[email protected]>
Update DDR PHY settings to support LPDDR4 mode only by adjusting DQ VREF ctrl, ODT and pads drive strength.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 18/26 imx: imx8ulp_evk: call the handshake with M33
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
If M33 handshake is successful, TPM and DSI panel MUX setting is done by M33, no need to set them.
If handshake is failed or M33 is not booted, continue the TPM and DSI panel MUX setting
--- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
board/freescale/imx8ulp_evk/imx8ulp_evk.c +9 -1
@@ -101,10 +101,18 @@ void mipi_dsi_panel_backlight(void)int board_init (void ) { +int sync = -ENODEV ; +if (IS_ENABLED (CONFIG_FEC_MXC ))setup_fec (); -if (IS_ENABLED (CONFIG_DM_VIDEO )) { +if (m33_image_booted ()) { + sync =m33_image_handshake (1000 ); +printf ("M33 Sync: %s\n" , sync ?"Timeout" :"OK" ); + } + +/* When sync with M33 is failed, use local driver to set for video */ +if (sync !=0 &&IS_ENABLED (CONFIG_DM_VIDEO )) {mipi_dsi_mux_panel ();mipi_dsi_panel_backlight (); }
Signature · 1 line
2.35.1
PATCH v2 18/26 imx: imx8ulp_evk: call the handshake with M33
Quoted 9 lines
From: Ye Li <[email protected]>
If M33 handshake is successful, TPM and DSI panel MUX setting is done by M33, no need to set them.
If handshake is failed or M33 is not booted, continue the TPM and DSI panel MUX settingReviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Biwen Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 19/26 imx: imx8ulp_evk: Power down the domains may used in u-boot
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Since ATF power domain will hold the enable counter for each power domain, We need to power off them before entering kernel to avoid this power domain can't be really powered off.
--- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+)
board/freescale/imx8ulp_evk/imx8ulp_evk.c +30 -0
@@ -13,6 +13,8 @@#include <miiphy.h> #include <netdev.h> #include <asm/gpio.h> +#include <power-domain.h> +#include <dt-bindings/power/imx8ulp-power.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -129,3 +131,31 @@ int board_late_init(void) {return 0 ; } + +void board_quiesce_devices (void ) +{ +/* Disable the power domains may used in u-boot before entering kernel */ +#if CONFIG_IS_ENABLED (POWER_DOMAIN ) +struct udevice *scmi_devpd; +int ret, i; +struct power_domain pd; +ulong ids[] = {IMX8ULP_PD_FLEXSPI2 ,IMX8ULP_PD_USB0 ,IMX8ULP_PD_USDHC0 , +IMX8ULP_PD_USDHC1 ,IMX8ULP_PD_USDHC2_USB1 ,IMX8ULP_PD_DCNANO , +IMX8ULP_PD_MIPI_DSI }; + + ret =uclass_get_device (UCLASS_POWER_DOMAIN ,0 , &scmi_devpd); +if (ret) { +printf ("Cannot get scmi devpd: err=%d\n" , ret); +return ; + } + + pd.dev = scmi_devpd; + +for (i =0 ; i <ARRAY_SIZE (ids); i++) { + pd.id = ids[i]; + ret =power_domain_off (&pd); +if (ret) +printf ("power_domain_off %lu failed: err=%d\n" , ids[i], ret); + } +#endif +}
Signature · 1 line
2.35.1
Re: [PATCH V2 19/26] imx: imx8ulp_evk: Power down the domains may used in u-boot
Hi Peng,Ye,
Quoted 17 lines · Peng Fan (OSS)
From: Ye Li <[email protected]>
Since ATF power domain will hold the enable counter for each power domain, We need to power off them before entering kernel to avoid this power domain can't be really powered off.
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>--- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+)board/freescale/imx8ulp_evk/imx8ulp_evk.c +0
-0
board/freescale/imx8ulp_evk/imx8ulp_evk.c line 17
Quoted 5 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +2
-0@@ -13,6 +13,8 @@#include <miiphy.h> #include <netdev.h> #include <asm/gpio.h> +#include <power-domain.h> +#include <dt-bindings/power/imx8ulp-power.h>
But which patch is adding the file above ? I cannot find it, it is not part of this series and of course build is broken without it.
Best regards,
Stefano
Quoted 34 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +28
-0DECLARE_GLOBAL_DATA_PTR ;@@ -129,3 +131,31 @@ int board_late_init(void) {return 0 ; } + +void board_quiesce_devices (void ) +{ +/* Disable the power domains may used in u-boot before entering kernel */ +#if CONFIG_IS_ENABLED (POWER_DOMAIN ) +struct udevice *scmi_devpd; +int ret, i; +struct power_domain pd; +ulong ids[] = {IMX8ULP_PD_FLEXSPI2 ,IMX8ULP_PD_USB0 ,IMX8ULP_PD_USDHC0 , +IMX8ULP_PD_USDHC1 ,IMX8ULP_PD_USDHC2_USB1 ,IMX8ULP_PD_DCNANO , +IMX8ULP_PD_MIPI_DSI }; + + ret =uclass_get_device (UCLASS_POWER_DOMAIN ,0 , &scmi_devpd); +if (ret) { +printf ("Cannot get scmi devpd: err=%d\n" , ret); +return ; + } + + pd.dev = scmi_devpd; + +for (i =0 ; i <ARRAY_SIZE (ids); i++) { + pd.id = ids[i]; + ret =power_domain_off (&pd); +if (ret) +printf ("power_domain_off %lu failed: err=%d\n" , ids[i], ret); + } +#endif +}
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] =====================================================================
Re: [PATCH V2 19/26] imx: imx8ulp_evk: Power down the domains may used in u-boot
Hi Stefano,
Quoted 15 lines · Stefano Babic
Hi Peng,Ye,
Quoted 12 lines · Peng Fan (OSS)
From: Ye Li <[email protected]>
Since ATF power domain will hold the enable counter for each power domain, We need to power off them before entering kernel to avoid this power domain can't be really powered off.
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>--- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+)
Quoted 13 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c line 17
Quoted 10 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +2
-0@@ -13,6 +13,8 @@#include <miiphy.h> #include <netdev.h> #include <asm/gpio.h> +#include <power-domain.h> +#include <dt-bindings/power/imx8ulp-power.h> But which patch is adding the file above ? I cannot find it, it is not part of this series and of course build is broken without it.
V5 patchset should not have such issue. I just see you already picked up V5 in your repo.
Thanks,
Peng.
Quoted 39 lines
Best regards,
StefanoQuoted 34 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +28
-0DECLARE_GLOBAL_DATA_PTR ;@@ -129,3 +131,31 @@ int board_late_init(void) {return 0 ; } + +void board_quiesce_devices (void ) +{ +/* Disable the power domains may used in u-boot before entering kernel */ +#if CONFIG_IS_ENABLED (POWER_DOMAIN ) +struct udevice *scmi_devpd; +int ret, i; +struct power_domain pd; +ulong ids[] = {IMX8ULP_PD_FLEXSPI2 ,IMX8ULP_PD_USB0 ,IMX8ULP_PD_USDHC0 , +IMX8ULP_PD_USDHC1 ,IMX8ULP_PD_USDHC2_USB1 ,IMX8ULP_PD_DCNANO , +IMX8ULP_PD_MIPI_DSI }; + + ret =uclass_get_device (UCLASS_POWER_DOMAIN ,0 , &scmi_devpd); +if (ret) { +printf ("Cannot get scmi devpd: err=%d\n" , ret); +return ; + } + + pd.dev = scmi_devpd; + +for (i =0 ; i <ARRAY_SIZE (ids); i++) { + pd.id = ids[i]; + ret =power_domain_off (&pd); +if (ret) +printf ("power_domain_off %lu failed: err=%d\n" , ids[i], ret); + } +#endif +}
Re: [PATCH V2 19/26] imx: imx8ulp_evk: Power down the domains may used in u-boot
Hi Peng,
Quoted 33 lines · Peng Fan (OSS)
Hi Stefano,
Quoted 16 lines · Stefano Babic
Hi Peng,Ye,
Quoted 13 lines · Peng Fan (OSS)
From: Ye Li <[email protected]>
Since ATF power domain will hold the enable counter for each power domain, We need to power off them before entering kernel to avoid this power domain can't be really powered off.
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>---
board/freescale/imx8ulp_evk/imx8ulp_evk.c| 30
+++++++++++++++++++++++1 file changed, 30 insertions(+)Quoted 13 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c line 17
Quoted 10 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +2
-0@@ -13,6 +13,8 @@ #include <miiphy.h> #include <netdev.h> #include <asm/gpio.h> +#include <power-domain.h> +#include <dt-bindings/power/imx8ulp-power.h> But which patch is adding the file above ? I cannot find it, it is not part of this series and of course build is broken without it.
Quoted 2 lines
V5 patchset should not have such issue. I just see you already picked up V5 in your repo.
Which series are you talking about ? This series is in V2, and yes, I merged the whole series with the exception of this patch, but none of the applied patches added imx8ulp-power.h.
Regards,
Stefano
Quoted 45 lines
Thanks,
Peng.Quoted 42 lines
Best regards,
StefanoQuoted 37 lines
board/freescale/imx8ulp_evk/imx8ulp_evk.c +4
-0DECLARE_GLOBAL_DATA_PTR;@@ -129,3 +131,31 @@ int board_late_init(void) { return 0; } + +void board_quiesce_devices (void ) +{ + /* Disable the power domains may used in u-boot before enteringkernel */
+#ifCONFIG_IS_ENABLED(POWER_DOMAIN)
+ struct udevice*scmi_devpd;
+ int ret, i;
+ structpower_domainpd;
+ ulong ids[] = {IMX8ULP_PD_FLEXSPI2,IMX8ULP_PD_USB0,IMX8ULP_PD_USDHC0,
+IMX8ULP_PD_USDHC1,IMX8ULP_PD_USDHC2_USB1,IMX8ULP_PD_DCNANO,
+IMX8ULP_PD_MIPI_DSI};board/freescale/imx8ulp_evk/imx8ulp_evk.c +14
-0+ + ret = uclass_get_device(UCLASS_POWER_DOMAIN, 0, &scmi_devpd); + if (ret) { + printf("Cannot get scmi devpd: err=%d\n", ret); + return; + } + + pd.dev = scmi_devpd; + + for (i = 0; i < ARRAY_SIZE(ids); i++) { + pd.id = ids[i]; + ret = power_domain_off(&pd); + if (ret) + printf("power_domain_off %lu failed: err=%d\n", ids[i],ret);
+ }board/freescale/imx8ulp_evk/imx8ulp_evk.c +2
-0+#endif +}
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] =====================================================================
PATCH v2 20/26 imx: dynamic setting mmcdev and mmcroot
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Dynamic setting mmcdev and mmcroot.
Then when boot linux, we can have correct "root=/dev/mmcblk[x]p2"
--- arch/arm/include/asm/mach-imx/sys_proto.h | 2 + board/freescale/common/Makefile | 3 ++ board/freescale/common/mmc.c | 49 +++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 board/freescale/common/mmc.c
arch/arm/include/asm/mach-imx/sys_proto.h +2 -0
@@ -228,6 +228,8 @@ int mxs_reset_block(struct mxs_register_32 *reg);int mxs_wait_mask_set (struct mxs_register_32 *reg,u32 mask,u32 timeout);int mxs_wait_mask_clr (struct mxs_register_32 *reg,u32 mask,u32 timeout); +void board_late_mmc_env_init (void ); +unsigned long call_imx_sip (unsigned long id,unsigned long reg0,unsigned long reg1,unsigned long reg2,unsigned long reg3);
board/freescale/common/Makefile +3 -0
@@ -63,6 +63,9 @@ obj-$(CONFIG_ZM7300) += zm7300.o obj-$(CONFIG_POWER_PFUZE100) += pfuze.o obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze.o obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.o +ifneq (,$(filter $(SOC), imx8ulp)) +obj-y += mmc.o +endif obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o
board/freescale/common/mmc.c new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v2 20/26 imx: dynamic setting mmcdev and mmcroot
Quoted 4 lines
From: Peng Fan <[email protected]>
Dynamic setting mmcdev and mmcroot.
Then when boot linux, we can have correct "root=/dev/mmcblk[x]p2"Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
Re: [PATCH V2 20/26] imx: dynamic setting mmcdev and mmcroot
In reply to Peng Fan (OSS)Quoted 97 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Dynamic setting mmcdev and mmcroot.
Then when boot linux, we can have correct "root=/dev/mmcblk[x]p2"Signed-off-by Peng Fan <[email protected]>--- arch/arm/include/asm/mach-imx/sys_proto.h | 2 + board/freescale/common/Makefile | 3 ++ board/freescale/common/mmc.c | 49 +++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 board/freescale/common/mmc.carch/arm/include/asm/mach-imx/sys_proto.h +2
-0@@ -228,6 +228,8 @@ int mxs_reset_block(struct mxs_register_32 *reg);int mxs_wait_mask_set (struct mxs_register_32 *reg,u32 mask,u32 timeout);int mxs_wait_mask_clr (struct mxs_register_32 *reg,u32 mask,u32 timeout); +void board_late_mmc_env_init (void ); +unsigned long call_imx_sip (unsigned long id,unsigned long reg0,unsigned long reg1,unsigned long reg2,unsigned long reg3);board/freescale/common/Makefile +3
-0@@ -63,6 +63,9 @@ obj-$(CONFIG_ZM7300) += zm7300.o obj-$(CONFIG_POWER_PFUZE100) += pfuze.o obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze.o obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.o +ifneq (,$(filter $(SOC), imx8ulp)) +obj-y += mmc.o +endif obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.oboard/freescale/common/mmc.c new file +49
-1@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2016 Freescale Semiconductor, Inc. +* Copyright 2018-2022 NXP +*/ + +#include <common.h> +#include <command.h> +#include <asm/arch/sys_proto.h> +#include <linux/errno.h> +#include <asm/io.h> +#include <stdbool.h> +#include <mmc.h> +#include <env.h> + +static int check_mmc_autodetect (void ) +{ +char *autodetect_str =env_get ("mmcautodetect" ); + +if (autodetect_str && !strcmp (autodetect_str,"yes" )) +return 1 ; + +return 0 ; +} + +/* This should be defined for each board */ +__weak int mmc_map_to_kernel_blk (int dev_no) +{ +return dev_no; +} + +void board_late_mmc_env_init (void ) +{ +char cmd[32 ]; +char mmcblk[32 ]; +u32 dev_no =mmc_get_env_dev (); + +if (!check_mmc_autodetect ()) +return ; + +env_set_ulong ("mmcdev" , dev_no); + +/* Set mmcblk env */ +sprintf (mmcblk,"/dev/mmcblk%dp2 rootwait rw" ,mmc_map_to_kernel_blk (dev_no)); +env_set ("mmcroot" , mmcblk); + +sprintf (cmd,"mmc dev %d" , dev_no); +run_command (cmd,0 ); +} --
Quoted 2 lines
2.35.1
Peng,
I see Stefano already applied this but I'm not sure I agree with it. Why should you assume that U-Boot and Linux have the same device mapping? The kernel device mapping is not guaranteed to be consistent. Every time I have asked about this I've been told the standard was to use a boot script that used 'part' to determine the UUID of the boot device from U-Boot's perspective then use root=PARTUUID= to match that from the kernel's perspective.
For example if using CONFIG_DISTRO_DEFAULTS=y (which I think everyone should be using) your bootscript would look like this:
part uuid ${devtype} ${devnum}:${distro_bootpart} uuid setenv bootargs "root=PARTUUID=${uuid} rootwait $bootargs"
Best Regards,
Tim
RE: [PATCH V2 20/26] imx: dynamic setting mmcdev and mmcroot
Quoted 115 lines
Subject: Re: [PATCH V2 20/26] imx: dynamic setting mmcdev and mmcroot
Quoted 81 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Dynamic setting mmcdev and mmcroot.
Then when boot linux, we can have correct "root=/dev/mmcblk[x]p2"Signed-off-by Peng Fan <[email protected]>--- arch/arm/include/asm/mach-imx/sys_proto.h | 2 + board/freescale/common/Makefile | 3 ++ board/freescale/common/mmc.c | 49 +++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 board/freescale/common/mmc.carch/arm/include/asm/mach-imx/sys_proto.h +0
-0@@ -228,6 +228,8 @@ int mxs_reset_block(struct mxs_register_32 *reg);int
mxs_wait_mask_set(struct mxs_register_32 *reg, u32 mask, u32 timeout); intmxs_wait_mask_clr(struct mxs_register_32 *reg, u32 mask, u32 timeout);arch/arm/include/asm/mach-imx/sys_proto.h +2
-0+void board_late_mmc_env_init (void ); +unsigned long call_imx_sip (unsigned long id,unsigned long reg0,unsigned long reg1,unsigned long reg2, unsigned long reg3); diff --gita/board/freescale/common/Makefile b/board/freescale/common/Makefile index
f13965daf2e..4df484935f4100644board/freescale/common/Makefile +3
-0@@ -63,6 +63,9 @@ obj-$(CONFIG_ZM7300) += zm7300.o obj-$(CONFIG_POWER_PFUZE100) += pfuze.o obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze.o obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.o +ifneq (,$(filter $(SOC), imx8ulp)) +obj-y += mmc.o +endif obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o(quoted diff) +0
-0
b/board/freescale/common/mmc.cnew file mode 100644 index 00000000000..8cd5079f962board/freescale/common/mmc.c new file +32
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright 2016 Freescale Semiconductor, Inc. +* Copyright 2018-2022 NXP +*/ + +#include <common.h> +#include <command.h> +#include <asm/arch/sys_proto.h> +#include <linux/errno.h> +#include <asm/io.h> +#include <stdbool.h> +#include <mmc.h> +#include <env.h> + +static int check_mmc_autodetect (void ) { +char *autodetect_str =env_get ("mmcautodetect" ); + +if (autodetect_str && !strcmp (autodetect_str,"yes" )) +return 1 ; + +return 0 ; +} + +/* This should be defined for each board */ __weak int +mmc_map_to_kernel_blk (int dev_no) { +return dev_no; +} + +void board_late_mmc_env_init (void ) +{ +char cmd[32 ];board/freescale/common/mmc.c line 42
Quoted 10 lines
board/freescale/common/mmc.c new file +10
-0+char mmcblk[32 ]; +u32 dev_no =mmc_get_env_dev (); + +if (!check_mmc_autodetect ()) +return ; + +env_set_ulong ("mmcdev" , dev_no); + +/* Set mmcblk env */ + sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
mmc_map_to_kernel_blk(dev_no));Quoted 8 lines
board/freescale/common/mmc.c new file +5
-1+env_set ("mmcroot" , mmcblk); + +sprintf (cmd,"mmc dev %d" , dev_no); +run_command (cmd,0 ); +} --2.35.1
Peng,
I see Stefano already applied this but I'm not sure I agree with it. Why should you assume that U-Boot and Linux have the same device mapping? The kernel device mapping is not guaranteed to be consistent.
Every time I have asked about this I've been told the standard was to use a boot script that used 'part' to determine the UUID of the boot device from U-Boot's perspective then use root=PARTUUID= to match that from the kernel's perspective.
Quoted 4 lines
For example if using
CONFIG_DISTRO_DEFAULTS=y(which I think everyone should be using) your bootscript would look like this:
part uuid ${devtype} ${devnum}:${distro_bootpart} uuid setenv bootargs "root=PARTUUID=${uuid} rootwait $bootargs"
For NXP internal release, we still use legacy way, with cmd in config header file, let me check and update to fix this. Thanks for pointing out.
Thanks,
Peng.
Quoted 4 lines
Best Regards,
Tim
PATCH v2 21/26 imx: imx8ulp_evk: Enable SD/MMC port auto detect
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Enable the SD/MMC port auto detect.
The mmc relevant env can be reset when auto detect is enabled.
--- board/freescale/imx8ulp_evk/imx8ulp_evk.c | 3 +++ 1 file changed, 3 insertions(+)
board/freescale/imx8ulp_evk/imx8ulp_evk.c +3 -0
@@ -129,6 +129,9 @@ int board_early_init_f(void)int board_late_init (void ) { +#if CONFIG_IS_ENABLED (ENV_IS_IN_MMC ) +board_late_mmc_env_init (); +#endif return 0 ; }
Signature · 1 line
2.35.1
PATCH v2 21/26 imx: imx8ulp_evk: Enable SD/MMC port auto detect
Quoted 4 lines
From: Peng Fan <[email protected]>
Enable the SD/MMC port auto detect.
The mmc relevant env can be reset when auto detect is enabled.Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 22/26 imx: imx8ulp: enable wdog_ad interrupt in CMC1
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Enable wdog_ad interrupt being triggered by CMC1 to CM33 to let CM33 know A35 reset and reinitialize rpmsg.
Clear wdog_ad and AD_PERIPH reset interrupt after A35 up, otherwise M33 will always receive interrupt.
--- arch/arm/mach-imx/imx8ulp/soc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +13 -0
@@ -571,6 +571,19 @@ int arch_cpu_init(void)int ret;bool rdc_en = true;/* Default assume DBD_EN is set */ +/* Enable System Reset Interrupt using WDOG_AD */ +setbits_le32 (CMC1_BASE_ADDR +0x8C ,BIT (13 )); +/* Clear AD_PERIPH Power switch domain out of reset interrupt flag */ +setbits_le32 (CMC1_BASE_ADDR +0x70 ,BIT (4 )); + +if (readl (CMC1_BASE_ADDR +0x90 ) &BIT (13 )) { +/* Clear System Reset Interrupt Flag Register of WDOG_AD */ +setbits_le32 (CMC1_BASE_ADDR +0x90 ,BIT (13 )); +/* Reset WDOG to clear reset request */ +pcc_reset_peripheral (3 ,WDOG3_PCC3_SLOT , true); +pcc_reset_peripheral (3 ,WDOG3_PCC3_SLOT , false); + } +/* Disable wdog */ init_wdog ();
Signature · 1 line
2.35.1
PATCH v2 22/26 imx: imx8ulp: enable wdog_ad interrupt in CMC1
Quoted 7 lines
From: Peng Fan <[email protected]>
Enablewdog_adinterrupt being triggered by CMC1 to CM33 to let CM33 know A35 reset and reinitialize rpmsg.
Clearwdog_adandAD_PERIPHreset interrupt after A35 up, otherwise M33 will always receive interrupt.Reviewed-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 23/26 imx: imx8ulp: reserve tee memory
In reply to Peng Fan (OSS)From: Ji Luo <[email protected]>
The TEE memory should be reserved when TEE is present, so need to runtime update dram bank and memory information according to tee present or not.
--- arch/arm/mach-imx/imx8ulp/soc.c | 102 +++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +100 -2
@@ -413,6 +413,17 @@ static struct mm_region imx8ulp_arm64_mem_map[] = {struct mm_region *mem_map = imx8ulp_arm64_mem_map; +static unsigned int imx8ulp_find_dram_entry_in_mem_map (void ) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (imx8ulp_arm64_mem_map); i++) +if (imx8ulp_arm64_mem_map[i].phys ==CONFIG_SYS_SDRAM_BASE ) +return i; + +hang ();/* Entry not found, this must never happen. */ +} +/* simplify the page table size to enhance boot speed */ #define MAX_PTE_ENTRIES 512#define MAX_MEM_MAP_REGIONS 16
@@ -444,19 +455,106 @@ u64 get_page_table_size(void)void enable_caches (void ) { -/* TODO: add TEE memmap region */ +/* If OPTEE runs, remove OPTEE memory from MMU table to avoid speculative prefetch */ +if (rom_pointer[1 ]) { +/* +* TEE are loaded, So the ddr bank structures +* have been modified update mmu table accordingly +*/ +int i =0 ; +int entry =imx8ulp_find_dram_entry_in_mem_map (); +u64 attrs = imx8ulp_arm64_mem_map[entry].attrs; + +while (i <CONFIG_NR_DRAM_BANKS && + entry <ARRAY_SIZE (imx8ulp_arm64_mem_map)) { +if (gd->bd->bi_dram[i].start ==0 ) +break ; + imx8ulp_arm64_mem_map[entry].phys = gd->bd->bi_dram[i].start; + imx8ulp_arm64_mem_map[entry].virt = gd->bd->bi_dram[i].start; + imx8ulp_arm64_mem_map[entry].size = gd->bd->bi_dram[i].size; + imx8ulp_arm64_mem_map[entry].attrs = attrs; +debug ("Added memory mapping (%d): %llx %llx\n" , entry, + imx8ulp_arm64_mem_map[entry].phys, imx8ulp_arm64_mem_map[entry].size); + i++; entry++; + } + }icache_enable ();dcache_enable (); } +__weak int board_phys_sdram_size (phys_size_t *size) +{ +if (!size) +return -EINVAL ; + + *size =PHYS_SDRAM_SIZE ; +return 0 ; +} +int dram_init (void ) { - gd->ram_size =PHYS_SDRAM_SIZE ; +unsigned int entry =imx8ulp_find_dram_entry_in_mem_map (); +phys_size_t sdram_size; +int ret; + + ret =board_phys_sdram_size (&sdram_size); +if (ret) +return ret; + +/* rom_pointer[1] contains the size of TEE occupies */ +if (rom_pointer[1 ]) + gd->ram_size = sdram_size - rom_pointer[1 ]; +else + gd->ram_size = sdram_size; + +/* also update the SDRAM size in the mem_map used externally */ + imx8ulp_arm64_mem_map[entry].size = sdram_size; +return 0 ; +} + +int dram_init_banksize (void ) +{ +int bank =0 ; +int ret; +phys_size_t sdram_size; + + ret =board_phys_sdram_size (&sdram_size); +if (ret) +return ret; + + gd->bd->bi_dram[bank].start =PHYS_SDRAM ; +if (rom_pointer[1 ]) { +phys_addr_t optee_start = (phys_addr_t )rom_pointer[0 ]; +phys_size_t optee_size = (size_t )rom_pointer[1 ]; + + gd->bd->bi_dram[bank].size = optee_start - gd->bd->bi_dram[bank].start; +if ((optee_start + optee_size) < (PHYS_SDRAM + sdram_size)) { +if (++bank >=CONFIG_NR_DRAM_BANKS ) { +puts ("CONFIG_NR_DRAM_BANKS is not enough\n" ); +return -1 ; + } + + gd->bd->bi_dram[bank].start = optee_start + optee_size; + gd->bd->bi_dram[bank].size =PHYS_SDRAM + + sdram_size - gd->bd->bi_dram[bank].start; + } + }else { + gd->bd->bi_dram[bank].size = sdram_size; + }return 0 ; } +phys_size_t get_effective_memsize (void ) +{ +/* return the first bank as effective memory */ +if (rom_pointer[1 ]) +return ((phys_addr_t )rom_pointer[0 ] -PHYS_SDRAM ); + +return gd->ram_size; +} +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG void get_board_serial (struct tag_serialnr *serialnr) {
Signature · 1 line
2.35.1
PATCH v2 23/26 imx: imx8ulp: reserve tee memory
Quoted 6 lines
From: Ji Luo <[email protected]>
The TEE memory should be reserved when TEE is present, so need to runtime update dram bank and memory information according to tee present or not.Signed-off-by Ji Luo <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 24/26 imx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
When TEE is present, the DRAM maybe split to two parts, so enlarge CONFIG_NR_DRAM_BANKS
--- configs/imx8ulp_evk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx8ulp_evk_defconfig +1 -1
@@ -5,7 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x1002000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 CONFIG_ENV_SIZE=0x2000 CONFIG_ENV_OFFSET=0x400000 CONFIG_IMX_CONFIG=""
Signature · 1 line
2.35.1
PATCH v2 24/26 imx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS
Quoted 4 lines
From: Peng Fan <[email protected]>
When TEE is present, the DRAM maybe split to two parts, so enlargeCONFIG_NR_DRAM_BANKSSigned-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 25/26 imx: imx8ulp_evk: Enable multiple env storage devices
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Enable multiple storages for u-boot env:
MMC or SPI flash or NOWHERE for usb
so u-boot can runtime select the storage flash according to boot device.
--- arch/arm/mach-imx/imx8ulp/soc.c | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm/mach-imx/imx8ulp/soc.c +36 -0
@@ -27,6 +27,8 @@#include <fuse.h> #include <thermal.h> #include <linux/iopoll.h> +#include <env.h> +#include <env_internal.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -787,3 +789,37 @@ u32 spl_arch_boot_image_offset(u32 image_offset, u32 rom_bt_dev)return image_offset; } + +enum env_location env_get_location (enum env_operation op,int prio) +{ +enum boot_device dev =get_boot_device (); +enum env_location env_loc =ENVL_UNKNOWN ; + +if (prio) +return env_loc; + +switch (dev) { +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH +case QSPI_BOOT : + env_loc =ENVL_SPI_FLASH ; +break ; +#endif +#ifdef CONFIG_ENV_IS_IN_MMC +case SD1_BOOT : +case SD2_BOOT : +case SD3_BOOT : +case MMC1_BOOT : +case MMC2_BOOT : +case MMC3_BOOT : + env_loc =ENVL_MMC ; +break ; +#endif +default : +#if defined(CONFIG_ENV_IS_NOWHERE ) + env_loc =ENVL_NOWHERE ; +#endif +break ; + } + +return env_loc; +}
Signature · 1 line
2.35.1
PATCH v2 25/26 imx: imx8ulp_evk: Enable multiple env storage devices
Quoted 6 lines
From: Ye Li <[email protected]>
Enable multiple storages for u-boot env:
MMC or SPI flash or NOWHERE for usb
so u-boot can runtime select the storage flash according to boot device.Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================
PATCH v2 26/26 misc: imx8ulp: Update fuse driver
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
- According to S400 API, the fuse bank 25 (Testconfig2) is able to access. Add it into driver's mapping table.
- According to FSB words list, the reserved 48 words are ahead of the bank 5 and bank 6. Fix the wrong position.
--- drivers/misc/imx8ulp/fuse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/imx8ulp/fuse.c +2 -1
@@ -34,9 +34,9 @@ struct s400_map_entry {struct fsb_map_entry fsb_mapping_table[] = { {3 ,8 }, {4 ,8 }, + {-1 ,48 },/* Reserve 48 words */ {5 ,8 }, {6 ,8 }, - {-1 ,48 },/* Reserve 48 words */ {8 ,4 , true }, {24 ,4 , true }, {26 ,4 , true },
@@ -63,6 +63,7 @@ struct s400_map_entry s400_api_mapping_table[] = { { 7, 4, 0, 1 }, /* OTP_UNIQ_ID */ { 15, 8 }, /* OEM SRK HASH */ { 23, 1, 4, 2 }, /* OTFAD */ + { 25, 8 }, /* Test config2 */ };static s32 map_fsb_fuse_index (u32 bank,u32 word,bool *redundancy)
Signature · 1 line
2.35.1
PATCH v2 26/26 misc: imx8ulp: Update fuse driver
Quoted 7 lines
From: Peng Fan <[email protected]>
- According to S400 API, the fuse bank 25 (Testconfig2) is able to access. Add it into driver's mapping table.
- According to FSB words list, the reserved 48 words are ahead of the bank 5 and bank 6. Fix the wrong position.Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
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] =====================================================================