Skip to contentSkip to conversation

ARM: imx: mxs: Add support for imx287 based BTT devices

PATCH Superseded Lukasz Majewski 2 participants 2 messages Jun 5, 2025

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ARM: imx: mxs: Add support for imx287 based BTT devices

The btt[c3] devices are based on imx287 SoC.

U-Boot SPL 2025.04-01081-g07e086681d26 (Apr 16 2025 - 12:24:36 +0200) Trying to boot from MMC1

U-Boot 2025.04-01081-g07e086681d26 (Apr 16 2025 - 12:24:36 +0200)

CPU:   Freescale i.MX28 rev1.2 at 454 MHz
BOOT:  SSP SPI #3, master, 3V3 NOR
Model: BTT3
Board: LWE BTT SoM HW rev 0
DRAM:  256 MiB
Core:  86 devices, 15 uclasses, devicetree: separate
MMC:   MXS MMC: 0
Loading Environment from SPIFlash... SF: Detected is25lp128 with page
                    size 256 Bytes, erase size 64 KiB, total 16 MiB
OK
In:    serial@80074000
Out:   serial@80074000
Err:   serial@80074000
Net:   eth0: ethernet@800f0000
Hit any key to stop autoboot:  0

---
Changes for v2:
- Replace README with entry in doc/boards (*.rst files)

Changes for v3:
- Keep alphabethical order in arch/arm/mach-imx/mxs/Kconfig
- Remove not needed headers (like <usb.h>) from btt.c file
- Add static to const iomux_cfg_t iomux_setup[] definition
- Use proper defines for HW_PINCTRL_EMI_DS_CTRL register setup
- Fix indentation in spl_btt.c
- Use SZ_256M instead of 0x10000000
- Add description regarding SPL and u-boot proper code

---
 arch/arm/dts/imx28-btt3-0-u-boot.dtsi |   7 +
 arch/arm/dts/imx28-btt3-1-u-boot.dtsi |   7 +
 arch/arm/dts/imx28-btt3-2-u-boot.dtsi |   7 +
 arch/arm/dts/imx28-btt3-u-boot.dtsi   |  90 ++++++
 arch/arm/mach-imx/mxs/Kconfig         |   6 +
 board/liebherr/btt/Kconfig            |  24 ++
 board/liebherr/btt/MAINTAINERS        |   6 +
 board/liebherr/btt/Makefile           |   9 +
 board/liebherr/btt/boot_img_scr.h     |  27 ++
 board/liebherr/btt/btt.c              | 450 ++++++++++++++++++++++++++
 board/liebherr/btt/btt.env            | 139 ++++++++
 board/liebherr/btt/spl_btt.c          | 347 ++++++++++++++++++++
 configs/imx28_btt3_defconfig          | 140 ++++++++
 doc/board/index.rst                   |   1 +
 doc/board/liebherr/btt.rst            |  34 ++
 doc/board/liebherr/index.rst          |   9 +
 include/configs/btt.h                 |  18 ++
 17 files changed, 1321 insertions(+)
 create mode 100644 arch/arm/dts/imx28-btt3-0-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx28-btt3-1-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx28-btt3-2-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx28-btt3-u-boot.dtsi
 create mode 100644 board/liebherr/btt/Kconfig
 create mode 100644 board/liebherr/btt/MAINTAINERS
 create mode 100644 board/liebherr/btt/Makefile
 create mode 100644 board/liebherr/btt/boot_img_scr.h
 create mode 100644 board/liebherr/btt/btt.c
 create mode 100644 board/liebherr/btt/btt.env
 create mode 100644 board/liebherr/btt/spl_btt.c
 create mode 100644 configs/imx28_btt3_defconfig
 create mode 100644 doc/board/liebherr/btt.rst
 create mode 100644 doc/board/liebherr/index.rst
 create mode 100644 include/configs/btt.h
arch/arm/dts/imx28-btt3-0-u-boot.dtsi new file +7 -0
new file mode 100644
index 00000000000..b128eef9e17
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025
+ * Lukasz Majewski, DENX Software Engineering, [email protected]
+ */
+
+#include "imx28-btt3-u-boot.dtsi"
arch/arm/dts/imx28-btt3-1-u-boot.dtsi new file +7 -0
new file mode 100644
index 00000000000..b128eef9e17
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025
+ * Lukasz Majewski, DENX Software Engineering, [email protected]
+ */
+
+#include "imx28-btt3-u-boot.dtsi"
arch/arm/dts/imx28-btt3-2-u-boot.dtsi new file +7 -0
new file mode 100644
index 00000000000..b128eef9e17
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025
+ * Lukasz Majewski, DENX Software Engineering, [email protected]
+ */
+
+#include "imx28-btt3-u-boot.dtsi"
arch/arm/dts/imx28-btt3-u-boot.dtsi new file +90 -0

