From 27b24eaaf0dafbeec0a317c7c75ba9efe50fe58b Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 27 Dec 2021 21:29:49 +0800
Subject: [PATCH] update uboot patch to fix fastboot mode failed bug

---
 bsp/bootloader/patch/uboot-imx-igkboard.patch |   52 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/bsp/bootloader/patch/uboot-imx-igkboard.patch b/bsp/bootloader/patch/uboot-imx-igkboard.patch
index f1bb514..083b4eb 100644
--- a/bsp/bootloader/patch/uboot-imx-igkboard.patch
+++ b/bsp/bootloader/patch/uboot-imx-igkboard.patch
@@ -1,6 +1,6 @@
 diff -Nuar uboot-imx/arch/arm/dts/imx6ul-14x14-evk.dtsi uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi
 --- uboot-imx/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-12-16 17:12:11.714490021 +0800
++++ uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-12-27 17:34:17.925670562 +0800
 @@ -21,7 +21,6 @@
  		regulator-name = "VSD_3V3";
  		regulator-min-microvolt = <3300000>;
@@ -117,7 +117,7 @@
  
 diff -Nuar uboot-imx/configs/igkboard_defconfig uboot-imx-igkboard/configs/igkboard_defconfig
 --- uboot-imx/configs/igkboard_defconfig	1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-igkboard/configs/igkboard_defconfig	2021-12-16 17:25:11.551447847 +0800
++++ uboot-imx-igkboard/configs/igkboard_defconfig	2021-12-27 21:28:57.371632449 +0800
 @@ -0,0 +1,96 @@
 +CONFIG_ARM=y
 +CONFIG_ARCH_MX6=y
@@ -137,7 +137,7 @@
 +CONFIG_BOOTDELAY=3
 +CONFIG_BOARD_EARLY_INIT_F=y
 +CONFIG_HUSH_PARSER=y
-+CONFIG_SYS_PROMPT="[u-boot@iMX6ULL]# "
++CONFIG_SYS_PROMPT="[u-boot@igkboard]# "
 +CONFIG_CMD_BOOTZ=y
 +# CONFIG_BOOTM_NETBSD is not set
 +# CONFIG_BOOTM_PLAN9 is not set
@@ -215,9 +215,25 @@
 +CONFIG_SYS_WHITE_ON_BLACK=y
 +CONFIG_SPLASH_SCREEN=y
 +CONFIG_SPLASH_SCREEN_ALIGN=y
+diff -Nuar uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c uboot-imx-igkboard/drivers/fastboot/fb_fsl/fb_fsl_partitions.c
+--- uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c	2021-09-06 16:48:23.000000000 +0800
++++ uboot-imx-igkboard/drivers/fastboot/fb_fsl/fb_fsl_partitions.c	2021-12-27 19:10:28.608974060 +0800
+@@ -185,6 +185,12 @@
+ 			boot_partition = FASTBOOT_MMC_BOOT_PARTITION_ID;
+ 			user_partition = FASTBOOT_MMC_USER_PARTITION_ID;
+ 		}
++
++		/* add by guowenxue to export mmc_no env */
++		env_set_ulong("mmc_no", mmc_no);
++		env_set_ulong("mmcdev", mmc_no);
++		env_set_ulong("emmc_dev", mmc_no);
++		env_set_ulong("emmc_ack", mmc_no);
+ 	} else {
+ 		printf("Can't setup partition table on this device %d\n",
+ 			fastboot_devinfo.type);
 diff -Nuar uboot-imx/drivers/net/phy/phy.c uboot-imx-igkboard/drivers/net/phy/phy.c
 --- uboot-imx/drivers/net/phy/phy.c	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/drivers/net/phy/phy.c	2021-12-16 17:12:11.714490021 +0800
++++ uboot-imx-igkboard/drivers/net/phy/phy.c	2021-12-27 17:34:17.929670552 +0800
 @@ -182,6 +182,9 @@
  {
  	int result;
@@ -230,33 +246,29 @@
  
 diff -Nuar uboot-imx/include/configs/mx6ullevk.h uboot-imx-igkboard/include/configs/mx6ullevk.h
 --- uboot-imx/include/configs/mx6ullevk.h	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/include/configs/mx6ullevk.h	2021-12-16 17:12:11.714490021 +0800
-@@ -100,124 +100,39 @@
++++ uboot-imx-igkboard/include/configs/mx6ullevk.h	2021-12-27 19:11:09.428964256 +0800
+@@ -100,124 +100,36 @@
  
  #else
  #define CONFIG_EXTRA_ENV_SETTINGS \
 -	CONFIG_MFG_ENV_SETTINGS \
 -	TEE_ENV \
-+    "emmc_dev=1\0"\
-+    "emmc_ack=1\0"\
  	"script=boot.scr\0" \
  	"image=zImage\0" \
  	"console=ttymxc0\0" \
 -	"fdt_high=0xffffffff\0" \
 -	"initrd_high=0xffffffff\0" \
 -	"fdt_file=undefined\0" \
-+	"fdt_file=imx6ull-emmc.dtb\0" \
++	"fdt_file=igkboard-emmc.dtb\0" \
  	"fdt_addr=0x83000000\0" \
 -	"tee_addr=0x84000000\0" \
 -	"tee_file=undefined\0" \
 -	"boot_fdt=try\0" \
 -	"ip_dyn=yes\0" \
  	"splashimage=0x8c000000\0" \
-+    "ipaddr=192.168.2.22\0" \
-+    "serverip=192.168.2.2\0" \
- 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
- 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
- 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+-	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+-	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
+-	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
 -	"mmcautodetect=yes\0" \
 -	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 -		BOOTARGS_CMA_SIZE \
@@ -265,7 +277,10 @@
 -		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 -	"bootscript=echo Running bootscript from mmc ...; " \
 -		"source\0" \
-+    "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0" \
++    "ipaddr=192.168.2.22\0" \
++    "serverip=192.168.2.2\0" \
++    "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
++    "mmcargs=setenv bootargs console=${console},${baudrate} root=/dev/mmcblk${mmc_no}p2 rootwait rw\0" \
 +    "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 +    "bootscript=echo Running bootscript from mmc ...; source\0" \
  	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
@@ -373,11 +388,12 @@
 +        "run mmcargs; " \
 +        "bootz ${loadaddr} - ${fdt_addr}\0" \
 +    "bootcmd=run mmcboot\0" \
-+    "bbl=tftp ${loadaddr} u-boot-imx6ull-emmc.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x500\0"
++    "upmode=fastboot 0\0" \
++    "bbl=tftp ${loadaddr} u-boot-igkboard-emmc.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x500\0"
  #endif
  
  /* Miscellaneous configurable options */
-@@ -238,7 +153,9 @@
+@@ -238,7 +150,9 @@
  	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  
  /* environment organization */
@@ -389,7 +405,7 @@
  #define CONFIG_IOMUX_LPSR
 diff -Nuar uboot-imx/Makefile uboot-imx-igkboard/Makefile
 --- uboot-imx/Makefile	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/Makefile	2021-12-16 17:23:36.221057260 +0800
++++ uboot-imx-igkboard/Makefile	2021-12-27 19:28:00.507661085 +0800
 @@ -263,6 +263,9 @@
  CROSS_COMPILE ?=
  endif

--
Gitblit v1.9.1