Skip to contentSkip to conversation

imx: add i.MX95 support

PATCH Superseded Alice Guo 5 participants 65 messages Jan 3, 2025 – Jan 15, 2025

Subsystems (8)

v3 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Alice Guo

author
#0 lore raw

v3 cover imx: add i.MX95 support

CI: https://dev.azure.com/pengfan/uboot-ci/_build/results?buildId=13&view=results

Changes in v3:
- update the binman etype used to add a header to DDR PHY firmware images
- create a test for the new binman etype
- correct issues in imx95_evk.rst
- factor out the common parts of i.MX95 device tree into an imx95-u-boot.dtsi file
- correct issues in imx95_19x19_evk.env

---
Alice Guo (3):
imx: Kconfig: IMX8_ROMAPI is not configured for i.MX95
binman: add a new entry type for packing DDR PHY firmware images
tools: imx8image: add i.MX95 support

Peng Fan (7):
mailbox: add i.MX95 Messaging Unit (MU) driver
pinctrl: nxp: add SCMI pin control protocol driver
scmi_protocols: add SCMI misc protocol protocol_id and message_id for getting the ROM passover data
scmi_protocols: add SCMI Performance domain management protocol message IDs
clk: scmi: add the command CLOCK_PARENT_SET
imx9: scmi: add i.MX95 SoC and clock related code
scmi: add the macro SCMI_MSG

Teo Hall (1):
imx: add V2X container support on i.MX95

Viorel Suman (1):
firmware: scmi: smt: Interrupt communication enable

Ye Li (5):
clk: scmi: check the clock state/parent/rate control permissions
scmi_protocols: update struct scmi_base_discover_list_protocols_out
imx9: add i.MX95 Kconfig and Makefile
imx9: scmi: soc: Override h_spl_load_read with trampoline buffer
imx95_evk: add i.MX95 19x19 EVK board basic support

 MAINTAINERS                                   |   1 +
 arch/arm/dts/imx95-19x19-evk-u-boot.dtsi      |  68 ++
 arch/arm/dts/imx95-u-boot.dtsi                | 173 +++++
 arch/arm/include/asm/arch-imx/cpu.h           |   3 +
 arch/arm/include/asm/arch-imx9/clock.h        |  10 +-
 arch/arm/include/asm/arch-imx9/imx-regs.h     |   7 +-
 arch/arm/include/asm/arch-imx9/sys_proto.h    |   3 +-
 arch/arm/include/asm/mach-imx/sys_proto.h     |  40 ++
 arch/arm/mach-imx/Kconfig                     |   2 +-
 arch/arm/mach-imx/image-container.c           |  63 +-
 arch/arm/mach-imx/imx9/Kconfig                |  12 +
 arch/arm/mach-imx/imx9/Makefile               |  11 +-
 arch/arm/mach-imx/imx9/scmi/Makefile          |   6 +
 arch/arm/mach-imx/imx9/scmi/clock.c           | 328 ++++++++++
 arch/arm/mach-imx/imx9/scmi/clock_scmi.c      | 148 +++++
 arch/arm/mach-imx/imx9/scmi/container.cfg     |  10 +
 arch/arm/mach-imx/imx9/scmi/imximage.cfg      |  15 +
 arch/arm/mach-imx/imx9/scmi/soc.c             | 873 ++++++++++++++++++++++++++
 arch/sandbox/include/asm/scmi_test.h          |   2 +
 board/freescale/imx95_evk/Kconfig             |  12 +
 board/freescale/imx95_evk/MAINTAINERS         |   6 +
 board/freescale/imx95_evk/Makefile            |  11 +
 board/freescale/imx95_evk/imx95_19x19_evk.env |  90 +++
 board/freescale/imx95_evk/imx95_evk.c         |  54 ++
 board/freescale/imx95_evk/spl.c               |  96 +++
 common/spl/spl_mmc.c                          |   2 +-
 configs/imx95_19x19_evk_defconfig             | 177 ++++++
 doc/board/nxp/imx95_evk.rst                   | 116 ++++
 doc/board/nxp/index.rst                       |   1 +
 drivers/clk/clk_scmi.c                        | 191 +++++-
 drivers/firmware/scmi/sandbox-scmi_agent.c    |  56 +-
 drivers/firmware/scmi/scmi_agent-uclass.c     |  11 +
 drivers/firmware/scmi/smt.c                   |   4 +
 drivers/firmware/scmi/smt.h                   |  10 +
 drivers/mailbox/Kconfig                       |   7 +
 drivers/mailbox/Makefile                      |   1 +
 drivers/mailbox/imx-mailbox.c                 | 417 ++++++++++++
 drivers/pinctrl/nxp/Kconfig                   |  13 +
 drivers/pinctrl/nxp/Makefile                  |   1 +
 drivers/pinctrl/nxp/pinctrl-imx.c             |   7 +-
 drivers/pinctrl/nxp/pinctrl-imx.h             |  11 +
 drivers/pinctrl/nxp/pinctrl-scmi.c            | 136 ++++
 include/configs/imx95_evk.h                   |  30 +
 include/imx8image.h                           |  19 +-
 include/scmi_agent-uclass.h                   |   2 +
 include/scmi_agent.h                          |  11 +
 include/scmi_protocols.h                      | 105 +++-
 tools/binman/entries.rst                      |  10 +
 tools/binman/etype/nxp_header_ddrfw.py        |  32 +
 tools/binman/ftest.py                         |  11 +
 tools/binman/test/346_nxp_ddrfw_imx95.dts     |  24 +
 tools/imx8image.c                             | 143 ++++-
 tools/imx9_image.sh                           |   8 +
 53 files changed, 3536 insertions(+), 64 deletions(-)

---
base-commit: ec9263b4f15c4cf82eb6a211c67baa6385065b8e
change-id: 20250103-imx95-4a8efab36b29

Best regards,

Signature · 1 line
Alice Guo <[email protected]>
author
#1 lore raw

PATCH v3 1/17 mailbox: add i.MX95 Messaging Unit (MU) driver

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

---
 MAINTAINERS                   |   1 +
 drivers/mailbox/Kconfig       |   7 +
 drivers/mailbox/Makefile      |   1 +
 drivers/mailbox/imx-mailbox.c | 417 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 426 insertions(+)
MAINTAINERS +1 -0
index ba31f86feb6da266cddd160a041d0594ac86d274..5ab2b72d0f93afaf70c4c2dcb8fc48210683b749 100644
@@ -313,6 +313,7 @@ F:	board/freescale/*mx*/
 F:	board/freescale/common/
 F:	common/spl/spl_imx_container.c
 F:	doc/imx/
+F:	drivers/mailbox/imx-mailbox.c
 F:	drivers/serial/serial_mxc.c
 F:	include/imx_container.h
 
drivers/mailbox/Kconfig +7 -0
index 67d5ac1a74228ccd82b2725c0bb745354d099948..4d9f004ebad7f57034a6cdae3bff9645fa0ee67d 100644
@@ -21,6 +21,13 @@ config APPLE_MBOX
 	  such as the System Management Controller (SMC) and NVMe and this
 	  driver is required to get that functionality up and running.
 
+config IMX_MU_MBOX
+	bool "Enable i.MX MU MBOX support"
+	depends on DM_MAILBOX
+	help
+	  Enable support for i.MX Messaging Unit for communication with other
+	  processors on the SoC using mailbox interface
+
 config SANDBOX_MBOX
 	bool "Enable the sandbox mailbox test driver"
 	depends on DM_MAILBOX && SANDBOX
drivers/mailbox/Makefile +1 -0
index 6072fa1956b793636c35aa0d1419c9dcaae27095..574add60005fe73d2beba715a12e0157fe4b0552 100644
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_$(XPL_)DM_MAILBOX) += mailbox-uclass.o
 obj-$(CONFIG_APPLE_MBOX) += apple-mbox.o
+obj-$(CONFIG_IMX_MU_MBOX) += imx-mailbox.o
 obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox.o
 obj-$(CONFIG_SANDBOX_MBOX) += sandbox-mbox-test.o
 obj-$(CONFIG_STM32_IPCC) += stm32-ipcc.o
drivers/mailbox/imx-mailbox.c new file +417 -0

417 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 8 lines · Alice Guo

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

Is this ported from Linux ? If so, as of which mainline Linux kernel commit ?

Can you add older iMX SoC support while adding this driver ? It seems imx6..imx95 MU IP look very similar.

#3 lore raw

回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 11 lines

主题: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 2 lines · Alice Guo

From: Peng Fan <[email protected]>

Quoted 7 lines
Quoted 6 lines

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

Is this ported from Linux ? If so, as of which mainline Linux kernel commit ?

Yes, u-boot/drivers/mailbox/imx-mailbox.c is ported v6.12.8 Linux.

Quoted 2 lines

Can you add older iMX SoC support while adding this driver ? It seems imx6..imx95 MU IP look very similar.

This patch-set is only for i.MX95. I can add the older iMX SoC support in the future.

Best Regards,
Alice Guo

#4 lore raw

Re: 回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 17 lines · Alice Guo (OSS)
Quoted 17 lines

主题: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 8 lines · Alice Guo

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

Quoted 3 lines
Quoted 1 line

Is this ported from Linux ? If so, as of which mainline Linux kernel commit ?

Yes, u-boot/drivers/mailbox/imx-mailbox.c is ported v6.12.8 Linux.

Please add that information into the commit message, including the kernel version and Linux commit ID , in case this driver needs to be updated.

Quoted 4 lines
Quoted 2 lines

Can you add older iMX SoC support while adding this driver ? It seems imx6..imx95 MU IP look very similar.

This patch-set is only for i.MX95. I can add the older iMX SoC support in the future.

Maybe you could split off addition of the MU driver into separate series and do it for all the SoCs right away instead ?

#5 lore raw

Re: 回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 25 lines · Marek Vasut
Quoted 17 lines · Alice Guo (OSS)
Quoted 17 lines

主题: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 8 lines · Alice Guo

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

Quoted 3 lines
Quoted 1 line

Is this ported from Linux ? If so, as of which mainline Linux kernel commit ?

Yes, u-boot/drivers/mailbox/imx-mailbox.c is ported v6.12.8 Linux.

Please add that information into the commit message, including the kernel version and Linux commit ID , in case this driver needs to be updated.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Can you add older iMX SoC support while adding this driver ? It seems imx6..imx95 MU IP look very similar.

This patch-set is only for i.MX95. I can add the older iMX SoC support in the future.

Maybe you could split off addition of the MU driver into separate series and do it for all the SoCs right away instead ?

Adding other SoCs support needs tests, but to tests other platforms, we need more work. We could not just put code here that not tested for other SoCs.

we are hoping to land i.MX95 in near term, so I would prefer to extend the driver after we finish i.MX95 patchset.

Thanks,
Peng

#6 lore raw

Re: 回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 29 lines · Peng Fan
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Alice Guo (OSS)
Quoted 17 lines

主题: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 8 lines · Alice Guo

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU interface. This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is this MU.

Quoted 3 lines
Quoted 1 line

Is this ported from Linux ? If so, as of which mainline Linux kernel commit ?

Yes, u-boot/drivers/mailbox/imx-mailbox.c is ported v6.12.8 Linux.

Please add that information into the commit message, including the kernel version and Linux commit ID , in case this driver needs to be updated.

Quoted 3 lines
Quoted 2 lines

Can you add older iMX SoC support while adding this driver ? It seems imx6..imx95 MU IP look very similar.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

This patch-set is only for i.MX95. I can add the older iMX SoC support in the future.

Maybe you could split off addition of the MU driver into separate series and do it for all the SoCs right away instead ?

Adding other SoCs support needs tests, but to tests other platforms, we need more work. We could not just put code here that not tested for other SoCs.

If you are already porting the MU driver for Linux, there is a good chance the support for other SoCs was already tested in Linux, so it should be safe to port it over in full to U-Boot that way ?

#7 lore raw

RE: 回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 44 lines

Subject: Re: 回复: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging Unit (MU) driver

Quoted 3 lines · Peng Fan
Quoted 2 lines · Marek Vasut
Quoted 1 line · Alice Guo (OSS)
Quoted 1 line

主题: [EXT] Re: [PATCH v3 01/17] mailbox: add i.MX95 Messaging

Unit

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

(MU) driver

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Alice Guo
Quoted 5 lines

From: Peng Fan <[email protected]>

i.MX95 Messaging Unit (MU) enables 2 processors on a chip to communicate and coordinate by passing messages (e.g. frame information, event notices and requests) through the MU

interface.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

This patch provides a driver for i.MX95 MU using the common mailbox framework. Currently, SCMI exchanges on i.MX95 uses a mailbox transport with SMT format, and the hardware used is

this MU.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is this ported from Linux ? If so, as of which mainline Linux kernel

commit ?

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Yes, u-boot/drivers/mailbox/imx-mailbox.c is ported v6.12.8 Linux.

Please add that information into the commit message, including the kernel version and Linux commit ID , in case this driver needs to be

updated.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Can you add older iMX SoC support while adding this driver ? It seems
imx6..imx95 MU IP look very similar.

This patch-set is only for i.MX95. I can add the older iMX SoC

support in the future.

Quoted 3 lines
Quoted 2 lines

Maybe you could split off addition of the MU driver into separate series and do it for all the SoCs right away instead ?

Quoted 6 lines
Quoted 2 lines

Adding other SoCs support needs tests, but to tests other platforms, we need more work. We could not just put code here that not tested

for other SoCs.
If you are already porting the MU driver for Linux, there is a good chance the support for other SoCs was already tested in Linux, so it should be safe to port it over in full to U-Boot that way ?

I will leave this to Fabio to decide, I not prefer to porting untested code in U-boot, even that works in Linux.

Thanks,
Peng.

author
#8 lore raw

PATCH v3 2/17 firmware: scmi: smt: Interrupt communication enable

In reply to Alice Guo

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported, the transport allows the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

---
 drivers/firmware/scmi/smt.c |  4 ++++
 drivers/firmware/scmi/smt.h | 10 ++++++++++
 2 files changed, 14 insertions(+)
drivers/firmware/scmi/smt.c +4 -0
index 67d2f45002490ab64a6bc997eda93a8f4681d99b..e5b902dcb0e641065f4c0faae6bc6660a7e2c6af 100644
@@ -48,6 +48,10 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt)
 	if (!smt->buf)
 		return -ENOMEM;
 
+	/* Command should complete via an interrupt so that set Channel flags to 1. */
+	if (IS_ENABLED(CONFIG_IMX95))
+		scmi_smt_enable_intr(smt, true);
+
 #ifdef CONFIG_ARM
 	if (dcache_status())
 		mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, MMU_SECTION_SIZE),
drivers/firmware/scmi/smt.h +10 -0
index 9d669a6c922666c48e7dce4c0affd7b47cb137e4..768b0f4c8a8d1cc7966530e724d278d72c2a167b 100644
@@ -84,6 +84,16 @@ static inline void scmi_smt_put_channel(struct scmi_smt *smt)
 	hdr->channel_status &= ~SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR;
 }
 
+static inline void scmi_smt_enable_intr(struct scmi_smt *smt, bool enable)
+{
+	struct scmi_smt_header *hdr = (void *)smt->buf;
+
+	if (enable)
+		hdr->flags |= SCMI_SHMEM_FLAG_INTR_ENABLED;
+	else
+		hdr->flags &= ~SCMI_SHMEM_FLAG_INTR_ENABLED;
+}
+
 int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt);
 
 /*
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 3 lines · Alice Guo

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Quoted 13 lines
---
  drivers/firmware/scmi/smt.c |  4 ++++
  drivers/firmware/scmi/smt.h | 10 ++++++++++
  2 files changed, 14 insertions(+)
drivers/firmware/scmi/smt.c +0 -0
index 67d2f45002490ab64a6bc997eda93a8f4681d99b..e5b902dcb0e641065f4c0faae6bc6660a7e2c6af 100644

drivers/firmware/scmi/smt.c int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) · line 53

Quoted 6 lines
drivers/firmware/scmi/smt.c +3 -0
@@ -48,6 +48,10 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt)
  	if (!smt->buf)
  		return -ENOMEM;
 
+	/* Command should complete via an interrupt so that set Channel flags to 1. */
+	if (IS_ENABLED(CONFIG_IMX95))
+		scmi_smt_enable_intr(smt, true);

This SoC specific stuff shouldn't be in generic code.

Can this be moved elsewhere ?

#10 lore raw

回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.

Quoted 7 lines
Quoted 1 line

+ /* Command should complete via an interrupt so that set Channel flags

to 1. */

drivers/firmware/scmi/smt.c int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) · line 53

Quoted 2 lines
drivers/firmware/scmi/smt.c +2 -0
+     if (IS_ENABLED(CONFIG_IMX95))
+             scmi_smt_enable_intr(smt, true);

This SoC specific stuff shouldn't be in generic code.

Can this be moved elsewhere ?

Will change it in v4.

Best Regards,
Alice Guo

#11 lore raw

Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 13 lines · Alice Guo (OSS)
Quoted 13 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

Quoted 7 lines
Quoted 1 line

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.

If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

#12 lore raw

回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 23 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 19 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

Quoted 7 lines
Quoted 1 line

This is based on Arm® System Control and Management Interface Platform

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set, the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

            if (callee)
            {
                /* Generate completion interrupt */
                if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                {
                    status = RPC_SMT_DoorbellRing(smtChannel);
                }
            }

Best Regards,
Alice Guo

#13 lore raw

Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 33 lines · Alice Guo (OSS)
Quoted 23 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 19 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

Quoted 7 lines
Quoted 1 line

This is based on Arm® System Control and Management Interface Platform

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set, the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

Quoted 8 lines
             if (callee)
             {
                 /* Generate completion interrupt */
                 if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                 {
                     status = RPC_SMT_DoorbellRing(smtChannel);
                 }
             }

Can the SM be updated instead ?

#14 lore raw

回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 58 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 19:11
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Viorel Suman <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt:
Interrupt communication enable

Quoted 25 lines · Alice Guo (OSS)
Quoted 25 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 21 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform

Quoted 8 lines
Quoted 6 lines

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set,

the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

Quoted 9 lines
             if (callee)
             {
                 /* Generate completion interrupt */
                 if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                 {
                     status = RPC_SMT_DoorbellRing(smtChannel);
                 }
             }
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with Linux/QNX/RTOS. System Manager cannot be changed.

#15 lore raw

Re: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 58 lines · Alice Guo (OSS)
Quoted 58 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 19:11
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Viorel Suman <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt:
Interrupt communication enable

Quoted 25 lines · Alice Guo (OSS)
Quoted 25 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 21 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform

Quoted 8 lines
Quoted 6 lines

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set,

the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

Quoted 9 lines
              if (callee)
              {
                  /* Generate completion interrupt */
                  if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                  {
                      status = RPC_SMT_DoorbellRing(smtChannel);
                  }
              }
Quoted 3 lines
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with Linux/QNX/RTOS. System Manager cannot be changed.

How come other SCMI providers (like optee) do not need this kind of change ?

#16 lore raw

RE: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 74 lines

Subject: Re: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware:
scmi: smt: Interrupt communication enable

Quoted 5 lines · Alice Guo (OSS)
Quoted 5 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 19:11
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio

Estevam

Quoted 1 line
Quoted 1 line

<[email protected]>; dl-uboot-imx <[email protected]>;

Lukasz

Quoted 1 line
Quoted 1 line

Majewski <[email protected]>; Sean Anderson

<[email protected]>; Simon

Quoted 1 line
Quoted 1 line

Glass <[email protected]>; Alper Nebi Yasak

<[email protected]>

Quoted 3 lines
Quoted 3 lines

抄送: [email protected]; [email protected]; Viorel Suman <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi:

smt:

Quoted 10 lines
Quoted 10 lines

Interrupt communication enable

Quoted 7 lines · Alice Guo (OSS)
Quoted 7 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt:
Interrupt communication enable

Quoted 3 lines · Alice Guo (OSS)
Quoted 3 lines · Alice Guo
Quoted 2 lines

From: Viorel Suman <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 3 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are

used.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

i.MX95 uses interrupt driven communication so that Channel

flags

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management

Interface

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Platform

Design Document Version 3.2 (Document number: DEN0056E)

5.1.2. When

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit

is

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

not set,

the System Manager will not request doorbell interrupt. The

following

Quoted 10 lines
Quoted 10 lines

is the code from imx-sm:

Quoted 9 lines
              if (callee)
              {
                  /* Generate completion interrupt */
                  if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                  {
                      status = RPC_SMT_DoorbellRing(smtChannel);
                  }
              }
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with

Linux/QNX/RTOS. System Manager cannot be changed.
How come other SCMI providers (like optee) do not need this kind of change ?

Could we use a Kconfig option here, saying CONFIG_SCMI_INTR_EN? Then to i.MX95, select this Kconfig option and not break others saying optee.

There is less chance for System Manager to change. If you would like to do some change, you could do a PR, I could ask owner to give a look.

Thanks,
Peng.

#17 lore raw

Re: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

On 1/9/25 1:49 AM, Peng Fan wrote:

[...]

Quoted 22 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

My commit log may have caused your misunderstanding. If the bit

is

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

not set,

the System Manager will not request doorbell interrupt. The

following

Quoted 10 lines
Quoted 10 lines

is the code from imx-sm:

Quoted 9 lines
               if (callee)
               {
                   /* Generate completion interrupt */
                   if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                   {
                       status = RPC_SMT_DoorbellRing(smtChannel);
                   }
               }
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with

Linux/QNX/RTOS. System Manager cannot be changed.
How come other SCMI providers (like optee) do not need this kind of change ?

Quoted 7 lines

Could we use a Kconfig option here, saying CONFIG_SCMI_INTR_EN? Then to i.MX95, select this Kconfig option and not break others saying optee.

There is less chance for System Manager to change. If you would like to do some change, you could do a PR, I could ask owner to give a look.

My understanding is that SCMI is supposed to be an ABI and that ABI is supposed to be the same across different platforms, correct ?

Therefore, I am wondering why does the MX95 need this special workaround, and whether that workaround should be fixed in the SCMI server OR whether other platforms need the same change as well ?

#18 lore raw

Re: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

In reply to Marek Vasut
Quoted 59 lines · Marek Vasut
Quoted 58 lines · Alice Guo (OSS)
Quoted 58 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 19:11
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Viorel Suman <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt:
Interrupt communication enable

Quoted 25 lines · Alice Guo (OSS)
Quoted 25 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 21 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform

Quoted 8 lines
Quoted 6 lines

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set,

the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

Quoted 9 lines
              if (callee)
              {
                  /* Generate completion interrupt */
                  if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                  {
                      status = RPC_SMT_DoorbellRing(smtChannel);
                  }
              }
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with Linux/QNX/RTOS. System Manager cannot be changed.

How come other SCMI providers (like optee) do not need this kind of change ?

Here to i.MX SM, this is just a doorbell to tell remote side that info is ready. To U-Boot i.MX, MU GSR set means SM sends data back, so with COMP_INT set, U-Boot could poll the MU GSR bit. Using interrupt here is not that accurate, it is just a doorbell.

For OP-TEE, it is using SMC, it is sync transports, SMC return means SCMI done. No need polling any bit or else.

Regards,
Peng

#19 lore raw

Re: 回复: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 65 lines · Peng Fan
Quoted 59 lines · Marek Vasut
Quoted 58 lines · Alice Guo (OSS)
Quoted 58 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 19:11
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Viorel Suman <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt:
Interrupt communication enable

Quoted 25 lines · Alice Guo (OSS)
Quoted 25 lines

主题: Re: 回复: [EXT] Re: [PATCH v3 02/17] firmware: scmi: smt: Interrupt communication enable

Quoted 21 lines · Alice Guo (OSS)
Quoted 7 lines · Alice Guo
Quoted 3 lines

From: Viorel Suman <[email protected]>

When interrupt driven communication is supported

U-Boot does not use interrupts.

Quoted 7 lines
Quoted 5 lines

, the transport allows
the caller to choose between interrupt and polling driven communications. To make the choice, the channel flags are used. i.MX95 uses interrupt driven communication so that Channel flags should be set to 1.

How does this work in U-Boot, which does not use interrupts ?

Hi Marek,

The clearer explanation will be added in the commit log.

This is based on Arm® System Control and Management Interface Platform

Quoted 8 lines
Quoted 6 lines

Design Document Version 3.2 (Document number: DEN0056E) 5.1.2. When Bit[0] of Channel flags is 1, the System Manager runs on M core will trigger general-purpose interrupts to A core. U-Boot polls General-purpose Status (GSR) until GIPn is set.
If U-Boot does polling, why does this bit need to be set, shouldn't the bit be cleared instead ?

My commit log may have caused your misunderstanding. If the bit is not set,

the System Manager will not request doorbell interrupt. The following is the code from imx-sm:

Quoted 9 lines
               if (callee)
               {
                   /* Generate completion interrupt */
                   if ((buf->channelFlags & SMT_COMP_INT) != 0U)
                   {
                       status = RPC_SMT_DoorbellRing(smtChannel);
                   }
               }
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Can the SM be updated instead ?

System Manager not only interacts with U-Boot, but also with Linux/QNX/RTOS. System Manager cannot be changed.

How come other SCMI providers (like optee) do not need this kind of change ?

Quoted 7 lines

Here to i.MX SM, this is just a doorbell to tell remote side that info is ready. To U-Boot i.MX, MU GSR set means SM sends data back, so with COMP_INT set, U-Boot could poll the MU GSR bit. Using interrupt here is not that accurate, it is just a doorbell.

For OP-TEE, it is using SMC, it is sync transports, SMC return means SCMI done. No need polling any bit or else.

In that case, do you need to check the DT /firmware/scmi node compatible string for compatible="arm,scmi-smc" and enable this flag only if the compatible is "arm,scmi", and disable the flag otherwise ?

author
#20 lore raw

PATCH v3 3/17 pinctrl: nxp: add SCMI pin control protocol driver

In reply to Alice Guo

From: Peng Fan <[email protected]>

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

---
 drivers/firmware/scmi/scmi_agent-uclass.c |  11 +++
 drivers/pinctrl/nxp/Kconfig               |  13 +++
 drivers/pinctrl/nxp/Makefile              |   1 +
 drivers/pinctrl/nxp/pinctrl-imx.c         |   7 +-
 drivers/pinctrl/nxp/pinctrl-imx.h         |  11 +++
 drivers/pinctrl/nxp/pinctrl-scmi.c        | 136 ++++++++++++++++++++++++++++++
 include/scmi_agent-uclass.h               |   2 +
 include/scmi_protocols.h                  |  34 ++++++++
 8 files changed, 213 insertions(+), 2 deletions(-)
