Skip to contentSkip to conversation

board: purism: add the Purism Librem5 phone

PATCH Superseded Angus Ainslie 2 participants 2 messages Apr 25, 2022 – Apr 27, 2022

Subsystems (3)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 board: purism: add the Purism Librem5 phone

Initial commit of Librem5 u-boot and SPL

---

All of the pre-requisite patches for this board are now upstream or in review.

Changes since v3:

Dropped unused MMCROOT
Rebased on u-boot-imx
Needs this patch to supress SPL warnings
https://lists.denx.de/pipermail/u-boot/2022-April/482369.html

Changes since v2:

Cleanup Kconfig symbols used in librem5.h
Cleanup various checkpatch issues
Drop some un-used functions

Changes since v1:

Merged patches into a monolithic board patch
Using DM drivers for devices in u-boot
Added USB storage support for uSD rootfs
Dropped many SPL_BUILD guarded define's
Fixed documentation index

 arch/arm/dts/Makefile                        |    3 +-
 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi   |  134 ++
 arch/arm/dts/imx8mq-librem5-r4.dts           |   35 +
 arch/arm/dts/imx8mq-librem5.dtsi             | 1255 +++++++++++++++++
 arch/arm/mach-imx/imx8m/Kconfig              |    9 +
 board/purism/librem5/Kconfig                 |   15 +
 board/purism/librem5/MAINTAINERS             |    8 +
 board/purism/librem5/Makefile                |   13 +
 board/purism/librem5/imximage-8mq-lpddr4.cfg |    8 +
 board/purism/librem5/librem5.c               |  425 ++++++
 board/purism/librem5/librem5.h               |  181 +++
 board/purism/librem5/lpddr4_timing.c         | 1324 ++++++++++++++++++
 board/purism/librem5/lpddr4_timing_b0.c      | 1191 ++++++++++++++++
 board/purism/librem5/spl.c                   |  593 ++++++++
 configs/librem5_defconfig                    |  142 ++
 doc/board/index.rst                          |    1 +
 doc/board/purism/index.rst                   |    9 +
 doc/board/purism/librem5.rst                 |   60 +
 include/configs/librem5.h                    |  113 ++
 19 files changed, 5518 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mq-librem5-r4.dts
 create mode 100644 arch/arm/dts/imx8mq-librem5.dtsi
 create mode 100644 board/purism/librem5/Kconfig
 create mode 100644 board/purism/librem5/MAINTAINERS
 create mode 100644 board/purism/librem5/Makefile
 create mode 100644 board/purism/librem5/imximage-8mq-lpddr4.cfg
 create mode 100644 board/purism/librem5/librem5.c
 create mode 100644 board/purism/librem5/librem5.h
 create mode 100644 board/purism/librem5/lpddr4_timing.c
 create mode 100644 board/purism/librem5/lpddr4_timing_b0.c
 create mode 100644 board/purism/librem5/spl.c
 create mode 100644 configs/librem5_defconfig
 create mode 100644 doc/board/purism/index.rst
 create mode 100644 doc/board/purism/librem5.rst
 create mode 100644 include/configs/librem5.h
arch/arm/dts/Makefile +2 -1
index 90f86e3fca..719fd7db8d 100644
@@ -937,7 +937,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mp-venice-gw74xx.dtb \
 	imx8mp-verdin.dtb \
 	imx8mq-pico-pi.dtb \
-	imx8mq-kontron-pitx-imx8m.dtb
+	imx8mq-kontron-pitx-imx8m.dtb \
+	imx8mq-librem5-r4.dtb
 
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
 	imxrt1020-evk.dtb
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi new file +134 -0

134 lines not on this page · raw message

arch/arm/dts/imx8mq-librem5-r4.dts new file +35 -0
new file mode 100644
index 0000000000..cbfb49aa25
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Purism SPC <[email protected]>
+
+/dts-v1/;
+
+#include "imx8mq-librem5.dtsi"
+
+/ {
+	model = "Purism Librem 5r4";
+	compatible = "purism,librem5r4", "purism,librem5", "fsl,imx8mq";
+};
+
+&accel_gyro {
+	mount-matrix =  "1",  "0",  "0",
+			"0",  "1",  "0",
+			"0",  "0", "-1";
+};
+
+&bat {
+	maxim,rsns-microohm = <1667>;
+};
+
+&bq25895 {
+	ti,battery-regulation-voltage = <4200000>; /* uV */
+	ti,charge-current = <1500000>; /* uA */
+	ti,termination-current = <144000>;  /* uA */
+};
+
+&led_backlight {
+	led-max-microamp = <25000>;
+};
+
+&proximity {
+	proximity-near-level = <10>;
+};
arch/arm/dts/imx8mq-librem5.dtsi new file +1255 -0

