guowenxue
2024-01-15 e144371582ce39f4dda26058f2b4b794796fb2f2
bootloader/patches/igkboard-imx8mp/uboot-imx-lf-6.1.36-2.1.0.patch
@@ -116,10 +116,10 @@
+};
diff --git a/arch/arm/dts/igkboard-imx8mp.dts b/arch/arm/dts/igkboard-imx8mp.dts
new file mode 100644
index 00000000..cddc9470
index 00000000..5bb2a64c
--- /dev/null
+++ b/arch/arm/dts/igkboard-imx8mp.dts
@@ -0,0 +1,475 @@
@@ -0,0 +1,469 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2023 LingYun IoT System Studio.
@@ -272,14 +272,13 @@
+    pinctrl-0 = <&pinctrl_eqos>;
+    phy-mode = "rgmii-id";
+    phy-handle = <&ethphy0>;
+    snps,reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+    snps,reset-delays-us = <100000 200000 150000>;
+    status = "okay";
+
+    mdio {
+        compatible = "snps,dwmac-mdio";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        clock-frequency = <5000000>;
+
+        ethphy0: ethernet-phy@0 { /* YT8521SH-CA */
+            compatible = "ethernet-phy-ieee802.3-c22";
@@ -289,22 +288,19 @@
+    };
+};
+
+/* Second 1000Mbps Ethernet on ENET1 */
+/* Second 1000Mbps Ethernet on ENET1, test okay */
+&fec {
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_fec>;
+    phy-mode = "rgmii-id";
+    phy-handle = <&ethphy1>;
+    phy-reset-duration = <200>;
+    phy-reset-post-delay = <150>;
+    phy-reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+
+    fsl,magic-packet;
+    status = "okay";
+
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        clock-frequency = <5000000>;
+
+        ethphy1: ethernet-phy@0 { /* YT8521SH-CA */
+            compatible = "ethernet-phy-ieee802.3-c22";
@@ -571,7 +567,6 @@
+            MX8MP_IOMUXC_ENET_TD3__ENET_QOS_RGMII_TD3                   0x16
+            MX8MP_IOMUXC_ENET_TX_CTL__ENET_QOS_RGMII_TX_CTL             0x16
+            MX8MP_IOMUXC_ENET_TXC__CCM_ENET_QOS_CLOCK_GENERATE_TX_CLK   0x16
+            MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06                         0x22
+        >;
+    };
+
@@ -591,7 +586,6 @@
+            MX8MP_IOMUXC_SAI1_TXD3__ENET1_RGMII_TD3                     0x16
+            MX8MP_IOMUXC_SAI1_TXD4__ENET1_RGMII_TX_CTL                  0x16
+            MX8MP_IOMUXC_SAI1_TXD5__ENET1_RGMII_TXC                     0x16
+            MX8MP_IOMUXC_GPIO1_IO01__GPIO1_IO01                         0x11
+        >;
+    };
+};
@@ -3253,10 +3247,10 @@
+}
diff --git a/configs/igkboard-imx8mp_defconfig b/configs/igkboard-imx8mp_defconfig
new file mode 100644
index 00000000..b063a6e8
index 00000000..bea65054
--- /dev/null
+++ b/configs/igkboard-imx8mp_defconfig
@@ -0,0 +1,166 @@
@@ -0,0 +1,173 @@
+CONFIG_ARM=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_TEXT_BASE=0x40200000
@@ -3347,6 +3341,13 @@
+CONFIG_SYS_MMC_ENV_DEV=1
+CONFIG_USE_ETHPRIME=y
+CONFIG_ETHPRIME="eth1"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_USE_IPADDR=y
+CONFIG_IPADDR="192.168.2.28"
+CONFIG_USE_NETMASK=y
+CONFIG_NETMASK="255.255.255.0"
+CONFIG_USE_SERVERIP=y
+CONFIG_SERVERIP="192.168.2.2"
+CONFIG_SPL_DM=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
+CONFIG_CLK_COMPOSITE_CCF=y
@@ -3713,13 +3714,15 @@
++CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/include/configs/igkboard-imx8mp.h b/include/configs/igkboard-imx8mp.h
new file mode 100644
index 00000000..16a4cb9b
index 00000000..6ad220e6
--- /dev/null
+++ b/include/configs/igkboard-imx8mp.h
@@ -0,0 +1,183 @@
@@ -0,0 +1,80 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ * Copyright (C) 2023 LingYun IoT System Studio
+ *
+ * Configuration settings for LingYun IGKBoard(IoT Gateway Kits Board) based on i.MX8MP
+ */
+
+#ifndef __IGKBOARD_IMX8MP_H
@@ -3733,42 +3736,9 @@
+#define CFG_SYS_UBOOT_BASE   (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+
+#if defined(CONFIG_CMD_NET)
+#define CFG_FEC_MXC_PHYADDR          1
+
+#define PHY_ANEG_TIMEOUT 20000
+
+#define CFG_FEC_MXC_PHYADDR          -1
+#define PHY_ANEG_TIMEOUT         20000
+#endif
+
+#ifdef CONFIG_DISTRO_DEFAULTS
+#define BOOT_TARGET_DEVICES(func) \
+   func(USB, usb, 0) \
+   func(MMC, mmc, 1) \
+   func(MMC, mmc, 2)
+
+#include <config_distro_bootcmd.h>
+#else
+#define BOOTENV
+#endif
+
+#define JH_ROOT_DTB    "imx8mp-evk-revb4-root.dtb"
+
+#define JAILHOUSE_ENV \
+   "jh_clk= \0 " \
+   "jh_root_dtb=" JH_ROOT_DTB "\0" \
+   "jh_mmcboot=setenv fdtfile ${jh_root_dtb};" \
+      "setenv jh_clk clk_ignore_unused mem=1920MB; " \
+            "if run loadimage; then " \
+               "run mmcboot; " \
+            "else run jh_netboot; fi; \0" \
+   "jh_netboot=setenv fdtfile ${jh_root_dtb}; setenv jh_clk clk_ignore_unused mem=1920MB; run netboot; \0 "
+
+#define SR_IR_V2_COMMAND \
+   "nodes=/busfreq /power-domains /soc@0/caam-sm@100000 /soc@0/bus@30000000/caam_secvio /soc@0/bus@30000000/caam-snvs@30370000 /soc@0/bus@30800000/flexspi_nand@30bb0000 /soc@0/bus@32c00000/mipi_dsi@32e60000 /soc@0/bus@32c00000/lcd-controller@32e80000 /soc@0/bus@32c00000/blk-ctl@32ec0000 /soc@0/bus@30800000/i2c@30a20000/pca9450@25 /soc@0/bus@30800000/i2c@30a30000/adv7535@3d /soc@0/bus@30800000/i2c@30a30000/tcpc@50 /wdt-reboot /mcu_rdc /soc@0/bus@30800000/ethernet@30bf0000 /dsi-host /rm67199_panel /cbtl04gp /binman /vpu_g1@38300000 /vpu_g2@38310000 /vpu_vc8000e@38320000 /vpu_v4l2 /gpu3d@38000000 /gpu2d@38008000 /vipsi@38500000 /mix_gpu_ml \0" \
+   "sr_ir_v2_cmd=cp.b ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"\
+   "fdt addr ${fdt_addr_r};"\
+   "fdt set /soc@0/usb@32f10100/usb@38100000 compatible snps,dwc3;" \
+   "fdt set /soc@0/usb@32f10108/usb@38200000 compatible snps,dwc3;" \
+   "for i in ${nodes}; do fdt rm ${i}; done \0"
+
+#define CFG_MFG_ENV_SETTINGS \
+   CFG_MFG_ENV_SETTINGS_DEFAULT \
@@ -3778,101 +3748,35 @@
+   "sd_dev=1\0"
+
+
+#ifdef CONFIG_NAND_BOOT
+#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(nandboot),16m(nandfit),32m(nandkernel),16m(nanddtb),8m(nandtee),-(nandrootfs)"
+#endif
+
+/* Initial environment variables */
+#if defined(CONFIG_NAND_BOOT)
+#define CFG_EXTRA_ENV_SETTINGS \
+   CFG_MFG_ENV_SETTINGS \
+   "splashimage=0x50000000\0" \
+   "fdt_addr_r=0x43000000\0"         \
+   "fdt_addr=0x43000000\0"         \
+   "fdt_high=0xffffffffffffffff\0" \
+   "mtdparts=" MFG_NAND_PARTITION "\0" \
+   "console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200\0" \
+   "bootargs=console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 ubi.mtd=nandrootfs "  \
+      "root=ubi0:nandrootfs rootfstype=ubifs "           \
+      MFG_NAND_PARTITION \
+      "\0" \
+   "bootcmd=nand read ${loadaddr} 0x5000000 0x2000000;"\
+      "nand read ${fdt_addr_r} 0x7000000 0x100000;"\
+      "booti ${loadaddr} - ${fdt_addr_r}"
+
+#else
+#define CFG_EXTRA_ENV_SETTINGS      \
+   CFG_MFG_ENV_SETTINGS \
+   JAILHOUSE_ENV \
+   SR_IR_V2_COMMAND \
+   BOOTENV \
+   "prepare_mcore=setenv mcore_clk clk-imx8mp.mcore_booted;\0" \
+   "scriptaddr=0x43500000\0" \
+   "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
+   "bsp_script=boot.scr\0" \
+   "image=Image\0" \
+   "splashimage=0x50000000\0" \
+   "console=ttymxc1,115200\0" \
+   "fdt_addr_r=0x43000000\0"         \
+   "fdt_addr=0x43000000\0"         \
+   "boot_fdt=try\0" \
+   "fdt_high=0xffffffffffffffff\0"      \
+   "boot_fit=no\0" \
+   "board=igkboard-imx8mp\0" \
+   "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+   "bootm_size=0x10000000\0" \
+   "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+   "mmcpart=1\0" \
+   "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
+   "mmcautodetect=yes\0" \
+   "mmcargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=${mmcroot}\0 " \
+   "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bsp_script};\0" \
+   "bootscript=echo Running bootscript from mmc ...; " \
+      "source\0" \
+   "mmcargs=setenv bootargs console=${console} root=/dev/mmcblk${mmc_no}p2 rootwait rw net.ifnames=0\0" \
+   "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}\0" \
+   "mmcboot=echo Booting from mmc ...; " \
+      "run mmcargs; " \
+      "if test ${boot_fit} = yes || test ${boot_fit} = try; then " \
+         "bootm ${loadaddr}; " \
+      "else " \
+         "if run loadfdt; then " \
+            "booti ${loadaddr} - ${fdt_addr_r}; " \
+         "else " \
+            "echo WARN: Cannot load the DT; " \
+         "fi; " \
+      "fi;\0" \
+   "netargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} " \
+      "root=/dev/nfs " \
+      "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+   "netboot=echo Booting from net ...; " \
+      "run netargs;  " \
+      "if test ${ip_dyn} = yes; then " \
+         "setenv get_cmd dhcp; " \
+      "else " \
+         "setenv get_cmd tftp; " \
+      "fi; " \
+      "${get_cmd} ${loadaddr} ${image}; " \
+      "if test ${boot_fit} = yes || test ${boot_fit} = try; then " \
+         "bootm ${loadaddr}; " \
+      "else " \
+         "if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then " \
+            "booti ${loadaddr} - ${fdt_addr_r}; " \
+         "else " \
+            "echo WARN: Cannot load the DT; " \
+         "fi; " \
+      "fi;\0" \
+   "bsp_bootcmd=echo Running BSP bootcmd ...; " \
+      "mmc dev ${mmcdev}; if mmc rescan; then " \
+         "if run loadbootscript; then " \
+            "run bootscript; " \
+         "else " \
+            "if run loadimage; then " \
+               "run mmcboot; " \
+            "else run netboot; " \
+            "fi; " \
+         "fi; " \
+      "fi;"
+#endif
+   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdtfile}\0" \
+   "bootos=booti ${loadaddr} - ${fdt_addr}\0" \
+   "mmcboot=mmc dev ${mmcdev};run mmcargs;run loadimage;run loadfdt;run bootos\0" \
+   "netboot=tftp $loadaddr $image; tftp $fdt_addr ${fdtfile}; run mmcargs; run bootos\0" \
+   "bbl=tftp ${loadaddr} u-boot-${board}.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x800\0" \
+   "bdtb=tftp $fdt_addr $fdtfile && fatwrite mmc 1:1 $fdt_addr $fdtfile $filesize\0" \
+   "bker=tftp $loadaddr $image&& fatwrite mmc 1:1 $loadaddr $image $filesize\0" \
+   "bsys=run bdtb && run bker\0"
+
+#undef   CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND      "mmc dev ${mmcdev}; mmc rescan; run mmcargs; run loadimage; run loadfdt; run bootos"
+
+/* Link Definitions */
+
@@ -3887,13 +3791,7 @@
+
+#define CFG_MXC_UART_BASE      UART2_BASE_ADDR
+
+#define CFG_SYS_NAND_BASE       0x20000000
+
+#ifdef CONFIG_TARGET_IMX8MP_DDR4_EVK
+#define CFG_SYS_FSL_USDHC_NUM   1
+#else
+#define CFG_SYS_FSL_USDHC_NUM   2
+#endif
+
+#ifdef CONFIG_ANDROID_SUPPORT
+#include "imx8mp_evk_android.h"