90 lines not on this page · raw message

arch/arm/mach-imx/mxs/Kconfig +6 -0
index d2e4205c5ce..b134d04b210 100644
@@ -38,6 +38,11 @@ choice
 	prompt "MX28 board select"
 	optional
 
+config TARGET_BTT
+	bool "Support BTT"
+	select PL01X_SERIAL
+	imply OF_UPSTREAM
+
 config TARGET_MX28EVK
 	bool "Support mx28evk"
 	select PL01X_SERIAL
@@ -70,6 +75,7 @@ config SPL_MXS_PMU_ENABLE_4P2_LINEAR_REGULATOR
 	  from VDD5V) - so the VDD4P2 power source is operational.
 
 source "board/freescale/mx28evk/Kconfig"
+source "board/liebherr/btt/Kconfig"
 source "board/liebherr/xea/Kconfig"
 
 endif
board/liebherr/btt/Kconfig new file +24 -0
new file mode 100644
index 00000000000..ff35dd04532
@@ -0,0 +1,24 @@
+if TARGET_BTT
+
+config SYS_BOARD
+	default "btt"
+
+config SYS_VENDOR
+	default "liebherr"
+
+config SYS_SOC
+	default "mxs"
+
+config SYS_CONFIG_NAME
+	default "btt"
+
+config ENV_SIZE
+	default 0x2000
+
+config ENV_SECT_SIZE
+	default 0x10000 if ENV_IS_IN_SPI_FLASH
+
+config ENV_OFFSET
+	default 0x80000 if ENV_IS_IN_SPI_FLASH
+
+endif
board/liebherr/btt/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..b4afed5aaeb
@@ -0,0 +1,6 @@
+BTT BOARD
+M:	Lukasz Majewski <[email protected]>
+S:	Maintained
+F:	board/liebherr/btt/
+F:	include/configs/btt.h
+F:	configs/imx28_btt3_defconfig
board/liebherr/btt/Makefile new file +9 -0
new file mode 100644
index 00000000000..a8ab657a9e0
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2025
+# Lukasz Majewski, DENX Software Engineering, [email protected].
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= btt.o
+obj-$(CONFIG_XPL_BUILD) += spl_btt.o
board/liebherr/btt/boot_img_scr.h new file +27 -0
new file mode 100644
index 00000000000..baa3072b49c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier:     GPL-2.0+ */
+/*
+ * Struct for boot image source description for placing in last
+ * two SPI NOR flash sectors on legcom.
+ */
+
+struct boot_img_src {
+	u8 magic;	/* Must be 'B' = 0x42 */
+	u8 flags;	/* flags to specify mmcblk[0|1] boot[0|1] */
+	u8 crc8;	/* CRC-8 over above two bytes */
+} __packed;
+
+/*
+ * Bit definition in boot_img_src.flags:
+ *  Bit 0: mmcblk device 0 or 1 (1 - if this bit set)
+ *  Bit 1: mmcblk boot partition 0 or 1.
+ *         for eMMC: boot0 if this bit is cleared, boot1 - if set
+ *         for SD-card the boot partition value will always be 0
+ *         (independent of the value of this bit)
+ *
+ */
+#define BOOT_SRC_MMC1	BIT(0)
+#define BOOT_SRC_PART1	BIT(1)
+
+/* Offset of the first boot image source descriptor in SPI NOR */
+#define SPI_FLASH_BOOT_SRC_OFFS	0xFE0000
+#define SPI_FLASH_SECTOR_SIZE	0x10000
board/liebherr/btt/btt.c new file +450 -0

450 lines not on this page · raw message

board/liebherr/btt/btt.env new file +139 -0

139 lines not on this page · raw message

board/liebherr/btt/spl_btt.c new file +347 -0

347 lines not on this page · raw message

configs/imx28_btt3_defconfig new file +140 -0

140 lines not on this page · raw message

