Skip to contentSkip to conversation

board: gateworks: venice: add imx8mn-gw7902 support

PATCH Superseded Tim Harvey 2 participants 3 messages Oct 7, 2021 – Oct 15, 2021

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH v2 1/1 board: gateworks: venice: add imx8mn-gw7902 support

The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
- LPDDR4 DRAM
- eMMC FLASH
- Gateworks System Controller
- LTE CAT M1 modem
- USB 2.0 HUB
- M.2 Socket with USB2.0, PCIe, and dual-SIM
- IMX8M FEC
- PCIe based GbE
- RS232/RS485/RS422 serial transceiver
- GPS
- CAN bus
- WiFi / Bluetooth
- MIPI header (DSI/CSI/GPIO/PWM/I2S)
- PMIC

To add support for the i.MX8M Nano GW7902:
- Add imx8mn-venice dts/defconfig/include
- Add imx8mn-gw7902 dts
- Add imx8mn-2gb lpddr4 dram configs
- Add misc support for IMX8M Nano SoC
- rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
- update README with differences for IMX8MN vs IMX8MM

---
v2:
- rebase on origin/master
- remove unused fdt_pack_reg function

---
 arch/arm/dts/Makefile                         |    2 +
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi |   29 +
 arch/arm/dts/imx8mn-venice-gw7902.dts         |  888 ++++++++++
 arch/arm/dts/imx8mn-venice-u-boot.dtsi        |  222 +++
 arch/arm/dts/imx8mn-venice.dts                |  152 ++
 arch/arm/mach-imx/imx8m/Kconfig               |    7 +
 board/gateworks/venice/Kconfig                |   15 +
 board/gateworks/venice/MAINTAINERS            |    6 +-
 board/gateworks/venice/Makefile               |   10 +-
 board/gateworks/venice/README                 |    3 +-
 board/gateworks/venice/gsc.c                  |   13 +
 .../gateworks/venice/imximage-8mn-lpddr4.cfg  |   10 +
 board/gateworks/venice/lpddr4_timing.h        |    5 +
 ...lpddr4_timing.c => lpddr4_timing_imx8mm.c} |    0
 .../lpddr4_timing_imx8mn_2gb_dual_die.c       | 1444 ++++++++++++++++
 .../lpddr4_timing_imx8mn_2gb_single_die.c     | 1445 +++++++++++++++++
 board/gateworks/venice/spl.c                  |   31 +-
 .../venice/{imx8mm_venice.c => venice.c}      |    0
 configs/imx8mn_venice_defconfig               |  114 ++
 include/configs/imx8mn_venice.h               |  114 ++
 20 files changed, 4503 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902.dts
 create mode 100644 arch/arm/dts/imx8mn-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice.dts
 create mode 100644 board/gateworks/venice/imximage-8mn-lpddr4.cfg
 rename board/gateworks/venice/{lpddr4_timing.c => lpddr4_timing_imx8mm.c} (100%)
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_dual_die.c
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_single_die.c
 rename board/gateworks/venice/{imx8mm_venice.c => venice.c} (100%)
 create mode 100644 configs/imx8mn_venice_defconfig
 create mode 100644 include/configs/imx8mn_venice.h
arch/arm/dts/Makefile +2 -0
index 9438bf735a..a338814d2c 100644
@@ -881,6 +881,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mn-ddr4-evk.dtb \
 	imx8mq-cm.dtb \
 	imx8mn-evk.dtb \
+	imx8mn-venice.dtb \
+	imx8mn-venice-gw7902.dtb \
 	imx8mq-evk.dtb \
 	imx8mm-beacon-kit.dtb \
 	imx8mn-beacon-kit.dtb \
arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi new file +29 -0
new file mode 100644
index 0000000000..f6f0aa7cb5
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+#include "imx8mn-venice-u-boot.dtsi"
+
+&fec1 {
+	phy-reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <1>;
+	phy-reset-post-delay = <1>;
+};
+
+&pinctrl_fec1 {
+	u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} {
+	u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b/regulators} {
+	u-boot,dm-spl;
+};
+
+&pinctrl_pmic {
+	u-boot,dm-spl;
+};
+
arch/arm/dts/imx8mn-venice-gw7902.dts new file +888 -0

