Skip to contentSkip to conversation

imx9: board cleanup and include ELE voltage API

PATCH Applied Peng Fan (OSS) 4 participants 17 messages Jan 8 – Jan 18

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

cover imx9: board cleanup and include ELE voltage API

This patchset is mainly to cleanup i.MX93-EVK board code and sort the included header files for i.MX93/1/4/5-EVK.

For patches to sort the header, I follow such rules to sort the header:
*.h [generic header]
asm/*.h
asm/arch/*.h
asm/mach-imx/*.h

While at here, the last three patches are including ELE voltage API to avoid create dependency if post in a separate patchset.

CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/28959

---
Peng Fan (12):
imx93_evk: Drop UART pad settings
imx93_evk: Drop setup_fec
imx93_evk: Drop board_phy_config
imx93_evk: Drop DECLARE_GLOBAL_DATA_PTR
imx93_evk: Cleanup headers
imx93_qsb: Cleanup headers
imx91_evk: Cleanup headers
imx94_evk: Sort header files
imx95_evk: Sort header files
imx95/4_evk: Add missing header
imx93_evk: Invoke the ELE voltage APIs when adjust VDD_SOC voltage
imx93_qsb: Invoke the ELE voltage APIs when adjust VDD_SOC voltage

Ye Li (1):
misc: ele_api: Add Voltage change start and finish APIs

 arch/arm/include/asm/mach-imx/ele_api.h |  4 +++
 board/freescale/imx91_evk/imx91_evk.c   |  2 --
 board/freescale/imx91_evk/spl.c         | 28 ++++--------------
 board/freescale/imx93_evk/imx93_evk.c   | 46 ------------------------------
 board/freescale/imx93_evk/spl.c         | 35 +++++++----------------
 board/freescale/imx93_qsb/imx93_qsb.c   |  2 --
 board/freescale/imx93_qsb/spl.c         | 33 +++++++---------------
 board/freescale/imx94_evk/imx94_evk.c   |  6 ++--
 board/freescale/imx94_evk/spl.c         | 11 ++++----
 board/freescale/imx95_evk/imx95_evk.c   |  2 +-
 board/freescale/imx95_evk/spl.c         |  9 +++---
 configs/imx93_11x11_evk_defconfig       |  2 +-
 drivers/misc/imx_ele/ele_api.c          | 50 +++++++++++++++++++++++++++++++++
 13 files changed, 96 insertions(+), 134 deletions(-)

---
base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
change-id: 20260107-imx-update-62e18b9653e5

Best regards,

Signature · 1 line
Peng Fan <[email protected]>
#1 lore raw

PATCH 1/13 imx93_evk: Drop UART pad settings

From: Peng Fan <[email protected]>

With DM_SERIAL and pinctrl driver, the UART pad settings in board code could be dropped. Then drop board_early_init_f(), since it is a dummy function now.

While at here, remove WDOG_PAD_CTRL, since no user.

---
 board/freescale/imx93_evk/imx93_evk.c | 16 ----------------
 board/freescale/imx93_evk/spl.c       |  2 --
 configs/imx93_11x11_evk_defconfig     |  1 -
 3 files changed, 19 deletions(-)
board/freescale/imx93_evk/imx93_evk.c +0 -16
index d62f94dc418..371b35bf1a6 100644
@@ -11,21 +11,12 @@
 #include <asm/global_data.h>
 #include <asm/arch-imx9/ccm_regs.h>
 #include <asm/arch/sys_proto.h>
-#include <asm/arch-imx9/imx93_pins.h>
 #include <asm/arch/clock.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define UART_PAD_CTRL	(PAD_CTL_DSE(6) | PAD_CTL_FSEL2)
-#define WDOG_PAD_CTRL	(PAD_CTL_DSE(6) | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
-
-static iomux_v3_cfg_t const uart_pads[] = {
-	MX93_PAD_UART1_RXD__LPUART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX93_PAD_UART1_TXD__LPUART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
 #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
 #define IMX_BOOT_IMAGE_GUID \
 	EFI_GUID(0xbc550d86, 0xda26, 0x4b70, 0xac, 0x05, \
@@ -46,13 +37,6 @@ struct efi_capsule_update_info update_info = {
 };
 #endif /* EFI_HAVE_CAPSULE_SUPPORT */
 
