From ac601ba02e5df2a8c4d9f09bf24cf4607b81a1da Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sat, 04 Jun 2022 18:37:50 +0800
Subject: [PATCH] update u-boot patch to add fdt overlay support
---
bsp/bootloader/patch/uboot-imx-lf-5.10.52-2.1.0.patch | 144 ++++++++++++++++++++++++++++++++++++++----------
bsp/bootloader/build.sh | 2
2 files changed, 114 insertions(+), 32 deletions(-)
diff --git a/bsp/bootloader/build.sh b/bsp/bootloader/build.sh
index bee3d16..d368d40 100755
--- a/bsp/bootloader/build.sh
+++ b/bsp/bootloader/build.sh
@@ -50,8 +50,6 @@
{
pr_warn "Build for ${UBOOT_SRC} source code"
-
-
cd ${UBOOT_SRC}
make $defconf
diff --git a/bsp/bootloader/patch/uboot-imx-lf-5.10.52-2.1.0.patch b/bsp/bootloader/patch/uboot-imx-lf-5.10.52-2.1.0.patch
index 194e261..825f5dc 100644
--- a/bsp/bootloader/patch/uboot-imx-lf-5.10.52-2.1.0.patch
+++ b/bsp/bootloader/patch/uboot-imx-lf-5.10.52-2.1.0.patch
@@ -1,6 +1,6 @@
diff -Nuar -x lingyun.bmp uboot-imx/arch/arm/dts/igkboard.dts uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/igkboard.dts
--- uboot-imx/arch/arm/dts/igkboard.dts 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/igkboard.dts 2022-06-01 21:24:08.271540515 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/igkboard.dts 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+//
@@ -23,7 +23,7 @@
+};
diff -Nuar -x lingyun.bmp uboot-imx/arch/arm/dts/imx6ul-14x14-evk.dtsi uboot-imx-lf-5.10.52-2.1.0/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-lf-5.10.52-2.1.0/arch/arm/dts/imx6ul-14x14-evk.dtsi 2022-06-01 21:13:14.171163364 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/imx6ul-14x14-evk.dtsi 2022-06-04 18:26:25.146238180 +0800
@@ -21,7 +21,6 @@
regulator-name = "VSD_3V3";
regulator-min-microvolt = <3300000>;
@@ -140,7 +140,7 @@
diff -Nuar -x lingyun.bmp uboot-imx/arch/arm/dts/Makefile uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/Makefile
--- uboot-imx/arch/arm/dts/Makefile 2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/Makefile 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/dts/Makefile 2022-06-04 18:26:25.146238180 +0800
@@ -779,6 +779,7 @@
imx6ul-pico-pi.dtb
@@ -151,7 +151,7 @@
imx6ull-14x14-ddr3-val-emmc.dtb \
diff -Nuar -x lingyun.bmp uboot-imx/arch/arm/mach-imx/mx6/Kconfig uboot-imx-lf-5.10.52-2.1.0/arch/arm/mach-imx/mx6/Kconfig
--- uboot-imx/arch/arm/mach-imx/mx6/Kconfig 2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/mach-imx/mx6/Kconfig 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/arch/arm/mach-imx/mx6/Kconfig 2022-06-04 18:26:25.146238180 +0800
@@ -158,6 +158,16 @@
prompt "MX6 board select"
optional
@@ -178,7 +178,7 @@
endif
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/igkboard.c uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/igkboard.c
--- uboot-imx/board/lingyun/igkboard/igkboard.c 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/igkboard.c 2022-06-01 21:27:23.609315746 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/igkboard.c 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
@@ -551,7 +551,7 @@
+}
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/imximage.cfg uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage.cfg
--- uboot-imx/board/lingyun/igkboard/imximage.cfg 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage.cfg 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage.cfg 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
@@ -676,7 +676,7 @@
+#endif
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/imximage_lpddr2.cfg uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage_lpddr2.cfg
--- uboot-imx/board/lingyun/igkboard/imximage_lpddr2.cfg 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage_lpddr2.cfg 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/imximage_lpddr2.cfg 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
@@ -806,7 +806,7 @@
+#endif
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/Kconfig uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Kconfig
--- uboot-imx/board/lingyun/igkboard/Kconfig 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Kconfig 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Kconfig 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,14 @@
+if TARGET_LINGYUN_IGKBOARD
+
@@ -824,7 +824,7 @@
+endif
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/MAINTAINERS uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/MAINTAINERS
--- uboot-imx/board/lingyun/igkboard/MAINTAINERS 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/MAINTAINERS 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/MAINTAINERS 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,6 @@
+LingYun IoT Gateway Board(IGKBoard)
+M: Guo Wenxue <guowenxue@gmail.com>
@@ -834,7 +834,7 @@
+F: configs/igkboard_defconfig
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/Makefile uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Makefile
--- uboot-imx/board/lingyun/igkboard/Makefile 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Makefile 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/Makefile 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+# (C) Copyright 2016 Freescale Semiconductor, Inc.
@@ -843,7 +843,7 @@
+obj-y += ../../freescale/common/mmc.o
diff -Nuar -x lingyun.bmp uboot-imx/board/lingyun/igkboard/plugin.S uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/plugin.S
--- uboot-imx/board/lingyun/igkboard/plugin.S 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/plugin.S 2022-06-01 21:12:05.407992382 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/board/lingyun/igkboard/plugin.S 2022-06-04 18:26:25.146238180 +0800
@@ -0,0 +1,263 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
@@ -1110,8 +1110,8 @@
+#include <asm/arch/mx6_plugin.S>
diff -Nuar -x lingyun.bmp uboot-imx/configs/igkboard_defconfig uboot-imx-lf-5.10.52-2.1.0/configs/igkboard_defconfig
--- uboot-imx/configs/igkboard_defconfig 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/configs/igkboard_defconfig 2022-06-01 23:25:58.609321231 +0800
-@@ -0,0 +1,96 @@
++++ uboot-imx-lf-5.10.52-2.1.0/configs/igkboard_defconfig 2022-06-04 18:35:06.876141713 +0800
+@@ -0,0 +1,97 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX6=y
+CONFIG_NR_DRAM_BANKS=1
@@ -1208,9 +1208,10 @@
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
++CONFIG_OF_LIBFDT_OVERLAY=y
diff -Nuar -x lingyun.bmp uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c uboot-imx-lf-5.10.52-2.1.0/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-lf-5.10.52-2.1.0/drivers/fastboot/fb_fsl/fb_fsl_partitions.c 2022-06-01 21:13:35.366909355 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/drivers/fastboot/fb_fsl/fb_fsl_partitions.c 2022-06-04 18:26:25.150238044 +0800
@@ -185,6 +185,12 @@
boot_partition = FASTBOOT_MMC_BOOT_PARTITION_ID;
user_partition = FASTBOOT_MMC_USER_PARTITION_ID;
@@ -1226,7 +1227,7 @@
fastboot_devinfo.type);
diff -Nuar -x lingyun.bmp uboot-imx/drivers/net/phy/phy.c uboot-imx-lf-5.10.52-2.1.0/drivers/net/phy/phy.c
--- uboot-imx/drivers/net/phy/phy.c 2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/drivers/net/phy/phy.c 2022-06-01 21:13:56.834652768 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/drivers/net/phy/phy.c 2022-06-04 18:26:25.150238044 +0800
@@ -182,6 +182,9 @@
{
int result;
@@ -1239,18 +1240,16 @@
diff -Nuar -x lingyun.bmp uboot-imx/include/configs/igkboard.h uboot-imx-lf-5.10.52-2.1.0/include/configs/igkboard.h
--- uboot-imx/include/configs/igkboard.h 1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/include/configs/igkboard.h 2022-06-01 22:52:38.739770773 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/include/configs/igkboard.h 2022-06-04 18:26:25.150238044 +0800
@@ -0,0 +1,200 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
-+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
-+ * Copyright 2017 NXP
++ * Copyright (C) 2022 LingYun IoT System Studio
+ *
-+ * Configuration settings for the Freescale i.MX6UL 14x14 EVK board.
++ * Configuration settings for the LingYun IoT Gateway Board.
+ */
-+#ifndef __MX6ULLEVK_CONFIG_H
-+#define __MX6ULLEVK_CONFIG_H
-+
++#ifndef __IGKBOARD_CONFIG_H
++#define __IGKBOARD_CONFIG_H
+
+#include <asm/arch/imx-regs.h>
+#include <linux/sizes.h>
@@ -1342,8 +1341,10 @@
+ "fi\0"
+
+#else
++#include "igkboard_overlay.h"
++
+#define CONFIG_EXTRA_ENV_SETTINGS \
-+ "script=boot.scr\0" \
++ "env_conf=config.txt\0" \
+ "image=zImage\0" \
+ "console=ttymxc0\0" \
+ "fdt_file=igkboard.dtb\0" \
@@ -1353,8 +1354,7 @@
+ "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 net.ifnames=0\0" \
-+ "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-+ "bootscript=echo Running bootscript from mmc ...; source\0" \
++ "loadenvconf=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${env_conf};env import -t ${loadaddr} ${filesize}\0" \
+ "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+ "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+ "bdtb=tftp $fdt_addr $fdt_file && fatwrite mmc 1:1 $fdt_addr $fdt_file $filesize\0" \
@@ -1362,18 +1362,19 @@
+ "bsys=run bdtb && run bker\0" \
+ "mmcboot=echo Booting from mmc ...; " \
+ "mmc dev ${mmcdev}; " \
++ "run mmcargs; run loadenvconf;" \
+ "run loadimage; run loadfdt; " \
-+ "run mmcargs; " \
-+ "run loadbootscript; run bootscript; " \
+ "bootz ${loadaddr} - ${fdt_addr}\0" \
+ "netboot=echo Booting from net ...; " \
+ "tftp $loadaddr $image; tftp $fdt_addr ${fdt_file};" \
+ "run mmcargs; " \
+ "bootz ${loadaddr} - ${fdt_addr}\0" \
-+ "bootcmd=run mmcboot\0" \
+ "upmode=fastboot 0\0" \
-+ "bbl=tftp ${loadaddr} u-boot-igkboard-emmc.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x500\0"
++ "bbl=tftp ${loadaddr} u-boot-igkboard-emmc.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x500\0" \
++ MMC_FDT_OVERLAY_SETTING \
++ "bootcmd=run mmcbootdto\0"
+#endif
++
+
+/* Miscellaneous configurable options */
+
@@ -1441,9 +1442,92 @@
+#endif
+
+#endif
+diff -Nuar -x lingyun.bmp uboot-imx/include/configs/igkboard_overlay.h uboot-imx-lf-5.10.52-2.1.0/include/configs/igkboard_overlay.h
+--- uboot-imx/include/configs/igkboard_overlay.h 1970-01-01 08:00:00.000000000 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/include/configs/igkboard_overlay.h 2022-06-04 18:26:25.150238044 +0800
+@@ -0,0 +1,79 @@
++/* SPDX-License-Identifier: GPL-2.0+ */
++/*
++ * Copyright (C) 2022 LingYun IoT System Studio
++ *
++ * Device Tree overlay env for the LingYun IoT Gateway Board.
++ */
++#ifndef __IGKBOARD_OVERLAY_H
++#define __IGKBOARD_OVERLAY_H
++
++#if 0
++ enable_xxx is set in uEnv.txt, then load the corresponding dtbo file
++
++ if env exists enable_lcd && test ${enable_lcd} = 1 -o ${enable_lcd} = yes ; then
++ dtbo_file=lcd.dtbo;
++ echo "Applying DT overlay: $dtbo_file";
++ fatload mmc ${mmcdev}:${mmcpart} ${dtbo_addr} ${dtbo_dir}/${dtbo_file};
++ fdt addr ${fdt_addr};
++ fdt resize ${fdt_size};
++ fdt apply ${dtbo_addr};
++ fi;
++
++
++ if env exists enable_uart ; then
++ for i in ${enable_uart};
++ do
++ dtbo_file=uart$i.dtbo;
++ echo "Applying DT overlay: $dtbo_file";
++ fatload mmc ${mmcdev}:${mmcpart} ${dtbo_addr} ${dtbo_dir}/${dtbo_file};
++ fdt addr ${fdt_addr};
++ fdt apply ${dtbo_addr};
++ done;
++ fi;
++
++#endif
++
++
++#define FDT_APPLY_OVERLAY() \
++ "echo Applying DT overlay ==> ${dtbo_file}; " \
++ "fatload mmc ${mmcdev}:${mmcpart} ${dtbo_addr} ${dtbo_dir}/${dtbo_file}; " \
++ "fdt addr ${fdt_addr}; " \
++ "fdt resize ${fdt_size}; " \
++ "fdt apply ${dtbo_addr}; "
++
++#define CHECK_APPLY_OVERLAY( name ) \
++ "if env exists enable_" name " && test ${enable_" name "} = 1 -o ${enable_" name "} = yes ; then " \
++ "setenv dtbo_file " name ".dtbo; " \
++ FDT_APPLY_OVERLAY() \
++ "fi; "
++
++#define CHECK_APPLY_OVERLAYS( name ) \
++ "if env exists enable_" name "; then " \
++ "for i in ${enable_" name "}; do " \
++ "setenv dtbo_file " name "$i.dtbo; " \
++ FDT_APPLY_OVERLAY() \
++ " done;" \
++ "fi; "
++
++#define FDT_ENTRY_DEF_SETTINGS \
++ CHECK_APPLY_OVERLAY("gpios") \
++ CHECK_APPLY_OVERLAY("lcd") \
++ CHECK_APPLY_OVERLAY("i2c1") \
++ CHECK_APPLY_OVERLAY("spi1") \
++ CHECK_APPLY_OVERLAYS("uart") \
++ CHECK_APPLY_OVERLAYS("can") \
++ CHECK_APPLY_OVERLAYS("pwm") \
++
++#define MMC_FDT_OVERLAY_SETTING \
++ "fdt_size=0x10000\0" \
++ "dtbo_addr=0x83010000\0" \
++ "dtbo_dir=overlays\0" \
++ "mmcbootdto=echo Booting from mmc with overlay...; " \
++ "mmc dev ${mmcdev}; run mmcargs; run loadenvconf; " \
++ "run loadimage; run loadfdt; " \
++ FDT_ENTRY_DEF_SETTINGS \
++ "bootz ${loadaddr} - ${fdt_addr}\0"
++
++#define ENABLE_UENV_FDTO_SUPPORT
++
++#endif
diff -Nuar -x lingyun.bmp uboot-imx/Makefile uboot-imx-lf-5.10.52-2.1.0/Makefile
--- uboot-imx/Makefile 2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-lf-5.10.52-2.1.0/Makefile 2022-06-01 23:18:29.941621006 +0800
++++ uboot-imx-lf-5.10.52-2.1.0/Makefile 2022-06-04 18:26:25.158237772 +0800
@@ -263,6 +263,9 @@
CROSS_COMPILE ?=
endif
--
Gitblit v1.9.1