drivers/firmware/scmi/scmi_agent-uclass.c +11 -0
index 8c907c3b0328095c4b35ba089ed608fcda48b567..5f101f4ede8b585f8c562a42886ea7be4ef09953 100644
@@ -97,6 +97,9 @@ struct udevice *scmi_get_protocol(struct udevice *dev,
 	case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
 		proto = priv->voltagedom_dev;
 		break;
+	case SCMI_PROTOCOL_ID_PINCTRL:
+		proto = priv->pinctrl_dev;
+		break;
 	default:
 		dev_err(dev, "Protocol not supported\n");
 		proto = NULL;
@@ -147,6 +150,9 @@ static int scmi_add_protocol(struct udevice *dev,
 	case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
 		priv->voltagedom_dev = proto;
 		break;
+	case SCMI_PROTOCOL_ID_PINCTRL:
+		priv->pinctrl_dev = proto;
+		break;
 	default:
 		dev_err(dev, "Protocol not supported\n");
 		return -EPROTO;
@@ -436,6 +442,11 @@ static int scmi_bind_protocols(struct udevice *dev)
 				drv = DM_DRIVER_GET(scmi_voltage_domain);
 			}
 			break;
+		case SCMI_PROTOCOL_ID_PINCTRL:
+			if (IS_ENABLED(CONFIG_PINCTRL_IMX_SCMI) &&
+			    scmi_protocol_is_supported(dev, protocol_id))
+				drv = DM_DRIVER_GET(scmi_pinctrl_imx);
+			break;
 		default:
 			break;
 		}
drivers/pinctrl/nxp/Kconfig +13 -0
index 06c26f156f6c8f63204604d6065485629cfd9b61..0086f9825837bf568bd7633a21da860e410eeeee 100644
@@ -1,6 +1,19 @@
 config PINCTRL_IMX
 	bool
 
+config PINCTRL_IMX_SCMI
+	bool "IMX pinctrl SCMI driver"
+	depends on ARCH_IMX9 && PINCTRL_FULL
+	select PINCTRL_IMX
+	help
+	  Say Y here to enable the imx pinctrl scmi driver
+
+	  This provides a simple pinctrl driver for i.MX SoC which supports
+	  SCMI. This feature depends on device tree configuration. This driver
+	  is different from the linux one, this is a simple implementation,
+	  only parses the 'fsl,pins' property and configure related
+	  registers.
+
 config PINCTRL_IMX_SCU
 	bool
 
drivers/pinctrl/nxp/Makefile +1 -0
index f10aa6ef188e37583b181bdf9d70ac191e506d75..3ec3e2a9c6fdb875da4ae9bf151df5666256883b 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_PINCTRL_IMX6)		+= pinctrl-imx6.o
 obj-$(CONFIG_PINCTRL_IMX7)		+= pinctrl-imx7.o
 obj-$(CONFIG_PINCTRL_IMX7ULP)		+= pinctrl-imx7ulp.o
 obj-$(CONFIG_PINCTRL_IMX8ULP)		+= pinctrl-imx8ulp.o
+obj-$(CONFIG_PINCTRL_IMX_SCMI)		+= pinctrl-scmi.o
 obj-$(CONFIG_PINCTRL_IMX_SCU)		+= pinctrl-scu.o
 obj-$(CONFIG_PINCTRL_IMX8)		+= pinctrl-imx8.o
 obj-$(CONFIG_PINCTRL_IMX8M)		+= pinctrl-imx8m.o
drivers/pinctrl/nxp/pinctrl-imx.c +5 -2
index b1960c56b512cc113a810304dc3ac3f99b237a7e..3d53d0cd4b60c0685dd4c73c23e61cb712cda0ee 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Peng Fan <[email protected]>
+ * Copyright 2024 NXP
  */
 
 #include <malloc.h>
@@ -65,7 +66,9 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 
 	npins = size / pin_size;
 
