Skip to contentSkip to conversation

pico-imx7d: Add support for BL33 case

PATCH Superseded Jun Nie 3 participants 27 messages May 8, 2019 – Jun 10, 2019

Subsystems (3)
lore
Share & tools
lore

Jun Nie

author
#0 lore raw

v4 cover pico-imx7d: Add support for BL33 case

Add configuration to boot U-boot as BL33 case. The boot flow is ATF -> OPTEE -> U-boot.

Changes vs V3:
- Remove CONFIG_IMX_CONSOLE_UART_ID.
- Add workaround if PMIC is not probed successfully.
- Add non-secure world cpu initilization for CONFIG_SKIP_LOWLEVEL_INIT case.

Changes vs V2:
- Revise fix to UART clock ID.
- Add documentation of build and test for BL33 usage case.
- Add device tree to store public key for FIT image verfication usage.
- Add revert patch to LCD support. Pico-pi does not boot with it. I see it is suggested to be reverted in maillist.

Changes vs V1:
- Remove DCD file.
- Add a patch to fix uart clock root ID.
- Change file name from pico-pi-imx7d_bl33_defconfig to pico-imx7d_bl33_defconfig

Jun Nie (8):
mx7_common: Share configs to skip low level init
imx: mx7: Skip secure init in arch_cpu_init
pico-imx7d: Correct uart clock root
pico-imx7d: Reserve region of memory to OPTEE
pico-imx7d: Add boot option for verified boot
pico-imx7d: Add bl33 config
pico-imx7d: README: Add BL33 usage case
pico-imx7d: enable boot without PMIC

 arch/arm/include/asm/arch-mx7/clock.h              | 18 ++++++
 arch/arm/mach-imx/mx7/clock.c                      |  2 +-
 arch/arm/mach-imx/mx7/soc.c                        | 43 +++++++++-----
 board/technexion/pico-imx7d/README.pico-imx7d_BL33 | 44 +++++++++++++++
 board/technexion/pico-imx7d/pico-imx7d.c           | 12 +++-
 configs/pico-imx7d_bl33_defconfig                  | 66 ++++++++++++++++++++++
 include/configs/mx7_common.h                       | 11 ++++
 include/configs/pico-imx7d.h                       | 38 ++++++++++++-
 include/configs/warp7.h                            | 11 ----
 9 files changed, 213 insertions(+), 32 deletions(-)
 create mode 100644 board/technexion/pico-imx7d/README.pico-imx7d_BL33
 create mode 100644 configs/pico-imx7d_bl33_defconfig
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v4 1/8 mx7_common: Share configs to skip low level init

Share configs in mx7 to skip low level init if we are in the case where OPTEE is loaded already (maybe by ARM Trusted Firmware) and that most of the low level initialization is already done and that we may/should skip it doing them here.

Fix the definition detection with size detection to decide whether to skip it.

---
 include/configs/mx7_common.h | 11 +++++++++++
 include/configs/warp7.h      | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
include/configs/mx7_common.h +11 -0
index cc7e872..57fbec7 100644
@@ -54,4 +54,15 @@
 #endif
 #endif
 
+/*
+ * If we have defined the OPTEE ram size and not OPTEE it means that we were
+ * launched by OPTEE, because of that we shall skip all the low level
+ * initialization since it was already done by ATF or OPTEE
+ */
+#if (CONFIG_OPTEE_TZDRAM_SIZE != 0)
+#ifndef CONFIG_OPTEE
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#endif
+#endif
+
 #endif
include/configs/warp7.h +0 -11
index 37649cf..742f390 100644
@@ -13,17 +13,6 @@
 
 #define PHYS_SDRAM_SIZE			SZ_512M
 
-/*
- * If we have defined the OPTEE ram size and not OPTEE it means that we were
- * launched by OPTEE, because of that we shall skip all the low level
- * initialization since it was already done by ATF or OPTEE
- */
-#ifdef CONFIG_OPTEE_TZDRAM_SIZE
-#ifndef CONFIG_OPTEE
-#define CONFIG_SKIP_LOWLEVEL_INIT
-#endif
-#endif
-
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(35 * SZ_1M)
 
Signature · 1 line
2.7.4
reviewer
#2 lore raw

PATCH v4 1/8 mx7_common: Share configs to skip low level init

Hi Jun,

