Skip to contentSkip to conversation

board: gateworks: venice: add imx8mn-gw7902 support

PATCH Superseded Tim Harvey 2 participants 4 messages Feb 3, 2022 – Feb 11, 2022

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH v3 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

---
v3:
- rebase on origin/master (fix for items moved to defconfig)
- update binman configuration to align with imx8mm binman

v2:
- rebase on origin/master (fix for items moved to defconfig)
- 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        |  244 +++
 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               |  116 ++
 include/configs/imx8mn_venice.h               |  110 ++
 20 files changed, 4523 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 ce332021d895..f8e33507e89d 100644
@@ -909,6 +909,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 000000000000..f6f0aa7cb5c0
@@ -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 +244 -0

244 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 d6a869068a3c..86f78f6917ea 100644
@@ -99,6 +99,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 687b94f24dd3..3034275ac2cd 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 07b9e2a60f79..cfdea0cb8adc 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 08f5c62db7c5..4ef8ae9188f4 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 773cc09e8724..9f3a250bb660 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 065d1fb8cc7a..a184ce822854 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 000000000000..8aaaaaf8a877
@@ -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 b73d067f7d6c..21dd158abf91 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

122 lines not on this page · raw message

board/gateworks/venice/spl.c +30 -1
index b819c6846d6f..9956958c206f 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 +116 -0

116 lines not on this page · raw message

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

110 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 59 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

---
v3:
- rebase on origin/master (fix for items moved to defconfig)
- update binman configuration to align with imx8mm binman

v2:
- rebase on origin/master (fix for items moved to defconfig)
- 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        |  244 +++
 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               |  116 ++
 include/configs/imx8mn_venice.h               |  110 ++
 20 files changed, 4523 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 / Fabio,

Could I get a review and/or status on this patch? I sent v1 back in september and had to rebase based on things moving to Kconfig twice now and have never gotten any responses. I have several patches pending that I haven't sent yet that depend on this one. I'm not sure if you are up to date on the pending imx patch backlog but I haven't seen any applied in a few days.

Best Regards,

Tim

Quoted 3 lines

--
2.17.1

reviewer Reviewed-by on v3 1/1
#2 lore raw
In reply to Tim Harvey

Hi Tim,

Your patch looks good.

include/configs/imx8mn_venice.h line 54

Quoted 8 lines · Tim Harvey
include/configs/imx8mn_venice.h new file +8 -0
+/* Initial environment variables */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       BOOTENV \
+       MEM_LAYOUT_ENV_SETTINGS \
+       "script=boot.scr\0" \
+       "bootm_size=0x10000000\0" \
+       "ipaddr=192.168.1.22\0" \
+       "serverip=192.168.1.146\0" \

It is not recommended to place hardcode ipaddr and serverip in the default environment.
Please remove them.

include/configs/imx8mn_venice.h line 108

Quoted 6 lines
include/configs/imx8mn_venice.h new file +6 -0
+/* FEC */
+#define CONFIG_ETHPRIME                 "eth0"
+#define CONFIG_FEC_XCV_TYPE             RGMII
+#define CONFIG_FEC_MXC_PHYADDR          0
+#define FEC_QUIRK_ENET_MAC
+#define IMX_FEC_BASE                   0x30BE0000

No need to pass IMX_FEC_BASE as the Ethernet driver model is used.

author
#3 lore raw
Quoted 29 lines · Fabio Estevam

Hi Tim,

Your patch looks good.

include/configs/imx8mn_venice.h line 54

Quoted 8 lines · Tim Harvey
include/configs/imx8mn_venice.h new file +8 -0
+/* Initial environment variables */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       BOOTENV \
+       MEM_LAYOUT_ENV_SETTINGS \
+       "script=boot.scr\0" \
+       "bootm_size=0x10000000\0" \
+       "ipaddr=192.168.1.22\0" \
+       "serverip=192.168.1.146\0" \

It is not recommended to place hardcode ipaddr and serverip in the default environment.
Please remove them.

include/configs/imx8mn_venice.h line 108

Quoted 6 lines
include/configs/imx8mn_venice.h new file +6 -0
+/* FEC */
+#define CONFIG_ETHPRIME                 "eth0"
+#define CONFIG_FEC_XCV_TYPE             RGMII
+#define CONFIG_FEC_MXC_PHYADDR          0
+#define FEC_QUIRK_ENET_MAC
+#define IMX_FEC_BASE                   0x30BE0000

No need to pass IMX_FEC_BASE as the Ethernet driver model is used.

Quoted 1 line

Fabio,

Thanks for the review - I will post a v4.

Best Regards,

Tim