Skip to contentSkip to conversation

board: purism: Add support for the Librem5 devkit

PATCH New Guido Günther 1 participant 1 message Jun 12

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

PATCH v2 1/1 board: purism: Add support for the Librem5 devkit

Although it has similar naming the Librem 5 Devkit is a completely different design from the Librem 5 phone. It uses an imx8mq SOM from Emcraft, a separate HDMI port instead of DisplayPort, different USB-C chip, panel, etc.

This is based on a Emcraft's SOM documentation, Purism's downstream fork and the available schematics of the devkit.

---
Based on a Emcraft's SOM documentation, Purism's downstream fork¹ and the available schematics² of the devkit.

Booting Debian's 7.0.x kernel (which was upstreamed a while back) via dhcp and from mmc works, so does booting an UKI via bootefi and via bootefi bootmgr.

The RAM timings were taken from the Librem 5 although it uses a slightly different DDR4 chips.

The SOM shipped by Purism uses the B0 revision but we leave timings for later imx8mq revisions in place in case ppl use a newer revision of EmCraft's SOM.

The original bringup was done by Angus Ainslie (based on imx's/Emcraft's tree) so I added him as Co-authored-by: and moved over the copyright notices.

¹) https://source.puri.sm/Librem5/uboot-imx
²) https://source.puri.sm/Librem5/dvk-mx8m-bsb
---
Changes in v2:

Address review comments from Fabio Estevam.

- Use generic load command
- Drop uart, watchdog and fec init
- Drop boot_fdt=try

Other changes

- Bump CONFIG_SYS_MALLOC_LEN, this allows flash -raw2sparse to work
- Use standard bootflow (we mostly want to boot EFI)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 arch/arm/dts/Makefile                              |   3 +-
 arch/arm/dts/imx8mq-librem5-devkit-u-boot.dtsi     |  11 +
 arch/arm/mach-imx/imx8m/Kconfig                    |   7 +
 board/purism/librem5-devkit/Kconfig                |  18 +
 board/purism/librem5-devkit/MAINTAINERS            |   8 +
 board/purism/librem5-devkit/Makefile               |  13 +
 .../purism/librem5-devkit/imximage-8mq-lpddr4.cfg  |   9 +
 board/purism/librem5-devkit/librem5-devkit.c       |  77 ++
 board/purism/librem5-devkit/librem5-devkit.env     |  20 +
 board/purism/librem5-devkit/lpddr4_timing.c        | 931 +++++++++++++++++++++
 board/purism/librem5-devkit/lpddr4_timing_b0.c     | 794 ++++++++++++++++++
 board/purism/librem5-devkit/spl.c                  | 371 ++++++++
 configs/librem5-devkit_defconfig                   | 183 ++++
 doc/board/purism/index.rst                         |   1 +
 doc/board/purism/librem5-devkit.rst                |  56 ++
 include/configs/librem5-devkit.h                   |  36 +
 16 files changed, 2537 insertions(+), 1 deletion(-)
arch/arm/dts/Makefile +2 -1
index e79cfb4b633..42e4b612363 100644
@@ -893,7 +893,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mp-msc-sm2s.dtb \
 	imx8mq-pico-pi.dtb \
 	imx8mq-kontron-pitx-imx8m.dtb \
-	imx8mq-librem5-r4.dtb
+	imx8mq-librem5-r4.dtb \
+	imx8mq-librem5-devkit.dtb
 
 dtb-$(CONFIG_ARCH_IMX9) += \
 	imx93-11x11-frdm.dtb \
arch/arm/dts/imx8mq-librem5-devkit-u-boot.dtsi new file +11 -0
new file mode 100644
index 00000000000..46a4dfe4e8a
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include "imx8mq-u-boot.dtsi"
+
+&pinctrl_uart1 {
+	bootph-pre-ram;
+};
+
+&uart1 { /* console */
+	bootph-pre-ram;
+};
arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 8b0d48b07b3..b5af8be1ffc 100644
@@ -427,6 +427,12 @@ config TARGET_LIBREM5
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
 
+config TARGET_LIBREM5_DEVKIT
+	bool "Purism Librem5 Devkit"
+	select IMX8MQ
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 endchoice
 
 source "board/advantech/imx8mp_rsb3720a1/Kconfig"
@@ -459,6 +465,7 @@ source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
 source "board/polyhex/imx8mp_debix_model_a/Kconfig"
 source "board/purism/librem5/Kconfig"
+source "board/purism/librem5-devkit/Kconfig"
 source "board/ronetix/imx8mq-cm/Kconfig"
 source "board/technexion/pico-imx8mq/Kconfig"
 source "board/variscite/imx8mn_var_som/Kconfig"
