Skip to contentSkip to conversation

imx8mn_var_som: Add support for Variscite VAR-SOM-MX8M-NANO board

PATCH Superseded Ariel D'Alessandro 2 participants 5 messages Nov 15, 2021

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 imx8mn_var_som: Add support for Variscite VAR-SOM-MX8M-NANO board

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

---
 MAINTAINERS                                   |   8 +
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/imx8mn-var-som-u-boot.dtsi       | 256 +++++++++
 arch/arm/dts/imx8mn-var-som.dts               | 423 ++++++++++++++
 arch/arm/mach-imx/imx8m/Kconfig               |   9 +
 board/variscite/imx8mn_var_som/Kconfig        |  17 +
 board/variscite/imx8mn_var_som/Makefile       |  12 +
 board/variscite/imx8mn_var_som/ddr4_timing.c  | 528 ++++++++++++++++++
 .../variscite/imx8mn_var_som/imx8mn_var_som.c |  30 +
 .../imx8mn_var_som/imximage-8mn-ddr4.cfg      |  10 +
 board/variscite/imx8mn_var_som/spl.c          |  93 +++
 configs/imx8mn_var_som_defconfig              |  98 ++++
 include/configs/imx8mn_var_som.h              | 106 ++++
 13 files changed, 1591 insertions(+)
 create mode 100644 arch/arm/dts/imx8mn-var-som-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-var-som.dts
 create mode 100644 board/variscite/imx8mn_var_som/Kconfig
 create mode 100644 board/variscite/imx8mn_var_som/Makefile
 create mode 100644 board/variscite/imx8mn_var_som/ddr4_timing.c
 create mode 100644 board/variscite/imx8mn_var_som/imx8mn_var_som.c
 create mode 100644 board/variscite/imx8mn_var_som/imximage-8mn-ddr4.cfg
 create mode 100644 board/variscite/imx8mn_var_som/spl.c
 create mode 100644 configs/imx8mn_var_som_defconfig
 create mode 100644 include/configs/imx8mn_var_som.h
MAINTAINERS +8 -0
index 6db5354322f..b13098c2138 100644
@@ -550,6 +550,14 @@ F:	arch/arm/mach-uniphier/
 F:	configs/uniphier_*_defconfig
 N:	uniphier
 
+ARM VARISCITE VAR-SOM-MX8MN MODULE
+M:	Ariel D'Alessandro <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/arch/arm/dts/imx8mn-var-som*
+F:	board/variscite/imx8mn_var_som/
+F:	configs/imx8mn_var_som_defconfig
+F:	include/configs/imx8mn_var_som.h
+
 ARM VERSAL
 M:	Michal Simek <[email protected]>
 S:	Maintained
arch/arm/dts/Makefile +1 -0
index cc34da7bd83..dfa034be80f 100644
@@ -901,6 +901,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mn-ddr4-evk.dtb \
 	imx8mq-cm.dtb \
 	imx8mn-evk.dtb \
+	imx8mn-var-som.dtb \
 	imx8mq-evk.dtb \
 	imx8mm-beacon-kit.dtb \
 	imx8mn-beacon-kit.dtb \
arch/arm/dts/imx8mn-var-som-u-boot.dtsi new file +256 -0

256 lines not on this page · raw message

arch/arm/dts/imx8mn-var-som.dts new file +423 -0

423 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +9 -0
index 276b8bd9742..82a5ab8ad00 100644
@@ -108,6 +108,14 @@ config TARGET_PICO_IMX8MQ
 	select IMX8MQ
 	select IMX8M_LPDDR4
 
+config TARGET_IMX8MN_VAR_SOM
+	bool "imx8mn_var_som"
+	select BINMAN
+	select IMX8MN
+	select SUPPORT_SPL
+	select IMX8M_DDR4
+	select IMX8M_BOARD_INIT_DRAM
+
 config TARGET_VERDIN_IMX8MM
 	bool "Support Toradex Verdin iMX8M Mini module"
 	select BINMAN
@@ -171,6 +179,7 @@ source "board/phytec/phycore_imx8mm/Kconfig"
 source "board/phytec/phycore_imx8mp/Kconfig"
 source "board/ronetix/imx8mq-cm/Kconfig"
 source "board/technexion/pico-imx8mq/Kconfig"
+source "board/variscite/imx8mn_var_som/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
 
 endif