-	if (info->flags & IMX8_USE_SCU) {
+	if (info->flags & IMX_USE_SCMI) {
+		return imx_pinctrl_scmi_conf_pins(dev, pin_data, npins);
+	} else if (info->flags & IMX8_USE_SCU) {
 		imx_pinctrl_scu_conf_pins(info, pin_data, npins);
 	} else {
 		/*
@@ -216,7 +219,7 @@ int imx_pinctrl_probe(struct udevice *dev,
 	priv->dev = dev;
 	priv->info = info;
 
-	if (info->flags & IMX8_USE_SCU)
+	if ((info->flags & IMX8_USE_SCU) || (info->flags & IMX_USE_SCMI))
 		return 0;
 
 	addr = ofnode_get_addr_size_index(dev_ofnode(dev), 0, &size);
drivers/pinctrl/nxp/pinctrl-imx.h +11 -0
index fa4c084e2fc067fcb4e92c33312d4f430081fffd..b2f8865ded0ae380fc0156baa5eaea505c12f501 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2016 Peng Fan <[email protected]>
+ * Copyright 2024 NXP
  */
 
 #ifndef __DRIVERS_PINCTRL_IMX_H
@@ -47,6 +48,7 @@ extern const struct pinctrl_ops imx_pinctrl_ops;
 #define ZERO_OFFSET_VALID	0x2
 #define CFG_IBE_OBE		0x4
 #define IMX8_USE_SCU		0x8
+#define IMX_USE_SCMI		0x10
 
 #define IOMUXC_CONFIG_SION	(0x1 << 4)
 
@@ -65,4 +67,13 @@ static inline int imx_pinctrl_scu_conf_pins(struct imx_pinctrl_soc_info *info,
 }
 #endif
 
+#ifdef CONFIG_PINCTRL_IMX_SCMI
+int imx_pinctrl_scmi_conf_pins(struct udevice *dev, u32 *pin_data, int npins);
+#else
+static inline int imx_pinctrl_scmi_conf_pins(struct udevice *dev, u32 *pin_data, int npins)
+{
+	return 0;
+}
+#endif
+
 #endif /* __DRIVERS_PINCTRL_IMX_H */
drivers/pinctrl/nxp/pinctrl-scmi.c new file +136 -0

136 lines not on this page · raw message

include/scmi_agent-uclass.h +2 -0
index 33e0e18c30d4ae4ddaaa2cb3830c03cd7a559cc0..4beec43cb080b14a777cac1cb0f18ef53433596c 100644
@@ -27,6 +27,7 @@ struct scmi_channel;
  * @clock_dev:		SCMI clock protocol device
  * @resetdom_dev:	SCMI reset domain protocol device
  * @voltagedom_dev:	SCMI voltage domain protocol device
+ * @pinctrl_dev:	SCMI pin control protocol device
  */
 struct scmi_agent_priv {
 	u32 version;
@@ -43,6 +44,7 @@ struct scmi_agent_priv {
 	struct udevice *clock_dev;
 	struct udevice *resetdom_dev;
 	struct udevice *voltagedom_dev;
+	struct udevice *pinctrl_dev;
 };
 
 static inline u32 scmi_version(struct udevice *dev)
include/scmi_protocols.h +34 -0
index 7abb2a6f36ba53223bd9103fcc02f58506fbfc8d..2367467512a6b65253317e51bea71de396aa96f9 100644
@@ -24,6 +24,7 @@ enum scmi_std_protocol {
 	SCMI_PROTOCOL_ID_SENSOR = 0x15,
 	SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16,
 	SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17,
+	SCMI_PROTOCOL_ID_PINCTRL = 0x19,
 };
 
 enum scmi_status_code {
@@ -1005,4 +1006,37 @@ struct scmi_voltd_level_get_out {
 	s32 voltage_level;
 };
 
+/* SCMI Pinctrl Protocol */
+enum scmi_pinctrl_message_id {
+	SCMI_MSG_PINCTRL_CONFIG_SET = 0x6
+};
+
+struct scmi_pin_config {
+	u32 type;
+	u32 val;
+};
+
+/**
+ * struct scmi_pad_config_set_in - Message payload for PAD_CONFIG_SET command
+ * @identifier:	Identifier for the pin or group.
+ * @function_id:	Identifier for the function selected to be enabled for the
+ * 					selected pin or group. This field is set to 0xFFFFFFFF if no
+ * 					function should be enabled by the pin or group.
+ * @attributes:	Bits[31:11] Reserved, must be zero.
+ * 				Bit[10] Function valid.
+ * 				Bits[9:2] Number of configurations to set.
+ * 				Bits[1:0] Selector: Whether the identifier field refers to a pin or a group.
+ * @configs:	Array of configurations.
+ */
+struct scmi_pinctrl_config_set_in {
+	u32 identifier;
+	u32 function_id;
+	u32 attributes;
+	struct scmi_pin_config configs[4];
+};
+
+struct scmi_pinctrl_config_set_out {
+	s32 status;
+};
+
 #endif /* _SCMI_PROTOCOLS_H */
Signature · 1 line
2.34.1
#21 lore raw

Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 5 lines · Alice Guo

From: Peng Fan <[email protected]>

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

What is the SCMI provider for this platform ?

Quoted 25 lines
drivers/firmware/scmi/scmi_agent-uclass.c +6 -0
index 8c907c3b0328095c4b35ba089ed608fcda48b567..5f101f4ede8b585f8c562a42886ea7be4ef09953 100644
@@ -97,6 +97,9 @@ struct udevice *scmi_get_protocol(struct udevice *dev,
  	case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
  		proto = priv->voltagedom_dev;
  		break;
+	case SCMI_PROTOCOL_ID_PINCTRL:
+		proto = priv->pinctrl_dev;
+		break;
  	default:
  		dev_err(dev, "Protocol not supported\n");
  		proto = NULL;
@@ -147,6 +150,9 @@ static int scmi_add_protocol(struct udevice *dev,
  	case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
  		priv->voltagedom_dev = proto;
  		break;
+	case SCMI_PROTOCOL_ID_PINCTRL:
+		priv->pinctrl_dev = proto;
+		break;
  	default:
  		dev_err(dev, "Protocol not supported\n");
  		return -EPROTO;

drivers/firmware/scmi/scmi_agent-uclass.c static int scmi_bind_protocols(struct udevice *dev) · line 448

Quoted 7 lines
drivers/firmware/scmi/scmi_agent-uclass.c +4 -0
@@ -436,6 +442,11 @@ static int scmi_bind_protocols(struct udevice *dev)
  				drv = DM_DRIVER_GET(scmi_voltage_domain);
  			}
  			break;
+		case SCMI_PROTOCOL_ID_PINCTRL:
+			if (IS_ENABLED(CONFIG_PINCTRL_IMX_SCMI) &&
+			    scmi_protocol_is_supported(dev, protocol_id))
+				drv = DM_DRIVER_GET(scmi_pinctrl_imx);

Generic code change, should be separate patch.

Quoted 4 lines
drivers/firmware/scmi/scmi_agent-uclass.c +1 -0
+			break;
  		default:
  			break;
  		}

...

Quoted 5 lines
drivers/pinctrl/nxp/Kconfig +0 -0
index 06c26f156f6c8f63204604d6065485629cfd9b61..0086f9825837bf568bd7633a21da860e410eeeee 100644

drivers/pinctrl/nxp/Kconfig line 9

Quoted 9 lines
drivers/pinctrl/nxp/Kconfig +6 -0
@@ -1,6 +1,19 @@
  config PINCTRL_IMX
  	bool
 
+config PINCTRL_IMX_SCMI
+	bool "IMX pinctrl SCMI driver"
+	depends on ARCH_IMX9 && PINCTRL_FULL
+	select PINCTRL_IMX
+	help
+	  Say Y here to enable the imx pinctrl scmi driver

Make sure the abbreviations like SCMI are always in capitals.

Quoted 45 lines
drivers/pinctrl/nxp/Kconfig +6 -0
+	  This provides a simple pinctrl driver for i.MX SoC which supports
+	  SCMI. This feature depends on device tree configuration. This driver
+	  is different from the linux one, this is a simple implementation,
+	  only parses the 'fsl,pins' property and configure related
+	  registers.
+
  config PINCTRL_IMX_SCU
  	bool
 
drivers/pinctrl/nxp/Makefile +1 -0
index f10aa6ef188e37583b181bdf9d70ac191e506d75..3ec3e2a9c6fdb875da4ae9bf151df5666256883b 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_PINCTRL_IMX6)		+= pinctrl-imx6.o
  obj-$(CONFIG_PINCTRL_IMX7)		+= pinctrl-imx7.o
  obj-$(CONFIG_PINCTRL_IMX7ULP)		+= pinctrl-imx7ulp.o
  obj-$(CONFIG_PINCTRL_IMX8ULP)		+= pinctrl-imx8ulp.o
+obj-$(CONFIG_PINCTRL_IMX_SCMI)		+= pinctrl-scmi.o
  obj-$(CONFIG_PINCTRL_IMX_SCU)		+= pinctrl-scu.o
  obj-$(CONFIG_PINCTRL_IMX8)		+= pinctrl-imx8.o
  obj-$(CONFIG_PINCTRL_IMX8M)		+= pinctrl-imx8m.o
drivers/pinctrl/nxp/pinctrl-imx.c +4 -1
index b1960c56b512cc113a810304dc3ac3f99b237a7e..3d53d0cd4b60c0685dd4c73c23e61cb712cda0ee 100644
@@ -1,6 +1,7 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
   * Copyright (C) 2016 Peng Fan <[email protected]>
+ * Copyright 2024 NXP
   */
 
  #include <malloc.h>
@@ -65,7 +66,9 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 
  	npins = size / pin_size;
 
-	if (info->flags & IMX8_USE_SCU) {
+	if (info->flags & IMX_USE_SCMI) {
+		return imx_pinctrl_scmi_conf_pins(dev, pin_data, npins);
+	} else if (info->flags & IMX8_USE_SCU) {
  		imx_pinctrl_scu_conf_pins(info, pin_data, npins);
  	} else {
  		/*

drivers/pinctrl/nxp/pinctrl-imx.c int imx_pinctrl_probe(struct udevice *dev, · line 222

Quoted 5 lines
drivers/pinctrl/nxp/pinctrl-imx.c +1 -1
@@ -216,7 +219,7 @@ int imx_pinctrl_probe(struct udevice *dev,
  	priv->dev = dev;
  	priv->info = info;
 
-	if (info->flags & IMX8_USE_SCU)
+	if ((info->flags & IMX8_USE_SCU) || (info->flags & IMX_USE_SCMI))

This works too:
if (info->flags & (IMX8_USE_SCU | IMX_USE_SCMI))

Quoted 24 lines
drivers/pinctrl/nxp/pinctrl-imx.c +0 -0
  		return 0;
 
  	addr = ofnode_get_addr_size_index(dev_ofnode(dev), 0, &size);
drivers/pinctrl/nxp/pinctrl-imx.h +2 -0
index fa4c084e2fc067fcb4e92c33312d4f430081fffd..b2f8865ded0ae380fc0156baa5eaea505c12f501 100644
@@ -1,6 +1,7 @@
  /* SPDX-License-Identifier: GPL-2.0+ */
  /*
   * Copyright (C) 2016 Peng Fan <[email protected]>
+ * Copyright 2024 NXP
   */
 
  #ifndef __DRIVERS_PINCTRL_IMX_H
@@ -47,6 +48,7 @@ extern const struct pinctrl_ops imx_pinctrl_ops;
  #define ZERO_OFFSET_VALID	0x2
  #define CFG_IBE_OBE		0x4
  #define IMX8_USE_SCU		0x8
+#define IMX_USE_SCMI		0x10
 
  #define IOMUXC_CONFIG_SION	(0x1 << 4)
 

drivers/pinctrl/nxp/pinctrl-imx.h static inline int imx_pinctrl_scu_conf_pins(struct imx_pinctrl_soc_info *info, · line 70

Quoted 4 lines
drivers/pinctrl/nxp/pinctrl-imx.h +1 -0
@@ -65,4 +67,13 @@ static inline int imx_pinctrl_scu_conf_pins(struct imx_pinctrl_soc_info *info,
  }
  #endif
 
+#ifdef CONFIG_PINCTRL_IMX_SCMI

Use IS_ENABLED() or CONFIG_IS_ENABLED()

Quoted 19 lines
drivers/pinctrl/nxp/pinctrl-imx.h +8 -0
+int imx_pinctrl_scmi_conf_pins(struct udevice *dev, u32 *pin_data, int npins);
+#else
+static inline int imx_pinctrl_scmi_conf_pins(struct udevice *dev, u32 *pin_data, int npins)
+{
+	return 0;
+}
+#endif
+
  #endif /* __DRIVERS_PINCTRL_IMX_H */
drivers/pinctrl/nxp/pinctrl-scmi.c new file +4 -0
new file mode 100644
index 0000000000000000000000000000000000000000..19b1b433a5ced0bb85e52f4d19bdeab2825f275e
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */

drivers/pinctrl/nxp/pinctrl-scmi.c line 14

Quoted 10 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +10 -0
+
+#include <dm.h>
+#include <dm/device_compat.h>
+#include <errno.h>
+#include <misc.h>
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include <asm/io.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <linux/bitops.h>

Keep the list sorted.

drivers/pinctrl/nxp/pinctrl-scmi.c line 18

Quoted 3 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +3 -0
+#include "pinctrl-imx.h"
+
+#if defined(CONFIG_IMX93)

Use IS_ENABLED() or CONFIG_IS_ENABLED()

drivers/pinctrl/nxp/pinctrl-scmi.c line 19

Quoted 1 line
drivers/pinctrl/nxp/pinctrl-scmi.c new file +1 -0
+#define DAISY_OFFSET	0x360

Why can this offset information not be queried from the firmware interface ?

Quoted 4 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +4 -0
+#endif
+#if defined(CONFIG_IMX95)
+#define DAISY_OFFSET	0x408
+#endif

[...]

#22 lore raw

回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 5 lines
Quoted 3 lines

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

What is the SCMI provider for this platform ?

Hi Marek,

System Manager which runs on M core sets pin or group configurations. U-Boot sends a SCMI message to System Manager to perform hardware operations. You can refer to the source code for details: https://github.com/nxp-imx/imx-sm.

Quoted 9 lines

drivers/pinctrl/nxp/pinctrl-scmi.c line 18

Quoted 3 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +3 -0
+#include "pinctrl-imx.h"
+
+#if defined(CONFIG_IMX93)

Use IS_ENABLED() or CONFIG_IS_ENABLED()

Quoted 1 line

+#define DAISY_OFFSET 0x360

Why can this offset information not be queried from the firmware interface ?

This offset information is not provided by System Manager. DAISY_OFFSET is used to convert the daisy register address in imx95-pinfunc.h for System Manager to use.

Best Regards,
Alice Guo

Quoted 5 lines
Quoted 4 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +4 -0
+#endif
+#if defined(CONFIG_IMX95)
+#define DAISY_OFFSET 0x408
+#endif

[...]

#23 lore raw

Re: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 9 lines · Alice Guo (OSS)
Quoted 5 lines
Quoted 3 lines

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

What is the SCMI provider for this platform ?

Hi Marek,

System Manager which runs on M core sets pin or group configurations. U-Boot sends a SCMI message to System Manager to perform hardware operations. You can refer to the source code for details: https://github.com/nxp-imx/imx-sm.

Can I use optee-os as a SCMI provider instead ?

Quoted 11 lines
Quoted 9 lines

drivers/pinctrl/nxp/pinctrl-scmi.c line 18

Quoted 3 lines
drivers/pinctrl/nxp/pinctrl-scmi.c new file +3 -0
+#include "pinctrl-imx.h"
+
+#if defined(CONFIG_IMX93)

Use IS_ENABLED() or CONFIG_IS_ENABLED()

Quoted 1 line

+#define DAISY_OFFSET 0x360

Why can this offset information not be queried from the firmware interface ?

This offset information is not provided by System Manager. DAISY_OFFSET is used to convert the daisy register address in imx95-pinfunc.h for System Manager to use.

OK

#24 lore raw

回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 21 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 4:46
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Peng Fan <[email protected]>; Ranjani Vaidyanathan <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 6 lines · Alice Guo (OSS)
Quoted 5 lines
Quoted 3 lines

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

What is the SCMI provider for this platform ?

Quoted 8 lines
Quoted 3 lines

Hi Marek,

System Manager which runs on M core sets pin or group configurations.

U-Boot sends a SCMI message to System Manager to perform hardware operations. You can refer to the source code for details:
https://github.com/nxp-imx/imx-sm.

Can I use optee-os as a SCMI provider instead ?

You cannot replace System Manager with optee-os.

#25 lore raw

Re: 回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 23 lines · Alice Guo (OSS)
Quoted 23 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 4:46
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]> 抄送: [email protected]; [email protected]; Peng Fan <[email protected]>; Ranjani Vaidyanathan <[email protected]>; Ye Li <[email protected]>
主题: Re: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 8 lines · Alice Guo (OSS)
Quoted 5 lines
Quoted 3 lines

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management Interface (SCMI) 3.2. Currently, only the PINCTRL_CONFIG_SET command is implemented.

What is the SCMI provider for this platform ?

Hi Marek,

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

System Manager which runs on M core sets pin or group configurations.

U-Boot sends a SCMI message to System Manager to perform hardware operations. You can refer to the source code for details:
https://github.com/nxp-imx/imx-sm.

Can I use optee-os as a SCMI provider instead ?

You cannot replace System Manager with optee-os.

I think optee-os is also capable of being SCMI provider, so I have to wonder, why does NXP use custom hand-written SCMI provider instead of something already available, like that optee-os ?

And one more question, would it be possible to make U-Boot NOT depend on SCMI at all and instead have regular clock/pinctrl drivers which can configure the hardware using plain register writes, like it is done on MX8M and older SoCs ? That would surely make hardware bring up easier .

#26 lore raw

RE: 回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 49 lines

Subject: Re: 回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 5 lines · Alice Guo (OSS)
Quoted 5 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月7日 4:46
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio

Estevam

Quoted 1 line
Quoted 1 line

<[email protected]>; dl-uboot-imx <[email protected]>;

Lukasz

Quoted 1 line
Quoted 1 line

Majewski <[email protected]>; Sean Anderson

<[email protected]>; Simon

Quoted 1 line
Quoted 1 line

Glass <[email protected]>; Alper Nebi Yasak

<[email protected]>

Quoted 4 lines
Quoted 4 lines

抄送: [email protected]; [email protected]; Peng Fan <[email protected]>; Ranjani Vaidyanathan <[email protected]>; Ye Li <[email protected]> 主题: Re: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI

pin

Quoted 5 lines
Quoted 5 lines

control protocol driver

Quoted 2 lines · Alice Guo (OSS)
Quoted 2 lines
Quoted 2 lines

This patch provides a driver for the SCMI pin control protocol which is based on ARM's System Control and Management

Interface (SCMI) 3.2.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Currently, only the PINCTRL_CONFIG_SET command is

implemented.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

What is the SCMI provider for this platform ?

Hi Marek,

System Manager which runs on M core sets pin or group

configurations.

Quoted 1 line
Quoted 1 line

U-Boot sends a SCMI message to System Manager to perform

hardware

Quoted 2 lines
Quoted 2 lines

operations. You can refer to the source code for details:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
github.com%2Fnxp-imx%2Fimx- sm&data=05%7C02%7Cpeng.fan%40nxp.com%7Cce165372497b40c20 3b408dd2f0df2fc%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C 0%7C638718459160955158%7CUnknown%7CTWFpbGZsb3d8eyJFbXB 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoi TWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=LMKHHdAJpBC iaHbrVIw1fg9Y%2FbqC7mWOUDfan00gItw%3D&reserved=0.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Can I use optee-os as a SCMI provider instead ?

You cannot replace System Manager with optee-os.

I think optee-os is also capable of being SCMI provider, so I have to wonder, why does NXP use custom hand-written SCMI provider instead of something already available, like that optee-os ?

System controller is the central controller of the system, and i.MX95 needs support safety.

We need to make sure when A55 crashes, safety core still work properly.

Quoted 5 lines

And one more question, would it be possible to make U-Boot NOT depend on SCMI at all and instead have regular clock/pinctrl drivers which can configure the hardware using plain register writes, like it is done on MX8M and older SoCs ?

See https://www.nxp.com/docs/en/data-sheet/IMX95CEC.pdf
Only one boot mode:
Low Power Boot (LPB): only M33 core is running after POR

You may configure TRDC to assign resources to A55, but you still need to make sure M33 work proper.

Regards,
Peng.

That would surely make hardware

Quoted 1 line

bring up easier .

#27 lore raw

Re: 回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

On 1/7/25 1:11 PM, Peng Fan wrote:

[...]

Quoted 11 lines
Quoted 5 lines
Quoted 1 line

You cannot replace System Manager with optee-os.

I think optee-os is also capable of being SCMI provider, so I have to wonder, why does NXP use custom hand-written SCMI provider instead of something already available, like that optee-os ?

System controller is the central controller of the system, and i.MX95 needs support safety.

We need to make sure when A55 crashes, safety core still work properly.

I think we are conflating two separate functionalities here:

- SM as the always-running monitor software
- SM as the SCMI provider

... please read on ...

Quoted 8 lines
Quoted 4 lines

And one more question, would it be possible to make U-Boot NOT depend on SCMI at all and instead have regular clock/pinctrl drivers which can configure the hardware using plain register writes, like it is done on MX8M and older SoCs ?

See https://www.nxp.com/docs/en/data-sheet/IMX95CEC.pdf
Only one boot mode:
Low Power Boot (LPB): only M33 core is running after POR

OK

Quoted 2 lines

You may configure TRDC to assign resources to A55, but you still need to make sure M33 work proper.

... so, I wonder, can the M33 act as SM, and can U-Boot configure whatever it needs via plain register writes, without having to rely on SCMI ?

#28 lore raw

Re: 回复: 回复: [EXT] Re: [PATCH v3 03/17] pinctrl: nxp: add SCMI pin control protocol driver

Quoted 32 lines · Marek Vasut

On 1/7/25 1:11 PM, Peng Fan wrote:

[...]

Quoted 11 lines
Quoted 5 lines
Quoted 1 line

You cannot replace System Manager with optee-os.

I think optee-os is also capable of being SCMI provider, so I have to wonder, why does NXP use custom hand-written SCMI provider instead of something already available, like that optee-os ?

System controller is the central controller of the system, and i.MX95 needs support safety.

We need to make sure when A55 crashes, safety core still work properly.

I think we are conflating two separate functionalities here:

- SM as the always-running monitor software
- SM as the SCMI provider

... please read on ...

Quoted 8 lines
Quoted 4 lines

And one more question, would it be possible to make U-Boot NOT depend on SCMI at all and instead have regular clock/pinctrl drivers which can configure the hardware using plain register writes, like it is done on MX8M and older SoCs ?

See https://www.nxp.com/docs/en/data-sheet/IMX95CEC.pdf
Only one boot mode:
Low Power Boot (LPB): only M33 core is running after POR

Quoted 6 lines

OK

Quoted 2 lines

You may configure TRDC to assign resources to A55, but you still need to make sure M33 work proper.

... so, I wonder, can the M33 act as SM, and can U-Boot configure whatever it needs via plain register writes, without having to rely on SCMI ?

Technically yes for prototype building, except TRDC and other secure periphrals.

Regards,
Peng

author
#29 lore raw

PATCH v3 4/17 scmi_protocols: add SCMI misc protocol protocol_id and message_id for getting the ROM passover data

In reply to Alice Guo

From: Peng Fan <[email protected]>

SCMI misc protocol is intended for miscellaneous functions which are device specific and are usually defined to access bit fields. This patch adds SCMI misc protocol protocol_id and message_id for getting the ROM passover data.

---
 include/scmi_protocols.h | 5 +++++
 1 file changed, 5 insertions(+)
include/scmi_protocols.h +5 -0
index 2367467512a6b65253317e51bea71de396aa96f9..6cda1f00df1f6baf6db65a28b4cab114f8540a4b 100644
@@ -25,6 +25,7 @@ enum scmi_std_protocol {
 	SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16,
 	SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17,
 	SCMI_PROTOCOL_ID_PINCTRL = 0x19,
+	SCMI_PROTOCOL_ID_IMX_MISC = 0x84,
 };
 
 enum scmi_status_code {
@@ -50,6 +51,10 @@ enum scmi_discovery_id {
 	SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
 };
 
+enum scmi_imx_misc_message_id {
+	SCMI_MISC_ROM_PASSOVER_GET = 0x7
+};
+
 /*
  * SCMI Base Protocol
  */
Signature · 1 line
2.34.1
author
#30 lore raw

PATCH v3 5/17 scmi_protocols: add SCMI Performance domain management protocol message IDs

In reply to Alice Guo

From: Peng Fan <[email protected]>

SCMI Performance domain management protocol is intended for performance management of groups of devices or APs that run in the same performance domain. The functionality provided by the callee-side can be used by passing the corresponding message_id.

---
 include/scmi_protocols.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
include/scmi_protocols.h +18 -0
index 6cda1f00df1f6baf6db65a28b4cab114f8540a4b..08c86a642844570424dddbfcf9670d1e6757d8d1 100644
@@ -1044,4 +1044,22 @@ struct scmi_pinctrl_config_set_out {
 	s32 status;
 };
 
+/* SCMI Perf Protocol */
+enum scmi_perf_message_id {
+	SCMI_PERF_DOMAIN_ATTRIBUTES = 0x3,
+	SCMI_PERF_DESCRIBE_LEVELS = 0x4,
+	SCMI_PERF_LIMITS_SET = 0x5,
+	SCMI_PERF_LIMITS_GET = 0x6,
+	SCMI_PERF_LEVEL_SET = 0x7,
+	SCMI_PERF_LEVEL_GET = 0x8
+};
+
+struct scmi_perf_in {
+	u32 domain_id;
+	u32 perf_level;
+};
+
+struct scmi_perf_out {
+	s32 status;
+};
 #endif /* _SCMI_PROTOCOLS_H */
Signature · 1 line
2.34.1
author
#31 lore raw

PATCH v3 6/17 clk: scmi: add the command CLOCK_PARENT_SET

In reply to Alice Guo

From: Peng Fan <[email protected]>

This patch adds the command CLOCK_PARENT_SET that can be used to set the parent of a clock. ARM SCMI Version 3.2 supports to change the parent of a clock device.

---
 drivers/clk/clk_scmi.c   | 20 ++++++++++++++++++++
 include/scmi_protocols.h | 19 +++++++++++++++++++
 2 files changed, 39 insertions(+)
drivers/clk/clk_scmi.c +20 -0
index e42d2032d45e011b751c19b395b6f99d5c54e78e..84333cdd0ccfe566c269f776f39725c69883c25c 100644
@@ -178,11 +178,31 @@ static int scmi_clk_probe(struct udevice *dev)
 	return 0;
 }
 
+static int scmi_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	struct scmi_clk_parent_set_in in = {
+		.clock_id = clk->id,
+		.parent_clk = parent->id,
+	};
+	struct scmi_clk_parent_set_out out;
+	struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
+					  SCMI_CLOCK_PARENT_SET,
+					  in, out);
+	int ret;
+
+	ret = devm_scmi_process_msg(clk->dev, &msg);
+	if (ret < 0)
+		return ret;
+
+	return scmi_to_linux_errno(out.status);
+}
+
 static const struct clk_ops scmi_clk_ops = {
 	.enable = scmi_clk_enable,
 	.disable = scmi_clk_disable,
 	.get_rate = scmi_clk_get_rate,
 	.set_rate = scmi_clk_set_rate,
+	.set_parent = scmi_clk_set_parent,
 };
 
 U_BOOT_DRIVER(scmi_clock) = {
include/scmi_protocols.h +19 -0
index 08c86a642844570424dddbfcf9670d1e6757d8d1..d529f8e2697472e60d0cb9c275f34ef0ecaed3ca 100644
@@ -737,6 +737,7 @@ enum scmi_clock_message_id {
 	SCMI_CLOCK_RATE_SET = 0x5,
 	SCMI_CLOCK_RATE_GET = 0x6,
 	SCMI_CLOCK_CONFIG_SET = 0x7,
+	SCMI_CLOCK_PARENT_SET = 0xD
 };
 
 #define SCMI_CLK_PROTO_ATTR_COUNT_MASK	GENMASK(15, 0)
@@ -839,6 +840,24 @@ struct scmi_clk_rate_set_out {
 	s32 status;
 };
 
+/**
+ * struct scmi_clk_parent_state_in - Message payload for CLOCK_PARENT_SET command
+ * @clock_id:		SCMI clock ID
+ * @parent_clk:		SCMI clock ID
+ */
+struct scmi_clk_parent_set_in {
+	u32 clock_id;
+	u32 parent_clk;
+};
+
+/**
+ * struct scmi_clk_parent_set_out - Response payload for CLOCK_PARENT_SET command
+ * @status:	SCMI command status
+ */
+struct scmi_clk_parent_set_out {
+	s32 status;
+};
+
 /*
  * SCMI Reset Domain Protocol
  */
Signature · 1 line
2.34.1
author
#32 lore raw

PATCH v3 7/17 clk: scmi: check the clock state/parent/rate control permissions

In reply to Alice Guo

From: Ye Li <[email protected]>

SCMI clock management protocol driver in Linux checks clock state, parent and rate control permissions. To be consistent with the kernel driver, add this check here.

When using common clock framework (CCF), use the clock signal ID to get the clock registered by clk_register() in scmi_clk_probe(), and then obatin the struct clk_scmi variable with container_of().

---
 arch/sandbox/include/asm/scmi_test.h       |   2 +
 drivers/clk/clk_scmi.c                     | 173 +++++++++++++++++++++++++++--
 drivers/firmware/scmi/sandbox-scmi_agent.c |  56 +++++++++-
 include/scmi_protocols.h                   |  26 ++++-
 4 files changed, 243 insertions(+), 14 deletions(-)
arch/sandbox/include/asm/scmi_test.h +2 -0
index 619f8f5098cdd82ba2343897166c34c82c753422..b30e536a35771ec3e1439c1e64fd09de3728dc50 100644
@@ -27,10 +27,12 @@ struct sandbox_scmi_pwd {
  * @id:		Identifier of the clock used in the SCMI protocol
  * @enabled:	Clock state: true if enabled, false if disabled
  * @rate:	Clock rate in Hertz
+ * @perm:	Indicating state/parent/rate permission
  */
 struct sandbox_scmi_clk {
 	bool enabled;
 	ulong rate;
+	u32 perm;
 };
 
 /**
drivers/clk/clk_scmi.c +163 -10

244 lines not on this page · raw message

drivers/firmware/scmi/sandbox-scmi_agent.c +53 -3

92 lines not on this page · raw message

include/scmi_protocols.h +25 -1
index d529f8e2697472e60d0cb9c275f34ef0ecaed3ca..9607433c3276f9aa18044c414a5bde3143726cf4 100644
@@ -731,13 +731,15 @@ int scmi_pwd_name_get(struct udevice *dev, u32 domain_id, u8 **name);
 /*
  * SCMI Clock Protocol
  */
+#define CLOCK_PROTOCOL_VERSION_3_0	0x30000
 
 enum scmi_clock_message_id {
 	SCMI_CLOCK_ATTRIBUTES = 0x3,
 	SCMI_CLOCK_RATE_SET = 0x5,
 	SCMI_CLOCK_RATE_GET = 0x6,
 	SCMI_CLOCK_CONFIG_SET = 0x7,
-	SCMI_CLOCK_PARENT_SET = 0xD
+	SCMI_CLOCK_PARENT_SET = 0xD,
+	SCMI_CLOCK_GET_PERMISSIONS = 0xF
 };
 
 #define SCMI_CLK_PROTO_ATTR_COUNT_MASK	GENMASK(15, 0)
@@ -776,6 +778,7 @@ struct scmi_clk_attribute_in {
 struct scmi_clk_attribute_out {
 	s32 status;
 	u32 attributes;
+#define CLK_HAS_RESTRICTIONS(x)	((x) & BIT(1))
 	char clock_name[SCMI_CLOCK_NAME_LENGTH_MAX];
 };
 
@@ -858,6 +861,27 @@ struct scmi_clk_parent_set_out {
 	s32 status;
 };
 
+/**
+ * @clock_id:	Identifier for the clock device.
+ */
+struct scmi_clk_get_permissions_in {
+	u32 clock_id;
+};
+
+/**
+ * @status:	Negative 32-bit integers are used to return error status codes.
+ * @permissions:	Bit[31] Clock state control, Bit[30] Clock parent control,
+ * 					Bit[29] Clock rate control, Bits[28:0] Reserved, must be zero
+ */
+struct scmi_clk_get_permissions_out {
+	s32 status;
+	u32 permissions;
+};
+
+#define SUPPORT_CLK_STAT_CONTROL	BIT(31)
+#define SUPPORT_CLK_PARENT_CONTROL	BIT(30)
+#define SUPPORT_CLK_RATE_CONTROL	BIT(29)
+
 /*
  * SCMI Reset Domain Protocol
  */
Signature · 1 line
2.34.1
#33 lore raw

Re: [PATCH v3 07/17] clk: scmi: check the clock state/parent/rate control permissions

Quoted 10 lines · Alice Guo

From: Ye Li <[email protected]>

SCMI clock management protocol driver in Linux checks clock state, parent and rate control permissions. To be consistent with the kernel driver, add this check here.

When using common clock framework (CCF), use the clock signal ID to get the clock registered by clk_register() in scmi_clk_probe(), and then obatin the struct clk_scmi variable with container_of().

Quoted 8 lines
---
  arch/sandbox/include/asm/scmi_test.h       |   2 +
  drivers/clk/clk_scmi.c                     | 173 +++++++++++++++++++++++++++--
  drivers/firmware/scmi/sandbox-scmi_agent.c |  56 +++++++++-
  include/scmi_protocols.h                   |  26 ++++-

Please split common/imx/sandbox changes into separate patches .

#34 lore raw

回复: [EXT] Re: [PATCH v3 07/17] clk: scmi: check the clock state/parent/rate control permissions

Quoted 14 lines
Quoted 8 lines

SCMI clock management protocol driver in Linux checks clock state, parent and rate control permissions. To be consistent with the kernel driver, add this check here.

When using common clock framework (CCF), use the clock signal ID to get the clock registered by clk_register() in scmi_clk_probe(), and then obatin the struct clk_scmi variable with container_of().

Quoted 6 lines
---
  arch/sandbox/include/asm/scmi_test.h       |   2 +
  drivers/clk/clk_scmi.c                     | 173
Quoted 4 lines

+++++++++++++++++++++++++++--

Quoted 2 lines
  drivers/firmware/scmi/sandbox-scmi_agent.c |  56 +++++++++-
  include/scmi_protocols.h                   |  26 ++++-

Please split common/imx/sandbox changes into separate patches .

Spliting common/imx/sandbox changes into separate patches will cause bisect issue.

#35 lore raw

Re: 回复: [EXT] Re: [PATCH v3 07/17] clk: scmi: check the clock state/parent/rate control permissions

Quoted 14 lines · Alice Guo (OSS)
Quoted 14 lines
Quoted 14 lines

SCMI clock management protocol driver in Linux checks clock state, parent and rate control permissions. To be consistent with the kernel driver, add this check here.

When using common clock framework (CCF), use the clock signal ID to get the clock registered by clk_register() in scmi_clk_probe(), and then obatin the struct clk_scmi variable with container_of().

---
   arch/sandbox/include/asm/scmi_test.h       |   2 +
   drivers/clk/clk_scmi.c                     | 173
Quoted 6 lines
Quoted 4 lines

+++++++++++++++++++++++++++--

Quoted 2 lines
   drivers/firmware/scmi/sandbox-scmi_agent.c |  56 +++++++++-
   include/scmi_protocols.h                   |  26 ++++-

Please split common/imx/sandbox changes into separate patches .

Spliting common/imx/sandbox changes into separate patches will cause bisect issue.

How so ?

author
#36 lore raw

PATCH v3 8/17 scmi_protocols: update struct scmi_base_discover_list_protocols_out

In reply to Alice Guo

From: Ye Li <[email protected]>

@protocols is an array of protocol identifiers that are implemented, excluding the Base protocol. The number of elements of @protocols is specified by callee-side. Currently, set it to 4 is enough for i.MX95.

---
 include/scmi_protocols.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/scmi_protocols.h +4 -1
index 9607433c3276f9aa18044c414a5bde3143726cf4..3c55d228cb641bc6c0e5ca7ac885efe84b41c66d 100644
@@ -141,11 +141,14 @@ struct scmi_base_discover_impl_version_out {
  * @status:		SCMI command status
  * @num_protocols:	Number of SCMI protocols in @protocol
  * @protocols:		Array of packed SCMI protocol ID's
+ *
+ * The number of elements of @protocols is specified by callee-side. Currently,
+ * set it to 4 is enough for i.MX95.
  */
 struct scmi_base_discover_list_protocols_out {
 	s32 status;
 	u32 num_protocols;
-	u32 protocols[3];
+	u32 protocols[4];
 };
 
 /**
Signature · 1 line
2.34.1
#37 lore raw

Re: [PATCH v3 08/17] scmi_protocols: update struct scmi_base_discover_list_protocols_out

Quoted 19 lines · Alice Guo

From: Ye Li <[email protected]>

@protocols is an array of protocol identifiers that are implemented, excluding the Base protocol. The number of elements of @protocols is specified by callee-side. Currently, set it to 4 is enough for i.MX95.

---
  include/scmi_protocols.h | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
include/scmi_protocols.h +0 -0
index 9607433c3276f9aa18044c414a5bde3143726cf4..3c55d228cb641bc6c0e5ca7ac885efe84b41c66d 100644
@@ -141,11 +141,14 @@ struct scmi_base_discover_impl_version_out {
   * @status:		SCMI command status
   * @num_protocols:	Number of SCMI protocols in @protocol

include/scmi_protocols.h struct scmi_base_discover_impl_version_out { · line 151

Quoted 10 lines
include/scmi_protocols.h +4 -1
   * @protocols:		Array of packed SCMI protocol ID's
+ *
+ * The number of elements of @protocols is specified by callee-side. Currently,
+ * set it to 4 is enough for i.MX95.
   */
  struct scmi_base_discover_list_protocols_out {
  	s32 status;
  	u32 num_protocols;
-	u32 protocols[3];
+	u32 protocols[4];

Can this be made somehow future-proof? For example, figure out how many protocols are supported, and then malloc this structure with the right size and query again ?

#38 lore raw

回复: [EXT] Re: [PATCH v3 08/17] scmi_protocols: update struct scmi_base_discover_list_protocols_out

Quoted 9 lines
Quoted 9 lines
include/scmi_protocols.h +4 -0
@@ -141,11 +141,14 @@ struct scmi_base_discover_impl_version_out {
   * @status:         SCMI command status
   * @num_protocols:  Number of SCMI protocols in @protocol
   * @protocols:              Array of packed SCMI protocol ID's
+ *
+ * The number of elements of @protocols is specified by callee-side.
+ Currently,
+ * set it to 4 is enough for i.MX95.
   */
Quoted 8 lines

include/scmi_protocols.h struct scmi_base_discover_impl_version_out { · line 151

Quoted 5 lines
include/scmi_protocols.h +1 -1
  struct scmi_base_discover_list_protocols_out {
      s32 status;
      u32 num_protocols;
-     u32 protocols[3];
+     u32 protocols[4];

Can this be made somehow future-proof? For example, figure out how many protocols are supported, and then malloc this structure with the right size and query again ?

Hi Marek,

Currently, 4 is enough. 10 protocols are defined in Arm® System Control and Management Interface Platform Design Document Version 3.2. I can make a new patch as you said in the future.

Best Regards,
Alice Guo

#39 lore raw

Re: 回复: [EXT] Re: [PATCH v3 08/17] scmi_protocols: update struct scmi_base_discover_list_protocols_out

Quoted 18 lines · Alice Guo (OSS)
Quoted 9 lines
Quoted 9 lines
include/scmi_protocols.h +4 -0
@@ -141,11 +141,14 @@ struct scmi_base_discover_impl_version_out {
    * @status:         SCMI command status
    * @num_protocols:  Number of SCMI protocols in @protocol
    * @protocols:              Array of packed SCMI protocol ID's
+ *
+ * The number of elements of @protocols is specified by callee-side.
+ Currently,
+ * set it to 4 is enough for i.MX95.
    */
Quoted 8 lines

include/scmi_protocols.h struct scmi_base_discover_impl_version_out { · line 151

Quoted 5 lines
include/scmi_protocols.h +1 -1
   struct scmi_base_discover_list_protocols_out {
       s32 status;
       u32 num_protocols;
-     u32 protocols[3];
+     u32 protocols[4];

Can this be made somehow future-proof? For example, figure out how many protocols are supported, and then malloc this structure with the right size and query again ?

Quoted 3 lines

Hi Marek,

Currently, 4 is enough. 10 protocols are defined in Arm® System Control and Management Interface Platform Design Document Version 3.2. I can make a new patch as you said in the future.

Or we can future-proof it to 10 right now. Are there any downsides of that ?

author
#40 lore raw

PATCH v3 9/17 imx9: scmi: add i.MX95 SoC and clock related code

In reply to Alice Guo

From: Peng Fan <[email protected]>

This patch adds i.MX95 SoC and clock related code. Because they are based on SCMI, put them in the scmi subfolder.

---
 arch/arm/include/asm/arch-imx/cpu.h        |   3 +
 arch/arm/include/asm/arch-imx9/clock.h     |  10 +-
 arch/arm/include/asm/arch-imx9/imx-regs.h  |   7 +-
 arch/arm/include/asm/arch-imx9/sys_proto.h |   3 +-
 arch/arm/include/asm/mach-imx/sys_proto.h  |  40 ++
 arch/arm/mach-imx/imx9/scmi/Makefile       |   6 +
 arch/arm/mach-imx/imx9/scmi/clock.c        | 328 ++++++++++++
 arch/arm/mach-imx/imx9/scmi/clock_scmi.c   | 148 +++++
 arch/arm/mach-imx/imx9/scmi/soc.c          | 832 +++++++++++++++++++++++++++++
 9 files changed, 1373 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-imx/cpu.h +3 -0
index 0d7a573461690046b27498c7174459110a73689c..b283c49afec83cbed670d07ad0909ad6f453853b 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * (C) Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2024 NXP
  */
 
 #define MXC_CPU_MX23		0x23
@@ -76,6 +77,8 @@
 #define MXC_CPU_IMX9111		0xCD /* dummy ID */
 #define MXC_CPU_IMX9101		0xCE /* dummy ID */
 
+#define MXC_CPU_IMX95		0x1C1 /* dummy ID */
+
 #define MXC_SOC_MX6		0x60
 #define MXC_SOC_MX7		0x70
 #define MXC_SOC_IMX8M		0x80
arch/arm/include/asm/arch-imx9/clock.h +8 -2
index 60d48b13b11f274c9e4c8caf20954de0431d9d6a..a64c18b28291553d47725d83cb748031faf64488 100644
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2022 NXP
+ * Copyright 2024 NXP
  *
- * Peng Fan <peng.fan at nxp.com>
+ * Peng Fan <[email protected]>
  */
 
 #ifndef __CLOCK_IMX9__
@@ -255,5 +255,11 @@ int ccm_shared_gpr_tz_access(u32 gpr, bool non_secure, bool user_mode, bool lock
 void enable_usboh3_clk(unsigned char enable);
 int set_clk_enet(enum enet_freq type);
 int set_clk_eqos(enum enet_freq type);
+int set_clk_netc(enum enet_freq type);
 void set_arm_clk(ulong freq);
+
+int imx_clk_scmi_enable(u32 clock_id, bool enable);
+ulong imx_clk_scmi_set_rate(u32 clock_id, ulong rate);
+ulong imx_clk_scmi_get_rate(u32 clock_id);
+int imx_clk_scmi_set_parent(u32 clock_id, u32 parent_id);
 #endif
arch/arm/include/asm/arch-imx9/imx-regs.h +6 -1
index ef9538bd42e8b2972d7e6829a402bc4f661e3cbb..5512d66ee0a44348845d2a559bd99327115bc1d0 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2022 NXP
+ * Copyright 2024 NXP
  */
 
 #ifndef __ASM_ARCH_IMX9_REGS_H__
@@ -20,6 +20,11 @@
 #define WDG4_BASE_ADDR      0x424a0000UL
 #define WDG5_BASE_ADDR      0x424b0000UL
 
+#define GPIO2_BASE_ADDR	    0x43810000UL
+#define GPIO3_BASE_ADDR	    0x43820000UL
+#define GPIO4_BASE_ADDR	    0x43840000UL
+#define GPIO5_BASE_ADDR	    0x43850000UL
+
 #define FSB_BASE_ADDR       0x47510000UL
 
 #define ANATOP_BASE_ADDR    0x44480000UL
arch/arm/include/asm/arch-imx9/sys_proto.h +2 -1
index e4bf6a63424f7c54c1dcdf6b882a908940e5fdb1..aac43c74a44a127549c67059e70f570aae5f680c 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright (C) 2022 NXP
+ * Copyright (C) 2024 NXP
  */
 
 #ifndef __ARCH_IMX9_SYS_PROTO_H
@@ -12,6 +12,7 @@ enum imx9_soc_voltage_mode {
 	VOLT_LOW_DRIVE = 0,
 	VOLT_NOMINAL_DRIVE,
 	VOLT_OVER_DRIVE,
+	VOLT_SUPER_OVER_DRIVE,
 };
 
 void soc_power_init(void);
arch/arm/include/asm/mach-imx/sys_proto.h +40 -0
index 109a806852ab42d018ce45a4e96af5b57adb6a9c..bcf33769ae5f45125bbf9377eb64d96473dc4996 100644
@@ -2,6 +2,7 @@
 /*
  * (C) Copyright 2009
  * Stefano Babic, DENX Software Engineering, [email protected].
+ * Copyright 2024 NXP
  */
 
 #ifndef _SYS_PROTO_H_
@@ -97,6 +98,8 @@ struct bd_info;
 #define is_imx9302() (is_cpu_type(MXC_CPU_IMX9302))
 #define is_imx9301() (is_cpu_type(MXC_CPU_IMX9301))
 
+#define is_imx95() (is_cpu_type(MXC_CPU_IMX95))
+
 #define is_imx9121() (is_cpu_type(MXC_CPU_IMX9121))
 #define is_imx9111() (is_cpu_type(MXC_CPU_IMX9111))
 #define is_imx9101() (is_cpu_type(MXC_CPU_IMX9101))
@@ -216,6 +219,43 @@ ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev);
 u32 rom_api_download_image(u8 *dest, u32 offset, u32 size);
 u32 rom_api_query_boot_infor(u32 info_type, u32 *info);
 
+#ifdef CONFIG_SCMI_FIRMWARE
+typedef struct rom_passover {
+	uint16_t tag;                   //!< Tag
+	uint8_t  len;                   //!< Fixed value of 0x80
+	uint8_t  ver;                   //!< Version
+	uint32_t boot_mode;             //!< Boot mode
+	uint32_t card_addr_mode;        //!< SD card address mode
+	uint32_t bad_blks_of_img_set0;  //!< NAND bad block count skipped 1
+	uint32_t ap_mu_id;              //!< AP MU ID
+	uint32_t bad_blks_of_img_set1;  //!< NAND bad block count skipped 1
+	uint8_t  boot_stage;            //!< Boot stage
+	uint8_t  img_set_sel;           //!< Image set booted from
+	uint8_t  rsv0[2];               //!< Reserved
+	uint32_t img_set_end;           //!< Offset of Image End
+	uint32_t rom_version;           //!< ROM version
+	uint8_t  boot_dev_state;        //!< Boot device state
+	uint8_t  boot_dev_inst;         //!< Boot device type
+	uint8_t  boot_dev_type;         //!< Boot device instance
+	uint8_t  rsv1;                  //!< Reserved
+	uint32_t dev_page_size;         //!< Boot device page size
+	uint32_t cnt_header_ofs;        //!< Container header offset
+	uint32_t img_ofs;               //!< Image offset
+}  __attribute__ ((packed)) rom_passover_t;
+
+/**
+ * struct scmi_rom_passover_out - Response payload for ROM_PASSOVER_GET command
+ * @status:	SCMI clock ID
+ * @attributes:	Attributes of the targets clock state
+ */
+struct scmi_rom_passover_get_out {
+	u32 status;
+	u32 numPassover;
+	u32 passover[(sizeof(rom_passover_t) + 8) / 4];
+};
+
+#endif
+
 /* For i.MX ULP */
 #define BT0CFG_LPBOOT_MASK	0x1
 #define BT0CFG_DUALBOOT_MASK	0x2
arch/arm/mach-imx/imx9/scmi/Makefile new file +6 -0
new file mode 100644
index 0000000000000000000000000000000000000000..78f24c6e5151e2d7280b9c456c0477a3b6a958c4
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2024 NXP
+
+obj-y += soc.o
+obj-y += clock_scmi.o clock.o
arch/arm/mach-imx/imx9/scmi/clock.c new file +328 -0

328 lines not on this page · raw message

arch/arm/mach-imx/imx9/scmi/clock_scmi.c new file +148 -0

148 lines not on this page · raw message

arch/arm/mach-imx/imx9/scmi/soc.c new file +832 -0

832 lines not on this page · raw message

Signature · 1 line
2.34.1
#41 lore raw

Re: [PATCH v3 09/17] imx9: scmi: add i.MX95 SoC and clock related code

On 1/3/25 7:45 AM, Alice Guo wrote:

[...]

arch/arm/include/asm/arch-imx9/clock.h line 3

Quoted 9 lines
arch/arm/include/asm/arch-imx9/clock.h +1 -1
index 60d48b13b11f274c9e4c8caf20954de0431d9d6a..a64c18b28291553d47725d83cb748031faf64488 100644
@@ -1,8 +1,8 @@
  /* SPDX-License-Identifier: GPL-2.0+ */
  /*
- * Copyright 2022 NXP
+ * Copyright 2024 NXP

2022-2024

arch/arm/include/asm/arch-imx9/clock.h line 5

Quoted 2 lines
arch/arm/include/asm/arch-imx9/clock.h +1 -1
- * Peng Fan <peng.fan at nxp.com>
+ * Peng Fan <[email protected]>

Is the email update desirable ?

[...]

Quoted 22 lines
arch/arm/include/asm/mach-imx/sys_proto.h +3 -0
index 109a806852ab42d018ce45a4e96af5b57adb6a9c..bcf33769ae5f45125bbf9377eb64d96473dc4996 100644
@@ -2,6 +2,7 @@
  /*
   * (C) Copyright 2009
   * Stefano Babic, DENX Software Engineering, [email protected].
+ * Copyright 2024 NXP
   */
 
  #ifndef _SYS_PROTO_H_
@@ -97,6 +98,8 @@ struct bd_info;
  #define is_imx9302() (is_cpu_type(MXC_CPU_IMX9302))
  #define is_imx9301() (is_cpu_type(MXC_CPU_IMX9301))
 
+#define is_imx95() (is_cpu_type(MXC_CPU_IMX95))
+
  #define is_imx9121() (is_cpu_type(MXC_CPU_IMX9121))
  #define is_imx9111() (is_cpu_type(MXC_CPU_IMX9111))
  #define is_imx9101() (is_cpu_type(MXC_CPU_IMX9101))

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 222

Quoted 4 lines
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
@@ -216,6 +219,43 @@ ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev);
  u32 rom_api_download_image(u8 *dest, u32 offset, u32 size);
  u32 rom_api_query_boot_infor(u32 info_type, u32 *info);
 
+#ifdef CONFIG_SCMI_FIRMWARE

Avoid typedefs

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 223

Quoted 1 line
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+typedef struct rom_passover {

Use uN types instead of uintN_t ...

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 224

Quoted 1 line
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+	uint16_t tag;                   //!< Tag

u16

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 225

Quoted 1 line
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+	uint8_t  len;                   //!< Fixed value of 0x80

u8 and so on ...

Quoted 8 lines
arch/arm/include/asm/mach-imx/sys_proto.h +8 -0
+	uint8_t  ver;                   //!< Version
+	uint32_t boot_mode;             //!< Boot mode
+	uint32_t card_addr_mode;        //!< SD card address mode
+	uint32_t bad_blks_of_img_set0;  //!< NAND bad block count skipped 1
+	uint32_t ap_mu_id;              //!< AP MU ID
+	uint32_t bad_blks_of_img_set1;  //!< NAND bad block count skipped 1
+	uint8_t  boot_stage;            //!< Boot stage
+	uint8_t  img_set_sel;           //!< Image set booted from

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 243

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+	uint8_t  rsv0[2];               //!< Reserved
+	uint32_t img_set_end;           //!< Offset of Image End
+	uint32_t rom_version;           //!< ROM version
+	uint8_t  boot_dev_state;        //!< Boot device state
+	uint8_t  boot_dev_inst;         //!< Boot device type
+	uint8_t  boot_dev_type;         //!< Boot device instance
+	uint8_t  rsv1;                  //!< Reserved
+	uint32_t dev_page_size;         //!< Boot device page size
+	uint32_t cnt_header_ofs;        //!< Container header offset
+	uint32_t img_ofs;               //!< Image offset

What is that //!< in comments ^ ?

arch/arm/include/asm/mach-imx/sys_proto.h ulong spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev); · line 244

Quoted 1 line
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+}  __attribute__ ((packed)) rom_passover_t;

__packed

[...]

Quoted 23 lines
arch/arm/include/asm/mach-imx/sys_proto.h +22 -0
+++ b/arch/arm/mach-imx/imx9/scmi/clock.c
@@ -0,0 +1,328 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <asm/arch/ccm_regs.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <command.h>
+#include <errno.h>
+#ifdef CONFIG_CLK_SCMI
+#include "../../../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include <dm/uclass.h>
+#include <dm/uclass-internal.h>
+#include <linux/clk-provider.h>
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include <dm/device.h>

arch/arm/include/asm/mach-imx/sys_proto.h line 31

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+#include <dm/device-internal.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+u32 get_arm_core_clk(void)
+{
+	u32 val;
+
+	/* TODO: */

To Do what ?

Quoted 12 lines
arch/arm/include/asm/mach-imx/sys_proto.h +12 -0
+	val = imx_clk_scmi_get_rate(IMX95_CLK_SEL_A55C0);
+	if (val)
+		return val;
+	return imx_clk_scmi_get_rate(IMX95_CLK_A55);
+}
+
+void set_arm_core_max_clk(void)
+{
+	int ret;
+	u32 arm_domain_id = 8;
+
+	struct scmi_perf_in in = {

arch/arm/include/asm/mach-imx/sys_proto.h line 53

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+		.domain_id = arm_domain_id,
+		.perf_level = 3,
+	};
+	struct scmi_perf_out out;
+	struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_PERF, SCMI_PERF_LEVEL_SET, in, out);
+	struct udevice *dev;
+
+	ret = uclass_get_device_by_name(UCLASS_CLK, "protocol@14", &dev);
+	if (ret)
+		printf("%s: %d\n", __func__, ret);

What happens on failure ?

arch/arm/include/asm/mach-imx/sys_proto.h line 59

Quoted 6 lines
arch/arm/include/asm/mach-imx/sys_proto.h +6 -0
+	ret = devm_scmi_process_msg(dev, &msg);
+	if (ret)
+		printf("%s: %d\n", __func__, ret);
+}
+
+void enable_usboh3_clk(unsigned char enable)

Is this needed ?

Quoted 44 lines
arch/arm/include/asm/mach-imx/sys_proto.h +44 -0
+{
+}
+
+int clock_init_early(void)
+{
+	return 0;
+}
+
+/* Set bus and A55 core clock per voltage mode */
+int clock_init_late(void)
+{
+	set_arm_core_max_clk();
+
+	return 0;
+}
+
+u32 get_lpuart_clk(void)
+{
+	return imx_clk_scmi_get_rate(IMX95_CLK_LPUART1);
+}
+
+void init_uart_clk(u32 index)
+{
+	u32 clock_id;
+
+	switch (index) {
+	case 0:
+		clock_id = IMX95_CLK_LPUART1;
+		break;
+	case 1:
+		clock_id = IMX95_CLK_LPUART2;
+		break;
+	case 2:
+		clock_id = IMX95_CLK_LPUART3;
+		break;
+	default:
+		return;
+	}
+
+	/* 24MHz */
+	imx_clk_scmi_enable(clock_id, false);
+	imx_clk_scmi_set_parent(clock_id, IMX95_CLK_24M);
+	imx_clk_scmi_set_rate(clock_id, 24000000);
+	imx_clk_scmi_enable(clock_id, true);

arch/arm/include/asm/mach-imx/sys_proto.h line 113

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+}
+
+/* I2C check */
+u32 imx_get_i2cclk(u32 i2c_num)
+{
+	if (i2c_num > 7)
+		return -EINVAL;
+	switch (i2c_num) {
+	case 0:
+		return imx_clk_scmi_get_rate(IMX95_CLK_LPI2C1);

Can this switch-case statement be turned into some

return imx_clk_scmi_get_rate(IMX95_CLK_LPI2C1 + i2c_num);

?

arch/arm/include/asm/mach-imx/sys_proto.h line 123

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+int enable_i2c_clk(unsigned char enable, u32 i2c_num)
+{
+	u32 clock_id;
+
+	if (i2c_num > 7)
+		return -EINVAL;
+
+	switch (i2c_num) {
+	case 0:
+		clock_id = IMX95_CLK_LPI2C1;

Can this switch-case statement be turned into some

clock_id = IMX95_CLK_LPI2C1 + i2c_num;

?

arch/arm/include/asm/mach-imx/sys_proto.h line 127

Quoted 4 lines
arch/arm/include/asm/mach-imx/sys_proto.h +4 -0
+		break;
+	case 1:
+		clock_id = IMX95_CLK_LPI2C2;
+		break;

DTTO for all the other switch-case statements.

Quoted 6 lines
arch/arm/include/asm/mach-imx/sys_proto.h +6 -0
+void dram_enable_bypass(ulong clk_val)
+{
+	u64 rate;
+
+	switch (clk_val) {
+	case MHZ(625):

arch/arm/include/asm/mach-imx/sys_proto.h line 143

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+		imx_clk_scmi_set_parent(IMX95_CLK_DRAMALT, IMX95_CLK_SYSPLL1_PFD2);
+		rate = imx_clk_scmi_set_rate(IMX95_CLK_DRAMALT, clk_val);
+		break;
+	case MHZ(400):
+		imx_clk_scmi_set_parent(IMX95_CLK_DRAMALT, IMX95_CLK_SYSPLL1_PFD1);
+		rate = imx_clk_scmi_set_rate(IMX95_CLK_DRAMALT, clk_val);
+		break;
+	case MHZ(333):
+		imx_clk_scmi_set_parent(IMX95_CLK_DRAMALT, IMX95_CLK_SYSPLL1_PFD0);
+		rate = imx_clk_scmi_set_rate(IMX95_CLK_DRAMALT, 333333333);

Why is this rate special with hard-coded 333333333 value , while the other rates use clk_val ?

[...]

arch/arm/include/asm/mach-imx/sys_proto.h line 151

Quoted 8 lines
arch/arm/include/asm/mach-imx/sys_proto.h +8 -0
+void dram_disable_bypass(void)
+{
+	u64 rate;
+	/* Set DRAM APB to 133Mhz */
+	imx_clk_scmi_set_parent(IMX95_CLK_DRAMAPB, IMX95_CLK_SYSPLL1_PFD1_DIV2);
+	rate = imx_clk_scmi_set_rate(IMX95_CLK_DRAMAPB, 133333333);
+
+	/*Set the DRAM_GPR_SEL to be sourced from DRAM_PLL.*/

/*[+SPACE+]Set the ...

Add the missing spaces into comments globally .

Quoted 22 lines
arch/arm/include/asm/mach-imx/sys_proto.h +22 -0
+	imx_clk_scmi_set_parent(IMX95_CLK_SEL_DRAM, IMX95_CLK_DRAMPLL);
+	rate = imx_clk_scmi_get_rate(IMX95_CLK_SEL_DRAM);
+	printf("%s:SEL_DRAM: %llu\n", __func__, rate);
+}
+
+#endif
+
+unsigned int mxc_get_clock(enum mxc_clock clk)
+{
+	switch (clk) {
+	case MXC_ARM_CLK:
+		return get_arm_core_clk();
+	case MXC_IPG_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_BUSWAKEUP);
+	case MXC_CSPI_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_LPSPI1);
+	case MXC_ESDHC_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_USDHC1);
+	case MXC_ESDHC2_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_USDHC2);
+	case MXC_ESDHC3_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_USDHC3);

arch/arm/include/asm/mach-imx/sys_proto.h line 183

Quoted 10 lines
arch/arm/include/asm/mach-imx/sys_proto.h +10 -0
+	case MXC_UART_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_LPUART1);
+	case MXC_FLEXSPI_CLK:
+		return imx_clk_scmi_get_rate(IMX95_CLK_FLEXSPI1);
+	default:
+		return -1;
+	};
+
+	return -1;
+};

Can this clock stuff be finally moved into drivers/clk/ ?

Quoted 5 lines
arch/arm/mach-imx/imx9/scmi/clock_scmi.c new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..543abe9fed481c796602b2b2eeeec6c8f9a94862

[...]

Quoted 4 lines
arch/arm/mach-imx/imx9/scmi/clock_scmi.c new file +4 -0
+int imx_clk_scmi_enable(u32 clock_id, bool enable)
+{
+	struct scmi_clk_state_in in = {
+		.clock_id = clock_id,

arch/arm/mach-imx/imx9/scmi/clock_scmi.c line 39

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/clock_scmi.c new file +10 -0
+		.attributes = (enable) ? 1 : 0,
+	};
+	struct scmi_clk_state_out out;
+	struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
+					  SCMI_CLOCK_CONFIG_SET,
+					  in, out);
+	int ret;
+	struct udevice *dev;
+
+	ret = uclass_get_device_by_name(UCLASS_CLK, "protocol@14", &dev);

It seems this pattern of

uclass_get_device_by_name(UCLASS_CLK, "protocol@14", &dev); devm_scmi_process_msg(dev, &msg); scmi_to_linux_errno(out.status);

is repeated in multiple functions here. Can this be deduplicated ?

Also, should devm_scmi_process_msg(dev, &msg); be used here ? Who is deallocating the devm_ allocated memory ?

[...]

Quoted 1 line
arch/arm/mach-imx/imx9/scmi/soc.c +0 -0

[...]

arch/arm/mach-imx/imx9/scmi/soc.c line 47

Quoted 3 lines
arch/arm/mach-imx/imx9/scmi/soc.c +3 -0
+DECLARE_GLOBAL_DATA_PTR;
+
+rom_passover_t rom_passover_data = {0};

Should this variable be static ?

arch/arm/mach-imx/imx9/scmi/soc.c line 59

Quoted 11 lines
arch/arm/mach-imx/imx9/scmi/soc.c +11 -0
+uint32_t scmi_get_rom_data(rom_passover_t *rom_data)
+{
+	/* Read ROM passover data */
+	struct scmi_rom_passover_get_out out;
+	struct scmi_msg msg = SCMI_MSG(SCMI_PROTOCOL_ID_IMX_MISC, SCMI_MISC_ROM_PASSOVER_GET, out);
+	int ret;
+	struct udevice *dev;
+
+	ret = uclass_get_device_by_name(UCLASS_CLK, "protocol@14", &dev);
+	if (ret)
+		return ret;

Seems like another duplicate pattern (see above).

arch/arm/mach-imx/imx9/scmi/soc.c line 64

Quoted 4 lines
arch/arm/mach-imx/imx9/scmi/soc.c +4 -0
+	ret = devm_scmi_process_msg(dev, &msg);
+	if (ret == 0 && out.status == 0) {
+		memcpy(rom_data, (struct rom_passover_t *)out.passover, sizeof(rom_passover_t));
+	} else {

Invert the conditional here, check for error and bail on error.

Quoted 13 lines
arch/arm/mach-imx/imx9/scmi/soc.c +13 -0
+		printf("Failed to get ROM passover data, scmi_err = %d, size_of(out) = %ld\n",
+		       out.status, sizeof(out));
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+#ifdef CONFIG_ENV_IS_IN_MMC
+__weak int board_mmc_get_env_dev(int devno)
+{
+	return devno;
+}

arch/arm/mach-imx/imx9/scmi/soc.c line 87

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+
+int mmc_get_env_dev(void)
+{
+	int ret;
+	u16 boot_type;
+	u8 boot_instance;
+
+	volatile gd_t *pgd = gd;
+	rom_passover_t *rdata;
+#ifdef CONFIG_SPL_BUILD

That would be XPL now . Also use if IS_ENABLED or CONFIG_IS_ENABLED .

Quoted 30 lines
arch/arm/mach-imx/imx9/scmi/soc.c +30 -0
+	rdata = &rom_passover_data;
+#else
+	rom_passover_t rom_data = {0};
+
+	if (!pgd->reloc_off)
+		rdata = &rom_data;
+	else
+		rdata = &rom_passover_data;
+#endif
+	if (rdata->tag == 0) {
+		ret = scmi_get_rom_data(rdata);
+		if (ret != 0) {
+			puts("SCMI: failure at rom_boot_info\n");
+			return CONFIG_SYS_MMC_ENV_DEV;
+		}
+	}
+	boot_type = rdata->boot_dev_type;
+	boot_instance = rdata->boot_dev_inst;
+	set_gd(pgd);
+
+	debug("boot_type %d, instance %d\n", boot_type, boot_instance);
+
+	/* If not boot from sd/mmc, use default value */
+	if (boot_type != BOOT_TYPE_SD && boot_type != BOOT_TYPE_MMC)
+		return env_get_ulong("mmcdev", 10, CONFIG_SYS_MMC_ENV_DEV);
+
+	return board_mmc_get_env_dev(boot_instance);
+}
+#endif
+

arch/arm/mach-imx/imx9/scmi/soc.c line 127

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+u32 get_cpu_speed_grade_hz(void)
+{
+	u32 speed, max_speed;
+	int ret;
+	u32 val, word, offset;
+
+	word = 17;
+	offset = 14;
+
+	ret = fuse_read((word / 8), (word % 8), &val);

No need for the parenthesis inside fuse_read() , fix globally.

Quoted 41 lines
arch/arm/mach-imx/imx9/scmi/soc.c +41 -0
+	if (ret)
+		val = 0; /* If read fuse failed, return as blank fuse */
+
+	val >>= offset;
+	val &= 0xf;
+
+	max_speed = 2300000000;
+	speed = max_speed - val * 100000000;
+
+	if (is_imx95())
+		max_speed = 2000000000;
+
+	/* In case the fuse of speed grade not programmed */
+	if (speed > max_speed)
+		speed = max_speed;
+
+	return speed;
+}
+
+u32 get_cpu_temp_grade(int *minc, int *maxc)
+{
+	int ret;
+	u32 val, word, offset;
+
+	word = 17;
+	offset = 12;
+
+	ret = fuse_read((word / 8), (word % 8), &val);
+	if (ret)
+		val = 0; /* If read fuse failed, return as blank fuse */
+
+	val >>= offset;
+	val &= 0x3;
+
+	if (minc && maxc) {
+		if (val == TEMP_AUTOMOTIVE) {
+			*minc = -40;
+			*maxc = 125;
+		} else if (val == TEMP_INDUSTRIAL) {
+			*minc = -40;
+			*maxc = 105;

arch/arm/mach-imx/imx9/scmi/soc.c line 178

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+		} else if (val == TEMP_EXTCOMMERCIAL) {
+			*minc = -20;
+			*maxc = 105;
+		} else {
+			*minc = 0;
+			*maxc = 95;
+		}
+	}
+	return val;
+}

Can at least some of this be moved into some thermal driver in drivers/thermal/ ?

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+static void set_cpu_info(struct ele_get_info_data *info)
+{
+	gd->arch.soc_rev = info->soc;
+	gd->arch.lifecycle = info->lc;
+	memcpy((void *)&gd->arch.uid, &info->uid, 4 * sizeof(u32));
+}
+
+u32 get_cpu_rev(void)
+{
+	u32 rev = (gd->arch.soc_rev >> 24) - 0xa0;

arch/arm/mach-imx/imx9/scmi/soc.c line 199

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+
+	return (MXC_CPU_IMX95 << 12) | (CHIP_REV_1_0 + rev);
+}
+
+#define UNLOCK_WORD 0xD928C520 /* unlock word */
+#define REFRESH_WORD 0xB480A602 /* refresh word */
+
+static void disable_wdog(void __iomem *wdog_base)
+{
+	u32 val_cs = readl(wdog_base + 0x00);

Can this be moved to drivers/watchdog/ ?

Quoted 18 lines
arch/arm/mach-imx/imx9/scmi/soc.c +18 -0
+	if (!(val_cs & 0x80))
+		return;
+
+	/* default is 32bits cmd */
+	writel(REFRESH_WORD, (wdog_base + 0x04)); /* Refresh the CNT */
+
+	if (!(val_cs & 0x800)) {
+		writel(UNLOCK_WORD, (wdog_base + 0x04));
+		while (!(readl(wdog_base + 0x00) & 0x800))
+			;
+	}
+	writel(0x0, (wdog_base + 0x0C)); /* Set WIN to 0 */
+	writel(0x400, (wdog_base + 0x08)); /* Set timeout to default 0x400 */
+	writel(0x2120, (wdog_base + 0x00)); /* Disable it and set update */
+
+	while (!(readl(wdog_base + 0x00) & 0x400))
+		;
+}

[...]

Quoted 12 lines
arch/arm/mach-imx/imx9/scmi/soc.c +12 -0
+int ft_system_setup(void *blob, struct bd_info *bd)
+{
+	return 0;
+}
+
+#if defined(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	printf("UID: 0x%x 0x%x 0x%x 0x%x\n",
+	       gd->arch.uid[0], gd->arch.uid[1], gd->arch.uid[2], gd->arch.uid[3]);
+
+	serialnr->low = gd->arch.uid[0];

arch/arm/mach-imx/imx9/scmi/soc.c line 644

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+	serialnr->high = gd->arch.uid[3];
+}
+#endif
+
+static void gpio_reset(ulong gpio_base)
+{
+	writel(0, gpio_base + 0x10);
+	writel(0, gpio_base + 0x14);
+	writel(0, gpio_base + 0x18);
+	writel(0, gpio_base + 0x1c);

This should be in drivers/gpio in the GPIO driver probe, if needed at all.

arch/arm/mach-imx/imx9/scmi/soc.c line 649

Quoted 5 lines
arch/arm/mach-imx/imx9/scmi/soc.c +5 -0
+}
+
+int arch_cpu_init(void)
+{
+	if (IS_ENABLED(CONFIG_SPL_BUILD)) {

if (!IS_ENABLED(CONFIG_SPL_BUILD))

	return 0;
Quoted 26 lines
arch/arm/mach-imx/imx9/scmi/soc.c +26 -0
+		disable_wdog((void __iomem *)WDG3_BASE_ADDR);
+		disable_wdog((void __iomem *)WDG4_BASE_ADDR);
+
+		clock_init_early();
+
+		gpio_reset(GPIO2_BASE_ADDR);
+		gpio_reset(GPIO3_BASE_ADDR);
+		gpio_reset(GPIO4_BASE_ADDR);
+		gpio_reset(GPIO5_BASE_ADDR);
+	}
+
+	return 0;
+}
+
+int imx9_probe_mu(void)
+{
+	struct udevice *dev;
+	int node, ret;
+	u32 res;
+	struct ele_get_info_data info;
+
+	ret = uclass_get_device_by_driver(UCLASS_SCMI_AGENT, DM_DRIVER_GET(scmi_mbox), &dev);
+	if (ret)
+		return ret;
+
+	ret = uclass_get_device_by_name(UCLASS_CLK, "protocol@14", &dev);

arch/arm/mach-imx/imx9/scmi/soc.c line 685

Quoted 10 lines
arch/arm/mach-imx/imx9/scmi/soc.c +10 -0
+	if (ret)
+		return ret;
+
+	ret = devm_scmi_of_get_channel(dev);
+	if (ret)
+		return ret;
+
+	ret = uclass_get_device_by_name(UCLASS_PINCTRL, "protocol@19", &dev);
+	if (ret)
+		return ret;

Is this really needed ? MU would be probed on first use automatically somewhere else.

[...]

author
#42 lore raw

PATCH v3 10/17 imx9: add i.MX95 Kconfig and Makefile

In reply to Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 Kconfig and Makefile. i.MX95 uses SCMI.

---
 arch/arm/mach-imx/imx9/Kconfig  |  6 ++++++
 arch/arm/mach-imx/imx9/Makefile | 11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx9/Kconfig +6 -0
index 54c6b117fcff21be5c3800ebd1dc30f8ea12ac42..596e753f2897c11d7ca3bcc9211af786d005bfd9 100644
@@ -21,6 +21,12 @@ config IMX91
 	select IMX9
 	select ARMV8_SPL_EXCEPTION_VECTORS
 
+config IMX95
+	bool
+	select IMX9
+	select ARMV8_SPL_EXCEPTION_VECTORS
+	select SCMI_FIRMWARE
+	select DM_MAILBOX
 
 config SYS_SOC
 	default "imx9"
arch/arm/mach-imx/imx9/Makefile +8 -3
index 45a9105a75a558dada3c328ed0878050da2a41e1..8d43ea2b267e2608df2e8f140c91b626dd969842 100644
@@ -1,10 +1,15 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
-# Copyright 2022 NXP
+# Copyright 2024 NXP
 
 obj-y += lowlevel_init.o
+
+ifeq ($(CONFIG_SCMI_FIRMWARE),y)
+obj-y += scmi/
+else
 obj-y += soc.o clock.o clock_root.o trdc.o
+endif
 
-#ifndef CONFIG_XPL_BUILD
+ifneq ($(CONFIG_SPL_BUILD),y)
 obj-y += imx_bootaux.o
-#endif
+endif
\ No newline at end of file
Signature · 1 line
2.34.1
#43 lore raw

Re: [PATCH v3 10/17] imx9: add i.MX95 Kconfig and Makefile

Quoted 34 lines · Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 Kconfig and Makefile. i.MX95 uses SCMI.

---
  arch/arm/mach-imx/imx9/Kconfig  |  6 ++++++
  arch/arm/mach-imx/imx9/Makefile | 11 ++++++++---
  2 files changed, 14 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx9/Kconfig +6 -0
index 54c6b117fcff21be5c3800ebd1dc30f8ea12ac42..596e753f2897c11d7ca3bcc9211af786d005bfd9 100644
@@ -21,6 +21,12 @@ config IMX91
  	select IMX9
  	select ARMV8_SPL_EXCEPTION_VECTORS
 
+config IMX95
+	bool
+	select IMX9
+	select ARMV8_SPL_EXCEPTION_VECTORS
+	select SCMI_FIRMWARE
+	select DM_MAILBOX
 
  config SYS_SOC
  	default "imx9"
arch/arm/mach-imx/imx9/Makefile +0 -0
index 45a9105a75a558dada3c328ed0878050da2a41e1..8d43ea2b267e2608df2e8f140c91b626dd969842 100644

arch/arm/mach-imx/imx9/Makefile line 3

Quoted 4 lines
arch/arm/mach-imx/imx9/Makefile +1 -1
@@ -1,10 +1,15 @@
  # SPDX-License-Identifier: GPL-2.0+
  #
-# Copyright 2022 NXP
+# Copyright 2024 NXP

2022-2024

author
#44 lore raw

PATCH v3 11/17 imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

In reply to Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

---
 arch/arm/mach-imx/imx9/scmi/soc.c | 40 +++++++++++++++++++++++++++++++++++++++
 common/spl/spl_mmc.c              |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/scmi/soc.c +40 -0
index fefb1a6f4ca58722a5d93c39e4f6a7aaf85aa177..8a7df24afecc1d6d77b7162be639b56af95fd975 100644
@@ -41,6 +41,8 @@
 #include <scmi_agent.h>
 #include <scmi_protocols.h>
 #endif
+#include <spl.h>
+#include <mmc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -830,3 +832,41 @@ enum boot_device get_boot_device(void)
 	return boot_dev;
 }
 #endif
+
+ulong h_spl_load_read(struct spl_load_info *load, ulong off,
+		      ulong size, void *buf)
+{
+	struct blk_desc *bd = load->priv;
+	lbaint_t sector = off >> bd->log2blksz;
+	lbaint_t count = size >> bd->log2blksz;
+	ulong trampoline_sz = SZ_16M;
+	void *trampoline = (void *)((ulong)CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE - trampoline_sz);
+	ulong ns_ddr_end = CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE;
+	ulong read_count, trampoline_cnt = trampoline_sz >> bd->log2blksz, actual, total;
+
+#ifdef PHYS_SDRAM_2_SIZE
+	ns_ddr_end += PHYS_SDRAM_2_SIZE;
+#endif
+
+	/* Check if the buf is in non-secure world, otherwise copy from trampoline */
+	if ((ulong)buf < CFG_SYS_SDRAM_BASE || (ulong)buf + (count * sector) > ns_ddr_end) {
+		total = 0;
+		while (count) {
+			read_count = trampoline_cnt > count ? count : trampoline_cnt;
+			actual = blk_dread(bd, sector, read_count, trampoline);
+			if (actual != read_count) {
+				printf("Error in blk_dread, %lu, %lu\n", read_count, actual);
+				return 0;
+			}
+			memcpy(buf, trampoline, actual * 512);
+			buf += actual * 512;
+			sector += actual;
+			total += actual;
+			count -= actual;
+		}
+
+		return total << bd->log2blksz;
+	}
+
+	return blk_dread(bd, sector, count, buf) << bd->log2blksz;
+}
common/spl/spl_mmc.c +1 -1
index fe4230170a039c0ca18b7230105997ed824f9f54..9b3de231bf4b94278e4ec376325ae5b51fa6e645 100644
@@ -17,7 +17,7 @@
 #include <image.h>
 #include <imx_container.h>
 
-static ulong h_spl_load_read(struct spl_load_info *load, ulong off,
+ulong __weak h_spl_load_read(struct spl_load_info *load, ulong off,
 			     ulong size, void *buf)
 {
 	struct blk_desc *bd = load->priv;
Signature · 1 line
2.34.1
#45 lore raw

Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Quoted 9 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

Can the attacker intercept this and rewrite the soon-to-be-secure-only software with something that would later allow them to take over the system ? For example, could the attacker flip some secure-test bit in the TEE while it is in non-secure DRAM and before it is copied in the secure location, and make TEE accept privileged SMC operations from any unprivileged software ?

#46 lore raw

回复: [EXT] Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Quoted 26 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月6日 5:44
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]>; Alice Guo <[email protected]>
抄送: [email protected]; [email protected]; Ye Li <[email protected]>; Peng Fan <[email protected]>
主题: [EXT] Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 6 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

Quoted 8 lines
Quoted 3 lines

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

Can the attacker intercept this and rewrite the soon-to-be-secure-only software with something that would later allow them to take over the system ? For example, could the attacker flip some secure-test bit in the TEE while it is in non-secure DRAM and before it is copied in the secure location, and make TEE accept privileged SMC operations from any unprivileged software ?

User can authenticate OP-TEE. When authentication succeeds, OP-TEE has not been modified.

Best Regards,
Alice Guo

#47 lore raw

Re: 回复: [EXT] Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Quoted 29 lines · Alice Guo (OSS)
Quoted 29 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年1月6日 5:44
收件人: Alice Guo (OSS) <[email protected]>; Tom Rini <[email protected]>; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Alper Nebi Yasak <[email protected]>; Alice Guo <[email protected]>
抄送: [email protected]; [email protected]; Ye Li <[email protected]>; Peng Fan <[email protected]>
主题: [EXT] Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 9 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

Quoted 7 lines
Quoted 5 lines

Can the attacker intercept this and rewrite the soon-to-be-secure-only software with something that would later allow them to take over the system ? For example, could the attacker flip some secure-test bit in the TEE while it is in non-secure DRAM and before it is copied in the secure location, and make TEE accept privileged SMC operations from any unprivileged software ?

User can authenticate OP-TEE. When authentication succeeds, OP-TEE has not been modified.

Does this also affect U-Boot proper ?

If so, does U-Boot proper have to be signed too to avoid any possibility of tampering ?

#48 lore raw

Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

In reply to Alice Guo
Quoted 32 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

---
  arch/arm/mach-imx/imx9/scmi/soc.c | 40 +++++++++++++++++++++++++++++++++++++++
  common/spl/spl_mmc.c              |  2 +-
  2 files changed, 41 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/scmi/soc.c +2 -0
index fefb1a6f4ca58722a5d93c39e4f6a7aaf85aa177..8a7df24afecc1d6d77b7162be639b56af95fd975 100644
@@ -41,6 +41,8 @@
  #include <scmi_agent.h>
  #include <scmi_protocols.h>
  #endif
+#include <spl.h>
+#include <mmc.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 

arch/arm/mach-imx/imx9/scmi/soc.c enum boot_device get_boot_device(void) · line 837

Quoted 6 lines
arch/arm/mach-imx/imx9/scmi/soc.c +3 -0
@@ -830,3 +832,41 @@ enum boot_device get_boot_device(void)
  	return boot_dev;
  }
  #endif
+
+ulong h_spl_load_read(struct spl_load_info *load, ulong off,
+		      ulong size, void *buf)

Can you simply define spl_get_load_buffer() instead to make sure SPL loads your stuff into the correct location ?

This hack in generic code is a NAK.

#49 lore raw

Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

---
  arch/arm/mach-imx/imx9/scmi/soc.c | 40 +++++++++++++++++++++++++++++++++++++++
  common/spl/spl_mmc.c              |  2 +-
  2 files changed, 41 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/scmi/soc.c +2 -0
index fefb1a6f4ca58722a5d93c39e4f6a7aaf85aa177..8a7df24afecc1d6d77b7162be639b56af95fd975 100644
@@ -41,6 +41,8 @@
  #include <scmi_agent.h>
  #include <scmi_protocols.h>
  #endif
+#include <spl.h>
+#include <mmc.h>
  DECLARE_GLOBAL_DATA_PTR;
@@ -830,3 +832,41 @@ enum boot_device get_boot_device(void)
  	return boot_dev;
Quoted 8 lines

arch/arm/mach-imx/imx9/scmi/soc.c enum boot_device get_boot_device(void) · line 837

Quoted 5 lines
arch/arm/mach-imx/imx9/scmi/soc.c +3 -0
  }
  #endif
+
+ulong h_spl_load_read(struct spl_load_info *load, ulong off,
+		      ulong size, void *buf)

Can you simply define spl_get_load_buffer() instead to make sure SPL loads your stuff into the correct location ?

spl_get_load_buffer does not help here, unless do a big change to spl_mmc.c h_spl_load_read is set to info->read, info->read is not just for reading headers, it also needs to read container image data.

Quoted 2 lines

This hack in generic code is a NAK.

This is set it as __weak, and overwrite in soc code, there are many similar code

Regards,
Peng

#50 lore raw

Re: [PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Quoted 47 lines · Peng Fan
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Alice Guo

From: Ye Li <[email protected]>

When SPL loading image to secure region, for example, ATF and tee to DDR secure region. Because the USDHC controller is non-secure master, it can't access this region and will cause loading issue.

So override h_spl_load_read to use a trampoline buffer in nonsecure region, then use CPU to copy the image from trampoline buffer to destination secure region.

---
   arch/arm/mach-imx/imx9/scmi/soc.c | 40 +++++++++++++++++++++++++++++++++++++++
   common/spl/spl_mmc.c              |  2 +-
   2 files changed, 41 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx9/scmi/soc.c +2 -0
index fefb1a6f4ca58722a5d93c39e4f6a7aaf85aa177..8a7df24afecc1d6d77b7162be639b56af95fd975 100644
@@ -41,6 +41,8 @@
   #include <scmi_agent.h>
   #include <scmi_protocols.h>
   #endif
+#include <spl.h>
+#include <mmc.h>
   DECLARE_GLOBAL_DATA_PTR;
@@ -830,3 +832,41 @@ enum boot_device get_boot_device(void)
   	return boot_dev;
Quoted 8 lines

arch/arm/mach-imx/imx9/scmi/soc.c enum boot_device get_boot_device(void) · line 837

Quoted 5 lines
arch/arm/mach-imx/imx9/scmi/soc.c +3 -0
   }
   #endif
+
+ulong h_spl_load_read(struct spl_load_info *load, ulong off,
+		      ulong size, void *buf)

Can you simply define spl_get_load_buffer() instead to make sure SPL loads your stuff into the correct location ?

spl_get_load_buffer does not help here, unless do a big change to spl_mmc.c h_spl_load_read is set to info->read, info->read is not just for reading headers, it also needs to read container image data.

Quoted 1 line
Quoted 4 lines
Quoted 1 line

This hack in generic code is a NAK.

This is set it as __weak, and overwrite in soc code, there are many similar code

The more I am looking at this, the more this simply does not work. Consider these use cases for example where this fails:

- Board boots from SPI NOR
- Board boots from filesystem on SD/eMMC

So what about taking a different approach. First, use the SPL loader as-is to load whatever blobs you need to memory locations into which you can load. Second, implement board or arch specific spl_perform_fixups(), which is already empty weak function, and make it move the blobs into the correct location. Would that work ?

author
#51 lore raw

PATCH v3 12/17 scmi: add the macro SCMI_MSG

In reply to Alice Guo

From: Peng Fan <[email protected]>

This patch adds the macro SCMI_MSG for protocols that do not need _in_array.

---
 include/scmi_agent.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/scmi_agent.h +11 -0
index 755986d6c424ccc881ac0943a88735cbcfacb001..5508a126a6dc504afa6d896c78c760b1af0d3deb 100644
@@ -54,6 +54,17 @@ struct scmi_msg {
 		.out_msg_sz = sizeof(_out_array),	\
 	}
 
+/* Helper macro to match a message on output array references */
+#define SCMI_MSG(_protocol, _message, _out_array)	\
+	(struct scmi_msg){				\
+		.protocol_id = (_protocol),		\
+		.message_id = (_message),		\
+		.in_msg = (uint8_t *)NULL,		\
+		.in_msg_sz = 0,				\
+		.out_msg = (uint8_t *)&(_out_array),	\
+		.out_msg_sz = sizeof(_out_array),	\
+	}
+
 /**
  * devm_scmi_of_get_channel() - Get SCMI channel handle from SCMI agent DT node
  *
Signature · 1 line
2.34.1
author
#52 lore raw

PATCH v3 13/17 imx: Kconfig: IMX8_ROMAPI is not configured for i.MX95

In reply to Alice Guo

From: Alice Guo <[email protected]>

i.MX95 only supports low power boot, which means A55 is kicked by M33. There is no ROM runs on A55 in such case so that deselect IMX8_ROMAPI for i.MX95.

---
 arch/arm/mach-imx/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/Kconfig +1 -1
index 134e42028c3787d78e28af03d40c41a8b2b1981b..daf6443aa5b40b6410f2645937239a4ec785fa34 100644
@@ -180,7 +180,7 @@ config DDRMC_VF610_CALIBRATION
 
 config IMX8_ROMAPI
 	def_bool y
-	depends on IMX8MN || IMX8MP || IMX8ULP || IMX9
+	depends on IMX8MN || IMX8MP || IMX8ULP || (IMX9 && !IMX95)
 
 config SPL_IMX_ROMAPI_LOADADDR
 	hex "Default load address to load image through ROM API"
Signature · 1 line
2.34.1
author
#53 lore raw

PATCH v3 14/17 binman: add a new entry type for packing DDR PHY firmware images

In reply to Alice Guo

From: Alice Guo <[email protected]>

i.MX95 needs to combine DDR PHY firmware images and their byte counts together, so add a new entry type nxp-header-ddrfw for this requirement.

---
 tools/binman/entries.rst                  | 10 ++++++++++
 tools/binman/etype/nxp_header_ddrfw.py    | 32 +++++++++++++++++++++++++++++++
 tools/binman/ftest.py                     | 11 +++++++++++
 tools/binman/test/346_nxp_ddrfw_imx95.dts | 24 +++++++++++++++++++++++
 4 files changed, 77 insertions(+)
tools/binman/entries.rst +10 -0
index 780e9817fb6496b5f2a4aef6ed1c0b4c8d9a4ba2..6da3f0b904643360ca11da32e31129f5f54d279c 100644
@@ -1663,6 +1663,16 @@ Properties / Entry arguments:
 
 
 
+.. _etype_nxp_header_ddrfw:
+
+Entry: nxp-header-ddrfw: add a header to DDR PHY firmware images
+---------------------------------------------------
+
+This entry is used to combine DDR PHY firmware images and their byte counts
+together. See imx95_evk.rst for how to get DDR PHY Firmware Images.
+
+
+
 .. _etype_opensbi:
 
 Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
tools/binman/etype/nxp_header_ddrfw.py new file +32 -0
new file mode 100644
index 0000000000000000000000000000000000000000..541f045aa2e0bff5fea7c91c6939e35ef0b7200a
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2024 NXP
+
+from binman.etype.section import Entry_section
+
+class Entry_nxp_header_ddrfw(Entry_section):
+    """Add a header to DDR PHY firmware images
+
+    This entry is used for i.MX95 to combine DDR PHY firmware images and their
+    byte counts together.
+
+    See imx95_evk.rst for how to get DDR PHY Firmware Images.
+    """
+
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+
+    def BuildSectionData(self, required):
+        section_data = bytearray()
+        header_data = bytearray()
+
+        for entry in self._entries.values():
+            entry_data = entry.GetData(required)
+
+            if not required and entry_data is None:
+                return None
+
+            section_data += entry_data
+            header_data += entry.contents_size.to_bytes(4, 'little')
+
+        return header_data + section_data
tools/binman/ftest.py +11 -0
index a553ca9e5642b685b908e817972b42bfba1d8a0a..62acc1d885cf6565999672d25584602929c3c4c3 100644
@@ -104,6 +104,8 @@ PRE_LOAD_VERSION      = 0x11223344.to_bytes(4, 'big')
 PRE_LOAD_HDR_SIZE     = 0x00001000.to_bytes(4, 'big')
 TI_BOARD_CONFIG_DATA  = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 TI_UNSECURE_DATA      = b'unsecuredata'
+IMX_LPDDR_IMEM_DATA   = b'qwertyuiop1234567890'
+IMX_LPDDR_DMEM_DATA   = b'asdfghjklzxcvbnm'
 
 # Subdirectory of the input dir to use to put test FDTs
 TEST_FDT_SUBDIR       = 'fdts'
@@ -202,6 +204,8 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('fsp_m.bin', FSP_M_DATA)
         TestFunctional._MakeInputFile('fsp_s.bin', FSP_S_DATA)
         TestFunctional._MakeInputFile('fsp_t.bin', FSP_T_DATA)
+        TestFunctional._MakeInputFile('lpddr5_imem.bin', IMX_LPDDR_IMEM_DATA)
+        TestFunctional._MakeInputFile('lpddr5_dmem.bin', IMX_LPDDR_DMEM_DATA)
 
         cls._elf_testdir = os.path.join(cls._indir, 'elftest')
         elf_test.BuildElfTestFiles(cls._elf_testdir)
@@ -7826,6 +7830,13 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         """Test that binman can produce an iMX8 image"""
         self._DoTestFile('339_nxp_imx8.dts')
 
+    def testNxpHeaderDdrfw(self):
+        """Test that binman can add a header to DDR PHY firmware images"""
+        data = self._DoReadFile('346_nxp_ddrfw_imx95.dts')
+        self.assertEqual(len(IMX_LPDDR_IMEM_DATA).to_bytes(4, 'little') +
+                         len(IMX_LPDDR_DMEM_DATA).to_bytes(4, 'little') +
+                         IMX_LPDDR_IMEM_DATA + IMX_LPDDR_DMEM_DATA, data)
+
     def testFitSignSimple(self):
         """Test that image with FIT and signature nodes can be signed"""
         if not elf.ELF_TOOLS:
tools/binman/test/346_nxp_ddrfw_imx95.dts new file +24 -0
new file mode 100644
index 0000000000000000000000000000000000000000..889f6f29860746c09a91aaad7658976559760d9c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		imx-lpddr {
+			type = "nxp-header-ddrfw";
+
+			imx-lpddr-imem {
+				filename = "lpddr5_imem.bin";
+				type = "blob-ext";
+			};
+
+			imx-lpddr-dmem {
+				filename = "lpddr5_dmem.bin";
+				type = "blob-ext";
+			};
+		};
+	};
+};
Signature · 1 line
2.34.1
#54 lore raw

Re: [PATCH v3 14/17] binman: add a new entry type for packing DDR PHY firmware images

Quoted 40 lines · Alice Guo

From: Alice Guo <[email protected]>

i.MX95 needs to combine DDR PHY firmware images and their byte counts together, so add a new entry type nxp-header-ddrfw for this requirement.

---
  tools/binman/entries.rst                  | 10 ++++++++++
  tools/binman/etype/nxp_header_ddrfw.py    | 32 +++++++++++++++++++++++++++++++
  tools/binman/ftest.py                     | 11 +++++++++++
  tools/binman/test/346_nxp_ddrfw_imx95.dts | 24 +++++++++++++++++++++++
  4 files changed, 77 insertions(+)
tools/binman/entries.rst +10 -0
index 780e9817fb6496b5f2a4aef6ed1c0b4c8d9a4ba2..6da3f0b904643360ca11da32e31129f5f54d279c 100644
@@ -1663,6 +1663,16 @@ Properties / Entry arguments:
 
 
 
+.. _etype_nxp_header_ddrfw:
+
+Entry: nxp-header-ddrfw: add a header to DDR PHY firmware images
+---------------------------------------------------
+
+This entry is used to combine DDR PHY firmware images and their byte counts
+together. See imx95_evk.rst for how to get DDR PHY Firmware Images.
+
+
+
  .. _etype_opensbi:
 
  Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
tools/binman/etype/nxp_header_ddrfw.py new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..541f045aa2e0bff5fea7c91c6939e35ef0b7200a

tools/binman/etype/nxp_header_ddrfw.py line 3

Quoted 3 lines
tools/binman/etype/nxp_header_ddrfw.py new file +3 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2024 NXP

2025 now.

[...]

author
#55 lore raw

PATCH v3 15/17 tools: imx8image: add i.MX95 support

In reply to Alice Guo

From: Alice Guo <[email protected]>

i.MX95 uses binman to invoke mkimage to create image container. 2 image containers are needed currently. The first one is composed of ahab-container.img, LPDDR firmware images, OEI images, System Manager image and u-boot-spl.bin. The second one is comsisted of ARM Trusted firmware and u-boot.bin.

Because DDR OEI image and LPDDR firmware images have to be packaged together and named as m33-oei-ddrfw.bin by binman, so imx9_image.sh does not check if m33-oei-ddrfw.bin exists.

When using "make imx95_19x19_evk_defconfig; make", imx9_image.sh will delete the line for u-boot.bin in container.cfg. In fact, binman is always called after the u-boot.bin is built, so imx9_image.sh does not check if u-boot.bin exists.

---
 include/imx8image.h |  19 +++++--
 tools/imx8image.c   | 143 +++++++++++++++++++++++++++++++++++++++++++++++-----
 tools/imx9_image.sh |   8 +++
 3 files changed, 153 insertions(+), 17 deletions(-)
include/imx8image.h +16 -3
index 6b95e93fb50980f9e86099b3103142dcbe38764a..233c28aa501f1e78c4160bdf5ca69d2b474217ea 100644
@@ -157,7 +157,9 @@ enum imx8image_cmd {
 	CMD_SOC_TYPE,
 	CMD_CONTAINER,
 	CMD_IMAGE,
-	CMD_DATA
+	CMD_DATA,
+	CMD_DUMMY_V2X,
+	CMD_HOLD
 };
 
 enum imx8image_core_type {
@@ -169,7 +171,9 @@ enum imx8image_core_type {
 	CFG_A35,
 	CFG_A55,
 	CFG_A53,
-	CFG_A72
+	CFG_A72,
+	CFG_M33,
+	CFG_OEI
 };
 
 enum imx8image_fld_types {
@@ -208,7 +212,10 @@ typedef enum option_type {
 	FILEOFF,
 	MSG_BLOCK,
 	SENTINEL,
-	UPOWER
+	UPOWER,
+	OEI,
+	DUMMY_V2X,
+	HOLD
 } option_type_t;
 
 typedef struct {
@@ -227,12 +234,16 @@ typedef struct {
 #define CORE_CA35       4
 #define CORE_CA72       5
 #define CORE_SECO       6
+#define CORE_M33        7
 
 #define CORE_ULP_CM33		0x1
 #define CORE_ULP_CA35		0x2
 #define CORE_ULP_UPOWER 	0x4
 #define CORE_ULP_SENTINEL 	0x6
 
+#define CORE_IMX95_M33P        0U
+#define CORE_IMX95_A55C0       2U
+
 #define SC_R_OTP	357U
 #define SC_R_DEBUG	354U
 #define SC_R_ROM_0	236U
@@ -246,10 +257,12 @@ typedef struct {
 #define IMG_TYPE_EXEC    0x03   /* Executable image type */
 #define IMG_TYPE_DATA    0x04   /* Data image type */
 #define IMG_TYPE_DCD_DDR 0x05   /* DCD/DDR image type */
+#define IMG_TYPE_OEI     0x05   /* Optional Executable image type */
 #define IMG_TYPE_SECO    0x06   /* SECO image type */
 #define IMG_TYPE_SENTINEL 0x06	/* SENTINEL image type */
 #define IMG_TYPE_PROV    0x07   /* Provisioning image type */
 #define IMG_TYPE_DEK     0x08   /* DEK validation type */
+#define IMG_TYPE_V2X_DUMMY 0x0E /* V2X Dummy image */
 
 #define IMG_TYPE_SHIFT   0
 #define IMG_TYPE_MASK    0x1f
tools/imx8image.c +129 -14

298 lines not on this page · raw message

tools/imx9_image.sh +8 -0
index ca78a57a19a06ade4792da6d2435cbc4fa07de62..6523d1a0ad109db2da29bae122a20b084c2522ed 100755
@@ -18,6 +18,14 @@ for f in $blobs; do
 		continue
 	fi
 
+	if [ $f = "m33-oei-ddrfw.bin" ]; then
+		continue
+	fi
+
+	if [ $f = "u-boot.bin" ]; then
+		continue
+	fi
+
 	if [ ! -f $tmp ]; then
 		echo "WARNING '$tmp' not found, resulting binary may be not-functional" >&2
 
Signature · 1 line
2.34.1
#56 lore raw

Re: [PATCH v3 15/17] tools: imx8image: add i.MX95 support

Quoted 18 lines · Alice Guo

From: Alice Guo <[email protected]>

i.MX95 uses binman to invoke mkimage to create image container. 2 image containers are needed currently. The first one is composed of ahab-container.img, LPDDR firmware images, OEI images, System Manager image and u-boot-spl.bin. The second one is comsisted of ARM Trusted firmware and u-boot.bin.

Because DDR OEI image and LPDDR firmware images have to be packaged together and named as m33-oei-ddrfw.bin by binman, so imx9_image.sh does not check if m33-oei-ddrfw.bin exists.

When using "make imx95_19x19_evk_defconfig; make", imx9_image.sh will delete the line for u-boot.bin in container.cfg. In fact, binman is always called after the u-boot.bin is built, so imx9_image.sh does not check if u-boot.bin exists.

[...]

include/imx8image.h typedef struct { · line 245

Quoted 13 lines
include/imx8image.h +3 -0
@@ -227,12 +234,16 @@ typedef struct {
  #define CORE_CA35       4
  #define CORE_CA72       5
  #define CORE_SECO       6
+#define CORE_M33        7
 
  #define CORE_ULP_CM33		0x1
  #define CORE_ULP_CA35		0x2
  #define CORE_ULP_UPOWER 	0x4
  #define CORE_ULP_SENTINEL 	0x6
 
+#define CORE_IMX95_M33P        0U
+#define CORE_IMX95_A55C0       2U

Drop the trailing U from the constant.

Quoted 3 lines
include/imx8image.h +0 -0
  #define SC_R_OTP	357U
  #define SC_R_DEBUG	354U
  #define SC_R_ROM_0	236U

[...]

tools/imx8image.c static void set_image_array_entry(flash_header_v3_t *container, · line 644

Quoted 8 lines
tools/imx8image.c +2 -1
@@ -586,8 +639,10 @@ static void set_image_array_entry(flash_header_v3_t *container,
  			meta = IMAGE_A53_DEFAULT_META(custom_partition);
  		} else if (soc == QM && core == CORE_CA72) {
  			meta = IMAGE_A72_DEFAULT_META(custom_partition);
-		} else if (((soc == ULP) || (soc == IMX9)) && core == CORE_CA35) {
+		} else if ((soc == ULP) && core == CORE_CA35) {
  			meta = 0;
+		} else if ((soc == IMX9) && core == CORE_CA35) {

Should this be CORE_CA55 ?

Quoted 4 lines
tools/imx8image.c +1 -0
+			meta = CORE_IMX95_A55C0;
  		} else {
  			fprintf(stderr,
  				"Error: invalid AP core id: %" PRIu64 "\n",

[...]

Quoted 4 lines
tools/imx8image.c +1 -1
-static int get_container_image_start_pos(image_t *image_stack, uint32_t align)
+static int get_container_image_start_pos(image_t *image_stack, uint32_t align, uint32_t *v2x)
  {
  	image_t *img_sp = image_stack;

tools/imx8image.c void set_container(flash_header_v3_t *container, uint16_t sw_version, · line 786

Quoted 10 lines
tools/imx8image.c +4 -1
  	/*8K total container header*/
  	int file_off = CONTAINER_IMAGE_ARRAY_START_OFFSET;
  	FILE *fd = NULL;
-	flash_header_v3_t header;
+	flash_header_v3_t *header;
+	flash_header_v3_t *header2;
+	void *p;
  	int ret;
 
+	p = calloc(1, SZ_4K);

Can this be simply reserved on stack ?

[...]

tools/imx9_image.sh for f in $blobs; do · line 23

Quoted 11 lines
tools/imx9_image.sh +3 -0
index ca78a57a19a06ade4792da6d2435cbc4fa07de62..6523d1a0ad109db2da29bae122a20b084c2522ed 100755
@@ -18,6 +18,14 @@ for f in $blobs; do
  		continue
  	fi
 
+	if [ $f = "m33-oei-ddrfw.bin" ]; then
+		continue
+	fi

Can this be wired into binman somehow instead ?

author
#57 lore raw

PATCH v3 16/17 imx: add V2X container support on i.MX95

In reply to Alice Guo

From: Teo Hall <[email protected]>

This patch adds V2X container support on i.MX95.

---
 arch/arm/mach-imx/image-container.c | 63 +++++++++++++++++++++++--------------
 1 file changed, 40 insertions(+), 23 deletions(-)
arch/arm/mach-imx/image-container.c +40 -23
index 2afe9d38a0681862098a6566a873873f24069b88..54ae7721888dbc93fdaba8e5aedc52c4506bb1c1 100644
@@ -231,45 +231,62 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)
 	return offset;
 }
 
-static int get_imageset_end(void *dev, int dev_type)
+static ulong get_imageset_end(void *dev, int dev_type)
 {
-	unsigned long offset1 = 0, offset2 = 0;
-	int value_container[2];
+	unsigned long offset[3] = {};
+	int value_container[3] = {};
 	u16 hdr_length;
 
-	offset1 = get_boot_device_offset(dev, dev_type);
-	offset2 = CONTAINER_HDR_ALIGNMENT + offset1;
+	offset[0] = get_boot_device_offset(dev, dev_type);
 
-	value_container[0] = get_dev_container_size(dev, dev_type, offset1, &hdr_length);
+	value_container[0] = get_dev_container_size(dev, dev_type, offset[0], &hdr_length);
 	if (value_container[0] < 0) {
 		printf("Parse seco container failed %d\n", value_container[0]);
-		return value_container[0];
+		return 0;
 	}
 
 	debug("seco container size 0x%x\n", value_container[0]);
 
-	value_container[1] = get_dev_container_size(dev, dev_type, offset2, &hdr_length);
-	if (value_container[1] < 0) {
-		debug("Parse scu container failed %d, only seco container\n",
-		      value_container[1]);
-		/* return seco container total size */
-		return value_container[0] + offset1;
+	if (is_imx95()) {
+		offset[1] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
+
+		value_container[1] = get_dev_container_size(dev, dev_type, offset[1], &hdr_length);
+		if (value_container[1] < 0) {
+			printf("Parse v2x container failed %d\n", value_container[1]);
+			return value_container[0] + offset[0]; /* return seco container total size */
+		}
+
+		debug("v2x container size 0x%x\n", value_container[1]);
+
+		offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[1];
+	} else {
+		/* Skip offset[1] */
+		offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
 	}
 
-	debug("scu container size 0x%x\n", value_container[1]);
+	value_container[2] = get_dev_container_size(dev, dev_type, offset[2], &hdr_length);
+	if (value_container[2] < 0) {
+		debug("Parse scu container image failed %d, only seco container\n", value_container[2]);
+		if (is_imx95())
+			return value_container[1] + offset[1]; /* return seco + v2x container total size */
+		else
+			return value_container[0] + offset[0]; /* return seco container total size */
+	}
 
-	return value_container[1] + offset2;
+	debug("scu container size 0x%x\n", value_container[2]);
+
+	return value_container[2] + offset[2];
 }
 
 #ifdef CONFIG_SPL_SPI_LOAD
 unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
 {
-	int end;
+	ulong end;
 
 	end = get_imageset_end(flash, QSPI_DEV);
 	end = ROUND(end, SZ_1K);
 
-	printf("Load image from QSPI 0x%x\n", end);
+	printf("Load image from QSPI 0x%lx\n", end);
 
 	return end;
 }
@@ -279,12 +296,12 @@ unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
 unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 						unsigned long raw_sect)
 {
-	int end;
+	ulong end;
 
 	end = get_imageset_end(mmc, MMC_DEV);
 	end = ROUND(end, SZ_1K);
 
-	printf("Load image from MMC/SD 0x%x\n", end);
+	printf("Load image from MMC/SD 0x%lx\n", end);
 
 	return end / mmc->read_bl_len;
 }
@@ -312,12 +329,12 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc)
 #ifdef CONFIG_SPL_NAND_SUPPORT
 uint32_t spl_nand_get_uboot_raw_page(void)
 {
-	int end;
+	ulong end;
 
 	end = get_imageset_end((void *)NULL, NAND_DEV);
 	end = ROUND(end, SZ_16K);
 
-	printf("Load image from NAND 0x%x\n", end);
+	printf("Load image from NAND 0x%lx\n", end);
 
 	return end;
 }
@@ -326,7 +343,7 @@ uint32_t spl_nand_get_uboot_raw_page(void)
 #ifdef CONFIG_SPL_NOR_SUPPORT
 unsigned long spl_nor_get_uboot_base(void)
 {
-	int end;
+	ulong end;
 
 	/* Calculate the image set end,
 	 * if it is less than CFG_SYS_UBOOT_BASE(0x8281000),
@@ -339,7 +356,7 @@ unsigned long spl_nor_get_uboot_base(void)
 	else
 		end = ROUND(end, SZ_1K);
 
-	printf("Load image from NOR 0x%x\n", end);
+	printf("Load image from NOR 0x%lx\n", end);
 
 	return end;
 }
Signature · 1 line
2.34.1
author
#58 lore raw

PATCH v3 17/17 imx95_evk: add i.MX95 19x19 EVK board basic support

In reply to Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

---
 arch/arm/dts/imx95-19x19-evk-u-boot.dtsi      |  68 ++++++++++
 arch/arm/dts/imx95-u-boot.dtsi                | 173 +++++++++++++++++++++++++
 arch/arm/mach-imx/imx9/Kconfig                |   6 +
 arch/arm/mach-imx/imx9/scmi/container.cfg     |  10 ++
 arch/arm/mach-imx/imx9/scmi/imximage.cfg      |  15 +++
 arch/arm/mach-imx/imx9/scmi/soc.c             |   1 +
 board/freescale/imx95_evk/Kconfig             |  12 ++
 board/freescale/imx95_evk/MAINTAINERS         |   6 +
 board/freescale/imx95_evk/Makefile            |  11 ++
 board/freescale/imx95_evk/imx95_19x19_evk.env |  90 +++++++++++++
 board/freescale/imx95_evk/imx95_evk.c         |  54 ++++++++
 board/freescale/imx95_evk/spl.c               |  96 ++++++++++++++
 configs/imx95_19x19_evk_defconfig             | 177 ++++++++++++++++++++++++++
 doc/board/nxp/imx95_evk.rst                   | 116 +++++++++++++++++
 doc/board/nxp/index.rst                       |   1 +
 include/configs/imx95_evk.h                   |  30 +++++
 16 files changed, 866 insertions(+)
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +68 -0
new file mode 100644
index 0000000000000000000000000000000000000000..36169b56ef3075a5c243f7fb1afd6399b0df77ad
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include "imx95-u-boot.dtsi"
+
+&gpio1 {
+	reg = <0 0x47400000 0 0x1000>, <0 0x47400040 0 0x40>;
+};
+
+&lpuart1 {
+	clocks = <&scmi_clk IMX95_CLK_LPUART1>, <&scmi_clk IMX95_CLK_LPUART1>;
+	clock-names = "ipg", "per";
+	bootph-pre-ram;
+};
+
+&pinctrl_uart1 {
+	bootph-pre-ram;
+};
+
+&usdhc1 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc1 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_100mhz {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_200mhz {
+	bootph-pre-ram;
+};
+
+&usdhc2 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_100mhz {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_200mhz {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_gpio {
+	bootph-pre-ram;
+};
+
+&reg_usdhc2_vmmc {
+	bootph-pre-ram;
+};
+
+&pinctrl_reg_usdhc2_vmmc {
+	bootph-pre-ram;
+};
+
+&wdog3 {
+	status = "disabled";
+};
arch/arm/dts/imx95-u-boot.dtsi new file +173 -0

173 lines not on this page · raw message

arch/arm/mach-imx/imx9/Kconfig +6 -0
index 596e753f2897c11d7ca3bcc9211af786d005bfd9..1ba277baeb353de301a1e67a7adf70f281752ded 100644
@@ -66,6 +66,11 @@ config TARGET_PHYCORE_IMX93
 	select OF_BOARD_FIXUP
 	select OF_BOARD_SETUP
 
+config TARGET_IMX95_19X19_EVK
+	bool "imx95_19x19_evk"
+	select IMX95
+	imply OF_UPSTREAM
+
 endchoice
 
 source "board/freescale/imx91_evk/Kconfig"
@@ -73,6 +78,7 @@ source "board/freescale/imx93_evk/Kconfig"
 source "board/freescale/imx93_qsb/Kconfig"
 source "board/phytec/phycore_imx93/Kconfig"
 source "board/variscite/imx93_var_som/Kconfig"
+source "board/freescale/imx95_evk/Kconfig"
 
 endif
 
arch/arm/mach-imx/imx9/scmi/container.cfg new file +10 -0
new file mode 100644
index 0000000000000000000000000000000000000000..29f346e59c4afd0c2689667abe36f4b776b29ba8
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+CONTAINER
+IMAGE A55 bl31.bin 0x8a200000
+IMAGE A55 u-boot.bin CONFIG_TEXT_BASE
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/imximage.cfg new file +15 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c90432f5efa78dccb2c67e237b88a96174446b96
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+APPEND mx95a0-ahab-container.img
+CONTAINER
+IMAGE OEI m33-oei-ddrfw.bin 0x1ffc0000
+HOLD 0x10000
+IMAGE OEI oei-m33-tcm.bin 0x1ffc0000
+IMAGE M33 m33_image.bin 0x1ffc0000
+IMAGE A55 spl/u-boot-spl.bin 0x20480000
+DUMMY_V2X 0x8b000000
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/soc.c +1 -0
index 8a7df24afecc1d6d77b7162be639b56af95fd975..38ade99964b64512ba93423efcaa0cfb58094b00 100644
@@ -43,6 +43,7 @@
 #endif
 #include <spl.h>
 #include <mmc.h>
+#include <asm/arch/mu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/freescale/imx95_evk/Kconfig new file +12 -0
new file mode 100644
index 0000000000000000000000000000000000000000..f9a67353e5db6d3ec94784cf091e45d8817d541c
@@ -0,0 +1,12 @@
+if TARGET_IMX95_19X19_EVK
+
+config SYS_BOARD
+	default "imx95_evk"
+
+config SYS_VENDOR
+	default "freescale"
+
+config SYS_CONFIG_NAME
+	default "imx95_evk"
+
+endif
board/freescale/imx95_evk/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000000000000000000000000000000000..5caf763e0cc390c46fc54ee627bc966b2b110958
@@ -0,0 +1,6 @@
+i.MX95 EVK BOARD
+M:	Alice Guo <[email protected]>
+S:	Maintained
+F:	board/freescale/imx95_evk/
+F:	include/configs/imx95_evk.h
+F:	configs/imx95_19x19_evk_defconfig
board/freescale/imx95_evk/Makefile new file +11 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a278d58ee0085176948b812703d120aaad3a3116
@@ -0,0 +1,11 @@
+#
+# Copyright 2024 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx95_evk.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
board/freescale/imx95_evk/imx95_19x19_evk.env new file +90 -0

91 lines not on this page · raw message

board/freescale/imx95_evk/imx95_evk.c new file +54 -0

54 lines not on this page · raw message

board/freescale/imx95_evk/spl.c new file +96 -0

96 lines not on this page · raw message

configs/imx95_19x19_evk_defconfig new file +177 -0

177 lines not on this page · raw message

doc/board/nxp/imx95_evk.rst new file +116 -0

116 lines not on this page · raw message

doc/board/nxp/index.rst +1 -0
index 8ca4b5619863f616dbedc7eb0ff8a286a3fbbf48..e7ec725cc04e9755ba3dac37561c26ebc3f1c716 100644
@@ -15,6 +15,7 @@ NXP Semiconductors
    imx91_11x11_evk
    imx93_9x9_qsb
    imx93_11x11_evk
+   imx95_evk
    imxrt1020-evk
    imxrt1050-evk
    imxrt1170-evk
include/configs/imx95_evk.h new file +30 -0
new file mode 100644
index 0000000000000000000000000000000000000000..00909a043a71751684ebd8dc413b05d5aee8dd69
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+#ifndef __IMX95_EVK_H
+#define __IMX95_EVK_H
+
+#include <linux/sizes.h>
+#include <linux/stringify.h>
+#include <asm/arch/imx-regs.h>
+
+#define CFG_SYS_UBOOT_BASE	\
+	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+
+#define CFG_SYS_INIT_RAM_ADDR        0x90000000
+#define CFG_SYS_INIT_RAM_SIZE        0x200000
+
+#define CFG_SYS_SDRAM_BASE           0x90000000
+#define PHYS_SDRAM                      0x90000000
+/* Totally 16GB */
+#define PHYS_SDRAM_SIZE			0x70000000 /* 2GB  - 256MB DDR */
+#define PHYS_SDRAM_2_SIZE		0x380000000 /* 14GB */
+
+#define CFG_SYS_FSL_USDHC_NUM	2
+
+/* Using ULP WDOG for reset */
+#define WDOG_BASE_ADDR          WDG3_BASE_ADDR
+
+#endif
Signature · 1 line
2.34.1
#59 lore raw

Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

Quoted 7 lines · Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

[...]

Quoted 24 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +18 -0
new file mode 100644
index 0000000000000000000000000000000000000000..36169b56ef3075a5c243f7fb1afd6399b0df77ad
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include "imx95-u-boot.dtsi"
+
+&gpio1 {
+	reg = <0 0x47400000 0 0x1000>, <0 0x47400040 0 0x40>;
+};
+
+&lpuart1 {
+	clocks = <&scmi_clk IMX95_CLK_LPUART1>, <&scmi_clk IMX95_CLK_LPUART1>;
+	clock-names = "ipg", "per";
+	bootph-pre-ram;
+};
+
+&pinctrl_uart1 {

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 28

Quoted 10 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +10 -0
+	bootph-pre-ram;
+};
+
+&usdhc1 {
+	bootph-pre-ram;
+};
+
+&pinctrl_usdhc1 {
+	bootph-pre-ram;
+};

Keep this DT sorted alphabetically .

[...]

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 8

Quoted 10 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +9 -0
+++ b/arch/arm/dts/imx95-u-boot.dtsi
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+/ {
+    binman {
+        multiple-images;

Indent with tabs, consistently.

Quoted 29 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +29 -0
+        m33-oei-ddrfw {
+            pad-byte = <0x00>;
+            align-size = <0x8>;
+            filename = "m33-oei-ddrfw.bin";
+
+            oei-m33-ddr {
+                align-size = <0x4>;
+                filename = "oei-m33-ddr.bin";
+                type = "blob-ext";
+            };
+
+            imx-lpddr {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem {
+                    filename = "lpddr5_imem_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem {
+                    filename = "lpddr5_dmem_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+
+            imx-lpddr-qb {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem-qb {

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 47

Quoted 10 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +10 -0
+                    filename = "lpddr5_imem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem-qb {
+                    filename = "lpddr5_dmem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+        };

Can you include a totem-pole illustration of the firmware format in the docs ? Like the one in doc/imx/habv4/guides/mx8m_spl_secure_boot.txt , search for 'Image Vector Table' .

Quoted 6 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +6 -0
+		imx-boot {
+			filename = "flash.bin";
+			pad-byte = <0x00>;
+
+            spl {
+                align = <0x400>;

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 63

Quoted 10 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +10 -0
+                align-size = <0x400>;
+                type = "mkimage";
+                args = "-n spl/u-boot-spl.cfgout -T imx8image";
+            };
+
+            u-boot {
+                type = "mkimage";
+                args = "-n u-boot-container.cfgout -T imx8image";
+            };
+		};

I have a feeling this will have to be restructured to assemble the image correctly .

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 69

Quoted 6 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +6 -0
+	};
+};
+
+&{/soc} {
+	bootph-all;
+	bootph-pre-ram;

Are both bootph-all and bootph-pre-ram needed ?

[...]

arch/arm/mach-imx/imx9/scmi/soc.c line 46

Quoted 9 lines
arch/arm/mach-imx/imx9/scmi/soc.c +1 -0
index 8a7df24afecc1d6d77b7162be639b56af95fd975..38ade99964b64512ba93423efcaa0cfb58094b00 100644
@@ -43,6 +43,7 @@
  #endif
  #include <spl.h>
  #include <mmc.h>
+#include <asm/arch/mu.h>

Should this change be part of this patch ?

Quoted 2 lines
arch/arm/mach-imx/imx9/scmi/soc.c +0 -0
  DECLARE_GLOBAL_DATA_PTR;
 

[...]

Quoted 22 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +16 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8d2b5dfcf07d251c77440bae44d62bff6253dfc7
@@ -0,0 +1,90 @@
+sec_boot=no
+initrd_addr=0x93800000
+emmc_dev=0
+sd_dev=1
+scriptaddr=0x93500000
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+image=Image
+splashimage=0xA0000000
+console=ttyLP0,115200 earlycon
+fdt_addr_r=0x93000000
+fdt_addr=0x93000000
+cntr_addr=0xA8000000
+cntr_file=os_cntr_signed.bin
+boot_fit=no
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+bootm_size=0x10000000

board/freescale/imx95_evk/imx95_19x19_evk.env line 26

Quoted 10 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +10 -0
+mmcautodetect=yes
+mmcargs=setenv bootargs console=${console} root=${mmcroot}
+loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
+bootscript=echo Running bootscript from mmc ...; source
+loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}
+auth_os=auth_cntr ${cntr_addr}
+boot_os=booti ${loadaddr} - ${fdt_addr_r};
+mmcboot=echo Booting from mmc ...;

Why not use bootmethod ?

[...]

Quoted 17 lines
board/freescale/imx95_evk/spl.c new file +11 -0
new file mode 100644
index 0000000000000000000000000000000000000000..54f56c8049876fde335485a5c3bd54dff6e4f730
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <command.h>
+#include <cpu_func.h>
+#include <clk.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>

board/freescale/imx95_evk/spl.c line 21

Quoted 10 lines
board/freescale/imx95_evk/spl.c new file +10 -0
+#include <log.h>
+#include <spl.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/syscounter.h>
+#include <asm/mach-imx/ele_api.h>
+#include <asm/sections.h>

Are all these headers really needed ?

Remove the unneeded ones .

Quoted 35 lines
board/freescale/imx95_evk/spl.c new file +35 -0
+#include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
+#include <linux/delay.h>
+#include <linux/iopoll.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/ccm_regs.h>
+#ifdef CONFIG_SCMI_FIRMWARE
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include "../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include "../../../dts/upstream/src/arm64/freescale/imx95-power.h"
+#endif
+#include <asm/arch/mu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int spl_board_boot_device(enum boot_device boot_dev_spl)
+{
+	switch (boot_dev_spl) {
+	case SD1_BOOT:
+	case MMC1_BOOT:
+		return BOOT_DEVICE_MMC1;
+	case SD2_BOOT:
+	case MMC2_BOOT:
+		return BOOT_DEVICE_MMC2;
+	case USB_BOOT:
+		return BOOT_DEVICE_BOARD;
+	default:
+		return BOOT_DEVICE_NONE;
+	}
+}
+
+void spl_board_init(void)

board/freescale/imx95_evk/spl.c line 66

Quoted 10 lines
board/freescale/imx95_evk/spl.c new file +10 -0
+{
+	puts("Normal Boot\n");
+}
+
+void board_init_f(ulong dummy)
+{
+	int ret;
+
+	/* Clear the BSS. */
+	memset(__bss_start, 0, __bss_end - __bss_start);

Is memset this necessary ? I don't think it is.

[...]

Quoted 24 lines
doc/board/nxp/imx95_evk.rst new file +18 -0
new file mode 100644
index 0000000000000000000000000000000000000000..132c45ed485148366533ee31485a4d5a41556eb0
@@ -0,0 +1,116 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+imx95_evk
+=======================
+
+U-Boot for the NXP i.MX95 19x19 EVK board
+
+Quick Start
+-----------
+
+- Get ahab-container.img
+- Get DDR PHY Firmware Images
+- Get and Build OEI Images
+- Get and Build System Manager Image
+- Get and Build the ARM Trusted Firmware
+- Build the Bootloader Image
+- Boot
+

doc/board/nxp/imx95_evk.rst line 28

Quoted 10 lines
doc/board/nxp/imx95_evk.rst new file +10 -0
+Get ahab-container.img
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+
+.. code-block:: bash
+
+   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-1.3.0-17945fc.bin
+   $ chmod +x firmware-ele-imx-1.3.0-17945fc.bin
+   $ ./firmware-ele-imx-1.3.0-17945fc.bin

It is possible to somehow only download and extract the file, without running script that was downloaded from the internet, without any validation ?

[...]

Quoted 17 lines
doc/board/nxp/imx95_evk.rst new file +16 -0
+++ b/include/configs/imx95_evk.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+#ifndef __IMX95_EVK_H
+#define __IMX95_EVK_H
+
+#include <linux/sizes.h>
+#include <linux/stringify.h>
+#include <asm/arch/imx-regs.h>
+
+#define CFG_SYS_UBOOT_BASE	\
+	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+

doc/board/nxp/imx95_evk.rst line 25

Quoted 10 lines
doc/board/nxp/imx95_evk.rst new file +10 -0
+#define CFG_SYS_INIT_RAM_ADDR        0x90000000
+#define CFG_SYS_INIT_RAM_SIZE        0x200000
+
+#define CFG_SYS_SDRAM_BASE           0x90000000
+#define PHYS_SDRAM                      0x90000000
+/* Totally 16GB */
+#define PHYS_SDRAM_SIZE			0x70000000 /* 2GB  - 256MB DDR */
+#define PHYS_SDRAM_2_SIZE		0x380000000 /* 14GB */
+
+#define CFG_SYS_FSL_USDHC_NUM	2

Is this still needed ?

doc/board/nxp/imx95_evk.rst line 27

Quoted 2 lines
doc/board/nxp/imx95_evk.rst new file +2 -0
+/* Using ULP WDOG for reset */
+#define WDOG_BASE_ADDR          WDG3_BASE_ADDR

Is this still needed ? DM WDT should be able to look up the address from DT .

#60 lore raw

Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

In reply to Alice Guo
Quoted 5 lines · Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

Hi Alice,

Could you add in the commit log what is and/or what is not supported?

From what I see:

the following is supported:
- gpio
- pci
- i2c
- mmc

the following are not yet supported by this series:
- ethernet
- usb

Best Regards,

Tim

Quoted 1,013 lines
---
 arch/arm/dts/imx95-19x19-evk-u-boot.dtsi      |  68 ++++++++++
 arch/arm/dts/imx95-u-boot.dtsi                | 173 +++++++++++++++++++++++++
 arch/arm/mach-imx/imx9/Kconfig                |   6 +
 arch/arm/mach-imx/imx9/scmi/container.cfg     |  10 ++
 arch/arm/mach-imx/imx9/scmi/imximage.cfg      |  15 +++
 arch/arm/mach-imx/imx9/scmi/soc.c             |   1 +
 board/freescale/imx95_evk/Kconfig             |  12 ++
 board/freescale/imx95_evk/MAINTAINERS         |   6 +
 board/freescale/imx95_evk/Makefile            |  11 ++
 board/freescale/imx95_evk/imx95_19x19_evk.env |  90 +++++++++++++
 board/freescale/imx95_evk/imx95_evk.c         |  54 ++++++++
 board/freescale/imx95_evk/spl.c               |  96 ++++++++++++++
 configs/imx95_19x19_evk_defconfig             | 177 ++++++++++++++++++++++++++
 doc/board/nxp/imx95_evk.rst                   | 116 +++++++++++++++++
 doc/board/nxp/index.rst                       |   1 +
 include/configs/imx95_evk.h                   |  30 +++++
 16 files changed, 866 insertions(+)
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +68 -0
new file mode 100644
index 0000000000000000000000000000000000000000..36169b56ef3075a5c243f7fb1afd6399b0df77ad
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include "imx95-u-boot.dtsi"
+
+&gpio1 {
+       reg = <0 0x47400000 0 0x1000>, <0 0x47400040 0 0x40>;
+};
+
+&lpuart1 {
+       clocks = <&scmi_clk IMX95_CLK_LPUART1>, <&scmi_clk IMX95_CLK_LPUART1>;
+       clock-names = "ipg", "per";
+       bootph-pre-ram;
+};
+
+&pinctrl_uart1 {
+       bootph-pre-ram;
+};
+
+&usdhc1 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_100mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_200mhz {
+       bootph-pre-ram;
+};
+
+&usdhc2 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_100mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_200mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_gpio {
+       bootph-pre-ram;
+};
+
+&reg_usdhc2_vmmc {
+       bootph-pre-ram;
+};
+
+&pinctrl_reg_usdhc2_vmmc {
+       bootph-pre-ram;
+};
+
+&wdog3 {
+       status = "disabled";
+};
arch/arm/dts/imx95-u-boot.dtsi new file +173 -0
new file mode 100644
index 0000000000000000000000000000000000000000..bf6b31210e0d70674d6ce7c787ff7157a1cf65ed
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+/ {
+    binman {
+        multiple-images;
+
+        m33-oei-ddrfw {
+            pad-byte = <0x00>;
+            align-size = <0x8>;
+            filename = "m33-oei-ddrfw.bin";
+
+            oei-m33-ddr {
+                align-size = <0x4>;
+                filename = "oei-m33-ddr.bin";
+                type = "blob-ext";
+            };
+
+            imx-lpddr {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem {
+                    filename = "lpddr5_imem_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem {
+                    filename = "lpddr5_dmem_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+
+            imx-lpddr-qb {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem-qb {
+                    filename = "lpddr5_imem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem-qb {
+                    filename = "lpddr5_dmem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+        };
+
+               imx-boot {
+                       filename = "flash.bin";
+                       pad-byte = <0x00>;
+
+            spl {
+                align = <0x400>;
+                align-size = <0x400>;
+                type = "mkimage";
+                args = "-n spl/u-boot-spl.cfgout -T imx8image";
+            };
+
+            u-boot {
+                type = "mkimage";
+                args = "-n u-boot-container.cfgout -T imx8image";
+            };
+               };
+       };
+};
+
+&{/soc} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips2 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips3 {
+       bootph-pre-ram;
+};
+
+&gpio2 {
+       reg = <0 0x43810000 0 0x1000>, <0 0x43810040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio3 {
+       reg = <0 0x43820000 0 0x1000>, <0 0x43820040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio4 {
+       reg = <0 0x43840000 0 0x1000>, <0 0x43840040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio5 {
+       reg = <0 0x43850000 0 0x1000>, <0 0x43850040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&osc_24m {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&clk_ext1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&mu2 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&sram0 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&scmi_buf0 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&scmi_buf1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@11} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@13} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@14} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@19} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&elemu3 {
+       compatible = "fsl,imx93-mu-s4";
+       status = "okay";
+       bootph-all;
+       bootph-pre-ram;
+};
arch/arm/mach-imx/imx9/Kconfig +6 -0
index 596e753f2897c11d7ca3bcc9211af786d005bfd9..1ba277baeb353de301a1e67a7adf70f281752ded 100644
@@ -66,6 +66,11 @@ config TARGET_PHYCORE_IMX93
        select OF_BOARD_FIXUP
        select OF_BOARD_SETUP
 
+config TARGET_IMX95_19X19_EVK
+       bool "imx95_19x19_evk"
+       select IMX95
+       imply OF_UPSTREAM
+
 endchoice
 
 source "board/freescale/imx91_evk/Kconfig"
@@ -73,6 +78,7 @@ source "board/freescale/imx93_evk/Kconfig"
 source "board/freescale/imx93_qsb/Kconfig"
 source "board/phytec/phycore_imx93/Kconfig"
 source "board/variscite/imx93_var_som/Kconfig"
+source "board/freescale/imx95_evk/Kconfig"
 
 endif
 
arch/arm/mach-imx/imx9/scmi/container.cfg new file +10 -0
new file mode 100644
index 0000000000000000000000000000000000000000..29f346e59c4afd0c2689667abe36f4b776b29ba8
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+CONTAINER
+IMAGE A55 bl31.bin 0x8a200000
+IMAGE A55 u-boot.bin CONFIG_TEXT_BASE
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/imximage.cfg new file +15 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c90432f5efa78dccb2c67e237b88a96174446b96
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+APPEND mx95a0-ahab-container.img
+CONTAINER
+IMAGE OEI m33-oei-ddrfw.bin 0x1ffc0000
+HOLD 0x10000
+IMAGE OEI oei-m33-tcm.bin 0x1ffc0000
+IMAGE M33 m33_image.bin 0x1ffc0000
+IMAGE A55 spl/u-boot-spl.bin 0x20480000
+DUMMY_V2X 0x8b000000
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/soc.c +1 -0
index 8a7df24afecc1d6d77b7162be639b56af95fd975..38ade99964b64512ba93423efcaa0cfb58094b00 100644
@@ -43,6 +43,7 @@
 #endif
 #include <spl.h>
 #include <mmc.h>
+#include <asm/arch/mu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/freescale/imx95_evk/Kconfig new file +12 -0
new file mode 100644
index 0000000000000000000000000000000000000000..f9a67353e5db6d3ec94784cf091e45d8817d541c
@@ -0,0 +1,12 @@
+if TARGET_IMX95_19X19_EVK
+
+config SYS_BOARD
+       default "imx95_evk"
+
+config SYS_VENDOR
+       default "freescale"
+
+config SYS_CONFIG_NAME
+       default "imx95_evk"
+
+endif
board/freescale/imx95_evk/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000000000000000000000000000000000..5caf763e0cc390c46fc54ee627bc966b2b110958
@@ -0,0 +1,6 @@
+i.MX95 EVK BOARD
+M:     Alice Guo <[email protected]>
+S:     Maintained
+F:     board/freescale/imx95_evk/
+F:     include/configs/imx95_evk.h
+F:     configs/imx95_19x19_evk_defconfig
board/freescale/imx95_evk/Makefile new file +11 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a278d58ee0085176948b812703d120aaad3a3116
@@ -0,0 +1,11 @@
+#
+# Copyright 2024 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx95_evk.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
board/freescale/imx95_evk/imx95_19x19_evk.env new file +90 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8d2b5dfcf07d251c77440bae44d62bff6253dfc7
@@ -0,0 +1,90 @@
+sec_boot=no
+initrd_addr=0x93800000
+emmc_dev=0
+sd_dev=1
+scriptaddr=0x93500000
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+image=Image
+splashimage=0xA0000000
+console=ttyLP0,115200 earlycon
+fdt_addr_r=0x93000000
+fdt_addr=0x93000000
+cntr_addr=0xA8000000
+cntr_file=os_cntr_signed.bin
+boot_fit=no
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+bootm_size=0x10000000
+mmcautodetect=yes
+mmcargs=setenv bootargs console=${console} root=${mmcroot}
+loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
+bootscript=echo Running bootscript from mmc ...; source
+loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}
+auth_os=auth_cntr ${cntr_addr}
+boot_os=booti ${loadaddr} - ${fdt_addr_r};
+mmcboot=echo Booting from mmc ...;
+               run mmcargs;
+               if test ${sec_boot} = yes; then
+                       if run auth_os; then
+                               run boot_os;
+                       else
+                               echo ERR: failed to authenticate;
+                       fi;
+               else
+                       if test ${boot_fit} = yes || test ${boot_fit} = try; then
+                               bootm ${loadaddr};
+                       else
+                               if run loadfdt; then
+                                       run boot_os;
+                               else
+                                       echo WARN: Cannot load the DT;
+                               fi;
+                       fi;
+               fi;
+netargs=setenv bootargs console=${console} root=/dev/nfs
+               ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
+netboot=echo Booting from net ...;
+               run netargs;
+               if test ${ip_dyn} = yes; then
+                       setenv get_cmd dhcp;
+               else
+                       setenv get_cmd tftp;
+               fi;
+               if test ${sec_boot} = yes; then
+                       ${get_cmd} ${cntr_addr} ${cntr_file};
+                       if run auth_os; then
+                               run boot_os;
+                       else
+                               echo ERR: failed to authenticate;
+                       fi;
+               else
+                       ${get_cmd} ${loadaddr} ${image};
+                       if test ${boot_fit} = yes || test ${boot_fit} = try; then
+                               bootm ${loadaddr};
+                       else
+                               if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then
+                                       run boot_os;
+                               else
+                                       echo WARN: Cannot load the DT;
+                               fi;
+                       fi;
+               fi;
+bsp_bootcmd=echo Running BSP bootcmd ...;
+                       mmc dev ${mmcdev}; if mmc rescan; then
+                       if run loadbootscript; then
+                               run bootscript;
+                       else
+                               if test ${sec_boot} = yes; then
+                                       if run loadcntr; then
+                                               run mmcboot;
+                                       else run netboot;
+                                       fi;
+                               else
+                                       if run loadimage; then
+                                               run mmcboot;
+                                       else run netboot;
+                                       fi;
+                               fi;
+                       fi;
+               fi;
\ No newline at end of file
board/freescale/imx95_evk/imx95_evk.c new file +54 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c75a8f2450288a34cfc01150d3c42b07f2215491
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <env.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <asm/arch-imx9/ccm_regs.h>
+#include <asm/arch/clock.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/gpio.h>
+#include <asm/mach-imx/sys_proto.h>
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include "../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include "../../../dts/upstream/src/arm64/freescale/imx95-power.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+       /* UART1: A55, UART2: M33, UART3: M7 */
+       init_uart_clk(0);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}
+
+int board_late_init(void)
+{
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
+       return 0;
+}
+
+int board_phys_sdram_size(phys_size_t *size)
+{
+       *size = PHYS_SDRAM_SIZE + PHYS_SDRAM_2_SIZE;
+
+       return 0;
+}
board/freescale/imx95_evk/spl.c new file +96 -0
new file mode 100644
index 0000000000000000000000000000000000000000..54f56c8049876fde335485a5c3bd54dff6e4f730
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <command.h>
+#include <cpu_func.h>
+#include <clk.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
+#include <spl.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/syscounter.h>
+#include <asm/mach-imx/ele_api.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 <linux/iopoll.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/ccm_regs.h>
+#ifdef CONFIG_SCMI_FIRMWARE
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include "../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include "../../../dts/upstream/src/arm64/freescale/imx95-power.h"
+#endif
+#include <asm/arch/mu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int spl_board_boot_device(enum boot_device boot_dev_spl)
+{
+       switch (boot_dev_spl) {
+       case SD1_BOOT:
+       case MMC1_BOOT:
+               return BOOT_DEVICE_MMC1;
+       case SD2_BOOT:
+       case MMC2_BOOT:
+               return BOOT_DEVICE_MMC2;
+       case USB_BOOT:
+               return BOOT_DEVICE_BOARD;
+       default:
+               return BOOT_DEVICE_NONE;
+       }
+}
+
+void spl_board_init(void)
+{
+       puts("Normal Boot\n");
+}
+
+void board_init_f(ulong dummy)
+{
+       int ret;
+
+       /* Clear the BSS. */
+       memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_SPL_RECOVER_DATA_SECTION
+       if (IS_ENABLED(CONFIG_SPL_BUILD))
+               spl_save_restore_data();
+#endif
+
+       timer_init();
+
+       /* Need dm_init() to run before any SCMI calls can be made. */
+       spl_early_init();
+
+       /* Need enable SCMI drivers and ELE driver before enabling console */
+       ret = imx9_probe_mu();
+       if (ret)
+               hang(); /* if MU not probed, nothing can output, just hang here */
+
+       arch_cpu_init();
+
+       board_early_init_f();
+
+       preloader_console_init();
+
+       debug("SOC: 0x%x\n", gd->arch.soc_rev);
+       debug("LC: 0x%x\n", gd->arch.lifecycle);
+
+       /* Will set ARM freq to max rate */
+       clock_init_late();
+
+       board_init_r(NULL, 0);
+}
configs/imx95_19x19_evk_defconfig new file +177 -0
new file mode 100644
index 0000000000000000000000000000000000000000..4d6b194528e7f3124e6626b28be0d6344758f6e5
@@ -0,0 +1,177 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX9=y
+CONFIG_TEXT_BASE=0x90200000
+CONFIG_SYS_MALLOC_LEN=0x2000000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=3
+CONFIG_ENV_SIZE=0x4000
+CONFIG_ENV_OFFSET=0x700000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="freescale/imx95-19x19-evk"
+CONFIG_SPL_TEXT_BASE=0x20480000
+CONFIG_TARGET_IMX95_19X19_EVK=y
+CONFIG_SYS_PROMPT="u-boot=> "
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL_STACK=0x204d6000
+CONFIG_SPL=y
+CONFIG_SPL_LOAD_IMX_CONTAINER=y
+CONFIG_IMX_CONFIG="arch/arm/mach-imx/imx9/scmi/imximage.cfg"
+CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/scmi/container.cfg"
+CONFIG_SYS_LOAD_ADDR=0x90400000
+CONFIG_SYS_MEMTEST_START=0x90000000
+CONFIG_SYS_MEMTEST_END=0xA0000000
+CONFIG_REMAKE_ELF=y
+CONFIG_SYS_MONITOR_LEN=524288
+CONFIG_DEFAULT_FDT_FILE="imx95-19x19-evk.dtb"
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SPL_MAX_SIZE=0x20000
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x204d6000
+CONFIG_SPL_BSS_MAX_SIZE=0x2000
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_GPIO=y
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x93200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
+CONFIG_SPL_POWER=y
+CONFIG_SDP_LOADADDR=0x90400000
+CONFIG_SPL_WATCHDOG=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_SYS_CBSIZE=2048
+CONFIG_SYS_PBSIZE=2074
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_NVEDIT_EFI=y
+CONFIG_CMD_CRC32=y
+CONFIG_CRC32_VERIFY=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EFIDEBUG=y
+CONFIG_CMD_RTC=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_GETTIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_NOWHERE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_ETHPRIME=y
+CONFIG_ETHPRIME="eth0"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_IMX_RGPIO2P=y
+CONFIG_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
+CONFIG_SF_DEFAULT_BUS=0
+CONFIG_SF_DEFAULT_SPEED=40000000
+CONFIG_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_IMX_LPI2C=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS400_ES_SUPPORT=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_FSL_USDHC=y
+CONFIG_PHY=y
+CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RTC=y
+CONFIG_DM_SERIAL=y
+CONFIG_FSL_LPUART=y
+CONFIG_ULP_WATCHDOG=y
+CONFIG_LZO=y
+CONFIG_BZIP2=y
+CONFIG_HUSH_PARSER=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ADP5585_GPIO=y
+CONFIG_SPL_I2C=y
+CONFIG_POWER_DOMAIN=y
+# SCMI options
+CONFIG_DM_MAILBOX=y
+CONFIG_SCMI_FIRMWARE=y
+CONFIG_SCMI_AGENT_SMCCC=n
+CONFIG_CLK_SCMI=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK_SCMI=y
+CONFIG_SPL_CLK=y
+CONFIG_PINCTRL_IMX_SCMI=y
+CONFIG_SCMI_POWER_DOMAIN=y
+CONFIG_SPL_DM_MAILBOX=y
+CONFIG_SPL_FIRMWARE=y
+#CONFIG_SPL_POWER_DOMAIN=y
+CONFIG_SPL_IMX_MU_MBOX=y
+CONFIG_IMX_MU_MBOX=y
+#CONFIG_REMOTEPROC_SCMI_LMM=y
+#CONFIG_CMD_REMOTEPROC=y
+# CONFIG_RESET_SCMI=y
+# CONFIG_DM_REGULATOR_SCMI=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_PCI=y
+CONFIG_PCIE_ECAM_GENERIC=y
+CONFIG_PCI_SCAN_SHOW=y
+CONFIG_CMD_PCI=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_PHYLIB=y
+CONFIG_PHYLIB_10G=y
+CONFIG_PHY_AQUANTIA=y
+CONFIG_PHY_REALTEK=y
+CONFIG_FSL_ENETC=y
+CONFIG_SYS_RX_ETH_BUFFER=8
+CONFIG_IMX8_ROMAPI=n
+CONFIG_CLK_CCF=y
+CONFIG_SPL_CLK_CCF=y
+CONFIG_SPL_RECOVER_DATA_SECTION=y
+CONFIG_ENV_SOURCE_FILE="imx95_19x19_evk"
doc/board/nxp/imx95_evk.rst new file +116 -0
new file mode 100644
index 0000000000000000000000000000000000000000..132c45ed485148366533ee31485a4d5a41556eb0
@@ -0,0 +1,116 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+imx95_evk
+=======================
+
+U-Boot for the NXP i.MX95 19x19 EVK board
+
+Quick Start
+-----------
+
+- Get ahab-container.img
+- Get DDR PHY Firmware Images
+- Get and Build OEI Images
+- Get and Build System Manager Image
+- Get and Build the ARM Trusted Firmware
+- Build the Bootloader Image
+- Boot
+
+Get ahab-container.img
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+
+.. code-block:: bash
+
+   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-1.3.0-17945fc.bin
+   $ chmod +x firmware-ele-imx-1.3.0-17945fc.bin
+   $ ./firmware-ele-imx-1.3.0-17945fc.bin
+   $ cp firmware-ele-imx-1.3.0-17945fc/mx95a0-ahab-container.img $(srctree)
+
+Get DDR PHY Firmware Images
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+
+.. code-block:: bash
+
+   $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.26-d4c33ab.bin
+   $ chmod +x firmware-imx-8.26-d4c33ab.bin
+   $ ./firmware-imx-8.26-d4c33ab.bin
+   $ cp firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr5*v202311.bin $(srctree)
+
+Get and Build OEI Images
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+Get OEI from: https://github.com/nxp-imx/imx-oei
+branch: master
+
+.. code-block:: bash
+
+   $ sudo apt -y install make gcc g++-multilib srecord
+   $ wget https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ tar xvf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ export TOOLS=$PWD
+   $ git clone -b master https://github.com/nxp-imx/imx-oei.git
+   $ cd imx-oei
+   $ make board=mx95lp5 oei=ddr DEBUG=1
+   $ cp build/mx95lp5/ddr/oei-m33-ddr.bin $(srctree)
+
+   $ make board=mx95lp5 oei=tcm DEBUG=1
+   $ cp build/mx95lp5/tcm/oei-m33-tcm.bin $(srctree)
+
+Get and Build System Manager Image
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+Get System Manager from: https://github.com/nxp-imx/imx-sm
+branch: master
+
+.. code-block:: bash
+
+   $ sudo apt -y install make gcc g++-multilib srecord
+   $ wget https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ tar xvf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ export TOOLS=$PWD
+   $ git clone -b master https://github.com/nxp-imx/imx-sm.git
+   $ cd imx-sm
+   $ make config=mx95evk all
+   $ cp build/mx95evk/m33_image.bin $(srctree)
+
+Get and Build the ARM Trusted Firmware
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+Get ATF from: https://github.com/nxp-imx/imx-atf/
+branch: lf_v2.10
+
+.. code-block:: bash
+
+   $ export CROSS_COMPILE=aarch64-poky-linux-
+   $ unset LDFLAGS
+   $ git clone -b lf_v2.10 https://github.com/nxp-imx/imx-atf.git
+   $ cd imx-atf
+   $ make PLAT=imx95 bl31
+   $ cp build/imx95/release/bl31.bin $(srctree)
+
+Build the Bootloader Image
+------------
+
+.. code-block:: bash
+
+   $ export CROSS_COMPILE=aarch64-poky-linux-
+   $ make imx95_19x19_evk_defconfig
+   $ make
+
+Copy imx-boot-imx95.bin to the MicroSD card:
+
+.. code-block:: bash
+
+   $ sudo dd if=flash.bin of=/dev/sd[x] bs=1k seek=32 conv=fsync
+
+Boot
+----
+
+Set i.MX95 boot device to MicroSD card
doc/board/nxp/index.rst +1 -0
index 8ca4b5619863f616dbedc7eb0ff8a286a3fbbf48..e7ec725cc04e9755ba3dac37561c26ebc3f1c716 100644
@@ -15,6 +15,7 @@ NXP Semiconductors
    imx91_11x11_evk
    imx93_9x9_qsb
    imx93_11x11_evk
+   imx95_evk
    imxrt1020-evk
    imxrt1050-evk
    imxrt1170-evk
include/configs/imx95_evk.h new file +30 -1
new file mode 100644
index 0000000000000000000000000000000000000000..00909a043a71751684ebd8dc413b05d5aee8dd69
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+#ifndef __IMX95_EVK_H
+#define __IMX95_EVK_H
+
+#include <linux/sizes.h>
+#include <linux/stringify.h>
+#include <asm/arch/imx-regs.h>
+
+#define CFG_SYS_UBOOT_BASE     \
+       (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+
+#define CFG_SYS_INIT_RAM_ADDR        0x90000000
+#define CFG_SYS_INIT_RAM_SIZE        0x200000
+
+#define CFG_SYS_SDRAM_BASE           0x90000000
+#define PHYS_SDRAM                      0x90000000
+/* Totally 16GB */
+#define PHYS_SDRAM_SIZE                        0x70000000 /* 2GB  - 256MB DDR */
+#define PHYS_SDRAM_2_SIZE              0x380000000 /* 14GB */
+
+#define CFG_SYS_FSL_USDHC_NUM  2
+
+/* Using ULP WDOG for reset */
+#define WDOG_BASE_ADDR          WDG3_BASE_ADDR
+
+#endif
 
--

2.34.1

#61 lore raw

Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

Quoted 9 lines · Tim Harvey
Quoted 5 lines · Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

Hi Alice,

Quoted 7 lines

Could you add in the commit log what is and/or what is not supported?

From what I see:

the following is supported:
- gpio
- pci

I don't think either the ECAM (internal ethernet PCIe) or PCIe host are supported, but the former is coming (I'm working on networking support) and the later is easy to add based on the current MX8MP DW PCIe driver and PHY drivers.

Quoted 6 lines

- i2c
- mmc

the following are not yet supported by this series:
- ethernet
- usb

USB 2.0 should be usable with u-boot/master now, although you will need to pull more recent DTs to obtain the controller node in imx95.dtsi .

USB 3.0 is possible without this TypeC switcher in PHY driver, I got it working as gadget I think.

#62 lore raw

Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

Quoted 15 lines · Marek Vasut
Quoted 13 lines · Tim Harvey
Quoted 5 lines · Alice Guo

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

Hi Alice,

Could you add in the commit log what is and/or what is not supported?

From what I see:

Quoted 8 lines
Quoted 3 lines

the following is supported:
- gpio
- pci

I don't think either the ECAM (internal ethernet PCIe) or PCIe host are supported, but the former is coming (I'm working on networking support) and the later is easy to add based on the current MX8MP DW PCIe driver and PHY drivers.

Hi Marek,

You're right. I have a set of messy patches pulled from nxp's u-boot that is enabling PCI ECAM and enetc. With the latest patchset from Alice PCI isn't there yet.

Quoted 10 lines
Quoted 7 lines

- i2c
- mmc

the following are not yet supported by this series:
- ethernet
- usb

USB 2.0 should be usable with u-boot/master now, although you will need to pull more recent DTs to obtain the controller node in imx95.dtsi .

Yes, I did get USB 2.0 by adding the relevant usb2 nodes to dt (haven't seen this submitted upstream yet) and your "usb: ehci-mx6:
Add i.MX95 support" patch.

Quoted 2 lines

USB 3.0 is possible without this TypeC switcher in PHY driver, I got it working as gadget I think.

Ok, the usb3 dt nodes have been submitted upstream [1] but I haven't gotten usb3 to work as host yet but did not try peripheral mode. I did notice there is no ptn5110 driver keeping type-C role selection working.

Best Regards,

Tim
[1] https://patchwork.kernel.org/project/imx/list/?series=914412

#63 lore raw

Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

On 1/15/25 6:10 PM, Tim Harvey wrote:

Hi,

Quoted 3 lines

You're right. I have a set of messy patches pulled from nxp's u-boot that is enabling PCI ECAM and enetc. With the latest patchset from Alice PCI isn't there yet.

I have ENETC pretty much cleaned up, the NETC block controller is what I still need to finish.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

- i2c
- mmc

the following are not yet supported by this series:
- ethernet
- usb

Quoted 7 lines
Quoted 3 lines

USB 2.0 should be usable with u-boot/master now, although you will need to pull more recent DTs to obtain the controller node in imx95.dtsi .

Yes, I did get USB 2.0 by adding the relevant usb2 nodes to dt (haven't seen this submitted upstream yet) and your "usb: ehci-mx6:
Add i.MX95 support" patch.

Good.

Quoted 7 lines
Quoted 2 lines

USB 3.0 is possible without this TypeC switcher in PHY driver, I got it working as gadget I think.

Ok, the usb3 dt nodes have been submitted upstream [1] but I haven't gotten usb3 to work as host yet but did not try peripheral mode. I did notice there is no ptn5110 driver keeping type-C role selection working.

Indeed . Do you want to start looking at the PTN and TCA block (that goes into USB PHY driver) support ?

#64 lore raw

回复: [EXT] Re: [PATCH v3 17/17] imx95_evk: add i.MX95 19x19 EVK board basic support

In reply to Tim Harvey
Quoted 19 lines · Alice Guo
Quoted 5 lines

From: Ye Li <[email protected]>

This patch adds i.MX95 19x19 EVK board basic support.

Hi Alice,

Could you add in the commit log what is and/or what is not supported?

From what I see:

the following is supported:
- gpio
- pci
- i2c
- mmc

Quoted 7 lines

the following are not yet supported by this series:
- ethernet
- usb

Best Regards,

Tim

Will add it in the commit log.

Best Regards,
Alice Guo

Quoted 1,192 lines
Quoted 6 lines
---
 arch/arm/dts/imx95-19x19-evk-u-boot.dtsi      |  68 ++++++++++
 arch/arm/dts/imx95-u-boot.dtsi                | 173

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

Quoted 11 lines
 arch/arm/mach-imx/imx9/Kconfig                |   6 +
 arch/arm/mach-imx/imx9/scmi/container.cfg     |  10 ++
 arch/arm/mach-imx/imx9/scmi/imximage.cfg      |  15 +++
 arch/arm/mach-imx/imx9/scmi/soc.c             |   1 +
 board/freescale/imx95_evk/Kconfig             |  12 ++
 board/freescale/imx95_evk/MAINTAINERS         |   6 +
 board/freescale/imx95_evk/Makefile            |  11 ++
 board/freescale/imx95_evk/imx95_19x19_evk.env |  90 +++++++++++++
 board/freescale/imx95_evk/imx95_evk.c         |  54 ++++++++
 board/freescale/imx95_evk/spl.c               |  96 ++++++++++++++
 configs/imx95_19x19_evk_defconfig             | 177

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

Quoted 1 line
 doc/board/nxp/imx95_evk.rst                   | 116

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

Quoted 9 lines
 doc/board/nxp/index.rst                       |   1 +
 include/configs/imx95_evk.h                   |  30 +++++
 16 files changed, 866 insertions(+)
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +0 -0
new file mode 100644

index

0000000000000000000000000000000000000000..36169b56ef3075a5c243f7fb 1afd

Quoted 6 lines

6399b0df77ad

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +2 -0
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*

arch/arm/dts/imx95-19x19-evk-u-boot.dtsi line 12

Quoted 10 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +10 -0
+ * Copyright 2024 NXP
+ */
+
+#include "imx95-u-boot.dtsi"
+
+&gpio1 {
+       reg = <0 0x47400000 0 0x1000>, <0 0x47400040 0 0x40>; };
+
+&lpuart1 {
+       clocks = <&scmi_clk IMX95_CLK_LPUART1>, <&scmi_clk

IMX95_CLK_LPUART1>;

Quoted 56 lines
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi new file +55 -0
+       clock-names = "ipg", "per";
+       bootph-pre-ram;
+};
+
+&pinctrl_uart1 {
+       bootph-pre-ram;
+};
+
+&usdhc1 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_100mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_200mhz {
+       bootph-pre-ram;
+};
+
+&usdhc2 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2 {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_100mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_200mhz {
+       bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_gpio {
+       bootph-pre-ram;
+};
+
+&reg_usdhc2_vmmc {
+       bootph-pre-ram;
+};
+
+&pinctrl_reg_usdhc2_vmmc {
+       bootph-pre-ram;
+};
+
+&wdog3 {
+       status = "disabled";
+};
(quoted diff) +0 -0
Quoted 2 lines

b/arch/arm/dts/imx95-u-boot.dtsi new file mode 100644 index

0000000000000000000000000000000000000000..bf6b31210e0d70674d6ce7c 787ff

Quoted 178 lines

7157a1cf65ed

arch/arm/dts/imx95-u-boot.dtsi new file +173 -0
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+/ {
+    binman {
+        multiple-images;
+
+        m33-oei-ddrfw {
+            pad-byte = <0x00>;
+            align-size = <0x8>;
+            filename = "m33-oei-ddrfw.bin";
+
+            oei-m33-ddr {
+                align-size = <0x4>;
+                filename = "oei-m33-ddr.bin";
+                type = "blob-ext";
+            };
+
+            imx-lpddr {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem {
+                    filename = "lpddr5_imem_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem {
+                    filename = "lpddr5_dmem_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+
+            imx-lpddr-qb {
+                type = "nxp-header-ddrfw";
+
+                imx-lpddr-imem-qb {
+                    filename = "lpddr5_imem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+
+                imx-lpddr-dmem-qb {
+                    filename = "lpddr5_dmem_qb_v202311.bin";
+                    type = "blob-ext";
+                };
+            };
+        };
+
+               imx-boot {
+                       filename = "flash.bin";
+                       pad-byte = <0x00>;
+
+            spl {
+                align = <0x400>;
+                align-size = <0x400>;
+                type = "mkimage";
+                args = "-n spl/u-boot-spl.cfgout -T imx8image";
+            };
+
+            u-boot {
+                type = "mkimage";
+                args = "-n u-boot-container.cfgout -T imx8image";
+            };
+               };
+       };
+};
+
+&{/soc} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips2 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&aips3 {
+       bootph-pre-ram;
+};
+
+&gpio2 {
+       reg = <0 0x43810000 0 0x1000>, <0 0x43810040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio3 {
+       reg = <0 0x43820000 0 0x1000>, <0 0x43820040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio4 {
+       reg = <0 0x43840000 0 0x1000>, <0 0x43840040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&gpio5 {
+       reg = <0 0x43850000 0 0x1000>, <0 0x43850040 0 0x40>;
+       bootph-pre-ram;
+};
+
+&osc_24m {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&clk_ext1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&mu2 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&sram0 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&scmi_buf0 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&scmi_buf1 {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@11} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@13} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@14} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&{/firmware/scmi/protocol@19} {
+       bootph-all;
+       bootph-pre-ram;
+};
+
+&elemu3 {
+       compatible = "fsl,imx93-mu-s4";
+       status = "okay";
+       bootph-all;
+       bootph-pre-ram;
+};
(quoted diff) +0 -0
Quoted 2 lines

b/arch/arm/mach-imx/imx9/Kconfig index

596e753f2897c11d7ca3bcc9211af786d005bfd9..1ba277baeb353de301a1e67a 7adf

Quoted 26 lines

70f281752ded 100644

arch/arm/mach-imx/imx9/Kconfig +6 -0
@@ -66,6 +66,11 @@ config TARGET_PHYCORE_IMX93
        select OF_BOARD_FIXUP
        select OF_BOARD_SETUP
 
+config TARGET_IMX95_19X19_EVK
+       bool "imx95_19x19_evk"
+       select IMX95
+       imply OF_UPSTREAM
+
 endchoice
 
 source "board/freescale/imx91_evk/Kconfig"
@@ -73,6 +78,7 @@ source "board/freescale/imx93_evk/Kconfig"
 source "board/freescale/imx93_qsb/Kconfig"
 source "board/phytec/phycore_imx93/Kconfig"
 source "board/variscite/imx93_var_som/Kconfig"
+source "board/freescale/imx95_evk/Kconfig"
 
 endif
 
arch/arm/mach-imx/imx9/scmi/container.cfg new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..29f346e59c4afd0c2689667a be36

Quoted 18 lines

f4b776b29ba8

arch/arm/mach-imx/imx9/scmi/container.cfg new file +10 -0
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+CONTAINER
+IMAGE A55 bl31.bin 0x8a200000
+IMAGE A55 u-boot.bin CONFIG_TEXT_BASE
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/imximage.cfg new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..c90432f5efa78dccb2c67e23 7b88

Quoted 19 lines

a96174446b96

arch/arm/mach-imx/imx9/scmi/imximage.cfg new file +12 -0
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */
+
+BOOT_FROM SD
+SOC_TYPE IMX9
+APPEND mx95a0-ahab-container.img
+CONTAINER
+IMAGE OEI m33-oei-ddrfw.bin 0x1ffc0000 HOLD 0x10000 IMAGE OEI
+oei-m33-tcm.bin 0x1ffc0000 IMAGE M33 m33_image.bin 0x1ffc0000 IMAGE
+A55 spl/u-boot-spl.bin 0x20480000 DUMMY_V2X 0x8b000000
\ No newline at end of file
arch/arm/mach-imx/imx9/scmi/soc.c +0 -0
Quoted 2 lines

index

8a7df24afecc1d6d77b7162be639b56af95fd975..38ade99964b64512ba93423ef caa

Quoted 14 lines

0cfb58094b00 100644

arch/arm/mach-imx/imx9/scmi/soc.c +1 -0
@@ -43,6 +43,7 @@
 #endif
 #include <spl.h>
 #include <mmc.h>
+#include <asm/arch/mu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/freescale/imx95_evk/Kconfig new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..f9a67353e5db6d3ec94784cf 091e

Quoted 19 lines

45d8817d541c

board/freescale/imx95_evk/Kconfig new file +12 -0
@@ -0,0 +1,12 @@
+if TARGET_IMX95_19X19_EVK
+
+config SYS_BOARD
+       default "imx95_evk"
+
+config SYS_VENDOR
+       default "freescale"
+
+config SYS_CONFIG_NAME
+       default "imx95_evk"
+
+endif
board/freescale/imx95_evk/MAINTAINERS new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..5caf763e0cc390c46fc54ee6 27bc

Quoted 13 lines

966b2b110958

board/freescale/imx95_evk/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@
+i.MX95 EVK BOARD
+M:     Alice Guo <[email protected]>
+S:     Maintained
+F:     board/freescale/imx95_evk/
+F:     include/configs/imx95_evk.h
+F:     configs/imx95_19x19_evk_defconfig
board/freescale/imx95_evk/Makefile new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..a278d58ee0085176948b812 703d1

Quoted 18 lines

20aaad3a3116

board/freescale/imx95_evk/Makefile new file +11 -0
@@ -0,0 +1,11 @@
+#
+# Copyright 2024 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx95_evk.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
board/freescale/imx95_evk/imx95_19x19_evk.env new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..8d2b5dfcf07d251c77440bae 44d6

Quoted 28 lines

2bff6253dfc7

board/freescale/imx95_evk/imx95_19x19_evk.env new file +24 -0
@@ -0,0 +1,90 @@
+sec_boot=no
+initrd_addr=0x93800000
+emmc_dev=0
+sd_dev=1
+scriptaddr=0x93500000
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+image=Image
+splashimage=0xA0000000
+console=ttyLP0,115200 earlycon
+fdt_addr_r=0x93000000
+fdt_addr=0x93000000
+cntr_addr=0xA8000000
+cntr_file=os_cntr_signed.bin
+boot_fit=no
+fdtfile=CONFIG_DEFAULT_FDT_FILE
+bootm_size=0x10000000
+mmcautodetect=yes
+mmcargs=setenv bootargs console=${console} root=${mmcroot}
+loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr}
+${script}; bootscript=echo Running bootscript from mmc ...; source
+loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}
+auth_os=auth_cntr ${cntr_addr} boot_os=booti ${loadaddr} -

board/freescale/imx95_evk/imx95_19x19_evk.env line 34

Quoted 10 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +10 -0
+${fdt_addr_r}; mmcboot=echo Booting from mmc ...;
+               run mmcargs;
+               if test ${sec_boot} = yes; then
+                       if run auth_os; then
+                               run boot_os;
+                       else
+                               echo ERR: failed to authenticate;
+                       fi;
+               else
+                       if test ${boot_fit} = yes || test ${boot_fit} = try;

then

board/freescale/imx95_evk/imx95_19x19_evk.env

Quoted 6 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +6 -0
+                               bootm ${loadaddr};
+                       else
+                               if run loadfdt; then
+                                       run boot_os;
+                               else
+                                       echo WARN: Cannot load

the DT;

Quoted 12 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +12 -0
+                               fi;
+                       fi;
+               fi;
+netargs=setenv bootargs console=${console} root=/dev/nfs
+               ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
+netboot=echo Booting from net ...;
+               run netargs;
+               if test ${ip_dyn} = yes; then
+                       setenv get_cmd dhcp;
+               else
+                       setenv get_cmd tftp;
+               fi;

board/freescale/imx95_evk/imx95_19x19_evk.env

Quoted 10 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +10 -0
+               if test ${sec_boot} = yes; then
+                       ${get_cmd} ${cntr_addr} ${cntr_file};
+                       if run auth_os; then
+                               run boot_os;
+                       else
+                               echo ERR: failed to authenticate;
+                       fi;
+               else
+                       ${get_cmd} ${loadaddr} ${image};
+                       if test ${boot_fit} = yes || test ${boot_fit} = try;

then

board/freescale/imx95_evk/imx95_19x19_evk.env

Quoted 3 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +3 -0
+                               bootm ${loadaddr};
+                       else
+                               if ${get_cmd} ${fdt_addr_r} ${fdtfile};

then

board/freescale/imx95_evk/imx95_19x19_evk.env

Quoted 3 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +3 -0
+                                       run boot_os;
+                               else
+                                       echo WARN: Cannot load

the DT;

Quoted 25 lines
board/freescale/imx95_evk/imx95_19x19_evk.env new file +21 -0
+                               fi;
+                       fi;
+               fi;
+bsp_bootcmd=echo Running BSP bootcmd ...;
+                       mmc dev ${mmcdev}; if mmc rescan; then
+                       if run loadbootscript; then
+                               run bootscript;
+                       else
+                               if test ${sec_boot} = yes; then
+                                       if run loadcntr; then
+                                               run mmcboot;
+                                       else run netboot;
+                                       fi;
+                               else
+                                       if run loadimage; then
+                                               run mmcboot;
+                                       else run netboot;
+                                       fi;
+                               fi;
+                       fi;
+               fi;
\ No newline at end of file
board/freescale/imx95_evk/imx95_evk.c new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..c75a8f2450288a34cfc01150 d3c4

Quoted 58 lines

2b07f2215491

board/freescale/imx95_evk/imx95_evk.c new file +53 -0
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <env.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <asm/arch-imx9/ccm_regs.h>
+#include <asm/arch/clock.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <asm/gpio.h>
+#include <asm/mach-imx/sys_proto.h>
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include "../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include "../../../dts/upstream/src/arm64/freescale/imx95-power.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+       /* UART1: A55, UART2: M33, UART3: M7 */
+       init_uart_clk(0);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}
+
+int board_late_init(void)
+{
+#ifdef CONFIG_ENV_IS_IN_MMC
+       board_late_mmc_env_init();
+#endif
+
+       return 0;
+}
+
+int board_phys_sdram_size(phys_size_t *size) {
+       *size = PHYS_SDRAM_SIZE + PHYS_SDRAM_2_SIZE;
+
+       return 0;
+}
(quoted diff) +0 -0
Quoted 2 lines

b/board/freescale/imx95_evk/spl.c new file mode 100644 index

0000000000000000000000000000000000000000..54f56c8049876fde335485a5 c3bd

Quoted 70 lines

54dff6e4f730

board/freescale/imx95_evk/spl.c new file +66 -0
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <command.h>
+#include <cpu_func.h>
+#include <clk.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
+#include <spl.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/syscounter.h>
+#include <asm/mach-imx/ele_api.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 <linux/iopoll.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/ccm_regs.h>
+#ifdef CONFIG_SCMI_FIRMWARE
+#include <scmi_agent.h>
+#include <scmi_protocols.h>
+#include "../../../dts/upstream/src/arm64/freescale/imx95-clock.h"
+#include "../../../dts/upstream/src/arm64/freescale/imx95-power.h"
+#endif
+#include <asm/arch/mu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int spl_board_boot_device(enum boot_device boot_dev_spl) {
+       switch (boot_dev_spl) {
+       case SD1_BOOT:
+       case MMC1_BOOT:
+               return BOOT_DEVICE_MMC1;
+       case SD2_BOOT:
+       case MMC2_BOOT:
+               return BOOT_DEVICE_MMC2;
+       case USB_BOOT:
+               return BOOT_DEVICE_BOARD;
+       default:
+               return BOOT_DEVICE_NONE;
+       }
+}
+
+void spl_board_init(void)
+{
+       puts("Normal Boot\n");
+}
+
+void board_init_f(ulong dummy)
+{
+       int ret;
+
+       /* Clear the BSS. */
+       memset(__bss_start, 0, __bss_end - __bss_start);
+

board/freescale/imx95_evk/spl.c line 76

Quoted 10 lines
board/freescale/imx95_evk/spl.c new file +10 -0
+#ifdef CONFIG_SPL_RECOVER_DATA_SECTION
+       if (IS_ENABLED(CONFIG_SPL_BUILD))
+               spl_save_restore_data(); #endif
+
+       timer_init();
+
+       /* Need dm_init() to run before any SCMI calls can be made. */
+       spl_early_init();
+
+       /* Need enable SCMI drivers and ELE driver before enabling console

*/

Quoted 22 lines
board/freescale/imx95_evk/spl.c new file +19 -0
+       ret = imx9_probe_mu();
+       if (ret)
+               hang(); /* if MU not probed, nothing can output, just
+ hang here */
+
+       arch_cpu_init();
+
+       board_early_init_f();
+
+       preloader_console_init();
+
+       debug("SOC: 0x%x\n", gd->arch.soc_rev);
+       debug("LC: 0x%x\n", gd->arch.lifecycle);
+
+       /* Will set ARM freq to max rate */
+       clock_init_late();
+
+       board_init_r(NULL, 0);
+}
configs/imx95_19x19_evk_defconfig new file +0 -0
new file mode 100644
Quoted 2 lines

index

0000000000000000000000000000000000000000..4d6b194528e7f3124e6626b 28be0

Quoted 17 lines

d6344758f6e5

configs/imx95_19x19_evk_defconfig new file +12 -0
@@ -0,0 +1,177 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX9=y
+CONFIG_TEXT_BASE=0x90200000
+CONFIG_SYS_MALLOC_LEN=0x2000000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=3
+CONFIG_ENV_SIZE=0x4000
+CONFIG_ENV_OFFSET=0x700000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_DM_GPIO=y

configs/imx95_19x19_evk_defconfig line 22

Quoted 10 lines
configs/imx95_19x19_evk_defconfig new file +10 -0
+CONFIG_DEFAULT_DEVICE_TREE="freescale/imx95-19x19-evk"
+CONFIG_SPL_TEXT_BASE=0x20480000
+CONFIG_TARGET_IMX95_19X19_EVK=y
+CONFIG_SYS_PROMPT="u-boot=> "
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL_STACK=0x204d6000
+CONFIG_SPL=y
+CONFIG_SPL_LOAD_IMX_CONTAINER=y
+CONFIG_IMX_CONFIG="arch/arm/mach-imx/imx9/scmi/imximage.cfg"

+CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/scmi/container.cf g"

Quoted 7 lines
configs/imx95_19x19_evk_defconfig new file +7 -0
+CONFIG_SYS_LOAD_ADDR=0x90400000
+CONFIG_SYS_MEMTEST_START=0x90000000
+CONFIG_SYS_MEMTEST_END=0xA0000000
+CONFIG_REMAKE_ELF=y
+CONFIG_SYS_MONITOR_LEN=524288
+CONFIG_DEFAULT_FDT_FILE="imx95-19x19-evk.dtb"
+CONFIG_ARCH_MISC_INIT=y

configs/imx95_19x19_evk_defconfig line 40

Quoted 10 lines
configs/imx95_19x19_evk_defconfig new file +10 -0
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SPL_MAX_SIZE=0x20000
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x204d6000
+CONFIG_SPL_BSS_MAX_SIZE=0x2000
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_MMC=y
+CONFIG_SPL_GPIO=y
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set

CONFIG_SPL_SYS_MALLOC=y

doc/board/nxp/imx95_evk.rst

Quoted 139 lines
configs/imx95_19x19_evk_defconfig new file +136 -0
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x93200000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
+CONFIG_SPL_POWER=y
+CONFIG_SDP_LOADADDR=0x90400000
+CONFIG_SPL_WATCHDOG=y
+CONFIG_SYS_MAXARGS=64
+CONFIG_SYS_CBSIZE=2048
+CONFIG_SYS_PBSIZE=2074
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_NVEDIT_EFI=y
+CONFIG_CMD_CRC32=y
+CONFIG_CRC32_VERIFY=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EFIDEBUG=y
+CONFIG_CMD_RTC=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_GETTIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_HASH=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_NOWHERE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_ETHPRIME=y
+CONFIG_ETHPRIME="eth0"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_IMX_RGPIO2P=y
+CONFIG_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
+CONFIG_SF_DEFAULT_BUS=0
+CONFIG_SF_DEFAULT_SPEED=40000000
+CONFIG_DM_PCA953X=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_IMX_LPI2C=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS400_ES_SUPPORT=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_FSL_USDHC=y
+CONFIG_PHY=y
+CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_SPL_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RTC=y
+CONFIG_DM_SERIAL=y
+CONFIG_FSL_LPUART=y
+CONFIG_ULP_WATCHDOG=y
+CONFIG_LZO=y
+CONFIG_BZIP2=y
+CONFIG_HUSH_PARSER=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_ADP5585_GPIO=y
+CONFIG_SPL_I2C=y
+CONFIG_POWER_DOMAIN=y
+# SCMI options
+CONFIG_DM_MAILBOX=y
+CONFIG_SCMI_FIRMWARE=y
+CONFIG_SCMI_AGENT_SMCCC=n
+CONFIG_CLK_SCMI=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK_SCMI=y
+CONFIG_SPL_CLK=y
+CONFIG_PINCTRL_IMX_SCMI=y
+CONFIG_SCMI_POWER_DOMAIN=y
+CONFIG_SPL_DM_MAILBOX=y
+CONFIG_SPL_FIRMWARE=y
+#CONFIG_SPL_POWER_DOMAIN=y
+CONFIG_SPL_IMX_MU_MBOX=y
+CONFIG_IMX_MU_MBOX=y
+#CONFIG_REMOTEPROC_SCMI_LMM=y
+#CONFIG_CMD_REMOTEPROC=y
+# CONFIG_RESET_SCMI=y
+# CONFIG_DM_REGULATOR_SCMI=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_PCI=y
+CONFIG_PCIE_ECAM_GENERIC=y
+CONFIG_PCI_SCAN_SHOW=y
+CONFIG_CMD_PCI=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_PHYLIB=y
+CONFIG_PHYLIB_10G=y
+CONFIG_PHY_AQUANTIA=y
+CONFIG_PHY_REALTEK=y
+CONFIG_FSL_ENETC=y
+CONFIG_SYS_RX_ETH_BUFFER=8
+CONFIG_IMX8_ROMAPI=n
+CONFIG_CLK_CCF=y
+CONFIG_SPL_CLK_CCF=y
+CONFIG_SPL_RECOVER_DATA_SECTION=y
+CONFIG_ENV_SOURCE_FILE="imx95_19x19_evk"
doc/board/nxp/imx95_evk.rst new file +0 -0
new file mode 100644 index

0000000000000000000000000000000000000000..132c45ed485148366533ee3 1485a

Quoted 20 lines

4d5a41556eb0

doc/board/nxp/imx95_evk.rst new file +16 -0
@@ -0,0 +1,116 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+imx95_evk
+=======================
+
+U-Boot for the NXP i.MX95 19x19 EVK board
+
+Quick Start
+-----------
+
+- Get ahab-container.img
+- Get DDR PHY Firmware Images
+- Get and Build OEI Images
+- Get and Build System Manager Image
+- Get and Build the ARM Trusted Firmware
+- Build the Bootloader Image

doc/board/nxp/imx95_evk.rst line 26

Quoted 10 lines
doc/board/nxp/imx95_evk.rst new file +10 -0
+- Boot
+
+Get ahab-container.img
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+
+.. code-block:: bash
+
+   $ wget

https://www.nxp/
.com%2Flgfiles%2FNMG%2FMAD%2FYOCTO%2Ffirmware-ele-imx-1.3.0-17945f c.bin&data=05%7C02%7Calice.guo%40nxp.com%7C8549109cb70649d1a5e808 dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6387249 08653955191%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlY iOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C 0%7C%7C%7C&sdata=aAifx4CF8Io%2BXvr1T8SxoHEV06CmVAymWusIO4fho98 %3D&reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 13 lines
doc/board/nxp/imx95_evk.rst new file +13 -0
+   $ chmod +x firmware-ele-imx-1.3.0-17945fc.bin
+   $ ./firmware-ele-imx-1.3.0-17945fc.bin
+   $ cp firmware-ele-imx-1.3.0-17945fc/mx95a0-ahab-container.img
+ $(srctree)
+
+Get DDR PHY Firmware Images
+--------------------------------------
+
+Note: srctree is U-Boot source directory
+
+.. code-block:: bash
+
+   $ wget

https://www.nxp/
.com%2Flgfiles%2FNMG%2FMAD%2FYOCTO%2Ffirmware-imx-8.26-d4c33ab.bi n&data=05%7C02%7Calice.guo%40nxp.com%7C8549109cb70649d1a5e808dd3 4eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6387249086 53974927%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiI wLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0% 7C%7C%7C&sdata=zpRiXDLptZOjJOP6SrT7pX7NWtyIdfZBbxugCB865%2B0%3D &reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 12 lines
doc/board/nxp/imx95_evk.rst new file +11 -0
+   $ chmod +x firmware-imx-8.26-d4c33ab.bin
+   $ ./firmware-imx-8.26-d4c33ab.bin
+   $ cp
+ firmware-imx-8.26-d4c33ab/firmware/ddr/synopsys/lpddr5*v202311.bin
+ $(srctree)
+
+Get and Build OEI Images
+--------------------------------------
+
+Note: srctree is U-Boot source directory Get OEI from:
+https://git/

+hub.com%2Fnxp-imx%2Fimx-oei&data=05%7C02%7Calice.guo%40nxp.com%7 C8549

Quoted 1 line

+109cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635 %7C0%7

Quoted 1 line

+C0%7C638724908653987236%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hc GkiOnRyd

Quoted 1 line

+WUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D %

Quoted 1 line

+3D%7C0%7C%7C%7C&sdata=OqVdNjiv5ueZnY%2F6lOzgp1Vr9NG4%2FLuvlyb9 eM6cZxY

doc/board/nxp/imx95_evk.rst

Quoted 7 lines

+%3D&reserved=0

doc/board/nxp/imx95_evk.rst new file +6 -0
+branch: master
+
+.. code-block:: bash
+
+   $ sudo apt -y install make gcc g++-multilib srecord
+   $ wget

https://developer/
.arm.com%2F-%2Fmedia%2FFiles%2Fdownloads%2Fgnu%2F13.3.rel1%2Fbinrel %2Farm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz&data=05%7C02 %7Calice.guo%40nxp.com%7C8549109cb70649d1a5e808dd34eb9688%7C686e a1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638724908653999025%7CUnk nown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsI lAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata= 9liBIvjvi4FxPQxvfnTK8tCNM98FrWjzRq%2FqNJrgrTo%3D&reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 3 lines
doc/board/nxp/imx95_evk.rst new file +3 -0
+   $ tar xvf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ export TOOLS=$PWD
+   $ git clone -b master

https://github.co/
m%2Fnxp-imx%2Fimx-oei.git&data=05%7C02%7Calice.guo%40nxp.com%7C854 9109cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635 %7C0%7C0%7C638724908654010845%7CUnknown%7CTWFpbGZsb3d8eyJFbXB 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=v2%2FRd8ZUcgmOGiNQTIOAKSt 1FK5EZh2%2BUJEKx23Cx%2FI%3D&reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 13 lines
doc/board/nxp/imx95_evk.rst new file +12 -0
+   $ cd imx-oei
+   $ make board=mx95lp5 oei=ddr DEBUG=1
+   $ cp build/mx95lp5/ddr/oei-m33-ddr.bin $(srctree)
+
+   $ make board=mx95lp5 oei=tcm DEBUG=1
+   $ cp build/mx95lp5/tcm/oei-m33-tcm.bin $(srctree)
+
+Get and Build System Manager Image
+--------------------------------------
+
+Note: srctree is U-Boot source directory Get System Manager from:
+https://git/

+hub.com%2Fnxp-imx%2Fimx-sm&data=05%7C02%7Calice.guo%40nxp.com%7 C85491

Quoted 1 line

+09cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635% 7C0%7C

Quoted 1 line

+0%7C638724908654022381%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hc GkiOnRydW

Quoted 1 line

+UsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3

Quoted 1 line

+D%7C0%7C%7C%7C&sdata=eVULomL2JKUvDqGX3w5K1ij%2BZN4U%2F1UuSU tLVl4Ra%2F

doc/board/nxp/imx95_evk.rst

Quoted 7 lines
doc/board/nxp/imx95_evk.rst new file +7 -0
+Q%3D&reserved=0
+branch: master
+
+.. code-block:: bash
+
+   $ sudo apt -y install make gcc g++-multilib srecord
+   $ wget

https://developer/
.arm.com%2F-%2Fmedia%2FFiles%2Fdownloads%2Fgnu%2F13.3.rel1%2Fbinrel %2Farm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz&data=05%7C02 %7Calice.guo%40nxp.com%7C8549109cb70649d1a5e808dd34eb9688%7C686e a1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638724908654033903%7CUnk nown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsI lAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata= 7QdYsYkO0ilYrnKTbALP4dnSXWtp8ytc9dAOQAQi%2Bu8%3D&reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 3 lines
doc/board/nxp/imx95_evk.rst new file +3 -0
+   $ tar xvf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
+   $ export TOOLS=$PWD
+   $ git clone -b master

https://github.co/
m%2Fnxp-imx%2Fimx-sm.git&data=05%7C02%7Calice.guo%40nxp.com%7C854 9109cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635 %7C0%7C0%7C638724908654045635%7CUnknown%7CTWFpbGZsb3d8eyJFbXB 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=SRE9onj5DDRoEormE%2FvDs9% 2B0%2FoNZhQeDd23cznvvy0c%3D&reserved=0

doc/board/nxp/imx95_evk.rst

Quoted 10 lines
doc/board/nxp/imx95_evk.rst new file +9 -0
+   $ cd imx-sm
+   $ make config=mx95evk all
+   $ cp build/mx95evk/m33_image.bin $(srctree)
+
+Get and Build the ARM Trusted Firmware
+--------------------------------------
+
+Note: srctree is U-Boot source directory Get ATF from:
+https://git/

+hub.com%2Fnxp-imx%2Fimx-atf%2F&data=05%7C02%7Calice.guo%40nxp.co m%7C8

Quoted 1 line

+549109cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c3016 35%7C

Quoted 1 line

+0%7C0%7C638724908654057344%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0e U1hcGkiOn

Quoted 1 line

+RydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%

Quoted 1 line

+3D%3D%7C0%7C%7C%7C&sdata=jjN2varoeh%2FW7UW579kVZXaGWWhJBlT OUJjCaWLdjq

doc/board/nxp/imx95_evk.rst

Quoted 8 lines
doc/board/nxp/imx95_evk.rst new file +8 -0
+o%3D&reserved=0
+branch: lf_v2.10
+
+.. code-block:: bash
+
+   $ export CROSS_COMPILE=aarch64-poky-linux-
+   $ unset LDFLAGS
+   $ git clone -b lf_v2.10

https://github.co/
m%2Fnxp-imx%2Fimx-atf.git&data=05%7C02%7Calice.guo%40nxp.com%7C854 9109cb70649d1a5e808dd34eb9688%7C686ea1d3bc2b4c6fa92cd99c5c301635 %7C0%7C0%7C638724908654071494%7CUnknown%7CTWFpbGZsb3d8eyJFbXB 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=pMHIeeaQdlqddAEA6FfYDkeJgd aKwc7UqAVjLml7PM0%3D&reserved=0

doc/board/nxp/index.rst index

Quoted 25 lines
doc/board/nxp/imx95_evk.rst new file +23 -0
+   $ cd imx-atf
+   $ make PLAT=imx95 bl31
+   $ cp build/imx95/release/bl31.bin $(srctree)
+
+Build the Bootloader Image
+------------
+
+.. code-block:: bash
+
+   $ export CROSS_COMPILE=aarch64-poky-linux-
+   $ make imx95_19x19_evk_defconfig
+   $ make
+
+Copy imx-boot-imx95.bin to the MicroSD card:
+
+.. code-block:: bash
+
+   $ sudo dd if=flash.bin of=/dev/sd[x] bs=1k seek=32 conv=fsync
+
+Boot
+----
+
+Set i.MX95 boot device to MicroSD card
doc/board/nxp/index.rst index renamed from doc/board/nxp/index.rst +0 -0

8ca4b5619863f616dbedc7eb0ff8a286a3fbbf48..e7ec725cc04e9755ba3dac375 61c

include/configs/imx95_evk.h

Quoted 14 lines

26ebc3f1c716 100644

doc/board/nxp/index.rst +1 -0
@@ -15,6 +15,7 @@ NXP Semiconductors
    imx91_11x11_evk
    imx93_9x9_qsb
    imx93_11x11_evk
+   imx95_evk
    imxrt1020-evk
    imxrt1050-evk
    imxrt1170-evk
include/configs/imx95_evk.h new file +0 -0
new file mode 100644 index

0000000000000000000000000000000000000000..00909a043a71751684ebd8d c413b

Quoted 8 lines

05d5aee8dd69

include/configs/imx95_evk.h new file +4 -0
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2024 NXP
+ */

include/configs/imx95_evk.h line 14

Quoted 10 lines
include/configs/imx95_evk.h new file +10 -0
+
+#ifndef __IMX95_EVK_H
+#define __IMX95_EVK_H
+
+#include <linux/sizes.h>
+#include <linux/stringify.h>
+#include <asm/arch/imx-regs.h>
+
+#define CFG_SYS_UBOOT_BASE     \
+       (QSPI0_AMBA_BASE +

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR *

include/configs/imx95_evk.h

Quoted 9 lines
include/configs/imx95_evk.h new file +9 -0
+512)
+
+#define CFG_SYS_INIT_RAM_ADDR        0x90000000
+#define CFG_SYS_INIT_RAM_SIZE        0x200000
+
+#define CFG_SYS_SDRAM_BASE           0x90000000
+#define PHYS_SDRAM                      0x90000000
+/* Totally 16GB */
+#define PHYS_SDRAM_SIZE                        0x70000000 /*

2GB - 256MB DDR */

Quoted 12 lines
include/configs/imx95_evk.h new file +8 -1
+#define PHYS_SDRAM_2_SIZE              0x380000000 /* 14GB */
+
+#define CFG_SYS_FSL_USDHC_NUM  2
+
+/* Using ULP WDOG for reset */
+#define WDOG_BASE_ADDR          WDG3_BASE_ADDR
+
+#endif
 
--

2.34.1