-int board_early_init_f(void)
-{
-	imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
-
-	return 0;
-}
-
 static int setup_fec(void)
 {
 	return set_clk_enet(ENET_125MHZ);
board/freescale/imx93_evk/spl.c +0 -2
index 67a10bbb05b..cba8ccdc01e 100644
@@ -133,8 +133,6 @@ void board_init_f(ulong dummy)
 
 	arch_cpu_init();
 
-	board_early_init_f();
-
 	spl_early_init();
 
 	preloader_console_init();
configs/imx93_11x11_evk_defconfig +0 -1
index 7d3463a57ea..a53e5fc1de1 100644
@@ -36,7 +36,6 @@ CONFIG_BOOTCOMMAND="bootflow scan -lb; run bsp_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx93-11x11-evk.dtb"
 CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2074
-CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x26000
 CONFIG_SPL_BOARD_INIT=y
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/13 imx93_evk: Drop setup_fec

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

The clock settings could be handled by "assigned-clock-rates" through DM clock driver, so drop setup_fec().

board_init() is a dummy function now, so clean it up.

---
 board/freescale/imx93_evk/imx93_evk.c | 15 ---------------
 configs/imx93_11x11_evk_defconfig     |  1 +
 2 files changed, 1 insertion(+), 15 deletions(-)
board/freescale/imx93_evk/imx93_evk.c +0 -15
index 371b35bf1a6..64400b584d1 100644
@@ -9,9 +9,7 @@
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/global_data.h>
-#include <asm/arch-imx9/ccm_regs.h>
 #include <asm/arch/sys_proto.h>
-#include <asm/arch/clock.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 
@@ -37,11 +35,6 @@ struct efi_capsule_update_info update_info = {
 };
 #endif /* EFI_HAVE_CAPSULE_SUPPORT */
 
-static int setup_fec(void)
-{
-	return set_clk_enet(ENET_125MHZ);
-}
-
 int board_phy_config(struct phy_device *phydev)
 {
 	if (phydev->drv->config)
@@ -50,14 +43,6 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
-int board_init(void)
-{
-	if (IS_ENABLED(CONFIG_FEC_MXC))
-		setup_fec();
-
-	return 0;
-}
-
 int board_late_init(void)
 {
 #if CONFIG_IS_ENABLED(ENV_IS_IN_MMC) || CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
configs/imx93_11x11_evk_defconfig +1 -0
index a53e5fc1de1..39a7962d7ca 100644
@@ -36,6 +36,7 @@ CONFIG_BOOTCOMMAND="bootflow scan -lb; run bsp_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="imx93-11x11-evk.dtb"
 CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2074
+# CONFIG_BOARD_INIT is not set
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x26000
 CONFIG_SPL_BOARD_INIT=y
Signature · 1 line
2.51.0
#3 lore raw

PATCH 3/13 imx93_evk: Drop board_phy_config

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

There is already a weak function in drivers/net/phy/phy.c, which does the same thing. So drop it.

---
 board/freescale/imx93_evk/imx93_evk.c | 10 ----------
 1 file changed, 10 deletions(-)
board/freescale/imx93_evk/imx93_evk.c +0 -10
index 64400b584d1..4c58272523a 100644
@@ -6,8 +6,6 @@
 #include <env.h>
 #include <efi_loader.h>
 #include <init.h>
-#include <miiphy.h>
-#include <netdev.h>
 #include <asm/global_data.h>
 #include <asm/arch/sys_proto.h>
 #include <dm/device.h>
@@ -35,14 +33,6 @@ struct efi_capsule_update_info update_info = {
 };
 #endif /* EFI_HAVE_CAPSULE_SUPPORT */
 
-int board_phy_config(struct phy_device *phydev)
-{
-	if (phydev->drv->config)
-		phydev->drv->config(phydev);
-
-	return 0;
-}
-
 int board_late_init(void)
 {
 #if CONFIG_IS_ENABLED(ENV_IS_IN_MMC) || CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
Signature · 1 line
2.51.0
#4 lore raw

PATCH 4/13 imx93_evk: Drop DECLARE_GLOBAL_DATA_PTR

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

No user of "gd" in this file, drop DECLARE_GLOBAL_DATA_PTR.

---
 board/freescale/imx93_evk/imx93_evk.c | 3 ---
 1 file changed, 3 deletions(-)
board/freescale/imx93_evk/imx93_evk.c +0 -3
index 4c58272523a..0278ef9805f 100644
@@ -6,13 +6,10 @@
 #include <env.h>
 #include <efi_loader.h>
 #include <init.h>
-#include <asm/global_data.h>
 #include <asm/arch/sys_proto.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
 #define IMX_BOOT_IMAGE_GUID \
 	EFI_GUID(0xbc550d86, 0xda26, 0x4b70, 0xac, 0x05, \
Signature · 1 line
2.51.0
#5 lore raw

PATCH 5/13 imx93_evk: Cleanup headers

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Drop unused headers and sort them.

---
 board/freescale/imx93_evk/imx93_evk.c |  2 --
 board/freescale/imx93_evk/spl.c       | 29 ++++++-----------------------
 2 files changed, 6 insertions(+), 25 deletions(-)
board/freescale/imx93_evk/imx93_evk.c +0 -2
index 0278ef9805f..70b07fa3c6f 100644
@@ -7,8 +7,6 @@
 #include <efi_loader.h>
 #include <init.h>
 #include <asm/arch/sys_proto.h>
-#include <dm/device.h>
-#include <dm/uclass.h>
 
 #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
 #define IMX_BOOT_IMAGE_GUID \
board/freescale/imx93_evk/spl.c +6 -23
index cba8ccdc01e..2e4de10fdd5 100644
@@ -3,36 +3,19 @@
  * Copyright 2022 NXP
  */
 
-#include <command.h>
-#include <cpu_func.h>
-#include <hang.h>
-#include <image.h>
 #include <init.h>
-#include <log.h>
+#include <power/pmic.h>
+#include <power/pca9450.h>
 #include <spl.h>
 #include <asm/global_data.h>
-#include <asm/io.h>
-#include <asm/arch/imx93_pins.h>
-#include <asm/arch/mu.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/mach-imx/boot_mode.h>
-#include <asm/mach-imx/mxc_i2c.h>
-#include <asm/arch-mx7ulp/gpio.h>
-#include <asm/mach-imx/ele_api.h>
-#include <asm/mach-imx/syscounter.h>
 #include <asm/sections.h>
-#include <dm/uclass.h>
-#include <dm/device.h>
-#include <dm/uclass-internal.h>
-#include <dm/device-internal.h>
-#include <linux/delay.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/ccm_regs.h>
 #include <asm/arch/ddr.h>
-#include <power/pmic.h>
-#include <power/pca9450.h>
+#include <asm/arch/mu.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/arch/trdc.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/ele_api.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.51.0
#6 lore raw

PATCH 6/13 imx93_qsb: Cleanup headers

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Drop unused headers and sort them.

---
 board/freescale/imx93_qsb/imx93_qsb.c |  2 --
 board/freescale/imx93_qsb/spl.c       | 29 ++++++-----------------------
 2 files changed, 6 insertions(+), 25 deletions(-)
board/freescale/imx93_qsb/imx93_qsb.c +0 -2
index 503a8667245..9de91758aa7 100644
@@ -5,8 +5,6 @@
 
 #include <env.h>
 #include <init.h>
-#include <miiphy.h>
-#include <netdev.h>
 #include <asm/arch/sys_proto.h>
 
 int board_late_init(void)
board/freescale/imx93_qsb/spl.c +6 -23
index 6d1ab60eda0..7d0f225c9b5 100644
@@ -3,36 +3,19 @@
  * Copyright 2024 NXP
  */
 
-#include <command.h>
-#include <cpu_func.h>
-#include <hang.h>
-#include <image.h>
 #include <init.h>
-#include <log.h>
+#include <power/pmic.h>
+#include <power/pca9450.h>
 #include <spl.h>
 #include <asm/global_data.h>
-#include <asm/io.h>
-#include <asm/arch/imx93_pins.h>
-#include <asm/arch/mu.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/mach-imx/boot_mode.h>
-#include <asm/mach-imx/mxc_i2c.h>
-#include <asm/arch-mx7ulp/gpio.h>
-#include <asm/mach-imx/ele_api.h>
-#include <asm/mach-imx/syscounter.h>
 #include <asm/sections.h>
-#include <dm/uclass.h>
-#include <dm/device.h>
-#include <dm/uclass-internal.h>
-#include <dm/device-internal.h>
-#include <linux/delay.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/ccm_regs.h>
 #include <asm/arch/ddr.h>
-#include <power/pmic.h>
-#include <power/pca9450.h>
+#include <asm/arch/mu.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/arch/trdc.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/ele_api.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.51.0
#7 lore raw

PATCH 7/13 imx91_evk: Cleanup headers

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Drop unused headers and sort them.

---
 board/freescale/imx91_evk/imx91_evk.c |  2 --
 board/freescale/imx91_evk/spl.c       | 28 ++++++----------------------
 2 files changed, 6 insertions(+), 24 deletions(-)
board/freescale/imx91_evk/imx91_evk.c +0 -2
index cbd0a72bf4b..fca2521081b 100644
@@ -5,8 +5,6 @@
 
 #include <env.h>
 #include <init.h>
-#include <miiphy.h>
-#include <netdev.h>
 #include <asm/arch/sys_proto.h>
 
 int board_late_init(void)
board/freescale/imx91_evk/spl.c +6 -22
index 46bde93fe3b..2aa63a61b74 100644
@@ -3,35 +3,19 @@
  * Copyright 2024 NXP
  */
 
-#include <command.h>
-#include <cpu_func.h>
-#include <hang.h>
-#include <image.h>
 #include <init.h>
-#include <log.h>
+#include <power/pmic.h>
+#include <power/pca9450.h>
 #include <spl.h>
 #include <asm/global_data.h>
-#include <asm/io.h>
-#include <asm/arch/mu.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/mach-imx/boot_mode.h>
-#include <asm/mach-imx/mxc_i2c.h>
-#include <asm/arch-mx7ulp/gpio.h>
-#include <asm/mach-imx/ele_api.h>
-#include <asm/mach-imx/syscounter.h>
 #include <asm/sections.h>
-#include <dm/uclass.h>
-#include <dm/device.h>
-#include <dm/uclass-internal.h>
-#include <dm/device-internal.h>
-#include <linux/delay.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/ccm_regs.h>
 #include <asm/arch/ddr.h>
-#include <power/pmic.h>
-#include <power/pca9450.h>
+#include <asm/arch/mu.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/arch/trdc.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/ele_api.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.51.0
#8 lore raw

PATCH 8/13 imx94_evk: Sort header files

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Sort header files following the order:
- generic-header
- asm/generic-header
- asm/arch/
- asm/mach-imx/

---
 board/freescale/imx94_evk/imx94_evk.c |  6 +++---
 board/freescale/imx94_evk/spl.c       | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
board/freescale/imx94_evk/imx94_evk.c +3 -3
index 28d512ac5f3..588aa7548d4 100644
@@ -3,11 +3,11 @@
  * Copyright 2025 NXP
  */
 
-#include <asm/arch/clock.h>
-#include <asm/gpio.h>
-#include <asm/mach-imx/sys_proto.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <asm/gpio.h>
+#include <asm/arch/clock.h>
+#include <asm/mach-imx/sys_proto.h>
 
 int board_early_init_f(void)
 {
board/freescale/imx94_evk/spl.c +5 -5
index 341b165b3c8..0aa75ea907e 100644
@@ -3,16 +3,16 @@
  * Copyright 2025 NXP
  */
 
+#include <hang.h>
+#include <init.h>
+#include <spl.h>
+#include <asm/gpio.h>
+#include <asm/sections.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mu.h>
 #include <asm/arch/sys_proto.h>
-#include <asm/gpio.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/ele_api.h>
-#include <asm/sections.h>
-#include <hang.h>
-#include <init.h>
-#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.51.0
#9 lore raw

PATCH 9/13 imx95_evk: Sort header files

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Sort header files following the order:
- generic-header
- asm/generic-header
- asm/arch/
- asm/mach-imx/

---
 board/freescale/imx95_evk/imx95_evk.c | 2 +-
 board/freescale/imx95_evk/spl.c       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
board/freescale/imx95_evk/imx95_evk.c +1 -1
index fe0111be508..ca1d916deab 100644
@@ -3,8 +3,8 @@
  * Copyright 2025 NXP
  */
 
-#include <asm/arch/clock.h>
 #include <asm/gpio.h>
+#include <asm/arch/clock.h>
 #include <asm/mach-imx/sys_proto.h>
 
 int board_early_init_f(void)
board/freescale/imx95_evk/spl.c +4 -4
index 48b47d2aed9..90c7429272b 100644
@@ -3,15 +3,15 @@
  * Copyright 2025 NXP
  */
 
+#include <hang.h>
+#include <init.h>
+#include <spl.h>
+#include <asm/sections.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mu.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/ele_api.h>
-#include <asm/sections.h>
-#include <hang.h>
-#include <init.h>
-#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.51.0
#10 lore raw

PATCH 10/13 imx95/4_evk: Add missing header

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

Include asm/global_data.h for using DECLARE_GLOBAL_DATA_PTR.

---
 board/freescale/imx94_evk/spl.c | 1 +
 board/freescale/imx95_evk/spl.c | 1 +
 2 files changed, 2 insertions(+)
board/freescale/imx94_evk/spl.c +1 -0
index 0aa75ea907e..797806a8d4d 100644
@@ -7,6 +7,7 @@
 #include <init.h>
 #include <spl.h>
 #include <asm/gpio.h>
+#include <asm/global_data.h>
 #include <asm/sections.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mu.h>
board/freescale/imx95_evk/spl.c +1 -0
index 90c7429272b..752d7f916b6 100644
@@ -6,6 +6,7 @@
 #include <hang.h>
 #include <init.h>
 #include <spl.h>
+#include <asm/global_data.h>
 #include <asm/sections.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mu.h>
Signature · 1 line
2.51.0
#11 lore raw

PATCH 11/13 misc: ele_api: Add Voltage change start and finish APIs

In reply to Peng Fan (OSS)

From: Ye Li <[email protected]>

On GDET enabled part, need to call voltage change start and finish APIs when adjust the voltage more than 100mv. Otherwise GDET will be triggered and system is reset

---
 arch/arm/include/asm/mach-imx/ele_api.h |  4 +++
 drivers/misc/imx_ele/ele_api.c          | 50 +++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
arch/arm/include/asm/mach-imx/ele_api.h +4 -0
index 64b243dcaaa..4e1afc42bd8 100644
@@ -14,6 +14,8 @@
 #define ELE_PING_REQ (0x01)
 #define ELE_FW_AUTH_REQ (0x02)
 #define ELE_RESTART_RST_TIMER_REQ (0x04)
+#define ELE_VOLT_CHANGE_START_REQ (0x12)
+#define ELE_VOLT_CHANGE_FINISH_REQ (0x13)
 #define ELE_DUMP_DEBUG_BUFFER_REQ (0x21)
 #define ELE_OEM_CNTN_AUTH_REQ (0x87)
 #define ELE_VERIFY_IMAGE_REQ (0x88)
@@ -160,4 +162,6 @@ int ele_return_lifecycle_update(ulong signed_msg_blk, u32 *response);
 int ele_start_rng(void);
 int ele_write_shadow_fuse(u32 fuse_id, u32 fuse_val, u32 *response);
 int ele_read_shadow_fuse(u32 fuse_id, u32 *fuse_val, u32 *response);
+int ele_volt_change_start_req(void);
+int ele_volt_change_finish_req(void);
 #endif
drivers/misc/imx_ele/ele_api.c +50 -0

53 lines not on this page · raw message

Signature · 1 line
2.51.0
#12 lore raw

Re: [PATCH 11/13] misc: ele_api: Add Voltage change start and finish APIs

Hi Peng,

Quoted 3 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

On GDET enabled part, need to call voltage change start and finish

Just a question, is this some special part or a regular i.MX93?

How or where do you enable Glitch detection?

Thanks,
BR,
Primoz

Quoted 90 lines

APIs when adjust the voltage more than 100mv. Otherwise GDET will be triggered and system is reset

---
 arch/arm/include/asm/mach-imx/ele_api.h |  4 +++
 drivers/misc/imx_ele/ele_api.c          | 50 +++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
arch/arm/include/asm/mach-imx/ele_api.h +4 -0
index 64b243dcaaa..4e1afc42bd8 100644
@@ -14,6 +14,8 @@
 #define ELE_PING_REQ (0x01)
 #define ELE_FW_AUTH_REQ (0x02)
 #define ELE_RESTART_RST_TIMER_REQ (0x04)
+#define ELE_VOLT_CHANGE_START_REQ (0x12)
+#define ELE_VOLT_CHANGE_FINISH_REQ (0x13)
 #define ELE_DUMP_DEBUG_BUFFER_REQ (0x21)
 #define ELE_OEM_CNTN_AUTH_REQ (0x87)
 #define ELE_VERIFY_IMAGE_REQ (0x88)
@@ -160,4 +162,6 @@ int ele_return_lifecycle_update(ulong signed_msg_blk, u32 *response);
 int ele_start_rng(void);
 int ele_write_shadow_fuse(u32 fuse_id, u32 fuse_val, u32 *response);
 int ele_read_shadow_fuse(u32 fuse_id, u32 *fuse_val, u32 *response);
+int ele_volt_change_start_req(void);
+int ele_volt_change_finish_req(void);
 #endif
drivers/misc/imx_ele/ele_api.c +50 -0
index 661f70cf870..e7aee0fcef1 100644
@@ -794,3 +794,53 @@ int ele_generate_dek_blob(u32 key_id, u32 src_paddr, u32 dst_paddr, u32 max_outp
 
 	return ret;
 }
+
+int ele_volt_change_start_req(void)
+{
+	struct udevice *dev = gd->arch.ele_dev;
+	int size = sizeof(struct ele_msg);
+	struct ele_msg msg = {};
+	int ret;
+
+	if (!dev) {
+		printf("ele dev is not initialized\n");
+		return -ENODEV;
+	}
+
+	msg.version = ELE_VERSION;
+	msg.tag = ELE_CMD_TAG;
+	msg.size = 1;
+	msg.command = ELE_VOLT_CHANGE_START_REQ;
+
+	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;
+}
+
+int ele_volt_change_finish_req(void)
+{
+	struct udevice *dev = gd->arch.ele_dev;
+	int size = sizeof(struct ele_msg);
+	struct ele_msg msg = {};
+	int ret;
+
+	if (!dev) {
+		printf("ele dev is not initialized\n");
+		return -ENODEV;
+	}
+
+	msg.version = ELE_VERSION;
+	msg.tag = ELE_CMD_TAG;
+	msg.size = 1;
+	msg.command = ELE_VOLT_CHANGE_FINISH_REQ;
+
+	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;
+}
Signature · 9 lines
Primoz Fiser
phone: +386-41-390-545
email: [email protected]
--
Norik systems d.o.o.
Your embedded software partner
Slovenia, EU
phone: +386-41-540-545
email: [email protected]
#13 lore raw

RE: [PATCH 11/13] misc: ele_api: Add Voltage change start and finish APIs

Hi Primoz,

Quoted 11 lines

Subject: Re: [PATCH 11/13] misc: ele_api: Add Voltage change start and finish APIs

Hi Peng,

Quoted 3 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

On GDET enabled part, need to call voltage change start and finish

Just a question, is this some special part or a regular i.MX93?

It is a special part. Figure 1. Part number nomenclature in [1], there is a special fuse char. "Full featured with GDET enabled",

[1] https://www.nxp.com.cn/docs/en/data-sheet/IMX93AEC.pdf

Regards
Peng.

Quoted 2 lines

How or where do you enable Glitch detection?

The detection is done by Secure Enclave, it is confidential.

Thanks,
Peng.

Quoted 114 lines

Thanks,
BR,
Primoz

Quoted 1 line

APIs when adjust the voltage more than 100mv. Otherwise GDET will

be

Quoted 8 lines

triggered and system is reset

---
 arch/arm/include/asm/mach-imx/ele_api.h |  4 +++
 drivers/misc/imx_ele/ele_api.c          | 50

+++++++++++++++++++++++++++++++++

Quoted 14 lines
 2 files changed, 54 insertions(+)
arch/arm/include/asm/mach-imx/ele_api.h +2 -0
index 64b243dcaaa..4e1afc42bd8 100644
@@ -14,6 +14,8 @@
 #define ELE_PING_REQ (0x01)
 #define ELE_FW_AUTH_REQ (0x02)
 #define ELE_RESTART_RST_TIMER_REQ (0x04)
+#define ELE_VOLT_CHANGE_START_REQ (0x12) #define
+ELE_VOLT_CHANGE_FINISH_REQ (0x13)
 #define ELE_DUMP_DEBUG_BUFFER_REQ (0x21)  #define
Quoted 1 line

ELE_OEM_CNTN_AUTH_REQ (0x87) #define ELE_VERIFY_IMAGE_REQ

(0x88) @@

Quoted 1 line

-160,4 +162,6 @@ int ele_return_lifecycle_update(ulong

signed_msg_blk,

Quoted 2 lines

u32 *response); int ele_start_rng(void); int ele_write_shadow_fuse(u32 fuse_id, u32 fuse_val, u32 *response);

int

Quoted 6 lines

ele_read_shadow_fuse(u32 fuse_id, u32 *fuse_val, u32 *response);

arch/arm/include/asm/mach-imx/ele_api.h +2 -0
+int ele_volt_change_start_req(void);
+int ele_volt_change_finish_req(void);
 #endif
(quoted diff) +0 -0

b/drivers/misc/imx_ele/ele_api.c index 661f70cf870..e7aee0fcef1

100644

Quoted 48 lines
drivers/misc/imx_ele/ele_api.c +0 -0
@@ -794,3 +794,53 @@ int ele_generate_dek_blob(u32 key_id, u32

src_paddr, u32 dst_paddr, u32 max_outp

drivers/misc/imx_ele/ele_api.c +40 -0
 	return ret;
 }
+
+int ele_volt_change_start_req(void)
+{
+	struct udevice *dev = gd->arch.ele_dev;
+	int size = sizeof(struct ele_msg);
+	struct ele_msg msg = {};
+	int ret;
+
+	if (!dev) {
+		printf("ele dev is not initialized\n");
+		return -ENODEV;
+	}
+
+	msg.version = ELE_VERSION;
+	msg.tag = ELE_CMD_TAG;
+	msg.size = 1;
+	msg.command = ELE_VOLT_CHANGE_START_REQ;
+
+	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;
+}
+
+int ele_volt_change_finish_req(void)
+{
+	struct udevice *dev = gd->arch.ele_dev;
+	int size = sizeof(struct ele_msg);
+	struct ele_msg msg = {};
+	int ret;
+
+	if (!dev) {
+		printf("ele dev is not initialized\n");
+		return -ENODEV;
+	}
+
+	msg.version = ELE_VERSION;
+	msg.tag = ELE_CMD_TAG;

drivers/misc/imx_ele/ele_api.c int ele_generate_dek_blob(u32 key_id, u32 src_paddr, u32 dst_paddr, u32 max_outp · line 846

Quoted 10 lines
drivers/misc/imx_ele/ele_api.c +10 -0
+	msg.size = 1;
+	msg.command = ELE_VOLT_CHANGE_FINISH_REQ;
+
+	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;
+}

--
Primoz Fiser
phone: +386-41-390-545
email: [email protected]
--
Norik systems d.o.o.
Your embedded software partner
Slovenia, EU
phone: +386-41-540-545
email: [email protected]

#14 lore raw

PATCH 12/13 imx93_evk: Invoke the ELE voltage APIs when adjust VDD_SOC voltage

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

SPL will adjust VDD_SOC to OD voltage, because some PMIC uses 0.8V as default for VDD_SOC. So need to call the voltage change APIs to avoid ELE Glitch Detection triggered reset.

---
 board/freescale/imx93_evk/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
board/freescale/imx93_evk/spl.c +4 -0
index 2e4de10fdd5..176d25a74a6 100644
@@ -85,6 +85,8 @@ int power_init_board(void)
 		printf("PMIC: Over Drive Voltage Mode\n");
 	}
 
+	ele_volt_change_start_req();
+
 	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB) {
 		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, buck_val);
 		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val);
@@ -93,6 +95,8 @@ int power_init_board(void)
 		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val + 0x4);
 	}
 
+	ele_volt_change_finish_req();
+
 	/* set standby voltage to 0.65v */
 	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB)
 		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x0);