doc/board/index.rst +1 -0
index 3c5a2c7d1cf..e084c7fb1df 100644
@@ -38,6 +38,7 @@ Board-specific doc
    kontron/index
    lenovo/index
    lg/index
+   liebherr/index
    mediatek/index
    microchip/index
    microsoft/index
doc/board/liebherr/btt.rst new file +34 -0
new file mode 100644
index 00000000000..d22ffa205bd
@@ -0,0 +1,34 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. sectionauthor:: Lukasz Majewski <[email protected]>
+
+BTT devices
+===========
+
+Those devices are based on IMX's IMX287 SoC. The description regarding the
+**btt** family of boards (i.e. `btt3` and `bttc`) is identical as the one for
+the already supported **xea** board.
+
+Building
+--------
+
+Make sure that `CROSS_COMPILE` is set appropriately:
+
+.. code-block:: text
+
+ $ make imx28_btt3_defconfig
+ $ make -j4 u-boot.sb u-boot.img
+
+Now you should see `u-boot.sb` and `u-boot.img` files in the build directory.
+
+For initial bringup - one can use `uuu` utulity to boot till u-boot prompt
+(USB connection with the board is required).
+
+Flashing
+--------
+
+Via U-Boot:
+
+.. code-block:: text
+
+ => run update_spl
+ => run update_uboot
doc/board/liebherr/index.rst new file +9 -0
new file mode 100644
index 00000000000..d8db6bd188c
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Liebherr
+========
+
+.. toctree::
+   :maxdepth: 2
+
+   btt
include/configs/btt.h new file +18 -0
new file mode 100644
index 00000000000..dea87fa9b77
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2025 DENX Software Engineering
+ * Lukasz Majewski, DENX Software Engineering, [email protected]
+ */
+#ifndef __CONFIGS_BTT_H__
+#define __CONFIGS_BTT_H__
+
+#include <linux/sizes.h>
+/* Memory configuration */
+#define PHYS_SDRAM_1			0x40000000	/* Base address */
+#define PHYS_SDRAM_1_SIZE		SZ_256M	/* Max 256 MB RAM */
+#define CFG_SYS_SDRAM_BASE		PHYS_SDRAM_1
+
+/* The rest of the configuration is shared */
+#include <configs/mxs.h>
+
+#endif /* __CONFIGS_BTT_H__ */
Signature · 1 line
2.39.5
reviewer
#1 lore raw

Hi Lukasz,

Quoted 24 lines · Lukasz Majewski

The btt[c3] devices are based on imx287 SoC.

U-Boot SPL 2025.04-01081-g07e086681d26 (Apr 16 2025 - 12:24:36 +0200) Trying to boot from MMC1

U-Boot 2025.04-01081-g07e086681d26 (Apr 16 2025 - 12:24:36 +0200)

CPU:   Freescale i.MX28 rev1.2 at 454 MHz
BOOT:  SSP SPI #3, master, 3V3 NOR
Model: BTT3
Board: LWE BTT SoM HW rev 0
DRAM:  256 MiB
Core:  86 devices, 15 uclasses, devicetree: separate
MMC:   MXS MMC: 0
Loading Environment from SPIFlash... SF: Detected is25lp128 with page
                    size 256 Bytes, erase size 64 KiB, total 16 MiB
OK
In:    serial@80074000
Out:   serial@80074000
Err:   serial@80074000
Net:   eth0: ethernet@800f0000
Hit any key to stop autoboot:  0
Quoted 1 line

I ran this patch through CI, and the following error is seen:

+board/liebherr/btt/btt.c: In function 'board_late_init':
+board/liebherr/btt/btt.c:362:19: error: implicit declaration of function 'env_set_ulong'; did you mean 'env_get_vlan'? [-Wimplicit-function-declaration]

+  362 |         int ret = env_set_ulong("board_som_rev", get_som_rev());
+      |                   ^~~~~~~~~~~~~
+      |                   env_get_vlan

+board/liebherr/btt/btt.c:367:15: error: implicit declaration of function 'env_set' [-Wimplicit-function-declaration]
+ 367 | ret = env_set("arch", get_board_name());
+ | ^~~~~~~
+make[2]: *** [scripts/Makefile.build:249: board/liebherr/btt/btt.o] Error 1 +make[1]: *** [Makefile:1923: board/liebherr/btt] Error 2
+make: *** [Makefile:185: sub-make] Error 2

Please run v4 through CI and make sure it passes.