From 13cc4273af6598a4eabbf66ac29932762a76837f Mon Sep 17 00:00:00 2001
From: Gary Bisson <gary.bisson@boundarydevices.com>
Date: Wed, 11 Jul 2018 10:30:10 +0200
Subject: [PATCH] boundary: bootscript-yocto: add i.MX8MQ support

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 .../boundary/bootscripts/bootscript-yocto.txt | 48 ++++++++-----------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/board/boundary/bootscripts/bootscript-yocto.txt b/board/boundary/bootscripts/bootscript-yocto.txt
index c7009d840a4..a076628ae2d 100644
--- a/board/boundary/bootscripts/bootscript-yocto.txt
+++ b/board/boundary/bootscripts/bootscript-yocto.txt
@@ -2,6 +2,8 @@ setenv bootargs ''
 
 setenv initrd_high 0xffffffff
 m4=''
+kernelimage=zImage
+bootcommand=bootz
 a_base=0x10000000
 if itest.s x51 == "x${imx_cpu}" ; then
 	a_base=0x90000000
@@ -9,10 +11,14 @@ elif itest.s x53 == "x${imx_cpu}"; then
 	a_base=0x70000000
 elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then
 	a_base=0x80000000
-	if itest.s "x1" == "x$m4enabled" ; then
-		run m4boot;
-		m4='-m4';
-	fi
+elif itest.s x8MQ == "x${imx_cpu}"; then
+	a_base=0x40000000
+	kernelimage=Image
+	bootcommand=booti
+fi
+if itest.s "x1" == "x$m4enabled" ; then
+	run m4boot;
+	m4='-m4';
 fi
 
 setexpr a_script  ${a_base} + 0x00800000
@@ -39,6 +45,8 @@ if itest.s "x" == "x${fdt_file}" ; then
 		fdt_file=imx6sx-${board}${m4}.dtb;
 	elif itest.s x7D == "x${imx_cpu}" ; then
 		fdt_file=imx7d-${board}${m4}.dtb;
+	elif itest.s x8MQ == "x${imx_cpu}" ; then
+		fdt_file=imx8mq-${board}${m4}.dtb;
 	elif itest.s x51 == "x${imx_cpu}" ; then
 		fdt_file=imx51-${board}${m4}.dtb;
 	elif itest.s x53 == "x${imx_cpu}" ; then
@@ -65,50 +73,36 @@ else
 	exit;
 fi
 
-cmd_xxx_present=
 fdt resize
 if itest.s "x" != "x${cmd_custom}" ; then
 	run cmd_custom
-	cmd_xxx_present=1;
 fi
-
 if itest.s "x" != "x${cmd_hdmi}" ; then
 	run cmd_hdmi
-	cmd_xxx_present=1;
-	if itest.s x == x${allow_noncea} ; then
-		setenv bootargs ${bootargs} mxc_hdmi.only_cea=1;
-		echo "only CEA modes allowed on HDMI port";
-	else
+	if itest.s x != x${allow_noncea} ; then
 		setenv bootargs ${bootargs} mxc_hdmi.only_cea=0;
 		echo "non-CEA modes allowed on HDMI, audio may be affected";
 	fi
 fi
-
 if itest.s "x" != "x${cmd_lcd}" ; then
 	run cmd_lcd
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lcd2}" ; then
 	run cmd_lcd2
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lvds}" ; then
 	run cmd_lvds
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lvds2}" ; then
 	run cmd_lvds2
-	cmd_xxx_present=1;
 fi
-
-if itest.s "x" == "x${cmd_xxx_present}" ; then
-	echo "!!!!!!!!!!!!!!!!"
-	echo "warning: your u-boot may be outdated, please upgrade"
-	echo "!!!!!!!!!!!!!!!!"
+if itest.s "x" != "x${cmd_mipi}" ; then
+	run cmd_mipi
 fi
 
-bpart=2
-
+if itest.s "x" == "x${bpart}" ; then
+	bpart=2
+fi
 if test "sata" = "${devtype}" ; then
 	setenv bootargs "${bootargs} root=/dev/sda${bpart}" ;
 elif test "usb" = "${devtype}" ; then
@@ -126,7 +120,7 @@ if itest.s "x" != "x${disable_giga}" ; then
 fi
 
 if itest.s "x" != "x${wlmac}" ; then
-	setenv bootargs ${bootargs} wlan.mac=${wlmac} wlcore.mac=${wlmac}
+	setenv bootargs ${bootargs} wlcore.mac=${wlmac}
 fi
 
 if itest.s "x" != "x${bd_addr}" ; then
@@ -159,7 +153,7 @@ if itest.s "x" != "x${show_env}" ; then
 	printenv
 fi
 
-if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}zImage ; then
-	bootz ${a_zImage} - ${a_fdt}
+if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}${kernelimage} ; then
+	${bootcommand} ${a_zImage} - ${a_fdt}
 fi
 echo "Error loading kernel image"
-- 
GitLab