888 lines not on this page · raw message

arch/arm/dts/imx8mn-venice-u-boot.dtsi new file +222 -0

222 lines not on this page · raw message

arch/arm/dts/imx8mn-venice.dts new file +152 -0

152 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 43901f15d2..3960f8817b 100644
@@ -90,6 +90,13 @@ config TARGET_IMX8MN_DDR4_EVK
 	select SUPPORT_SPL
 	select IMX8M_DDR4
 
+config TARGET_IMX8MN_VENICE
+	bool "Support Gateworks Venice iMX8M Nano module"
+	select BINMAN
+	select IMX8MN
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 config TARGET_IMX8MP_EVK
 	bool "imx8mp LPDDR4 EVK board"
 	select BINMAN
board/gateworks/venice/Kconfig +15 -0
index 687b94f24d..3034275ac2 100644
@@ -12,3 +12,18 @@ config SYS_CONFIG_NAME
 config IMX_CONFIG
 	default "board/gateworks/venice/imximage-8mm-lpddr4.cfg"
 endif
+
+if TARGET_IMX8MN_VENICE
+
+config SYS_BOARD
+	default "venice"
+
+config SYS_VENDOR
+	default "gateworks"
+
+config SYS_CONFIG_NAME
+	default "imx8mn_venice"
+
+config IMX_CONFIG
+	default "board/gateworks/venice/imximage-8mn-lpddr4.cfg"
+endif
board/gateworks/venice/MAINTAINERS +3 -3
index 07b9e2a60f..cfdea0cb8a 100644
@@ -1,7 +1,7 @@
 i.MX8MM Venice
 M:	Tim Harvey <[email protected]>
 S:	Maintained
-F:	arch/arm/dts/imx8mm-venice*
+F:	arch/arm/dts/imx8m*-venice*
 F:	board/gateworks/venice/
-F:	include/configs/venice.h
-F:	configs/imx8mm_venice_defconfig
+F:	include/configs/imx8m*_venice.h
+F:	configs/imx8m*_venice_defconfig
board/gateworks/venice/Makefile +8 -2
index 08f5c62db7..4ef8ae9188 100644
@@ -4,9 +4,15 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y += imx8mm_venice.o gsc.o
+obj-y += venice.o gsc.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
-obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+ifdef CONFIG_IMX8MM
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing_imx8mm.o
+endif
+ifdef CONFIG_IMX8MN
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing_imx8mn_2gb_dual_die.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing_imx8mn_2gb_single_die.o
+endif
 endif
board/gateworks/venice/README +2 -1
index 773cc09e87..9f3a250bb6 100644
@@ -31,4 +31,5 @@ Update eMMC
 ===========
 => tftpboot $loadaddr flash.bin
 => setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200