board/variscite/imx8mn_var_som/Kconfig new file +17 -0
new file mode 100644
index 00000000000..cfe6fc8c2c7
@@ -0,0 +1,17 @@
+if TARGET_IMX8MN_VAR_SOM
+
+config SYS_BOARD
+	default "imx8mn_var_som"
+
+config SYS_VENDOR
+	default "variscite"
+
+config SYS_CONFIG_NAME
+	default "imx8mn_var_som"
+
+config IMX_CONFIG
+	default "board/variscite/imx8mn_var_som/imximage-8mn-ddr4.cfg"
+
+source "board/freescale/common/Kconfig"
+
+endif
board/variscite/imx8mn_var_som/Makefile new file +12 -0
new file mode 100644
index 00000000000..a8b6a343ffc
@@ -0,0 +1,12 @@
+#
+# Copyright 2021 Collabora Ltd.
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mn_var_som.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-y += ddr4_timing.o
+endif
board/variscite/imx8mn_var_som/ddr4_timing.c new file +528 -0

528 lines not on this page · raw message

board/variscite/imx8mn_var_som/imx8mn_var_som.c new file +30 -0
new file mode 100644
index 00000000000..e274e0e0a4c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Collabora Ltd.
+ */
+
+#include <common.h>
+#include <env.h>
+#include <asm/io.h>
+
+static void setup_fec(void)
+{
+	struct iomuxc_gpr_base_regs *gpr =
+		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
+
+	/* Use 125M anatop REF_CLK1 for ENET1, not from external */
+	clrsetbits_le32(&gpr->gpr[1], 0x2000, 0);
+}
+
+int board_init(void)
+{
+	if (CONFIG_IS_ENABLED(FEC_MXC))
+		setup_fec();
+
+	return 0;
+}
+
+int board_mmc_get_env_dev(int devno)
+{
+	return devno;
+}
board/variscite/imx8mn_var_som/imximage-8mn-ddr4.cfg new file +10 -0
new file mode 100644
index 00000000000..2083233e500
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 Collabora Ltd.
+ */
+
+#define __ASSEMBLY__
+
+ROM_VERSION	v2
+BOOT_FROM	sd
+LOADER		u-boot-spl-ddr.bin	0x912000
board/variscite/imx8mn_var_som/spl.c new file +93 -0

93 lines not on this page · raw message

configs/imx8mn_var_som_defconfig new file +98 -0

98 lines not on this page · raw message

include/configs/imx8mn_var_som.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.30.2
#1 lore raw
Quoted 11 lines · Ariel D'Alessandro

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

---
 MAINTAINERS                                   |   8 +

Typically this goes in to board/.../MAINTAINERS

Quoted 1 line
 arch/arm/dts/imx8mn-var-som.dts               | 423 ++++++++++++++

What linux kernel version (or, is it just in linux-next?) is this from?

[snip]

include/configs/imx8mn_var_som.h line 33

Quoted 12 lines
include/configs/imx8mn_var_som.h new file +12 -0
+#ifdef CONFIG_SPL_BUILD
+
+#define CONFIG_SPL_STACK		0x980000
+#define CONFIG_SPL_BSS_START_ADDR	0x950000
+#define CONFIG_SPL_BSS_MAX_SIZE		SZ_8K
+#define CONFIG_SYS_SPL_MALLOC_START	0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	SZ_512K
+
+/* For RAW image gives a error info not panic */
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#endif /* CONFIG_SPL_BUILD */

We can't guard CONFIG options with CONFIG_SPL_BUILD or !CONFIG_SPL_BUILD.

Signature · 1 line
Tom
#2 lore raw

Hi Tom,

Thanks for the feedback.

Quoted 10 lines · Tom Rini
Quoted 8 lines · Ariel D'Alessandro

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

Quoted 5 lines
Quoted 3 lines
---
 MAINTAINERS                                   |   8 +

Typically this goes in to board/.../MAINTAINERS

Will fix in v3.

Quoted 4 lines
Quoted 2 lines
 arch/arm/dts/imx8mn-var-som.dts               | 423 ++++++++++++++

What linux kernel version (or, is it just in linux-next?) is this from?

It's already supported in current linux/master:

$ git describe origin/master
v5.16-rc1-3-g8ab774587903
Quoted 17 lines

[snip]

include/configs/imx8mn_var_som.h line 33

Quoted 12 lines
include/configs/imx8mn_var_som.h new file +12 -0
+#ifdef CONFIG_SPL_BUILD
+
+#define CONFIG_SPL_STACK		0x980000
+#define CONFIG_SPL_BSS_START_ADDR	0x950000
+#define CONFIG_SPL_BSS_MAX_SIZE		SZ_8K
+#define CONFIG_SYS_SPL_MALLOC_START	0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	SZ_512K
+
+/* For RAW image gives a error info not panic */
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#endif /* CONFIG_SPL_BUILD */

We can't guard CONFIG options with CONFIG_SPL_BUILD or !CONFIG_SPL_BUILD.

Sorry I don't understand, could you expand on the proper way to handle the above configuration? AFAICS, several imx8m boards follow this same pattern:

$ git grep -l CONFIG_SPL_BUILD -- include/configs/imx8m*
include/configs/imx8mm-cl-iot-gate.h
include/configs/imx8mm_beacon.h
include/configs/imx8mm_evk.h
include/configs/imx8mm_icore_mx8mm.h
include/configs/imx8mm_venice.h
include/configs/imx8mn_beacon.h
include/configs/imx8mn_evk.h
include/configs/imx8mp_evk.h
include/configs/imx8mq_cm.h
include/configs/imx8mq_evk.h
include/configs/imx8mq_phanbell.h

Regards,
Ariel

#3 lore raw
Quoted 24 lines · Ariel D'Alessandro

Hi Tom,

Thanks for the feedback.

Quoted 10 lines · Tom Rini
Quoted 8 lines · Ariel D'Alessandro

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

Quoted 5 lines
Quoted 3 lines
---
 MAINTAINERS                                   |   8 +

Typically this goes in to board/.../MAINTAINERS

Will fix in v3.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
 arch/arm/dts/imx8mn-var-som.dts               | 423 ++++++++++++++

What linux kernel version (or, is it just in linux-next?) is this from?

It's already supported in current linux/master:

$ git describe origin/master
v5.16-rc1-3-g8ab774587903

OK, good, thanks.

Quoted 23 lines
Quoted 18 lines

[snip]

include/configs/imx8mn_var_som.h line 33

Quoted 12 lines
include/configs/imx8mn_var_som.h new file +12 -0
+#ifdef CONFIG_SPL_BUILD
+
+#define CONFIG_SPL_STACK		0x980000
+#define CONFIG_SPL_BSS_START_ADDR	0x950000
+#define CONFIG_SPL_BSS_MAX_SIZE		SZ_8K
+#define CONFIG_SYS_SPL_MALLOC_START	0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	SZ_512K
+
+/* For RAW image gives a error info not panic */
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#endif /* CONFIG_SPL_BUILD */

We can't guard CONFIG options with CONFIG_SPL_BUILD or !CONFIG_SPL_BUILD.

Sorry I don't understand, could you expand on the proper way to handle the above configuration? AFAICS, several imx8m boards follow this same pattern:

Quoted 12 lines
$ git grep -l CONFIG_SPL_BUILD -- include/configs/imx8m*
include/configs/imx8mm-cl-iot-gate.h
include/configs/imx8mm_beacon.h
include/configs/imx8mm_evk.h
include/configs/imx8mm_icore_mx8mm.h
include/configs/imx8mm_venice.h
include/configs/imx8mn_beacon.h
include/configs/imx8mn_evk.h
include/configs/imx8mp_evk.h
include/configs/imx8mq_cm.h
include/configs/imx8mq_evk.h
include/configs/imx8mq_phanbell.h

Yes, it's sadly a common anti-pattern. Just always define things.

Signature · 1 line
Tom
#4 lore raw
Quoted 18 lines · Tom Rini
Quoted 17 lines · Ariel D'Alessandro

Hi Tom,

Thanks for the feedback.

Quoted 12 lines · Tom Rini
Quoted 10 lines · Ariel D'Alessandro

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

---

[snip]

Quoted 33 lines
Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
include/configs/imx8mn_var_som.h new file +7 -0
+#ifdef CONFIG_SPL_BUILD
+
+#define CONFIG_SPL_STACK		0x980000
+#define CONFIG_SPL_BSS_START_ADDR	0x950000
+#define CONFIG_SPL_BSS_MAX_SIZE		SZ_8K
+#define CONFIG_SYS_SPL_MALLOC_START	0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	SZ_512K
Quoted 8 lines

include/configs/imx8mn_var_som.h line 33

Quoted 5 lines
include/configs/imx8mn_var_som.h new file +5 -0
+
+/* For RAW image gives a error info not panic */
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#endif /* CONFIG_SPL_BUILD */

We can't guard CONFIG options with CONFIG_SPL_BUILD or !CONFIG_SPL_BUILD.

Sorry I don't understand, could you expand on the proper way to handle the above configuration? AFAICS, several imx8m boards follow this same pattern:

Quoted 12 lines
$ git grep -l CONFIG_SPL_BUILD -- include/configs/imx8m*
include/configs/imx8mm-cl-iot-gate.h
include/configs/imx8mm_beacon.h
include/configs/imx8mm_evk.h
include/configs/imx8mm_icore_mx8mm.h
include/configs/imx8mm_venice.h
include/configs/imx8mn_beacon.h
include/configs/imx8mn_evk.h
include/configs/imx8mp_evk.h
include/configs/imx8mq_cm.h
include/configs/imx8mq_evk.h
include/configs/imx8mq_phanbell.h
Quoted 1 line

Yes, it's sadly a common anti-pattern. Just always define things.

I see. Will be fixed in v3.

Thanks a lot!
Ariel