Skip to contentSkip to conversation

imx8mm-phg: Add board support

PATCH Superseded Fabio Estevam 2 participants 4 messages Jan 9, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8mm-phg: Add board support

Add the board support for the i.MX8MM Cloos PHG board.

This board uses a imx8mm-tqma8mqml SoM from TQ-Group.

imx8mm-phg.dts and imx8mm-tqma8mqml.dtsi are taken directly from Linux 6.2-rc3.

---
 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/imx8mm-phg-u-boot.dtsi           |  137 ++
 arch/arm/dts/imx8mm-phg.dts                   |  266 +++
 arch/arm/dts/imx8mm-tqma8mqml.dtsi            |  341 +++
 arch/arm/mach-imx/imx8m/Kconfig               |    8 +
 board/cloos/imx8mm_phg/Kconfig                |   15 +
 board/cloos/imx8mm_phg/MAINTAINERS            |    6 +
 board/cloos/imx8mm_phg/Makefile               |   12 +
 board/cloos/imx8mm_phg/README                 |   55 +
 board/cloos/imx8mm_phg/imx8mm_phg.c           |   50 +
 .../cloos/imx8mm_phg/imximage-8mm-lpddr4.cfg  |    8 +
 board/cloos/imx8mm_phg/lpddr4_timing.c        | 1846 +++++++++++++++++
 board/cloos/imx8mm_phg/spl.c                  |  147 ++
 configs/imx8mm_phg_defconfig                  |  120 ++
 include/configs/imx8mm_phg.h                  |   62 +
 15 files changed, 3074 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm-phg-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-phg.dts
 create mode 100644 arch/arm/dts/imx8mm-tqma8mqml.dtsi
 create mode 100644 board/cloos/imx8mm_phg/Kconfig
 create mode 100644 board/cloos/imx8mm_phg/MAINTAINERS
 create mode 100644 board/cloos/imx8mm_phg/Makefile
 create mode 100644 board/cloos/imx8mm_phg/README
 create mode 100644 board/cloos/imx8mm_phg/imx8mm_phg.c
 create mode 100644 board/cloos/imx8mm_phg/imximage-8mm-lpddr4.cfg
 create mode 100644 board/cloos/imx8mm_phg/lpddr4_timing.c
 create mode 100644 board/cloos/imx8mm_phg/spl.c
 create mode 100644 configs/imx8mm_phg_defconfig
 create mode 100644 include/configs/imx8mm_phg.h
arch/arm/dts/Makefile +1 -0
index 43951a7731..c06227bae8 100644
@@ -955,6 +955,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mm-kontron-bl.dtb \
 	imx8mm-kontron-bl-osm-s.dtb \
 	imx8mm-mx8menlo.dtb \
+	imx8mm-phg.dtb \
 	imx8mm-venice.dtb \
 	imx8mm-venice-gw71xx-0x.dtb \
 	imx8mm-venice-gw72xx-0x.dtb \
arch/arm/dts/imx8mm-phg-u-boot.dtsi new file +137 -0

137 lines not on this page · raw message

arch/arm/dts/imx8mm-phg.dts new file +266 -0

266 lines not on this page · raw message

arch/arm/dts/imx8mm-tqma8mqml.dtsi new file +341 -0

341 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +8 -0
index a0715e8091..64e6b49f46 100644
@@ -94,6 +94,13 @@ config TARGET_IMX8MM_MX8MENLO
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_PHG
+	bool "i.MX8MM PHG board"
+	select BINMAN
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 config TARGET_IMX8MM_VENICE
 	bool "Support Gateworks Venice iMX8M Mini module"
 	select BINMAN
@@ -305,6 +312,7 @@ source "board/advantech/imx8mp_rsb3720a1/Kconfig"
 source "board/beacon/imx8mm/Kconfig"
 source "board/beacon/imx8mn/Kconfig"
 source "board/bsh/imx8mn_smm_s2/Kconfig"
+source "board/cloos/imx8mm_phg/Kconfig"
 source "board/compulab/imx8mm-cl-iot-gate/Kconfig"
 source "board/data_modul/imx8mm_edm_sbc/Kconfig"
 source "board/dhelectronics/dh_imx8mp/Kconfig"
board/cloos/imx8mm_phg/Kconfig new file +15 -0
new file mode 100644
index 0000000000..04680d93b5
@@ -0,0 +1,15 @@
+if TARGET_IMX8MM_PHG
+
+config SYS_BOARD
+	default "imx8mm_phg"
+
+config SYS_VENDOR
+	default "cloos"
+
+config SYS_CONFIG_NAME
+	default "imx8mm_phg"
+
+config IMX_CONFIG
+	default "board/cloos/imx8mm_phg/imximage-8mm-lpddr4.cfg"
+
+endif
board/cloos/imx8mm_phg/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..476f23061b
@@ -0,0 +1,6 @@
+i.MX8MM PHG BOARD
+M:	Fabio Estevam <[email protected]>
+S:	Maintained
+F:	board/cloos/imx8mm_phg/
+F:	include/configs/imx8mm_phg.h
+F:	configs/imx8mm_phg_defconfig
board/cloos/imx8mm_phg/Makefile new file +12 -0
new file mode 100644
index 0000000000..2b36931fcf
@@ -0,0 +1,12 @@
+#
+# Copyright 2018 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mm_phg.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/cloos/imx8mm_phg/README new file +55 -0

55 lines not on this page · raw message