1,255 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +9 -0
index 24299ae037..11a2abf00c 100644
@@ -257,6 +257,14 @@ config TARGET_IMX8MP_RSB3720A1_6G
 	select IMX8MP
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
+
+config TARGET_LIBREM5
+	bool "Purism Librem5 Phone"
+	select BINMAN
+	select IMX8MQ
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 endchoice
 
 source "board/advantech/imx8mp_rsb3720a1/Kconfig"
@@ -277,6 +285,7 @@ source "board/kontron/sl-mx8mm/Kconfig"
 source "board/menlo/mx8menlo/Kconfig"
 source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
+source "board/purism/librem5/Kconfig"
 source "board/ronetix/imx8mq-cm/Kconfig"
 source "board/technexion/pico-imx8mq/Kconfig"
 source "board/variscite/imx8mn_var_som/Kconfig"
board/purism/librem5/Kconfig new file +15 -0
new file mode 100644
index 0000000000..cf0f303683
@@ -0,0 +1,15 @@
+if TARGET_LIBREM5
+
+config SYS_BOARD
+	default "librem5"
+
+config SYS_VENDOR
+	default "purism"
+
+config SYS_CONFIG_NAME
+	default "librem5"
+
+config IMX_CONFIG
+	default "board/purism/librem5/imximage-8mq-lpddr4.cfg"
+
+endif
board/purism/librem5/MAINTAINERS new file +8 -0
new file mode 100644
index 0000000000..09e7f20e33
@@ -0,0 +1,8 @@
+PURISM LIBREM5 PHONE
+M:	Angus Ainslie <[email protected]>
+R:	[email protected]
+S:	Supported
+F:	arch/arm/dts/imx8mq-librem5*
+F:	board/purism/librem5/
+F:	configs/librem5_defconfig
+F:	include/configs/librem5.h
board/purism/librem5/Makefile new file +13 -0
new file mode 100644
index 0000000000..47f25f047b
@@ -0,0 +1,13 @@
+#
+# Copyright 2017 NXP
+# Copyright 2019 Purism
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += librem5.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o lpddr4_timing_b0.o
+endif
board/purism/librem5/imximage-8mq-lpddr4.cfg new file +8 -0
new file mode 100644
index 0000000000..648471028f
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+BOOT_FROM	sd
+SIGNED_HDMI     signed_dp_imx8m.bin
+LOADER		u-boot-spl-ddr.bin	0x7E1000
board/purism/librem5/librem5.c new file +425 -0

425 lines not on this page · raw message

board/purism/librem5/librem5.h new file +181 -0

181 lines not on this page · raw message

board/purism/librem5/lpddr4_timing.c new file +1324 -0

896 lines not on this page · raw message

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

1,191 lines not on this page · raw message

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

593 lines not on this page · raw message

configs/librem5_defconfig new file +142 -0

142 lines not on this page · raw message

doc/board/index.rst +1 -0
index f90a9cad45..ffa5def303 100644

Lines of this file are not shown. View the raw message.

doc/board/purism/index.rst new file +9 -0
new file mode 100644
index 0000000000..a9cdc312d4

Lines of this file are not shown. View the raw message.

doc/board/purism/librem5.rst new file +60 -0

60 lines not on this page · raw message

include/configs/librem5.h new file +113 -0

113 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 202 lines · Angus Ainslie

Initial commit of Librem5 u-boot and SPL

---

All of the pre-requisite patches for this board are now upstream or in review.

Changes since v3:

Dropped unused MMCROOT
Rebased on u-boot-imx
Needs this patch to supress SPL warnings
https://lists.denx.de/pipermail/u-boot/2022-April/482369.html

Changes since v2:

Cleanup Kconfig symbols used in librem5.h
Cleanup various checkpatch issues
Drop some un-used functions

Changes since v1:

Merged patches into a monolithic board patch
Using DM drivers for devices in u-boot
Added USB storage support for uSD rootfs
Dropped many SPL_BUILD guarded define's
Fixed documentation index

 arch/arm/dts/Makefile                        |    3 +-
 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi   |  134 ++
 arch/arm/dts/imx8mq-librem5-r4.dts           |   35 +
 arch/arm/dts/imx8mq-librem5.dtsi             | 1255 +++++++++++++++++
 arch/arm/mach-imx/imx8m/Kconfig              |    9 +
 board/purism/librem5/Kconfig                 |   15 +
 board/purism/librem5/MAINTAINERS             |    8 +
 board/purism/librem5/Makefile                |   13 +
 board/purism/librem5/imximage-8mq-lpddr4.cfg |    8 +
 board/purism/librem5/librem5.c               |  425 ++++++
 board/purism/librem5/librem5.h               |  181 +++
 board/purism/librem5/lpddr4_timing.c         | 1324 ++++++++++++++++++
 board/purism/librem5/lpddr4_timing_b0.c      | 1191 ++++++++++++++++
 board/purism/librem5/spl.c                   |  593 ++++++++
 configs/librem5_defconfig                    |  142 ++
 doc/board/index.rst                          |    1 +
 doc/board/purism/index.rst                   |    9 +
 doc/board/purism/librem5.rst                 |   60 +
 include/configs/librem5.h                    |  113 ++
 19 files changed, 5518 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mq-librem5-r4.dts
 create mode 100644 arch/arm/dts/imx8mq-librem5.dtsi
 create mode 100644 board/purism/librem5/Kconfig
 create mode 100644 board/purism/librem5/MAINTAINERS
 create mode 100644 board/purism/librem5/Makefile
 create mode 100644 board/purism/librem5/imximage-8mq-lpddr4.cfg
 create mode 100644 board/purism/librem5/librem5.c
 create mode 100644 board/purism/librem5/librem5.h
 create mode 100644 board/purism/librem5/lpddr4_timing.c
 create mode 100644 board/purism/librem5/lpddr4_timing_b0.c
 create mode 100644 board/purism/librem5/spl.c
 create mode 100644 configs/librem5_defconfig
 create mode 100644 doc/board/purism/index.rst
 create mode 100644 doc/board/purism/librem5.rst
 create mode 100644 include/configs/librem5.h
arch/arm/dts/Makefile +2 -1
index 90f86e3fca..719fd7db8d 100644
@@ -937,7 +937,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mp-venice-gw74xx.dtb \
 	imx8mp-verdin.dtb \
 	imx8mq-pico-pi.dtb \
-	imx8mq-kontron-pitx-imx8m.dtb
+	imx8mq-kontron-pitx-imx8m.dtb \
+	imx8mq-librem5-r4.dtb
 
 dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
 	imxrt1020-evk.dtb
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi new file +115 -0
new file mode 100644
index 0000000000..e3f780ca75
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+&binman {
+	u-boot-spl-ddr {
+		filename = "u-boot-spl-ddr.bin";
+		pad-byte = <0xff>;
+		align-size = <4>;
+		align = <4>;
+
+		u-boot-spl {
+			align-end = <4>;
+		};
+
+		blob_1: blob-ext@1 {
+			filename = "lpddr4_pmu_train_1d_imem.bin";
+			size = <0x8000>;
+		};
+
+		blob_2: blob-ext@2 {
+			filename = "lpddr4_pmu_train_1d_dmem.bin";
+			size = <0x4000>;
+		};
+
+		blob_3: blob-ext@3 {
+			filename = "lpddr4_pmu_train_2d_imem.bin";
+			size = <0x8000>;
+		};
+
+		blob_4: blob-ext@4 {
+			filename = "lpddr4_pmu_train_2d_dmem.bin";
+			size = <0x4000>;
+		};
+	};
+
+	spl {
+		filename = "spl.bin";
+
+		mkimage {
+			args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+
+			blob {
+				filename = "u-boot-spl-ddr.bin";
+			};
+		};
+	};
+
+	itb {
+		filename = "u-boot.itb";
+
+		fit {
+			description = "Configuration to load ATF before U-Boot";
+			#address-cells = <1>;
+			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+			images {
+				uboot {
+					description = "U-Boot (64-bit)";
+					type = "standalone";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SYS_TEXT_BASE>;
+
+					uboot_blob: blob-ext {
+						filename = "u-boot-nodtb.bin";
+					};
+				};
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <0x910000>;
+					entry = <0x910000>;
+
+					atf_blob: blob-ext {
+						filename = "bl31.bin";
+					};
+				};
+
+				fdt {
+					description = "NAME";
+					type = "flat_dt";
+					compression = "none";
+
+					uboot_fdt_blob: blob-ext {
+						filename = "u-boot.dtb";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf";
+
+				conf {
+					description = "NAME";
+					firmware = "uboot";
+					loadables = "atf";
+					fdt = "fdt";
+				};
+			};
+		};
+	};
+
+	imx-boot {
+		filename = "flash.bin";
+		pad-byte = <0x00>;
+
+		spl: blob-ext@1 {

arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi line 125

Quoted 10 lines
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi new file +10 -0
+			offset = <0x0>;
+			filename = "spl.bin";
+		};
+
+		uboot: blob-ext@2 {
+			offset = <0x57c00>;
+			filename = "u-boot.itb";
+		};
+	};
+};

These look mostly the same as imx8mq-u-boot.dtsi, try #include-ing that instead of duplicating things here.

Quoted 2 lines
arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi new file +2 -0
+
+[...]