Please add Stefano Babic on your imx patches.

Quoted 10 lines · Jun Nie

Share configs in mx7 to skip low level init if we are in the case where OPTEE is loaded already (maybe by ARM Trusted Firmware) and that most of the low level initialization is already done and that we may/should skip it doing them here.

Fix the definition detection with size detection to decide whether to skip it.

#3 lore raw

PATCH v4 1/8 mx7_common: Share configs to skip low level

In reply to Jun Nie
Quoted 8 lines

Share configs in mx7 to skip low level init if we are in the case where OPTEE is loaded already (maybe by ARM Trusted Firmware) and that most of the low level initialization is already done and that we may/should skip it doing them here.
Fix the definition detection with size detection to decide whether to skip it.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#4 lore raw

PATCH v4 2/8 imx: mx7: Skip secure init in arch_cpu_init

In reply to Jun Nie

Skip secure related initialization in arch_cpu_init if low level init is skipped. Because these should be done in early stage firmware, such as ARM trusted firmware.

---
 arch/arm/mach-imx/mx7/soc.c | 43 ++++++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 15 deletions(-)
arch/arm/mach-imx/mx7/soc.c +28 -15
index 7cfdff0..ccfab82 100644
@@ -164,15 +164,6 @@ u32 __weak get_board_rev(void)
 }
 #endif
 
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-/* enable all periherial can be accessed in nosec mode */
-static void init_csu(void)
-{
-	int i = 0;
-	for (i = 0; i < CSU_NUM_REGS; i++)
-		writel(CSU_INIT_SEC_LEVEL0, CSU_IPS_BASE_ADDR + i * 4);
-}
-
 static void imx_enet_mdio_fixup(void)
 {
 	struct iomuxc_gpr_base_regs *gpr_regs =
@@ -191,6 +182,26 @@ static void imx_enet_mdio_fixup(void)
 	}
 }
 
+static void init_cpu_basic(void)
+{
+	imx_enet_mdio_fixup();
+
+#ifdef CONFIG_APBH_DMA
+	/* Start APBH DMA */
+	mxs_dma_init();
+#endif
+}
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+/* enable all periherial can be accessed in nosec mode */
+static void init_csu(void)
+{
+	int i = 0;
+
+	for (i = 0; i < CSU_NUM_REGS; i++)
+		writel(CSU_INIT_SEC_LEVEL0, CSU_IPS_BASE_ADDR + i * 4);
+}
+
 static void imx_gpcv2_init(void)
 {
 	u32 val, i;
@@ -269,12 +280,7 @@ int arch_cpu_init(void)
 	/* Disable PDE bit of WMCR register */
 	imx_wdog_disable_powerdown();
 
-	imx_enet_mdio_fixup();
-
-#ifdef CONFIG_APBH_DMA
-	/* Start APBH DMA */
-	mxs_dma_init();
-#endif
+	init_cpu_basic();
 
 #if CONFIG_IS_ENABLED(IMX_RDC)
 	isolate_resource();
@@ -286,6 +292,13 @@ int arch_cpu_init(void)
 
 	return 0;
 }
+#else
+int arch_cpu_init(void)
+{
+	init_cpu_basic();
+
+	return 0;
+}
 #endif
 
 #ifdef CONFIG_ARCH_MISC_INIT
Signature · 1 line
2.7.4
reviewer
#5 lore raw

PATCH v4 2/8 imx: mx7: Skip secure init in arch_cpu_init

arch/arm/mach-imx/mx7/soc.c static void imx_enet_mdio_fixup(void) · line 196

Quoted 2 lines · Jun Nie
arch/arm/mach-imx/mx7/soc.c +2 -0
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+/* enable all periherial can be accessed in nosec mode */

Typo "peripheral"

arch/arm/mach-imx/mx7/soc.c static void imx_enet_mdio_fixup(void) · line 199

