[U-Boot] [PATCH 09/11] cl-som-imx7: Add Windows boot support for cl-som-imx7
Henry Beberman
Henry.Beberman at microsoft.com
Sat Jul 14 00:11:52 UTC 2018
From: Henry Beberman <henry.beberman at microsoft.com>
This patch adds a new bootable configuration for Windows 10 IoT Core on
the Compulab CL-SOM-iMX7.
It also adds a new device tree sources file for imx7d-cl-som-imx7.dts.
This is not required by Windows or UEFI but the build system requires a
device tree when building SPL with flat image tree support.
Baseboard I2C is required for display initialization. This commit
patch doesn't use display during U-Boot, but it needs to setup and MUX
the baseboard I2C for use in UEFI when the GOP driver initializes.
Signed-off-by: Henry Beberman <henry.beberman at microsoft.com>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Fabio Estevam <fabio.estevam at nxp.com>
Cc: Uri Mashiach <uri.mashiach at compulab.co.il>
Cc: Igor Grinberg <grinberg at compulab.co.il>
---
arch/arm/dts/Makefile | 1 +
arch/arm/dts/imx7d-cl-som-imx7.dts | 8 ++++
board/compulab/cl-som-imx7/MAINTAINERS | 2 +
board/compulab/cl-som-imx7/cl-som-imx7.c | 47 +++++++++++++++++--
board/compulab/cl-som-imx7/spl.c | 7 +++
configs/cl-som-imx7_nt_defconfig | 80 ++++++++++++++++++++++++++++++++
include/configs/cl-som-imx7.h | 18 ++++++-
7 files changed, 159 insertions(+), 4 deletions(-)
create mode 100644 arch/arm/dts/imx7d-cl-som-imx7.dts
create mode 100644 configs/cl-som-imx7_nt_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 1bbb9bf388..6fa7a78a2e 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -436,6 +436,7 @@ dtb-$(CONFIG_MX6UL) += \
dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb
dtb-$(CONFIG_MX7) += imx7-colibri.dtb \
+ imx7d-cl-som-imx7.dtb \
imx7d-sdb.dtb
dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
diff --git a/arch/arm/dts/imx7d-cl-som-imx7.dts b/arch/arm/dts/imx7d-cl-som-imx7.dts
new file mode 100644
index 0000000000..cbb31ec693
--- /dev/null
+++ b/arch/arm/dts/imx7d-cl-som-imx7.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Microsoft Corporation
+ */
+
+/dts-v1/;
+
+#include "imx7d.dtsi"
diff --git a/board/compulab/cl-som-imx7/MAINTAINERS b/board/compulab/cl-som-imx7/MAINTAINERS
index 2b917a5c80..aeaa73a85a 100644
--- a/board/compulab/cl-som-imx7/MAINTAINERS
+++ b/board/compulab/cl-som-imx7/MAINTAINERS
@@ -4,3 +4,5 @@ S: Maintained
F: board/compulab/cl-som-imx7
F: include/configs/cl-som-imx7.h
F: configs/cl-som-imx7_defconfig
+F: configs/cl-som-imx7_nt_defconfig
+F: arch/arm/dts/imx7d-cl-som-imx7.dts
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c
index 1bc33b0a7b..6a219b892a 100644
--- a/board/compulab/cl-som-imx7/cl-som-imx7.c
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -50,15 +50,54 @@ static struct i2c_pads_info cl_som_imx7_i2c_pad_info2 = {
},
};
+static struct i2c_pads_info cl_som_imx7_i2c_pad_info4 = {
+ .scl = {
+ .i2c_mode = MX7D_PAD_GPIO1_IO10__I2C4_SCL |
+ MUX_PAD_CTRL(I2C_PAD_CTRL),
+ .gpio_mode = MX7D_PAD_GPIO1_IO10__GPIO1_IO10 |
+ MUX_PAD_CTRL(I2C_PAD_CTRL),
+ .gp = IMX_GPIO_NR(1, 10),
+ },
+ .sda = {
+ .i2c_mode = MX7D_PAD_GPIO1_IO11__I2C4_SDA |
+ MUX_PAD_CTRL(I2C_PAD_CTRL),
+ .gpio_mode = MX7D_PAD_GPIO1_IO11__GPIO1_IO11 |
+ MUX_PAD_CTRL(I2C_PAD_CTRL),
+ .gp = IMX_GPIO_NR(1, 11),
+ },
+};
+
+/* Environment variable: base board I2C bus enable */
+#define CL_SOM_IMX7_ENV_BASE_I2C "baseboard_i2c_enable"
+
/*
* cl_som_imx7_setup_i2c() - I2C pinmux configuration.
*/
-static void cl_som_imx7_setup_i2c(void)
+static void cl_som_imx7_setup_i2c0(void)
{
setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &cl_som_imx7_i2c_pad_info2);
}
+
+static int cl_som_imx7_setup_i2c1(void)
+{
+ int ret;
+ char *base_i2c = env_get(CL_SOM_IMX7_ENV_BASE_I2C);
+
+ if (base_i2c && (!strcmp(base_i2c, "yes") ||
+ !strcmp(base_i2c, "true") ||
+ !strcmp(base_i2c, "1"))) {
+ ret = setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f,
+ &cl_som_imx7_i2c_pad_info4);
+ if (ret)
+ return 0;
+ return 1;
+ }
+
+ return 0;
+}
#else /* !CONFIG_SYS_I2C_MXC */
-static void cl_som_imx7_setup_i2c(void) {}
+static void cl_som_imx7_setup_i2c0(void) {}
+static int cl_som_imx7_setup_i2c1(void) { return 0; }
#endif /* CONFIG_SYS_I2C_MXC */
int dram_init(void)
@@ -256,7 +295,7 @@ int board_init(void)
{
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
- cl_som_imx7_setup_i2c();
+ cl_som_imx7_setup_i2c0();
cl_som_imx7_setup_fec();
cl_som_imx7_spi_init();
@@ -327,5 +366,7 @@ int checkboard(void)
printf("Board: CL-SOM-iMX7 in %s mode\n", mode);
+ cl_som_imx7_setup_i2c1();
+
return 0;
}
diff --git a/board/compulab/cl-som-imx7/spl.c b/board/compulab/cl-som-imx7/spl.c
index 76a4c8beb0..23ea30a795 100644
--- a/board/compulab/cl-som-imx7/spl.c
+++ b/board/compulab/cl-som-imx7/spl.c
@@ -208,3 +208,10 @@ void board_boot_order(u32 *spl_boot_list)
break;
}
}
+
+#if defined(CONFIG_MULTI_DTB_FIT) || defined(CONFIG_SPL_LOAD_FIT)
+int board_fit_config_name_match(const char *name)
+{
+ return 0;
+}
+#endif
diff --git a/configs/cl-som-imx7_nt_defconfig b/configs/cl-som-imx7_nt_defconfig
new file mode 100644
index 0000000000..4fe8233f0f
--- /dev/null
+++ b/configs/cl-som-imx7_nt_defconfig
@@ -0,0 +1,80 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX7=y
+CONFIG_SYS_THUMB_BUILD=y
+CONFIG_SYS_TEXT_BASE=0x87800000
+CONFIG_TARGET_CL_SOM_IMX7=y
+CONFIG_DEFAULT_DEVICE_TREE="imx7d-cl-som-imx7"
+CONFIG_OF_CONTROL=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_OPTEE_BOOT=y
+CONFIG_SPL=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_LEGACY_IMAGE_SUPPORT=n
+CONFIG_SPL_FIT=y
+CONFIG_SPL_OF_LIBFDT=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_CRYPTO_SUPPORT=y
+CONFIG_SPL_ENABLE_CACHES=y
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_USE_TINY_PRINTF=y
+CONFIG_SPL_USE_ARCH_MEMCPY=n
+CONFIG_SPL_WATCHDOG_SUPPORT=y
+CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
+CONFIG_ARMV7_NONSEC=n
+CONFIG_BAUDRATE=115200
+CONFIG_BOOTDELAY=-2
+CONFIG_UEFI_BOOT=y
+CONFIG_UEFI_LOAD_ADDR=0x82004000
+CONFIG_EFI_LOADER=n
+CONFIG_IMX_RDC=y
+CONFIG_IMX_BOOTAUX=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
+CONFIG_SECURE_BOOT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPI_BOOT=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8a
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="CL-SOM-iMX7 # "
+CONFIG_CMD_BOOTZ=n
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+CONFIG_CMD_GREPENV=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+# CONFIG_ENV_IS_IN_MMC is not set
+CONFIG_FSL_ESDHC=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI=y
+CONFIG_MXC_SPI=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_CI_UDC=y
+CONFIG_OF_LIBFDT=y
diff --git a/include/configs/cl-som-imx7.h b/include/configs/cl-som-imx7.h
index faea6c6b93..14744ba0ca 100644
--- a/include/configs/cl-som-imx7.h
+++ b/include/configs/cl-som-imx7.h
@@ -19,9 +19,13 @@
#define CONFIG_BOARD_LATE_INIT
+#ifndef CONFIG_SECURE_BOOT
+#ifndef CONFIG_CSF_SIZE
+#define CONFIG_CSF_SIZE 0x4000
+#endif
+#endif /* CONFIG_SECURE_BOOT */
/* Uncomment to enable secure boot support */
/* #define CONFIG_SECURE_BOOT */
-#define CONFIG_CSF_SIZE 0x4000
/* Network */
#define CONFIG_FEC_MXC
@@ -63,6 +67,16 @@
#undef CONFIG_SYS_AUTOLOAD
#undef CONFIG_EXTRA_ENV_SETTINGS
+
+#ifdef CONFIG_UEFI_BOOT
+#include <config_uefi_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "mmcdev=0\0" \
+ "displaytype=dvi\0" \
+ "baseboard_i2c_enable=true\0" \
+ BOOTENV
+#else
#undef CONFIG_BOOTCOMMAND
#undef CONFIG_BOOTDELAY
@@ -126,6 +140,8 @@
"echo eMMC boot attempt ...; run emmcbootscript; run emmcboot; " \
"echo USB boot attempt ...; run usbbootscript; "
+#endif /* CONFIG_UEFI_BOOT */
+
#define CONFIG_SYS_MEMTEST_START 0x80000000
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x20000000)
--
2.16.2.gvfs.1.33.gf5370f1
More information about the U-Boot
mailing list