board/purism/librem5-devkit/Kconfig new file +18 -0
new file mode 100644
index 00000000000..3e069690142
@@ -0,0 +1,18 @@
+if TARGET_LIBREM5_DEVKIT
+
+config SYS_BOARD
+	default "librem5-devkit"
+
+config SYS_VENDOR
+	default "purism"
+
+config SYS_CONFIG_NAME
+	default "librem5-devkit"
+
+config ENV_SOURCE_FILE
+	default "librem5-devkit"
+
+config IMX_CONFIG
+	default "board/purism/librem5-devkit/imximage-8mq-lpddr4.cfg"
+
+endif
board/purism/librem5-devkit/MAINTAINERS new file +8 -0
new file mode 100644
index 00000000000..95bdc17cc8f
@@ -0,0 +1,8 @@
+PURISM LIBREM5 DEVKIT
+M:	Guido Günther
+R:	[email protected]
+S:	Supported
+F:	arch/arm/dts/imx8mq-librem5-devkit-u-boot.dtsi
+F:	board/purism/librem5-devkit/
+F:	configs/librem5-devkit_defconfig
+F:	include/configs/librem5-devkit.h
board/purism/librem5-devkit/Makefile new file +13 -0
new file mode 100644
index 00000000000..95044811186
@@ -0,0 +1,13 @@
+#
+# Copyright 2017 NXP
+# Copyright 2026 Phosh.mobi e.V.
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += librem5-devkit.o
+
+ifdef CONFIG_XPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o lpddr4_timing_b0.o
+endif
board/purism/librem5-devkit/imximage-8mq-lpddr4.cfg new file +9 -0
new file mode 100644
index 00000000000..d102e70a954
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+FIT
+BOOT_FROM	sd
+SIGNED_HDMI	signed_hdmi_imx8m.bin
+LOADER		u-boot-spl-ddr.bin	0x7E1000
board/purism/librem5-devkit/librem5-devkit.c new file +77 -0

77 lines not on this page · raw message

board/purism/librem5-devkit/librem5-devkit.env new file +20 -0
new file mode 100644
index 00000000000..2acec768c06
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+
+boot_targets=mmc0 dhcp
+bootmeths=efi extlinux script
+bootm_size=0x10000000
+console=ttymxc0,115200
+fdt_addr_r=0x43000000
+fdtfile=DEFAULT_FDT_FILE
+initrd_addr=0x43800000
+image=Image
+kernel_addr_r=CONFIG_SYS_LOAD_ADDR
+loadaddr=CONFIG_SYS_LOAD_ADDR
+mmcautodetect=yes
+mmcdev=CONFIG_ENV_MMC_DEVICE_INDEX
+mmcpart=1
+mmcroot=/dev/mmcblk0p1
+scriptaddr=CONFIG_SYS_LOAD_ADDR
+mmcargs=setenv bootargs console=${console} root=${mmcroot} rootwait rw
+loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
+loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
board/purism/librem5-devkit/lpddr4_timing.c new file +931 -0

931 lines not on this page · raw message

board/purism/librem5-devkit/lpddr4_timing_b0.c new file +794 -0

794 lines not on this page · raw message

board/purism/librem5-devkit/spl.c new file +371 -0

371 lines not on this page · raw message

configs/librem5-devkit_defconfig new file +183 -0

183 lines not on this page · raw message

doc/board/purism/index.rst +1 -0
index a9cdc312d46..0225aa7f3aa 100644
@@ -7,3 +7,4 @@ Purism SPC
    :maxdepth: 2
 
    librem5
+   librem5-devkit
doc/board/purism/librem5-devkit.rst new file +56 -0

56 lines not on this page · raw message

include/configs/librem5-devkit.h new file +36 -0
new file mode 100644
index 00000000000..9ba6a70d58e
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2017 NXP
+ *           2018 Emcraft Systems
+ *           2022 Purism
+ *           2026 Phosh.mobi e.V.
+ */
+
+#ifndef __LIBREM5_DEVKIT_H
+#define __LIBREM5_DEVKIT_H
+
+/* #define DEBUG */
+
+#include <version.h>
+#include <linux/sizes.h>
+#include <asm/arch/imx-regs.h>
+
+#define CFG_SYS_FSL_USDHC_NUM	2
+
+/* UART */
+#define CFG_MXC_UART_BASE		UART1_BASE_ADDR
+
+/* Link Definitions */
+
+#define CFG_SYS_INIT_RAM_ADDR		0x40000000
+#define CFG_SYS_INIT_RAM_SIZE		0x80000
+
+#define CFG_SYS_SDRAM_BASE		0x40000000
+#define PHYS_SDRAM			0x40000000
+#define PHYS_SDRAM_SIZE			0xc0000000 /* 3GB LPDDR4 one Rank */
+
+/* Monitor Command Prompt */
+
+#define CFG_SYS_FSL_ESDHC_ADDR		0
+
+#endif

---
base-commit: 22a285380e35a31d0a882af66278bc1edc1b917e
change-id: 20260521-devkit-d2180dce1637

Best regards,

Signature · 1 line
Guido Günther <[email protected]>