board/cloos/imx8mm_phg/imx8mm_phg.c new file +50 -0

50 lines not on this page · raw message

board/cloos/imx8mm_phg/imximage-8mm-lpddr4.cfg new file +8 -0
new file mode 100644
index 0000000000..20061521f2
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+
+BOOT_FROM	sd
+LOADER		u-boot-spl-ddr.bin	0x7E1000
board/cloos/imx8mm_phg/lpddr4_timing.c new file +1846 -0

1,846 lines not on this page · raw message

board/cloos/imx8mm_phg/spl.c new file +147 -0

147 lines not on this page · raw message

configs/imx8mm_phg_defconfig new file +120 -0

90 lines not on this page · raw message

include/configs/imx8mm_phg.h new file +62 -0

62 lines not on this page · raw message

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

Signature · 1 line
2.25.1

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

#1 lore raw
Quoted 6 lines · Fabio Estevam

Add the board support for the i.MX8MM Cloos PHG board.

This board uses a imx8mm-tqma8mqml SoM from TQ-Group.

imx8mm-phg.dts and imx8mm-tqma8mqml.dtsi are taken directly from Linux 6.2-rc3.

This is going to need to be rebased on top of current master due to CONFIG -> CFG or Kconfig migration. On top of that:

[snip]

Quoted 1 line
 create mode 100644 board/cloos/imx8mm_phg/README

This needs to be doc/board/cloos/imx8mm_phg.rst (and related index, etc changes).

[snip]

include/configs/imx8mm_phg.h line 29

Quoted 8 lines
include/configs/imx8mm_phg.h new file +8 -0
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 2) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+#endif

No, you cannot guard stuff with CONFIG_SPL_BUILD as that way leads to inconsistencies. There should be no size impact in SPL from having this.

Quoted 9 lines
include/configs/imx8mm_phg.h new file +9 -0
+/* Initial environment variables */
+#define CONFIG_EXTRA_ENV_SETTINGS		\
+	BOOTENV \
+	"scriptaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+	"kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+	"image=Image\0" \
+	"console=ttymxc1,115200\0" \
+	"fdt_addr_r=0x43000000\0"			\
+	"boot_fit=no\0" \

include/configs/imx8mm_phg.h line 49

Quoted 10 lines
include/configs/imx8mm_phg.h new file +10 -0
+	"fdtfile=imx8mm-phg.dtb\0" \
+	"initrd_addr=0x43800000\0"		\
+	"bootm_size=0x10000000\0" \
+	"mmcdev=0\0" \
+	"mmcargs=setenv bootargs console=ttymxc1,115200 root=/dev/mmcblk${mmcdev}p${mmcpart} rw rootwait quiet\0" \
+	"bootcmd=env exists mmcpart || setenv mmcpart 1; run mmcargs; \
+	mmc dev ${mmcdev}; \
+	load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/Image; \
+	load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} boot/${fdtfile}; \
+	booti ${loadaddr} - ${fdt_addr_r}\0"

And all of this should be in a text based environment instead. The macros from distro boot have to stay in the header, for now, but the rest does not.

include/configs/imx8mm_phg.h line 60

Quoted 3 lines
include/configs/imx8mm_phg.h new file +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x40000000
+#define PHYS_SDRAM			0x40000000
+#define PHYS_SDRAM_SIZE		0x80000000 /* 2GB DDR */

Please make sure we need to define PHYS_SDRAM* at all. Thanks!

Signature · 1 line
Tom
#2 lore raw

Hi Tom,

Quoted 2 lines · Tom Rini

This is going to need to be rebased on top of current master due to CONFIG -> CFG or Kconfig migration. On top of that:

Ok, I will rebase on top of the current master.

Quoted 5 lines

include/configs/imx8mm_phg.h line 60

Quoted 3 lines
include/configs/imx8mm_phg.h new file +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x40000000
+#define PHYS_SDRAM			0x40000000
+#define PHYS_SDRAM_SIZE		0x80000000 /* 2GB DDR */

Please make sure we need to define PHYS_SDRAM* at all. Thanks!

Sorry, I don't understand this comment.

PHYS_SDRAM and PHYS_SDRAM_SIZE are used by arch/arm/mach-imx/imx8m/soc.c.

Regards,

Fabio Estevam

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-60 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw
Quoted 15 lines · Fabio Estevam

Hi Tom,

Quoted 2 lines · Tom Rini

This is going to need to be rebased on top of current master due to CONFIG -> CFG or Kconfig migration. On top of that:

Ok, I will rebase on top of the current master.

Quoted 5 lines

include/configs/imx8mm_phg.h line 60

Quoted 3 lines
include/configs/imx8mm_phg.h new file +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x40000000
+#define PHYS_SDRAM			0x40000000
+#define PHYS_SDRAM_SIZE		0x80000000 /* 2GB DDR */

Please make sure we need to define PHYS_SDRAM* at all. Thanks!

Quoted 3 lines

Sorry, I don't understand this comment.

PHYS_SDRAM and PHYS_SDRAM_SIZE are used by arch/arm/mach-imx/imx8m/soc.c.

OK, so those defines are used. There's a surprising amount of unused defines that end up in include/configs/ so I want to be sure when I see a new one pop up.

As a tangent, are these actually board specific? My first glance is that we're just saying where memory could be, rather than is all of memory and so it should just be a static "starts here, takes up the remaining 2GB of address space".

Signature · 1 line
Tom