Quoted 3 lines
arch/arm/mach-imx/mx7/soc.c +3 -0
+static void init_csu(void)
+{
+       int i = 0;

No need to initialize i here.

#6 lore raw

PATCH v4 2/8 imx: mx7: Skip secure init in arch_cpu_init

In reply to Jun Nie
Quoted 4 lines

Skip secure related initialization in arch_cpu_init if low level init is skipped. Because these should be done in early stage firmware, such as ARM trusted firmware.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#7 lore raw

PATCH v4 3/8 pico-imx7d: Correct uart clock root

In reply to Jun Nie

Correct uart clock root ID. Incorrect ID may result the clock is gated because rate value 0 is returned in imx_get_uartclk()

The ID can be ignored if CONFIG_SKIP_LOWLEVEL_INIT is not enabled because init_clk_uart() will enable all uart clocks in that case.

---
 arch/arm/include/asm/arch-mx7/clock.h | 18 ++++++++++++++++++
 arch/arm/mach-imx/mx7/clock.c         |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-mx7/clock.h +18 -0
index f56564e..1d07fde 100644
@@ -175,6 +175,24 @@ enum clk_root_index {
 	CLK_ROOT_MAX,
 };
 
+#if (CONFIG_CONS_INDEX == 0)
+#define UART_CLK_ROOT UART1_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 1)
+#define UART_CLK_ROOT UART2_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 2)
+#define UART_CLK_ROOT UART3_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 3)
+#define UART_CLK_ROOT UART4_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 4)
+#define UART_CLK_ROOT UART5_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 5)
+#define UART_CLK_ROOT UART6_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 6)
+#define UART_CLK_ROOT UART7_CLK_ROOT
+#else
+#error "Invalid IMX UART ID for serial console is defined"
+#endif
+
 struct clk_root_setting {
 	enum clk_root_index root;
 	u32 setting;
arch/arm/mach-imx/mx7/clock.c +1 -1
index 8cda71c..e364b16 100644
@@ -53,7 +53,7 @@ static u32 get_ipg_clk(void)
 
 u32 imx_get_uartclk(void)
 {
-	return get_root_clk(UART1_CLK_ROOT);
+	return get_root_clk(UART_CLK_ROOT);
 }
 
 u32 imx_get_fecclk(void)
Signature · 1 line
2.7.4
reviewer
#8 lore raw

PATCH v4 3/8 pico-imx7d: Correct uart clock root

Quoted 4 lines · Jun Nie
arch/arm/include/asm/arch-mx7/clock.h +4 -0
+#if (CONFIG_CONS_INDEX == 0)
+#define UART_CLK_ROOT UART1_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 1)
+#define UART_CLK_ROOT UART2_CLK_ROOT

arch/arm/include/asm/arch-mx7/clock.h enum clk_root_index { · line 191

Quoted 10 lines
arch/arm/include/asm/arch-mx7/clock.h +10 -0
+#elif (CONFIG_CONS_INDEX == 2)
+#define UART_CLK_ROOT UART3_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 3)
+#define UART_CLK_ROOT UART4_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 4)
+#define UART_CLK_ROOT UART5_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 5)
+#define UART_CLK_ROOT UART6_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 6)
+#define UART_CLK_ROOT UART7_CLK_ROOT

I remember I commented about this before: this looks ugly.

We don't do this on other i.MX devices.

author
#9 lore raw

PATCH v4 3/8 pico-imx7d: Correct uart clock root

Quoted 20 lines · Fabio Estevam <[email protected]> 于2019年5月31日周五 上午7:56写道:
Quoted 4 lines · Jun Nie
arch/arm/include/asm/arch-mx7/clock.h +4 -0
+#if (CONFIG_CONS_INDEX == 0)
+#define UART_CLK_ROOT UART1_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 1)
+#define UART_CLK_ROOT UART2_CLK_ROOT

arch/arm/include/asm/arch-mx7/clock.h enum clk_root_index { · line 191

Quoted 10 lines
arch/arm/include/asm/arch-mx7/clock.h +10 -0
+#elif (CONFIG_CONS_INDEX == 2)
+#define UART_CLK_ROOT UART3_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 3)
+#define UART_CLK_ROOT UART4_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 4)
+#define UART_CLK_ROOT UART5_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 5)
+#define UART_CLK_ROOT UART6_CLK_ROOT
+#elif (CONFIG_CONS_INDEX == 6)
+#define UART_CLK_ROOT UART7_CLK_ROOT

I remember I commented about this before: this looks ugly.

Quoted 1 line

We don't do this on other i.MX devices.

I thought this can be removed if dts is enabled, but no actually. I will find another solution for this. Thanks!

#10 lore raw

PATCH v4 3/8 pico-imx7d: Correct uart clock root <mailto:[email protected]?subject=unsubscribe> <mailto:[email protected]?subject=subscribe>

In reply to Jun Nie
Quoted 6 lines

Correct uart clock root ID. Incorrect ID may result the clock is gated because rate value 0 is returned in imx_get_uartclk()
The ID can be ignored if CONFIG_SKIP_LOWLEVEL_INIT is not enabled because init_clk_uart() will enable all uart clocks in that case.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#11 lore raw

PATCH v4 4/8 pico-imx7d: Reserve region of memory to OPTEE

In reply to Jun Nie

Subtracts CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size so that the OPTEE memory is not override during u-boot relocation.

Note the OPTEE live in the end part of DRAM and OPTEE boot process will itself subtract the DRAM region it lives in from the memory map passed to Linux.

---
 board/technexion/pico-imx7d/pico-imx7d.c | 5 +++++
 1 file changed, 5 insertions(+)
board/technexion/pico-imx7d/pico-imx7d.c +5 -0
index e63b19d..5b357f2 100644
@@ -63,6 +63,11 @@ int dram_init(void)
 {
 	gd->ram_size = imx_ddr_size();
 
+	/* Subtract the defined OPTEE runtime firmware length */
+#ifdef CONFIG_OPTEE_TZDRAM_SIZE
+		gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
+#endif
+
 	return 0;
 }
 
Signature · 1 line
2.7.4
#12 lore raw

PATCH v4 4/8 pico-imx7d: Reserve region of memory to OPTEE

Quoted 7 lines

Subtracts CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size so that the OPTEE memory is not override during u-boot relocation. Note the OPTEE live in the end part of DRAM and OPTEE boot process will itself subtract the DRAM region it lives in from the memory map passed to Linux.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#13 lore raw

PATCH v4 5/8 pico-imx7d: Add boot option for verified boot

In reply to Jun Nie

Add boot option to boot from fitimage to support verified boot. The boot script plain text file should be packed into fit blob as image with name of bootscr.

---
 include/configs/pico-imx7d.h | 38 +++++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)
include/configs/pico-imx7d.h +35 -3
index 04d316f..1a2736d 100644
@@ -52,11 +52,29 @@
 		"/boot/imx7d-pico-pi.dtb ext4 0 1;" \
 		"rootfs part 0 1\0" \
 
-#define BOOTMENU_ENV \
+/* When booting with FIT specify the node entry containing boot.scr */
+#if defined(CONFIG_FIT)
+#define PICO_BOOT_ENV \
+	"bootscr_fitimage_name=bootscr\0" \
+	"bootscriptaddr=0x83200000\0" \
+	"fdtovaddr=0x83100000\0" \
+	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"rootwait rw;\0" \
+	"loadbootscript=" \
+		"load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
+	"bootscript=echo Running bootscript from mmc ...; " \
+	"source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
+#else
+#define PICO_BOOT_ENV \
 	"bootmenu_0=Boot using PICO-Hobbit baseboard=" \
 		"setenv fdtfile imx7d-pico-hobbit.dtb\0" \
 	"bootmenu_1=Boot using PICO-Pi baseboard=" \
 		"setenv fdtfile imx7d-pico-pi.dtb\0" \
+	BOOTENV
+#endif
+
 
 #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
@@ -70,7 +88,6 @@
 	"initrd_high=0xffffffff\0" \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"videomode=video=ctfb:x:800,y:480,depth:24,mode:0,pclk:30000,le:46,ri:210,up:22,lo:23,hs:20,vs:10,sync:0,vmode:0\0" \
-	BOOTMENU_ENV \
 	"fdt_addr=0x83000000\0" \
 	"fdt_addr_r=0x83000000\0" \
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
@@ -90,7 +107,22 @@
 		"name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \
 	"fastboot_partition_alias_system=rootfs\0" \
 	"setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \
-	BOOTENV
+	PICO_BOOT_ENV
+
+#if defined(CONFIG_FIT)
+#define CONFIG_BOOTCOMMAND \
+	"mmc dev ${mmcdev};" \
+	"mmc dev ${mmcdev}; if mmc rescan; then " \
+		"if run loadbootscript; then " \
+			"iminfo ${bootscriptaddr};" \
+			"if test $? -eq 1; then hab_failsafe; fi;" \
+			"run bootscript; " \
+		"else " \
+			"echo Fail to load fitImage with boot script;" \
+			"hab_failsafe;" \
+		"fi; " \
+	"fi"
+#endif
 
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 0) \
Signature · 1 line
2.7.4
#14 lore raw

PATCH v4 5/8 pico-imx7d: Add boot option for verified boot

Quoted 4 lines

Add boot option to boot from fitimage to support verified boot. The boot script plain text file should be packed into fit blob as image with name of bootscr.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#15 lore raw

PATCH v4 6/8 pico-imx7d: Add bl33 config

In reply to Jun Nie

Add default configuration to run u-boot as BL33 in the boot flow case of ATF(ARM Trusted Firmware) -> OPTEE -> U-boot.

---
 configs/pico-imx7d_bl33_defconfig | 66 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 configs/pico-imx7d_bl33_defconfig
configs/pico-imx7d_bl33_defconfig new file +66 -0
new file mode 100644
index 0000000..932ed4c
@@ -0,0 +1,66 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX7=y
+CONFIG_SYS_TEXT_BASE=0x87800000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TARGET_PICO_IMX7D=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
+CONFIG_BOUNCE_BUFFER=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_BOOTD is not set
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_WRITE_SIZE=0x20000
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DFU_MMC=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_FSL_ESDHC=y
+CONFIG_PHYLIB=y
+CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX7=y
+CONFIG_CONS_INDEX=4
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_ETHER=y
+CONFIG_USB_ETH_CDC=y
+CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
+CONFIG_VIDEO=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_OPTEE_TZDRAM_SIZE=0x2000000
Signature · 1 line
2.7.4
#17 lore raw

PATCH v4 6/8 pico-imx7d: Add bl33 config

In reply to Jun Nie
Quoted 4 lines

Add default configuration to run u-boot as BL33 in the boot flow case of ATF(ARM Trusted Firmware) -> OPTEE -> U-boot.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#18 lore raw

PATCH v4 7/8 pico-imx7d: README: Add BL33 usage case

In reply to Jun Nie

Add Documentation of BL33 usage case. U-boot is in non-secure world in this case.

---
 board/technexion/pico-imx7d/README.pico-imx7d_BL33 | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 board/technexion/pico-imx7d/README.pico-imx7d_BL33
board/technexion/pico-imx7d/README.pico-imx7d_BL33 new file +44 -0
new file mode 100644
index 0000000..40324ff
@@ -0,0 +1,44 @@
+This document describes the instruction to build and flash ATF/OPTEE/U-Boot on
+pico-imx7d board. U-Boot is loaded as part of FIP image by ATF in this setup.
+The boot sequence is ATF -> OPTEE -> U-Boot -> Linux. U-Boot is in non-secure
+world in this case.
+
+- Build u-boot
+    Set environment variable of CROSS_COMPILE for your toolchain and ARCH=arm
+    $ make pico-imx7d_bl33_defconfig
+    $ make all
+
+- Download and build OPTEE
+    $ git clone git at github.com:OP-TEE/optee_os.git
+    $ make PLATFORM=imx PLATFORM_FLAVOR=mx7dpico_mbl CFG_BOOT_SECONDARY_REQUEST=y ARCH=arm
+
+- Download and build ATF
+    $ git clone https://git.linaro.org/landing-teams/working/mbl/arm-trusted-firmware.git -b linaro-imx7
+    $ make DEBUG=1 PLAT=picopi ARCH=aarch32 ARM_ARCH_MAJOR=7 \
+            CROSS_COMPILE=arm-linux-gnueabihf- LOG_LEVEL=50 V=1 \
+            CRASH_REPORTING=1 AARCH32_SP=optee all
+    Save file content in this link to file pico-imx7d.cfg:
+      http://git.linaro.org/landing-teams/working/mbl/u-boot.git/tree/board/technexion/pico-imx7d/pico-imx7d.cfg?h=linaro-imx
+    $ u-boot/tools/mkimage -n pico-imx7d.cfg -T imximage -e 0x9df00000 -d \
+            build/picopi/debug/bl2.bin bl2.imx
+
+- Create FIP image
+    Create a  fiptool_images/ folder in ATF folder, copy u-boot.bin in u-boot
+folder and tee*.bin in optee out/arm-plat-imx/core/tee/ folder to
+fiptool_images. Run below command in ATF folder to generate FIP image.
+    $ make -C tools/fiptool/
+    $ tools/fiptool/fiptool create --tos-fw fiptool_images/tee-header_v2.bin \
+          --tos-fw-extra1 fiptool_images/tee-pager_v2.bin \
+          --tos-fw-extra2 fiptool_images/tee-pageable_v2.bin \
+          --nt-fw fiptool_images/u-boot.bin \
+          fip.bin
+
+- Burn the images to eMMC for test.
+    Run below command in atf folder:
+    $ dd if=build/picopi/debug/bl2.bin.imx of=/dev/disk/by-id/usb-<your device>  bs=1024 seek=1;sync
+    $ dd if=fip.bin of=/dev/disk/by-id/usb-<your device>  bs=1024 seek=1;sync
+
+- Test
+    Just boot up your board and wait for u-boot start up after ATF's log.
+    For booting Linux in FIT image, please reference the FIT files in
+    u-boot doc/uImage.FIT/ folder.
Signature · 1 line
2.7.4
#19 lore raw

PATCH v4 7/8 pico-imx7d: README: Add BL33 usage case

Quoted 3 lines

Add Documentation of BL33 usage case. U-boot is in non-secure world in this case.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#20 lore raw

PATCH v4 8/8 pico-imx7d: enable boot without PMIC

In reply to Jun Nie

If PMIC is not probed successfully, it is still OK to boot with default configuration although power is not optimized.

Default voltage of SW1A/SW1B is 1.1V/1.0V for PC32PF3000A1EP on pico according to table 42 of spec of PF3000 ver 9.0.

Default mode of SW1A/SW1B is APS as expected(table 47).

---
 board/technexion/pico-imx7d/pico-imx7d.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
board/technexion/pico-imx7d/pico-imx7d.c +5 -2
index 5b357f2..e3d75e5 100644
@@ -85,8 +85,11 @@ int power_init_board(void)
 
 	p = pmic_get("PFUZE3000");
 	ret = pmic_probe(p);
-	if (ret)
-		return ret;
+	if (ret) {
+		printf("Warning:  Cannot find PMIC PFUZE3000\n");
+		printf("\tPower consumption is not optimized.\n");
+		return 0;
+	}
 
 	pmic_reg_read(p, PFUZE3000_DEVICEID, &reg);
 	pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
Signature · 1 line
2.7.4
reviewer
#21 lore raw

PATCH v4 8/8 pico-imx7d: enable boot without PMIC

Quoted 2 lines · Jun Nie

If PMIC is not probed successfully, it is still OK to boot

Are you getting PMIC probe failure?

What is the exact issue you are facing?

author
#22 lore raw

PATCH v4 8/8 pico-imx7d: enable boot without PMIC

Quoted 8 lines · Fabio Estevam <[email protected]> 于2019年5月31日周五 上午7:58写道:
Quoted 2 lines · Jun Nie

If PMIC is not probed successfully, it is still OK to boot

Are you getting PMIC probe failure?

What is the exact issue you are facing?

There is no response from the PMIC I2C address in software test.

reviewer
#23 lore raw

PATCH v4 8/8 pico-imx7d: enable boot without PMIC

Hi Jun,

Quoted 1 line · Jun Nie

There is no response from the PMIC I2C address in software test.

Please fix this issue instead of proceeding with a failure on PMIC probe.

#24 lore raw

PATCH v4 8/8 pico-imx7d: enable boot without PMIC

In reply to Jun Nie
Quoted 6 lines

If PMIC is not probed successfully, it is still OK to boot with default configuration although power is not optimized. Default voltage of SW1A/SW1B is 1.1V/1.0V for PC32PF3000A1EP on pico according to table 42 of spec of PF3000 ver 9.0. Default mode of SW1A/SW1B is APS as expected(table 47).

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#26 lore raw

v4 cover pico-imx7d: Add support for BL33 case

In reply to Jun Nie
Quoted 4 lines · Jun Nie <[email protected]> 于2019年5月8日周三 下午2:39写道:

Add configuration to boot U-boot as BL33 case. The boot flow is ATF -> OPTEE -> U-boot.

Hi Fabio,

Do you have any comments on this patch set, or it can be merged now? Thank you!

Jun