summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorJoão Paulo Gonçalves <[email protected]>2025-10-27 11:58:57 +0100
committerFabio Estevam <[email protected]>2025-10-30 12:39:57 -0300
commitff0540fcfe4916cb202eca2dbfcdda6d9508d9d4 (patch)
treecbfbbb53ffab4b9a7acd2e6a36f288937fc3d836 /board
parentf6f319f035c7c8b04f95e3252ac136c128357871 (diff)
board: toradex: add Toradex SMARC iMX95
Add support for the Toradex SMARC iMX95. Link: https://www.toradex.com/computer-on-modules/smarc-arm-family/nxp-imx95 Link: https://www.toradex.com/products/carrier-board/smarc-development-board-kit Signed-off-by: João Paulo Gonçalves <[email protected]> Co-developed-by: Emanuele Ghidoli <[email protected]> Signed-off-by: Emanuele Ghidoli <[email protected]> Co-developed-by: Max Krummenacher <[email protected]> Signed-off-by: Max Krummenacher <[email protected]> Co-developed-by: Ernest Van Hoecke <[email protected]> Signed-off-by: Ernest Van Hoecke <[email protected]>
Diffstat (limited to 'board')
-rw-r--r--board/toradex/smarc-imx95/Kconfig36
-rw-r--r--board/toradex/smarc-imx95/MAINTAINERS11
-rw-r--r--board/toradex/smarc-imx95/Makefile8
-rw-r--r--board/toradex/smarc-imx95/smarc-imx95.c31
-rw-r--r--board/toradex/smarc-imx95/smarc-imx95.env20
-rw-r--r--board/toradex/smarc-imx95/spl.c119
6 files changed, 225 insertions, 0 deletions
diff --git a/board/toradex/smarc-imx95/Kconfig b/board/toradex/smarc-imx95/Kconfig
new file mode 100644
index 00000000000..97b2c3da188
--- /dev/null
+++ b/board/toradex/smarc-imx95/Kconfig
@@ -0,0 +1,36 @@
+if TARGET_TORADEX_SMARC_IMX95
+
+config SYS_BOARD
+ default "smarc-imx95"
+
+config SYS_VENDOR
+ default "toradex"
+
+config SYS_CONFIG_NAME
+ default "toradex-smarc-imx95"
+
+config TDX_CFG_BLOCK
+ default y
+
+config TDX_CFG_BLOCK_2ND_ETHADDR
+ default y
+
+config TDX_CFG_BLOCK_DEV
+ default "0"
+
+# Toradex config block in eMMC, at the end of 1st "boot sector"
+config TDX_CFG_BLOCK_OFFSET
+ default "-512"
+
+config TDX_CFG_BLOCK_PART
+ default "1"
+
+config TDX_HAVE_EEPROM_EXTRA
+ default y
+
+config TDX_HAVE_MMC
+ default y
+
+source "board/toradex/common/Kconfig"
+
+endif
diff --git a/board/toradex/smarc-imx95/MAINTAINERS b/board/toradex/smarc-imx95/MAINTAINERS
new file mode 100644
index 00000000000..73517d36f1f
--- /dev/null
+++ b/board/toradex/smarc-imx95/MAINTAINERS
@@ -0,0 +1,11 @@
+Toradex SMARC iMX95
+F: arch/arm/dts/imx95-toradex-smarc.dtsi
+F: arch/arm/dts/imx95-toradex-smarc-dev.dts
+F: arch/arm/dts/imx95-toradex-smarc-dev-u-boot.dtsi
+F: board/toradex/smarc-imx95/
+F: configs/toradex-smarc-imx95_defconfig
+F: doc/board/toradex/smarc-imx95.rst
+F: include/configs/toradex-smarc-imx95.h
+M: Francesco Dolcini <[email protected]>
+S: Maintained
+W: https://www.toradex.com/computer-on-modules/smarc-arm-family/nxp-imx95
diff --git a/board/toradex/smarc-imx95/Makefile b/board/toradex/smarc-imx95/Makefile
new file mode 100644
index 00000000000..e5d0b0c7e8c
--- /dev/null
+++ b/board/toradex/smarc-imx95/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2025 Toradex
+
+obj-y += smarc-imx95.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
diff --git a/board/toradex/smarc-imx95/smarc-imx95.c b/board/toradex/smarc-imx95/smarc-imx95.c
new file mode 100644
index 00000000000..c2cf872d9f9
--- /dev/null
+++ b/board/toradex/smarc-imx95/smarc-imx95.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (C) 2025 Toradex */
+
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <fdt_support.h>
+#include <init.h>
+
+#include "../common/tdx-cfg-block.h"
+
+int board_early_init_f(void)
+{
+ /* UART1: A55 */
+ init_uart_clk(0);
+
+ return 0;
+}
+
+int board_phys_sdram_size(phys_size_t *size)
+{
+ *size = PHYS_SDRAM_SIZE + PHYS_SDRAM_2_SIZE;
+
+ return 0;
+}
+
+#if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+ return ft_common_board_setup(blob, bd);
+}
+#endif
diff --git a/board/toradex/smarc-imx95/smarc-imx95.env b/board/toradex/smarc-imx95/smarc-imx95.env
new file mode 100644
index 00000000000..b94250bbc52
--- /dev/null
+++ b/board/toradex/smarc-imx95/smarc-imx95.env
@@ -0,0 +1,20 @@
+boot_scripts=boot.scr
+boot_script_dhcp=boot.scr
+boot_targets=mmc1 mmc0 dhcp
+console=ttyLP1
+fdt_board=dev
+fdt_addr=0x9c400000
+fdt_addr_r=0x9c400000
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+kernel_comp_addr_r=0x94400000
+kernel_comp_size=0x8000000
+ramdisk_addr_r=0x9c800000
+scriptaddr=0x9c600000
+
+update_uboot=
+ askenv confirm Did you load flash.bin (y/N)?;
+ if test $confirm = y; then
+ setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt
+ ${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0
+ ${blkcnt};
+ fi
diff --git a/board/toradex/smarc-imx95/spl.c b/board/toradex/smarc-imx95/spl.c
new file mode 100644
index 00000000000..e0e39b8bb94
--- /dev/null
+++ b/board/toradex/smarc-imx95/spl.c
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (C) 2025 Toradex */
+
+#include <asm/arch/clock.h>
+#include <asm/arch/mu.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/ele_api.h>
+#include <asm/sections.h>
+#include <asm/global_data.h>
+#include <clk.h>
+#include <dm/ofnode.h>
+#include <dm/uclass.h>
+#include <hang.h>
+#include <i2c.h>
+#include <init.h>
+#include <spl.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define EC_I2C_BUS_NODE_PATH "/soc/bus@42000000/i2c@42540000"
+
+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;
+ }
+}
+
+static void ec_boot_notify(void)
+{
+ struct udevice *bus;
+ struct udevice *i2c_dev;
+ ofnode node;
+ int ret;
+ u8 val = 0x03;
+
+ node = ofnode_path(EC_I2C_BUS_NODE_PATH);
+ if (!ofnode_valid(node)) {
+ puts("Failed to find Toradex EC I2C BUS node\n");
+ return;
+ }
+
+ ret = uclass_get_device_by_ofnode(UCLASS_I2C, node, &bus);
+ if (ret) {
+ puts("Failed to get Toradex EC I2C BUS\n");
+ return;
+ }
+
+ ret = dm_i2c_probe(bus, 0x28, 0, &i2c_dev);
+ if (ret) {
+ puts("Toradex EC not found\n");
+ return;
+ }
+
+ /* USB configuration before this command (when SoC starts in recovery):
+ * - SoC USB1 -> Smarc USB0
+ * - SoC USB2 -> NC
+ * After the command:
+ * - SoC USB1 -> SoM hub -> Smarc USB1, USB2, USB3 and USB4
+ * - SoC USB2 -> Smarc USB0
+ */
+ ret = dm_i2c_write(i2c_dev, 0xD0, &val, 1);
+ if (ret)
+ puts("Cannot send command to Toradex EC\n");
+}
+
+void spl_board_init(void)
+{
+ int ret;
+
+ ret = ele_start_rng();
+ if (ret)
+ printf("Fail to start RNG: %d\n", ret);
+}
+
+void board_init_f(ulong dummy)
+{
+ int ret;
+
+ /* Clear the BSS. */
+ memset(__bss_start, 0, __bss_end - __bss_start);
+
+ if (IS_ENABLED(CONFIG_SPL_RECOVER_DATA_SECTION))
+ spl_save_restore_data();
+
+ timer_init();
+
+ /* Need dm_init() to run before any SCMI calls */
+ spl_early_init();
+
+ /* Need to enable SCMI drivers and ELE driver before console */
+ ret = imx9_probe_mu();
+ if (ret)
+ hang(); /* MU not probed, nothing can be outputed, hang */
+
+ 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);
+
+ ec_boot_notify();
+ get_reset_reason(true, false);
+
+ board_init_r(NULL, 0);
+}