Signature · 1 line
2.51.0
#15 lore raw

PATCH 13/13 imx93_qsb: Invoke the ELE voltage APIs when adjust VDD_SOC voltage

In reply to Peng Fan (OSS)

From: Peng Fan <[email protected]>

SPL will adjust VDD_SOC to OD voltage, because some PMIC uses 0.8V as default for VDD_SOC. So need to call the voltage change APIs to avoid ELE Glitch Detection triggered reset.

---
 board/freescale/imx93_qsb/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
board/freescale/imx93_qsb/spl.c +4 -0
index 7d0f225c9b5..9e64714521b 100644
@@ -81,6 +81,8 @@ int power_init_board(void)
 		printf("PMIC: Over Drive Voltage Mode\n");
 	}
 
+	ele_volt_change_start_req();
+
 	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB) {
 		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, buck_val);
 		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val);
@@ -89,6 +91,8 @@ int power_init_board(void)
 		pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, buck_val + 0x4);
 	}
 
+	ele_volt_change_finish_req();
+
 	/* set standby voltage to 0.65v */
 	if (val & PCA9450_REG_PWRCTRL_TOFF_DEB)
 		pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x0);
Signature · 1 line
2.51.0
reviewer Applied
#16 lore raw
In reply to Peng Fan (OSS)
Quoted 10 lines · Peng Fan (OSS)

This patchset is mainly to cleanup i.MX93-EVK board code and sort the included header files for i.MX93/1/4/5-EVK.

For patches to sort the header, I follow such rules to sort the header:
*.h [generic header]
asm/*.h
asm/arch/*.h
asm/mach-imx/*.h

Quoted 6 lines

While at here, the last three patches are including ELE voltage API to avoid create dependency if post in a separate patchset.

CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/28959

Applied, thanks.