-=> mmc dev 2 && mmc write $loadaddr 0x42 $blkcnt
+=> mmc dev 2 && mmc write $loadaddr 0x42 $blkcnt # for IMX8MM
+=> mmc dev 2 && mmc write $loadaddr 0x40 $blkcnt # for IMX8MN
board/gateworks/venice/gsc.c +13 -0
index 065d1fb8cc..a184ce8228 100644
@@ -378,7 +378,11 @@ char get_pcb_rev(const char *str)
 	snprintf((dest) + strlen(dest), (sz) - strlen(dest), fmt, ##__VA_ARGS__)
 const char *gsc_get_dtb_name(int level, char *buf, int sz)
 {
+#ifdef CONFIG_IMX8MM
 	const char *pre = "imx8mm-venice-gw";
+#else
+	const char *pre = "imx8mn-venice-gw";
+#endif
 	int model, rev_pcb, rev_bom;
 
 	model = ((som_info.model[2] - '0') * 1000)
@@ -544,6 +548,15 @@ int gsc_init(int quiet)
 	 * board may be ready to probe the GSC before its firmware is
 	 * running.  We will wait here indefinately for the GSC/EEPROM.
 	 */
+#ifdef CONFIG_IMX8MN
+	// TODO:
+	//   IMX8MN boots quicker than IMX8MM and exposes issue
+	//   where because GSC I2C state machine isn't running and its
+	//   SCL/SDA are driven low spams i2c errors
+	//
+	//   Put a loop here that somehow waits for I2C CLK/DAT to be high
+	mdelay(40);
+#endif
 	while (1) {
 		/* probe device */
 		dev = gsc_get_dev(GSC_BUSNO, GSC_SC_ADDR);
board/gateworks/venice/imximage-8mn-lpddr4.cfg new file +10 -0
new file mode 100644
index 0000000000..8aaaaaf8a8
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+#define __ASSEMBLY__
+
+ROM_VERSION	v2
+BOOT_FROM	sd
+LOADER		u-boot-spl-ddr.bin	0x912000
board/gateworks/venice/lpddr4_timing.h +5 -0
index b73d067f7d..21dd158abf 100644
@@ -6,8 +6,13 @@
 #ifndef __LPDDR4_TIMING_H__
 #define __LPDDR4_TIMING_H__
 
+#ifdef CONFIG_IMX8MM
 extern struct dram_timing_info dram_timing_1gb;
 extern struct dram_timing_info dram_timing_2gb;
 extern struct dram_timing_info dram_timing_4gb;
+#elif CONFIG_IMX8MN
+extern struct dram_timing_info dram_timing_2gb_single_die;
+extern struct dram_timing_info dram_timing_2gb_dual_die;
+#endif
 
 #endif /* __LPDDR4_TIMING_H__ */
board/gateworks/venice/lpddr4_timing_imx8mm.c renamed from board/gateworks/venice/lpddr4_timing.c +0 -0
similarity index 100%
rename from board/gateworks/venice/lpddr4_timing.c
rename to board/gateworks/venice/lpddr4_timing_imx8mm.c
board/gateworks/venice/lpddr4_timing_imx8mn_2gb_dual_die.c new file +1444 -0

1,444 lines not on this page · raw message

board/gateworks/venice/lpddr4_timing_imx8mn_2gb_single_die.c new file +1445 -0

144 lines not on this page · raw message

board/gateworks/venice/spl.c +30 -1
index b819c6846d..9956958c20 100644

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

board/gateworks/venice/venice.c renamed from board/gateworks/venice/imx8mm_venice.c +0 -0
similarity index 100%
rename from board/gateworks/venice/imx8mm_venice.c
rename to board/gateworks/venice/venice.c
configs/imx8mn_venice_defconfig new file +114 -0

114 lines not on this page · raw message

include/configs/imx8mn_venice.h new file +114 -0

114 lines not on this page · raw message

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

Signature · 1 line
2.17.1

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

author
#1 lore raw
Quoted 55 lines · Tim Harvey

The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
- LPDDR4 DRAM
- eMMC FLASH
- Gateworks System Controller
- LTE CAT M1 modem
- USB 2.0 HUB
- M.2 Socket with USB2.0, PCIe, and dual-SIM
- IMX8M FEC
- PCIe based GbE
- RS232/RS485/RS422 serial transceiver
- GPS
- CAN bus
- WiFi / Bluetooth
- MIPI header (DSI/CSI/GPIO/PWM/I2S)
- PMIC

To add support for the i.MX8M Nano GW7902:
- Add imx8mn-venice dts/defconfig/include
- Add imx8mn-gw7902 dts
- Add imx8mn-2gb lpddr4 dram configs
- Add misc support for IMX8M Nano SoC
- rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
- update README with differences for IMX8MN vs IMX8MM

---
v2:
- rebase on origin/master
- remove unused fdt_pack_reg function

---
 arch/arm/dts/Makefile                         |    2 +
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi |   29 +
 arch/arm/dts/imx8mn-venice-gw7902.dts         |  888 ++++++++++
 arch/arm/dts/imx8mn-venice-u-boot.dtsi        |  222 +++
 arch/arm/dts/imx8mn-venice.dts                |  152 ++
 arch/arm/mach-imx/imx8m/Kconfig               |    7 +
 board/gateworks/venice/Kconfig                |   15 +
 board/gateworks/venice/MAINTAINERS            |    6 +-
 board/gateworks/venice/Makefile               |   10 +-
 board/gateworks/venice/README                 |    3 +-
 board/gateworks/venice/gsc.c                  |   13 +
 .../gateworks/venice/imximage-8mn-lpddr4.cfg  |   10 +
 board/gateworks/venice/lpddr4_timing.h        |    5 +
 ...lpddr4_timing.c => lpddr4_timing_imx8mm.c} |    0
 .../lpddr4_timing_imx8mn_2gb_dual_die.c       | 1444 ++++++++++++++++
 .../lpddr4_timing_imx8mn_2gb_single_die.c     | 1445 +++++++++++++++++
 board/gateworks/venice/spl.c                  |   31 +-
 .../venice/{imx8mm_venice.c => venice.c}      |    0
 configs/imx8mn_venice_defconfig               |  114 ++
 include/configs/imx8mn_venice.h               |  114 ++
 20 files changed, 4503 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902.dts
 create mode 100644 arch/arm/dts/imx8mn-venice-u-boot.dtsi
Quoted 9 lines
 create mode 100644 arch/arm/dts/imx8mn-venice.dts
 create mode 100644 board/gateworks/venice/imximage-8mn-lpddr4.cfg
 rename board/gateworks/venice/{lpddr4_timing.c => lpddr4_timing_imx8mm.c} (100%)
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_dual_die.c
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_single_die.c
 rename board/gateworks/venice/{imx8mm_venice.c => venice.c} (100%)
 create mode 100644 configs/imx8mn_venice_defconfig
 create mode 100644 include/configs/imx8mn_venice.h

Stefano,

I noticed you have applied my first version of this patch into your imx master-next tree which is now broken because of some other patches that required it to be rebased:
7abf178bb815 power: Tidy up #undef of CONFIG_DM_PMIC 2a7360666871 serial: Rename SERIAL_SUPPORT to SERIAL 103c5f180694 mmc: Rename MMC_SUPPORT to MMC
7cfbba36e9f8 Convert CONFIG_SYS_MALLOC_LEN to Kconfig 148b8bb4b6bd imx: Finish migration of IMX_CONFIG to Kconfig 49c8ef0e45a9 Convert CONFIG_SYS_LOAD_ADDR to Kconfig 72d81360aabd global: Convert CONFIG_LOADADDR to CONFIG_SYS_LOADADDR 15e7b7682474 Convert CONFIG_SYS_I2C_MXC et al to Kconfig

This v2 patch here was rebased on top of origin/master to take care of this.

A grep for SERIAL_SUPPORT (which was renamed to SERIAL) shows all the boards in your master-next that got merged like mine that currently likely need fixups:

$ git grep SERIAL_SUPPORT configs/
configs/imx8mm-cl-iot-gate-optee_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/imx8mn_venice_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/iot2050_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/kontron-sl-mx6ul_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/kontron-sl-mx8mm_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y

A quick test shows all the above with the exception of perhaps iot2050_defconfig are not buildable.

How do you wish us to proceed? I have a set of patches that I can submit to resolve this but I'm not clear if I should squash them and if you should perhaps squash them into the original commit before requesting a git pull to master?
imx8mn_venice: fix SERIAL
imx8mn_venice: fix MMC_SUPPORT
imx8mn_venice: fix SYS_MALLOC_LEN
imx8mn-venice: fix IMX_CONFIG
imx8mn_venice: fix loadaddr
imx8mn-venice: fix I2C

Or should you revert and instead apply this v2 version that takes care of these things?

What are your plans for requesting a git pull to master?

Best regards,

Tim
[1] https://source.denx.de/u-boot/custodians/u-boot-imx/-/tree/master-next

Quoted 3 lines

--
2.17.1

#2 lore raw
Quoted 7 lines · Tim Harvey

A grep for SERIAL_SUPPORT (which was renamed to SERIAL) shows all the boards in your master-next that got merged like mine that currently likely need fixups:

$ git grep SERIAL_SUPPORT configs/
configs/imx8mm-cl-iot-gate-optee_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/imx8mn_venice_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y
configs/iot2050_defconfig:CONFIG_SPL_SERIAL_SUPPORT=y

Thanks, but this board was already fixed in master (ce543d0d).

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux